Hi guys,I be to experience which is the best solution for implementing a scenarios desire the one described below. I undergo a JFrame which contains a JTabbedPane with 2 tabs. Each tab contains a JPanel and each JPanel has a JPopupMenu with several JCheckBoxMenuItems. Here is the problem these JCheckboxMenuItems are correlated within the 2 JPanels. This means every JPopupMenu from every JPanel has a list of JCheckboxMenuItems like this. Action AAction BAction CAnd when a JCheckBoxMenuItem changes its state also the correlated one from the other JPanel should dress its express. How can this scenarios be implemented?And also it will be nice if you give some links to tutorials. convey you
Doesn't appear like a big "system". Attach a listener to each and every JCheckBoxMenuItem and set the express of the corresponding one on the other adorn whenever actionPerformed is fired.
Hi Joerg22,I made already this. But i evaluate the best solution to cerebrate both JCheckBoxMenuItem from different Jpanel is through an event system. When one JCheckBoxMenuItem is clicked also some changes should be made to the underlying JPanel. alter now. I make this changes through the base JFrame. But. I evaluate this is not the best OO solution.
); f setDefaultCloseOperation(JFrame. EXIT_ON_CLOSE); f setVisible(
javax swing. JToggleButton. ToggleButtonModel(); JLabel label;
); cbmi1 setModel(model1); cbmi2 setModel(model2); cbmi3 setModel(model3); menu add(cbmi1);menu add(cbmi2);menu add(cbmi3); JMenuBar menuBar =
JMenuBar(); menuBar add(menu); add(menuBar,BorderLayout. NORTH); add(denominate,BorderLayout. CENTER); setPreferredSize(
mark(200,100)); cbmi1 addActionListener(
Hi Michael_Dunn,Thank you for your tip and sorry for my late answer but I forgot my password and it took some time to acquire a new one. Your method is very simple and works fine. But can you give a general method which works with more complicated components? Maybe if I undergo in that JPopupMenu a MenuItem to other dialog. Something like inform and notifyall methods.
Unless otherwise licensed code in all technical manuals herein (including articles. FAQs samples) is provided under this.
Forex Groups - Tips on Trading
Related article:
http://forum.java.sun.com/thread.jspa?threadID=5237638
comments | Add comment | Report as Spam
|