I made a Checkbox so where when you click it it opens another window with more checkboxes. How is it you would go about making those checkboxes open another window?
Have you tried adding an actionlistener to your checkBox component?
It's hard to see what excactly you're trying to achieve; but from what you write it shouldn't be more than that.
You can try this tutorial, for starters:
http://www.java2s.com/Code/JavaAPI/javax.swing/JCheckBoxaddActionListenerActionListenerlis.htm
Related
I have a button in my JFrame (windowbuilder). I would like to hide this button using its properties, but I couldn't find any related property for this purpose. Just it is possible to enable/disable it, but a disable button is visible yet.
Thank you
Every Item you add to your Gui with the WindowsBuilder can be setup separatly in the source code. If you use:
<objectname>.setVisible(false);
it should be not visible in your gui. To do that: Switch from the Desgin-Tab into the Source-Tab search for the button and add this line of code with your name of the variable.
I am using the JFrame feature in NetBeans in order to make it simpler to customize and edit. In my program, clicking a button calls an action that displays a dialog box. I want to have an image inside of that dialog box. In NetBeans along with its JFrame editor you can add boxes and customize them, along with a dialog box. Which means it will be easier to edit that dialog box.
How to I call that custom dialog box to display when the button is clicked?
To put it more simply without the need for puting code. I have created a cusome dialog box in netbeans GUI builder. Now, how to I call/use that custome dialog box inside of my actual JFrame, which was also coded inside the netbeans GUI editor, and is located inside the same package and all.
First Drag and drop Swing Windows >> Dialog.
Then inside your code write this line to show it
jDialog1.setVisible (true);
After that double click on the Dialog design and add as many components as you like
Best Wishes
I am developing a Java application using Swing. I am using menu bar in my application. Whenever I click a menu item I need to open a new panel/frame within the window containing menu options.
To be precise I don't want to open a new window on clicking a menu item. What is the possible solution to this problem?
Thanks in advance.
If you want to put windows inside of other windows, you should look at JInternalFrame:
http://download.oracle.com/javase/tutorial/uiswing/components/internalframe.html
If you don't want to open a new window when clicking a menu item, CardLayout is a good choice. Also, don't overlook the convenience of using actions in your menus.
Is it possible to put an actionlistener on a tab in swing? If it is please could you post a small example?
The only way to do that is to add a javax.swing.event.ChangeListener to the JTabbedPane itself. You might have to keep track of the selected tab vs. previously selected tab depending on what you are doing with the state change...
I have created 8 tabs in a tabbed panel using Java Swing. The problem is when I enter data in any tab and click the save button. After clicking it leaves the present tab/panel and goes to the first tab.
I have to retain on the same tab after clicking the save button.
Please help me on this.
I got the answer, just forgot to comment the getFrame().dispose() method.
Thanks for your concern.