NetBeans - How to show all Swing components in a JFrame?

I am building a Swing GUI with NetBeans using the built-in form builder that works reasonably well.

However, if I accidentally put the wrong panel on the form, I have no way to delete it or select it again.

Likewise, if I want a button to open a new window, say a file selection, I don't know how to add that file to a form, but not show it until the button is clicked.

Does anyone have any experience with the NetBeans Swing Form Builder? It seems like a common thing, but I don't understand how to do it. Did I miss something?


source to share

1 answer

Yee netbeans user! In the lower left corner of the window there should be a navigator window. There it displays all the components on the form. I'm not too sure what you mean by file selection, but to open a new window, that is, another Jform, you create a different form class. Then you create this form and setVisible.

So let's say you have a mainProgram form AND a helpMenu form

In mainProgram

public mainProgram(){
 InitComponents();//or something on the lines of that
 helpMenu helpMenuWindow = new helpMenuWindow();


This will allow you to open new windows, but if you click on the red X to close the window, it closes your entire program. In the properties for the helpMenu area, you can choose an option for what the window should do when exiting.



Don't do anything In the above code is the code that runs before the Jpane is displayed, if you want to show or hide items, just the code



I hope I answered your Tetramputechture question.



All Articles