Results 1 to 2 of 2
Thread: Buttons to show new panels
- 03-03-2008, 12:26 PM #1
Member
- Join Date
- Dec 2007
- Posts
- 6
- Rep Power
- 0
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
}
}
}
- 03-06-2008, 04:22 PM #2
Similar Threads
-
images, panels and applets
By jamesfrize in forum Java AppletsReplies: 3Last Post: 03-20-2008, 04:35 PM -
netbeans 6.0 not show commpunent or show blank page
By fahimaamir in forum NetBeansReplies: 1Last Post: 01-26-2008, 06:20 AM -
Working with Labels on Panels.
By vargihate in forum AWT / SwingReplies: 2Last Post: 01-04-2008, 04:09 AM -
JMenu calling another Forms/Panels
By plodos in forum New To JavaReplies: 2Last Post: 12-10-2007, 08:02 AM -
Need a tutorial for Studying about Panels
By ramachandran in forum New To JavaReplies: 1Last Post: 10-25-2007, 09:05 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks