Note that there are some explanatory texts on larger screens.

plurals
  1. POJComboBox causes a runtime error
    primarykey
    data
    text
    <p>I'm trying some GUI development in Java and when I added the following code, I got a runtime error during initialization of the class:</p> <pre><code>public class Search_Album_Main_Tab extends JPanel{ JComboBox search_list; JTextArea searched_data; JButton search_button; Results_Main_Tab rmt; Search_Action_Listener listener; public Search_Album_Main_Tab(Results_Main_Tab results_main_tab) { String[] search_options = {"Album", "Artist", "Genre", "ID", "Year"}; setLayout(new GridLayout(3,1)); rmt = results_main_tab; listener = new Search_Action_Listener(); /* Searched data */ searched_data = new JTextArea(); /* Search button */ search_button = new JButton("Search Album"); search_button.addActionListener(listener); /* Drop down menu */ search_list = new JComboBox(search_options); add(search_list); add(searched_data); add(search_button); } private class Search_Action_Listener implements ActionListener { public void actionPerformed(ActionEvent event) { if (event.getSource() == search_button) { } } } } </code></pre> <p>The error I get is:</p> <pre><code>dcm_gui.GUI at localhost:53806 Thread [main] (Suspended (exception NullPointerException)) CUIAquaComboBox.applySizeFor(JComponent, CoreUIConstants$Size) line: 454 CUIAquaUtilControlSize.applyUISizing(JComponent, CoreUIConstants$Size) line: 99 CUIAquaUtilControlSize.access$200(JComponent, CoreUIConstants$Size) line: 13 CUIAquaUtilControlSize$PropertySizeListener.applyComponentSize(JComponent, Object) line: 121 CUIAquaUtilControlSize.addSizePropertyListener(JComponent) line: 25 CUIAquaComboBox.installListeners() line: 47 CUIAquaComboBox(BasicComboBoxUI).installUI(JComponent) line: 229 CUIAquaComboBox.installUI(JComponent) line: 30 JComboBox(JComponent).setUI(ComponentUI) line: 653 JComboBox.setUI(ComboBoxUI) line: 238 JComboBox.updateUI() line: 247 JComboBox.init() line: 212 JComboBox.&lt;init&gt;(Object[]) line: 178 Search_Album_Main_Tab.&lt;init&gt;(Results_Main_Tab) line: 36 GUI.main(String[]) line: 28 Daemon Thread [AWT-AppKit] (Running) /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/bin/java (Oct 10, 2010 11:55:27 PM) </code></pre> <p>Does anyone has any idea why?</p> <p>Binyamin</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload