I'm trying to put a JButton in the WYSIWYG GUI editor in Netbeans at the center of a wheel of buttons I made around an input panel. The input panel is hidden in the program (specified by a user in an XML file) and the JButton should just be at the center of the wheel. I can't figure out how to do that because actually putting it in on top of the input panel in the WYSIWYG editor just puts it in the input panel and it is therefore hidden when when the code is executed. Is it possible to view the "layers" in the editor and put the button in "under" the input panel so that it won't be hidden along with the panel?
The only effective solution I could find was to modify a gridbag constraints object and manually insert the button in the code after the panel was hidden at runtime.
Related
I am designing a game for a project in Java Swing using a JForm. I know that you have to use the code
jPanel1.setVisible(true);
I used this for all panels, even in the init() method in the source.
I am using the "Layered Panel" option for every panel I add. I placed the image on the first panel:
There are radio buttons in my second panel. I want the user to click on the option while looking at the picture, kind of like clicking on an icon (radio button) on desktop (background image).
Like this:
When I try to look at my design preview, it just shows me Panel2 (only radio buttons), not 1.
Is it possible to fix this (make two panels visible at once), or should I just make a button to switch between the panels?
i'm new to swing. i've created a jpanel form using the swing palette design. It has jlabels, jtextfields and a jbutton. when the button is clicked, the data entered in the jtextfields is inserted in the database through the model.
i don't want the the jpanel to be always displayed so i would like to add another button that displays this jpanel form when i click on it. is it possible to perform this using the palette design knowing that the source code is locked in the initComponent private function, or do i have to re-code all the components and layout myself?
thanks for your time!
"knowing that the source code is locked in the initComponent private function"
You can edit the auto-generated source code, as see here in this answer.
"that displays this jpanel form when i click on it. is it possible to perform this using the palette design"
Sounds like you want to swap views. You can do that using CardLayout and yes, it can be done from the design view. You can see more at How to Use CardLayout with Netbeans GUI Builder
Im using netbeans 7.4.
Im going to create a JFrame using nebeans forms which contain a tab pane.
I have set the tab placement property to "left" and I have added a few tabs.
But the tabs are so thin. i need to increase the area of a tab(not the JPanel inside the tab pane but the tabs (which contain the titles of tabs)).
Can someone please explain me how can i change tabs' appearance and the area(height or thicknes)?
this is like what i need
http://i.stack.imgur.com/lAo4f.jpg
I need to change the label of the currently selected tab in tabbed pane.
It is for when the user saves the file the change must be reflected in the label of the current panel in the tabbed pane.
Tried a few things like:
tabbedPane.setSelectedComponent(this.panel1.setName(name));
but no good
A very simple line of java code will do this:
tabbedPane.setTitleAt(tabbedPane.getSelectedIndex(), newTabLabel);
This could be easily figured out from the Java API for JTabbedPane.
I want to put one toolbar type component in which there will be one button which when pressed the toolbar should expand, size of the form increases and it contains some components like text area and label that user can see and once again when the button is pressed the toolbar is minimized and the size of the form decreases.
Can anybody tell me how to accomplish this?
e.g; like in windows 7 in my computer there is one toolbar called "Hard Disk Drives". When we press on it it shows all the drives and when we again press it it hides it.
SwingX has a collapsible panel control that I think should do what you want.
Also take a look at How to have Collapsable/Expandable JPanel in Java Swing.
Some alternatives:
You can add a JButon to a JToolBar. In your button's ActionListener, open a JOptionPane containing your components. This example illustrates some possibilities.
For a more advanced view, consider Outline, illustrated here.