Home Answers Viewqa Java-Beginners how to go from one frame to another frame in swings

 
 


mohammed afsar
how to go from one frame to another frame in swings
3 Answer(s)      3 years and 11 months ago
Posted in : Java Beginners

View Answers

July 9, 2009 at 10:46 AM


Hi Friend,

Try the following code:

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

public class MoveFrame extends JFrame{
JLabel label=new JLabel();
JTextField text=new JTextField(20);
JPanel panel=new JPanel(new GridLayout(2,2));
JButton button1 =new JButton("OK");
JButton button2 =new JButton("Next");

public MoveFrame(){
label.setText("Enter Name:");
panel.add(label);
panel.add(text);
panel.add(button1);
panel.add(button2);
add(panel,BorderLayout.CENTER);
button1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae){
JOptionPane.showConfirmDialog(null, "Are you Confirm?");
}
});
button2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae){
String value=text.getText();
JLabel label1=new JLabel("Welcome: "+value);
JPanel pan=new JPanel();
pan.add(label1);
JFrame frame1 = new JFrame();
frame1.setVisible(true);
frame1.add(pan);
frame1.setSize(250,100);

}
});
}
public static void main(String arg[]){
MoveFrame frame=new MoveFrame();
frame.setSize(300,100);
frame.setVisible(true);
}
}

Thanks

July 9, 2009 at 9:19 PM


Hi rose india,

The code which u have given is very helpful.........Thnaks mate, u have decreased all my stress.....thanks a lot

August 16, 2012 at 4:50 PM


hi how to navigate from one panel to another panel by clicking a button. Eg: there are 2 buttons in main frame. register train_list

when i click train_list It has to open new panel train list and has to hide the home panel. Then in the train list panel there is a back button. When I press back button, It has to go to the home panel. Please tell me how to do this









