the errors im getting...package Components; import javax.swing.*; import java.awt.*; import java.awt.event.*; public class JVideos extends JPanel implements ActionListener { JLabel explainSelector = new JLabel("Please use the drop down menu\nto select a movie to rent."); public JVideos() { String[] movieStrings = {"Reservoir Dogs", "Memento", "Oldboy", "Inglorious Bastards", "Snatch", "Slumdog Millionaire", "District 9", "Ip Man", "Gran Torino", "The Matrix"}; JComboBox movieChoice = new JComboBox(movieStrings); JPanel panel = new JPanel(); JLabel greenBox = new JLabel("Welcome to Greenbox"); movieChoice.setSelectedIndex(0); movieChoice.addActionListener(this); panel.add(greenBox); panel.add(explainSelector); panel.add(movieChoice); this.add(panel); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLayout(new FlowLayout()); } public void main(String[] args) { JVideos aFrame = new JVideos(); final int WIDTH = 400; final int HEIGHT = 600; aFrame.setSize(WIDTH, HEIGHT); aFrame.setVisible(true); } }
Components.JVideos is not abstract and does not override abstract method actionPerformed(java.awt.event.ActionEvent) in java.awt.event.ActionListener
cannot find symbol method setDefaultCloseOperation(int)
This is the first Im working with comboboxes so my questions are
1.How do i get past these two error so that I can build error free?
2.What else would I need so that my I can have a GUI output with that information in it?
The panel parts Im not sure if I need, I just pulled it from another example hoping that it would work, before I had simply added those label using
add(explainSelector); . . . etc
if those lines work any better or would help to clean up the code to make it easier to work with I would like to switch back to that.
I have the listener in there so that I can later give the user further information once they select a film they would like to rent. I'll try to figure out how to create an event after they have selected a movie, any help there would also be much appreciated.