[SIZE=2]I have several forms created in java (Net beans) and one of them have a button. (simple example)
I want to open a new form when I click this button( new Form().show ) , but I want to hide the first one ( and the dispose dont work )
And also , when the second is closed, the fist is opened !!
suggestions?
Thanks, I really need this, please answers/SIZE]
14 replies to this topic
#1
Posted 17 February 2012 - 12:11 PM
|
|
|
#2
Posted 17 February 2012 - 02:14 PM
Not sure what you mean by a form? Is it a window like a Frame or a Dialog?
One way to swap the GUI being shown in window from one panel to another panel is to use CardLayout.
Otherwise post a small, simple program that compiles, executes and shows the problem.
One way to swap the GUI being shown in window from one panel to another panel is to use CardLayout.
Otherwise post a small, simple program that compiles, executes and shows the problem.
#3
Posted 18 February 2012 - 02:13 PM
form means a JFrame 'form' http://dl.dropbox.co...33652950/ss.jpg
#4
Posted 18 February 2012 - 02:21 PM
Did you look at the CardLayout class? It allows you to easily change what is shown on a GUI.
#5
Posted 18 February 2012 - 02:25 PM
yes !! bu i want do it in code !!
example , click login button and the login panel hides and the new panel shows up ! in this new panel, i click, for example, change user, and this panel hides, and the login panel shows up again !!
example , click login button and the login panel hides and the new panel shows up ! in this new panel, i click, for example, change user, and this panel hides, and the login panel shows up again !!
#6
Posted 18 February 2012 - 02:27 PM
Using CardLayout would be much easier.
Do you have code that shows what you want to do and that you are having problems with?
Or make a small simple program that compiles, executes and shows the problem and post that here.
Do you have code that shows what you want to do and that you are having problems with?
Or make a small simple program that compiles, executes and shows the problem and post that here.
#7
Posted 18 February 2012 - 04:08 PM
If you only hide a panel for a short time simple call setVisible(false) on the main frame, while you create and show the 2nd panel. When you're done with the 2nd panel, dispose() it, and setVisible(true) the first again.
#8
Posted 19 February 2012 - 04:43 AM
Oh thanks ! ! setVisible(false) - of coursse !! thanks
#9
Posted 24 February 2012 - 08:12 AM
setVisible(false) doesnt work !!
String pass = JTPassword.getText();
if (pass.equals("admin")) {
JLErrado.setVisible(false);
// if the in the texfield is correct, this jform shoul disappear and the other appear !!
new LOGIN().setVisible(false); // dont work !!
new Desk().show();
} else {
JLErrado.setVisible(true);
}
#10
Posted 24 February 2012 - 08:19 AM
Can you make a small, simple program (SSCCE) that compiles, executes and shows your problem and post it here for testing?
#11
Posted 24 February 2012 - 09:01 AM
How can I make that ??
#12
Posted 24 February 2012 - 09:06 AM
One way is to Use an editor.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









