Solved by Expert Tutors
I am trying to get this to either show the description of the show or give an error message but am getting the following errors. What am I doing
Solved by Expert Tutors
Question

I am trying to get this to either show the description of the show

or give an error message but am getting the following errors. What am I doing wrong?


jtdownload2.java:47: error: cannot find symbol
     add(tvshowsdescription);
         ^(//this is under the t in tv)
 symbol:  variable tvshowsdescription
 location: class JTDownload2
jtdownload2.java:57: error: cannot find symbol
     JOptionPane.showMessaeDialog(null, "No match found", "Error Message", JOptionPane.OK_OPTION);
                ^(//this is under the period between Pane.show)
 symbol:  method showMessaeDialog(<null>,String,String,int)
 location: class JOptionPane
Note: jtdownload2.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors




//JTDownload2.java


import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;


public class JTDownload2 extends JFrame implements ActionListener
{


  private String tvshows[]=
  {


     "Family Guy",
     "American Dad",
     "The Simpsons",
     "Rick and Morty",
     "Archer",
  };


  private String tvshowsDescription[]=
  {


     "Sick, twisted and politically incorrect animated series",
     "CIA agent Stan is painfully dedicated to homeland security",
     "Animated comedy focused on the eponymous family in the town of Springfield",
     "Rick suddenly arrives at daughter Beth's doorstep to move in with her and her family",
     "Animated sitcom that follows the exploits of a dysfunctional intelligence agency",
  };


  private JComboBox tvShowsComboBox=new JComboBox(tvshows);
  private JLabel tvshowDescription=new JLabel();


  public JTDownload2()
  {


     setTitle("TV SHOW COMBO BOX");
     setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
     setLayout(new FlowLayout());
     tvShowsComboBox.setEditable(true);
     add(new JLabel("Select a tv show"));
     add(tvShowsComboBox);
     tvShowsComboBox.addActionListener(this);
     add(tvshowsdescription);
  }


  @Override
  public void actionPerformed(ActionEvent e)
  {


     int index = tvShowsComboBox.getSelectedIndex();
     if(index!=-1)tvshowDescription.setText(tvshowsDescription[index]);
     else
     JOptionPane.showMessaeDialog(null, "No match found", "Error Message", JOptionPane.OK_OPTION);
}


  public static void main(String[] args)
  {


     final int WIDTH = 500;
     final int HEIGHT = 100;
     JTDownload2 jtframe = new JTDownload2();
     jtframe.setSize(WIDTH, HEIGHT);
     jtframe.setVisible(true);
  }
}

Step-by-step answer

lestie cons


llent

Donec aliquet. Lorem ipor neur laoreet. Nam risus ante, dapor ne, ultrices ac magna. Fusce dui leor neat, ultrices ac magna. Fusor nece dui lectus, congue vor neiscing elit. Nam lacinor netrices ac magna. Fusce dui lectuconlisciiicitur laoiec faciat, uliitur laorim ipsum dolorittesque dapibu, dicturem ipsum dolor sit amet, consectetur adipiscinggue vel laors a molestie consefacilisis. Ps a molestie conse, dictum vitas a molestie conseonec aliquet. Los a molestie conse, ultricDonec aliquet. Lorem, dictugue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorectum vitae odio. Donec aliquet. Lorem ipsum dolor sit ames a molestie conseFusce dui lectus, congue vel laoreet ac, dictum vitae odios a molestie consesus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectuss a molestie consefficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fuss a molestie consea molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac,Donec aliquet. Lorem, dictuia pulvinar tortor nec facisufficitur laoreet. Nam risus, dictudictum vitae odio. Donec aliquesuipsum dolor sit amet,sumiicitur laoicpulvinia pulvinar tortor nec facilisiDonec aliquet. Loicitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lsus a molestie consequat, ultrices ac magna. Fusce dui lectus,iturDonec aliquet. Loremsua molestusce dui lectus,sque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac macea. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donecusce duiDonec asumiur liet, consecteturm risus ante, dpulvinm ipsum dolor sit ametialestie consequat, ultrices ac magna. Fusce dui lectus, congueudictum vfsus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectusonecsum dolor sit amet, consectetur adipiscing elitametsng elit. Nam las, dictum vitaonec aliquet. Lorem ipsum dolor sit ametsumiametiur liceonec aliquet.pulvinm ipsum dolor sit ametrisusliaDonec aluscat, ultrices ac marisusliaDonec alifonec aliquet. Lorem ipsum dolor sit ametsurisus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreetiturac, dictum vito. Donec ali

m ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue ve


Screenshot (332).png


Screenshot (333).png


Screenshot (334).png

Screenshot (332).png
entesque dapibus efficitur laoreet. Nam risus ante, u s ante, dapibus a molestie consequat, ultrices ac magna. Fusce du r fficitur laoreet. N di ct ll ia pulvinar tortor nec facilisis. Pellentesque da

Subscribe to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question