How to Hide a Task in Java JFrame
The Java "visible" property lets you show and hide any task in the JFrame window. A JFrame is the main window that shows the information to the user, so you place each button, panel, label and text box task on the JFrame window when you design and code your interface. The visibility set to "false" hides the task until you want to display it to the user.
Instructions
-
-
1
Right-click the Java project file you want to edit and select "Eclipse" in the popup window to open the Java code in the editor.
-
2
Double-click the project source code file you want to edit. In the code, add the task you want to set up in the JFrame. For instance, the following code creates a panel:
JPanel panel = new JPanel();
-
-
3
Set the visibility of the task to "hidden" by setting the "visible" property to false. The following code hides the task:
panel.setVisible(true);
-
4
Save the file and click "Run" to execute the new code changes in the Eclipse debugger.
-
1