Related Pages:
how to go from one frame to another frame in swings - Java Beginners
how to go from one frame to another frame in swings  Hi, My task is to go from one frame to another.......... let us think that iam having two... this task in swings or applet......... i have gone through one example of login
another frame by using awt or swings
another frame by using awt or swings  how to connect one frame to another frame by using awt or swings
one frame update another frame
one frame update another frame  How do I make a link or form in one frame update another frame
frame update another frame.
frame update another frame.   How do I make a link or form in one frame update another frame
Drag and Drop components from one frame to another frame
Drag and Drop components from one frame to another frame... button etc.) from one frame to another frame. In this code we have used...;One frame has five component, user can drag and drop component from one
how to create frame in swings
how to create frame in swings  how to create frame in swings
Show a hidden frame previously from another from
Show a hidden frame previously from another from  How can i show a hidden frame previously by this code: jframe_name.hide(); and make it visible from another frame i'm waiting for the answer, and i'll be thankfull
frame
frame  how to creat a frame in java   Hi Friend, Try the following code: import java.awt.*; import javax.swing.*; import java.awt.event.*; class RetrieveDataFromTextFields{ public static void main(String[] args
swings:how to link from one form to another form
swings:how to link from one form to another form  how to link from one form to another form
call frame - Java Beginners
call frame   dear java, I want to ask something about call frame to another frame and back to first frame. I have FrameA and FrameB. In frameA...) and send to JTextfield in FrameA. the result is succses but the result go to new
I want display frame in another frame - Java Beginners
I want display frame in another frame  Hi all, this is available... in left side uses link if i click this link then open the page in another frame... the page into other frame then you have to create another frame to be shown
how can i close a frame. - Java Beginners
how can i close a frame.  Hi, My question is how can we close a frame when an action is taken......For example let us think that we have a frame and in that table is displayed and one button is added to that frame
link to other frame - Applet
link to other frame  how a button to open to another frame? and the frame can keyin the data and it can show at the previous frame
call frame again - Java Beginners
can run ,first i have one frameA in this frame have one jTextfield1,one jbutton1,second i have FrameB in this frame have one Jtextfield1 and jbutton1. I can...call frame again  d, thank's for your answer, but i can't combine
how can i close particular frame in swings - Java Beginners
how can i close particular frame in swings  Hi, I want to know, how can we close a particular frame when mulitple frames are appearing as output... on second frame close button, it should only get close....iam trying this in swings
Copy data from one JTextField to another JTextField
, you will learn how to copy the data from one JTextField into another... Copy data from one JTextField to another JTextField... and then paste into another JTextField. JTextField is used in the swing
swings
swings  i have 20 labels in mappanel ,if i click on the one label ,how to know which one is selected in this...  Hi Friend, Try...(String[]args){ ActionOnLabel frame=new ActionOnLabel(); } } Thanks
How to make frame of the picture, make frame of the picture, frame of the picture
How to make frame of the picture       This is about a frame example that has been made by some steps... key). Inverse: Go to Select menu > Apply Inverse (Shift + Ctrl + I
how to call a frame having threading concept
how to call a frame having threading concept   i hav a frame having buttton on it .on click event of the button ,i want to call another frame which... of that frame ,frame is displaying but no other content. that frame contains
Show Addition, Subtraction, Intersection, Exclusive OR on one Frame
illustrates you how to show Addition, Subtraction, Intersection, ExclusiveOR on one... the functions on one frame. Two classes Rectangle2D and Ellipse2D are used... Show Addition, Subtraction, Intersection, Exclusive OR on one
Show Addition, Subtraction, Intersection, Exclusive OR on one frame
illustrates you how to show Addition, Subtraction, Intersection, ExclusiveOR on one frame... Show Addition, Subtraction, Intersection, Exclusive OR on one frame... the functions on one frame. Two classes Rectangle2D and Ellipse2D are used which
adding of two numbers in designing of frame
create two textfield for mark1&mark2 from db.how to add these two numbers in another one text field.how to write a coding... if u have another one idea pls...=st.executeQuery("select * from student where id=1"); int mar1=0,mar2=0
Frame with JDBC - JDBC
Frame with JDBC   i am using frame having two textfield so how i retrieve the data from the ms-access there is two columns name and salary   Hi,Do you want to display the data on JSP Page?If yes then following tutorial
Creating a Frame
Creating a Frame : Swing Tutorials       This program shows you how to create a frame in Java Swing... and adding it to the container one by one. The frame initially are not visible
how to add panel inside frame?
how to add panel inside frame?  I prepared a Frame with two labels and text fields and one button.when ever user clicks on the button two text fields should be appear(those text fields should be added to the panel) .I want
how to print JInternal frame component ?
how to print JInternal frame component ?  hello sir, i devalop a swing application .but problem is that how display report & print it. some data prefech from database & keep to jtable but how it is print with table
how to write function of copy from one to another location in this code
how to write function of copy from one to another location in this code  I need to write a code to copy a file from one location to another using... ); } public void actionPerformed(ActionEvent e) { Chooser frame = new Chooser
FRAME
FRAME  WHILE I'M RUNNINGFILE OF A GUI PROGRAMME(JDBC CONNECTION) INSTEAD OF OUTPUT FRAME ONLY TWO BLANK FRAMES ARE GETTING DISPLAYD... CAN ANYONE HELP ME TO SOLVE DS PROBLEM
FRAME
FRAME  WHILE I'M RUNNINGFILE OF A GUI PROGRAMME(JDBC CONNECTION) INSTEAD OF OUTPUT FRAME ONLY TWO BLANK FRAMES ARE GETTING DISPLAYD... CAN ANYONE HELP ME TO SOLVE DS PROBLEM
Helps with combo box and frame
on add button another frame pop up with text field(name ,address etc..) ,confirm button and cancel button at bottom of the frame. When i put something... don't really know how to doing it.   Sorry i forget to put my code i
billing frame
billing frame  how to generate billing frame using swing which contain sr. no, name of product, quantity, price & total
How to design a frame of the picture.
How to design a frame of the picture.       This is a picture frame example, it will help you to make a picture frame easily because it has some simple steps. If you want
Redirect Entire Frame
. Any one have idea how i can redirect the entire header and trailer? What i can do
how to call a frame having threading concept
how to call a frame having threading concept   i hav a frame having buttton on it .on click event of the button ,i want to call another frame which... of that frame ,frame is displaying but no other content. that frame contains
frame generation
frame generation  Hi I wnat to genarate one frame with two tabs working ,production..and I want two radiobuttons sector ,others in the frames..based on the tab selection I want to clikc the radio button..when i ckick the radio
Create a Frame in Java
Create a Frame in Java       Introduction This program shows you how to create a frame in java AWT package. The frame in java works like the main window where your
Swings - Java Beginners
Swings  iam created one login form.iam using mysql database.values also stored in database.after login how to go to another page  Hi Friend...(); ResultSet res = st.executeQuery("SELECT * FROM user where username
How to close a frame on action event of a button from a different class ?
How to close a frame on action event of a button from a different class ?  How to close a frame on action event of a button from a different class... was opened when I had press first jbutton from control-frame) when I press second
Restlet Frame work Related question
Restlet Frame work Related question  How to send data from client to server using Restlet framework. The main problem is i am not able to get data at server side. Can anyone post a complete program how to achieve
Java Frame/ Applet /swing/awt
Java Frame/ Applet /swing/awt  I have produced a .exe file with the help of .jar file................... Now How can I Protect my software( .exe ) file bulid in Java from being Copy and Paste....????????? please reply
Navigation Frame in HTML
Frame in HTML. In this Tutorial we help you to understand how to make Navigation...; Another htm code is created, which use this hyperlink created in the Navigation Frame... Navigation Frame in HTML   
How to Create Button on Frame
How to Create Button on Frame       In this section, you will learn how to create Button on  frame the topic of Java AWT package. In the section, from the generated output
how to output text from comboBox from first frame to textField on the second frame? please help me.. thank you in advance..
how to output text from comboBox from first frame to textField on the second frame? please help me.. thank you in advance..  how to output text from comboBox from first frame to textField on the second frame? please help me
Swings - Java Beginners
Swings  iam created one login form.iam using mysql database.values also stored in database.after login how to go to another page  Hi Friend... * FROM login where username='"+value1+"' && password='"+value2
Struts 2 imagae set to frame.
Struts 2 imagae set to frame.  I could not set image to frame... src from value stack. And fname , ftype working in right way. But using... not render the image. And if i go to imageInfo , after right click on image
navigating the value of JTextField from one JFrame to another - Swing AWT
navigating the value of JTextField from one JFrame to another  hello I m doing one project where I m retriving the data from databse in JTextField..now I have one JButton "Detail" in that frame..when a user will click in detail
how display jsp frame - Java Beginners
how display jsp frame  Hi all, I am creating two jsp in frame... in another frame,you have to use target attribute of tag in your footer.jsp.... giving link in footer.jsp file this link will be display.but not opn another
how can i print the selected content of a frame
how can i print the selected content of a frame  hello sir, I am designing a bill calculate program. I want to print the bill in crystal form. I want to skip all the text fields shapes and all the button from the frame.. but all
collection frame work
collection frame work  explain the hierarchy of one dimensional collection frame work classes

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.