NetBeans 8.0.1
This is the 3rd time I've rebuilt this program.
My problem seems to be when I add the Menu's.
When I use RUN, the menu's sometimes show up or sometimes NOT.
When I use DEBUG it works every time.
This is the smallest I can get the program before the problem
starts.
When I add the menu's it fails?
package myclockpaneltest; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import javax.swing.*; public class MyclockPanelTest { public JFrame f = new JFrame(); public JPanel main = new JPanel(); public JPanel p1 = new JPanel(); public JPanel p2 = new JPanel(); public JMenuBar jmb = new JMenuBar(); public JMenu jm0, jm1; public JMenuItem mi0, mi1; public MyclockPanelTest(){ f.setVisible(true); f.setSize(357,165); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); main.setBackground(Color.BLUE); f.add(main); main.add(p1); main.add(p2); p1.setPreferredSize(new Dimension(70,90)); p1.setBackground(Color.ORANGE); p2.setPreferredSize(new Dimension(260,90)); p2.setBackground(Color.BLACK); f.setJMenuBar(jmb); jm0 = new JMenu("Close"); mi0 = new JMenuItem("Exit"); jm0.add(mi0); jm1 = new JMenu("Time"); mi1 = new JMenuItem("24-Hour clock"); jm1.add(mi1); jmb.add(jm0); jmb.add(jm1); } public static void main(String[] args) { // TODO code application logic here new MyclockPanelTest(); } }