473,396 Members | 2,037 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

JFrames

I am trying to activate one Jframe from another JFrame. I dont want to keep the first frame visible when the second one is visible, but by the click of button on second frame the second frame should close and first one be visible.
Both the frames are placed in seperate programs with main function in the program for first JFrame.
Can anyone help me with the code.
Thanx
Oct 2 '07 #1
5 5299
Ramola
35
I am trying to activate one Jframe from another JFrame. I dont want to keep the first frame visible when the second one is visible, but by the click of button on second frame the second frame should close and first one be visible.
Both the frames are placed in seperate programs with main function in the program for first JFrame.
Can anyone help me with the code.
Thanx

The point where u make an obj of the 2nd JFrame , call dispose() method immediately after it .


Kind regards,
Malavika
Oct 3 '07 #2
r035198x
13,262 8TB
I am trying to activate one Jframe from another JFrame. I dont want to keep the first frame visible when the second one is visible, but by the click of button on second frame the second frame should close and first one be visible.
Both the frames are placed in seperate programs with main function in the program for first JFrame.
Can anyone help me with the code.
Thanx
1.) You should have only one main method
2.) Disposing a JFrame (dispose) and making it invisible (setVisible(false)) are two different things.
Oct 3 '07 #3
1.) You should have only one main method
2.) Disposing a JFrame (dispose) and making it invisible (setVisible(false)) are two different things.
Thanx but the problem remains same. I have only one main method in the program which activates first JFrame. when a button on first JFrame is clicked second JFrame is made visible but how do i go BACK FROM SECOND JFrame to FIRST JFrame, if first is hidden or disposed.
Oct 3 '07 #4
Ganon11
3,652 Expert 2GB
In the second JFrame, add a link back to the first JFrame. That is, add a member JFrame variable, and in the constructor, request a variable of type JFrame.

Back in your first JFrame, when you make the second JFrame, pass it the this variable. When you're done in your second JFrame, set the first Frame visible again.
Oct 3 '07 #5
In the second JFrame, add a link back to the first JFrame. That is, add a member JFrame variable, and in the constructor, request a variable of type JFrame.

Back in your first JFrame, when you make the second JFrame, pass it the this variable. When you're done in your second JFrame, set the first Frame visible again.
Thank you it worked.
Oct 4 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Arjun | last post by:
Hi, I am using a menu based Swing Application .I have got an option to cascade the screens(JFrames) .The cascading of Screens works fine.The problem is that after cascading i am not able to move...
10
by: Steve | last post by:
I need to build a very dynamic client and would be interested in knowing the pros and cons of using JSF and Ajax to accomplish this. Thanks. Steve
5
by: crossroadsk | last post by:
I have implemented the following code : ----------------------------------------------------------------------------------------------------------------- import javax.swing.*; import java.awt.*; ...
2
by: harshvardhan3 | last post by:
I have a requirement. when we start a java program we should get a frame where we have restart button. when we press that button the program should exit from JVM and again start execution.
4
by: lenin42001 | last post by:
Can someone be off assistance? We're trying to input/output some patients data in a hypothetical form. The records display sequentially & can be retrieved from a data store................This must...
8
by: lBalal | last post by:
Hi all I am using netbeans to make my hci. now in my form1 i have a button that when pressed takes me to form2 (class2) on form2 i want to press a button to change the color of button in form...
5
Shinzon
by: Shinzon | last post by:
ok so far I have got: JFrame frame = new JFrame( "Matt's DVD's" ); frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); frame.setSize( 420, 170 ); // set frame size ...
3
by: Firecore | last post by:
Can someone please explain what JFrames are?
1
by: pankajs | last post by:
Hi! I m facing a problem that I want to close one JFrame when two are running simultaneously.. How can it be done??????
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.