![]() WestPanel.add(doorsPanel, BorderLayout.NORTH) ListPanel.add(listButtons, BorderLayout.EAST) tBorder(BorderFactory.createTitledBorder("Manage Shopping List: ")) LightsPanel.add(lightTimerGrid, BorderLayout.CENTER) LightsPanel.add(lightButtons, BorderLayout.SOUTH) LightsPanel.add(lightsGrid, BorderLayout.NORTH) tBorder(BorderFactory.createTitledBorder("Manage Lights: ")) Private JLabel totalPrice = new JLabel("Total Price: ") ĭtBorder(BorderFactory.createTitledBorder("Manage Doors: ")) ĭoorsPanel.add(doorsGrid, BorderLayout.NORTH) ĭoorsPanel.add(doorButtons, BorderLayout.SOUTH) Private JLabel itemDesc = new JLabel("Item Name - Item Price") Private JPanel listButtons = new JPanel(new GridBagLayout()) Private JPanel listPanel = new JPanel(new BorderLayout()) Private JPanel lightButtons = new JPanel(new FlowLayout()) Private JPanel lightTimerGrid = new JPanel(new GridBagLayout()) Private JPanel lightsGrid = new JPanel(new GridBagLayout()) Private JPanel lightsPanel = new JPanel(new BorderLayout()) Private JPanel doorButtons = new JPanel(new FlowLayout()) Private JPanel doorsGrid = new JPanel(new GridBagLayout()) Private JPanel doorsPanel = new JPanel(new BorderLayout()) Private JPanel eastPanel = new JPanel(new BorderLayout()) Private JPanel westPanel = new JPanel(new BorderLayout()) After much trouble I've gotten my GUI to look how I want, however it feels as if my code is very inefficient, as if I'm going about this the wrong way? //main panels GetContentPane().setLayout(new BorderLayout()) ītnBack.I've never done Java GUI's before. "keyboard will be locked sooner or later." + "the about dialog will be closed and opened again and again," + "then press down space key and don't release, " + "2 - press Alt+A in main window, it will popup an about dialog," + "repeat Alt+N and Alt+B again and again, keyboard will be locked during navigating. "then try Alt+B to navigate back and also don't release keys untill page 0," + "1 - press Alt+N to navigate next, and don't release keys untill there are no more next page, " + ![]() " This program will help to find keyboard lock problems, two way to reproduce:" + The keyboard focus is there, but it don't respond any key event in all component and window, except in JPasswordField. Run the program I post, follow the steps in "about":ġ - press Alt+N to navigate next, and don't release keys untill there are no more next page, then try Alt+B to navigate back and also don't release keys untill page 0, repeat Alt+N and Alt+B again and again, keyboard will be locked during navigating.Ģ - press Alt+A in main window, it will popup an about dialog, then press down space key and don't release, the about dialog will be closed and opened again and again, keyboard will be locked sooner or later. STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : It always can be reproduced on RHEL 4 and Red Flag 5. Here is a demo program, no multi-thread, no event-dispatching thread problem. Run some swing program, keyboard is locked after some opterations, then it don't respond any key event. Java HotSpot(TM) Client VM (build 1.5.0_10-b03, mixed mode, sharing) Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_10-b03) Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing) ![]() Java(TM) SE Runtime Environment (build 1.6.0-b105)
0 Comments
Leave a Reply. |