Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



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

Have Programming Question? Ask it here!
 
 
 


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



Advertisement
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 Tutorials/Questions & Answers:
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
one frame update another frame
one frame update another frame  How do I make a link or form in one frame update another frame
Advertisements
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
how to create frame in swings
how to create frame in swings  how to create frame in swings
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
frame update another frame.
frame update another frame.   How do I make a link or form in one frame update another frame
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
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
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
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
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
how to access the object of one frame on clicking a button without using this keyword
how to access the object of one frame on clicking a button without using... extends Frame { public static void main(String args[]) { Button b1...) { System.exit(0); } }); } } class Myclass extends Frame implements
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 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
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
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 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
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 forward the control from one jsp to another?
How to forward the control from one jsp to another?  Hi! This is Prasad Jandrajupalli. I have the 3 JSP's, but I want communicate with each... is not communicate with the Third JSP. I want forward the control from first jsp to second
how to pass a string from one class to another
how to pass a string from one class to another  hi all, Good morning... string from one class to another. import java.util.*; class A{ static String... string from one class to another. import java.io.*; class Class1 { public
How to center a frame
How to center a frame In this tutorial, you will learn how to center a frame on screen. A Frame is a top-level window having a title and a border and its... and minimize also. Here we are going to center the frame on the screen
How to navigate from one jsf to another in eclipse
How to navigate from one jsf to another in eclipse  Hi there is my...; <from-view-id>/JSF/UserDetail.jsp</from-view-id> <navigation-case> <from-outcome>success</from-outcome> <
Calling awt Frame methods from subclass
Calling awt Frame methods from subclass  Calling awt Frame methods from subclass
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
pass data from java frame to file
pass data from java frame to file  i want to write the data to file, and data must be copy from java frame java frame contains 7-8 labels n below that 1 table. i want store all this data to 1 file. plz help me
how to set a image in frame? - Swing AWT
how to set a image in frame?  how to set a image in frame using swing
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
How to Synchronize the Entire collection Frame Work?
How to Synchronize the Entire collection Frame Work?  How to Synchronize the Entire collection Frame Work?   I Think We must implement the Through Sub Interfaces of Collection Frame work
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 copy file from one directory to another in java with examples
how to copy file from one directory to another in java with examples  how to copy file from one directory to another in java with examples? I want... copy from one directory to another in java. Thanks
how to pass an array from one jsp to another jsp - JSP-Servlet
how to pass an array from one jsp to another jsp  hi friedns, can any One tell me how to send an array from one jsp to another jsp,pls any one send the code for this.also porvid the code how to retrive the arry in another jsp
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
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
billing frame
billing frame  how to generate billing frame using swing which contain sr. no, name of product, quantity, price & total
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 to pass variable from one class to another in java
How to pass variable from one class to another in java  How to pass variable from one class to another in java?   Example: public class...; } } //Another class Class2. public class Class2 { public static void main(String
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
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
How to create CheckBox On frame
How to create CheckBox On frame     ... will learn how to create CheckBox on the frame. In the Java AWT, top-level windows... can learn in very efficient manner. In this section, you will see how to create
Java Frame
Java Frame  What is the difference between a Window and a Frame
panel and frame
panel and frame  What is the difference between panel and frame
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
How To Pass data from one GUI to another in java swing
How To Pass data from one GUI to another in java swing  I'm new to java and part of our assignment is to build a GUI and display a result set from data input. I'm stuck at how to get the user's input from JTextFields and combobox
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
Image on frame
Image on frame   Hi, This is my code. In this I am unable to load... java.awt.event.*; public class AwtImg extends Frame { Image img; public...(); } AwtImg() { super("Image Frame"); MediaTracker mt=new
Advertisements
 

 

 

DMCA.com