Results 1 to 2 of 2
  1. #1
    Lehane_9 is offline Member
    Join Date
    Dec 2007
    Posts
    6
    Rep Power
    0

    Default Buttons to show new panels

    I have a frame with three buttons, basically i want to know how to get one button to bring to a new pane where i can have new buttons etc, any help would be greatly appreciated. this is what i have


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

    public class Example_22_2 extends JFrame implements ActionListener
    {
    private JButton loginBtn, viewTimeTablesBtn,BuyTicketsBtn;

    Container c;
    FlowLayout layout;





    public Example_22_2()
    {
    super("Irish Rail Timetabling and Ticketing System ");

    c=getContentPane();

    layout= new FlowLayout();
    c.setLayout(layout);

    loginBtn =new JButton("Login change timetables");
    viewTimeTablesBtn = new JButton("View Timetables");
    BuyTicketsBtn = new JButton ("Buy tickets");
    clearForm = new JButton("Clear");

    loginBtn.addActionListener(this);
    viewTimeTablesBtn.addActionListener(this);
    BuyTicketsBtn.addActionListener(this);
    clearForm.addActionListener(this);

    c.add(loginBtn);
    c.add(viewTimeTablesBtn);
    c.add(BuyTicketsBtn);
    c.add(clearForm);

    setSize (250, 200);
    show();
    }

    public static void main (String args[])
    {
    Example_22_2 example = new Example_22_2();
    }

    public void actionPerformed(ActionEvent e)
    {


    if(e.getSource()==(viewTimeTablesBtn))
    {

    // I want to go to a new panel

    }


    }
    }

  2. #2
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Posts
    1,576
    Rep Power
    9

Similar Threads

  1. images, panels and applets
    By jamesfrize in forum Java Applets
    Replies: 3
    Last Post: 03-20-2008, 05:35 PM
  2. netbeans 6.0 not show commpunent or show blank page
    By fahimaamir in forum NetBeans
    Replies: 1
    Last Post: 01-26-2008, 07:20 AM
  3. Working with Labels on Panels.
    By vargihate in forum AWT / Swing
    Replies: 2
    Last Post: 01-04-2008, 05:09 AM
  4. JMenu calling another Forms/Panels
    By plodos in forum New To Java
    Replies: 2
    Last Post: 12-10-2007, 09:02 AM
  5. Need a tutorial for Studying about Panels
    By ramachandran in forum New To Java
    Replies: 1
    Last Post: 10-25-2007, 10:05 AM

Posting Permissions

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