Results 1 to 4 of 4
  1. #1
    imrankhan is offline Member
    Join Date
    Jan 2009
    Posts
    1
    Rep Power
    0

    Post navigation b/w frames

    helloo everyone i need help in creating frames that are in layers when one button is clicked it should navigate me to the next frame and so on.each frame should have its own controls on it like we see in every software installation process.please help me out this problem.Thanks

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    It sounds as if you want to create dialogs that are opened by pressing buttons.

    Question 1: how do you create your GUIs, by hand or by NetBeans code generation?
    Question 2: How much Swing do you know? Have you gone through any of the Sun Swing tutorials?

  3. #3
    rajan1987 is offline Member
    Join Date
    Mar 2012
    Posts
    1
    Rep Power
    0

    Default Re: navigation b/w frames

    If u have two frame than try it

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

    class PassData extends JFrame
    {
    JTextField text;
    PassData(){
    JLabel l=new JLabel("Name: ");
    text=new JTextField(20);
    JButton b=new JButton("Send");
    setLayout(null);
    l.setBounds(10,10,100,20);
    text.setBounds(120,10,150,20);
    b.setBounds(120,40,80,20);
    add(l);
    add(text);
    add(b);
    setVisible(true);
    setSize(300,100);
    b.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent e){
    String value=text.getText();
    NextPage page=new NextPage(value);
    page.setVisible(true);
    }
    });
    }
    public static void main(String[] args)
    {
    new PassData();
    }
    }








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

    class NextPage extends JFrame
    {
    NextPage(String st)
    {
    setLayout(null);
    setDefaultCloseOperation(javax.swing. WindowConstants.DISPOSE_ON_CLOSE);
    setTitle("Welcome");
    JLabel lab=new JLabel("Welcome "+st);
    lab.setBounds(10,10,500,20);
    add(lab);
    setSize(300, 100);
    }
    }

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,458
    Rep Power
    20

    Default Re: navigation b/w frames

    Quote Originally Posted by rajan1987 View Post
    If u have two frame than try it
    1. Don't spoonfeed. People come here to learn. Don't deny them that opportunity.
    2. Learn to use the code tags so that your code retains its formatting. To find out how, scout around the FAQs section of the site.
    3. Don't include multiple blank lines in your posts. They just annoy people who need to scroll down to the next content.
    4. That code is crappy.
    • Learn to use layout managers instead of setting bounds.
    • Learn to respect Swing's single threaded rule.
    • Dont use a verbose, fully qualified name for an inherited constant.
    • Don't abuse inheritance by needlessly extending JFrame for everything. Favor composition.


    Last but not least: Don't needlessly and uselessly post to old dead threads. This one's three years old.

    Closing.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. jsf command link navigation case
    By Srikala in forum JavaServer Faces (JSF)
    Replies: 1
    Last Post: 03-23-2009, 12:16 PM
  2. Grid layout frames GUI
    By fritz1474 in forum AWT / Swing
    Replies: 1
    Last Post: 10-15-2008, 03:04 AM
  3. Editing video frames in JMF
    By russ2620 in forum Networking
    Replies: 0
    Last Post: 05-31-2008, 12:26 AM
  4. [SOLVED] Navigation between swing forms
    By stevedb in forum AWT / Swing
    Replies: 7
    Last Post: 04-01-2008, 02:23 PM
  5. Wep page navigation buttons
    By anthony417 in forum Advanced Java
    Replies: 1
    Last Post: 07-26-2007, 09:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •