Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 07-06-2005, 02:16 PM   #1
LQ Newbie
Registered: Apr 2005
Posts: 25

Rep: Reputation: 15
Unhappy Help with Panels in Java please.

What i want to do is move from one frame to another like when you install a new software and you click on the next button. I am currently using an abstract class and override my drawPanel in each class that follows. The code that i have now is:

import javax.swing.*;

public abstract class Abs{
public abstract JPanel drawPanel();


private JFrame frame;

SecondPage sp = new SecondPage(frame);

public FirstPage(JFrame f){
frame = f;
panel = new JPanel();
next = new JButton("Next");
pre = new JButton("Pre");
ActionListener nextL = new NextListener();

public JPanel drawPanel(){

return panel;

public class NextListener implements ActionListener{
public void actionPerformed(ActionEvent event){
System.out.println("First Page Listener Next");

So can someone plaese help me or provide me with some source code to do this?

Thank You
Old 07-07-2005, 03:44 PM   #2
LQ Guru
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

This might be of interest:

Before you go that far, I'd definitely make sure you're comfortable programming a basic JFrame, first. Specifically:

1. Create a JFrame with a panel (for example, a scrollable text area) and a couple of buttons (for example, "Do Something" and "Quit")

2. Successfully lay out the controls on the JFrame (for example, change the default JFrame layout manager to a vertical BoxLayout, position the panel on the top, and center the buttons horizontall on the bottom).

3. Successfully display the JFrame (and the attached controls).

4. Successfully field events from the controls (for example, detect button clicks; handle "X" exit)

If you're unclear about any of these "basics", trying working through the Swing tutorials on

You might also want to check out JavaRanch as another resource (in addition to

'Hope that helps .. PSM


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
panels in enlightenment? echo_max Linux - Software 1 08-22-2005 01:52 AM
deleted panels bharatp Linux - Newbie 4 07-28-2005 10:21 AM
Java menus (radio buttons) and panels titanium_geek Programming 6 01-07-2004 11:13 AM
my panels are gone ... s9722 Linux - Software 10 05-29-2003 04:33 PM
panels s9722 Linux - Newbie 0 05-23-2003 01:49 PM

All times are GMT -5. The time now is 03:59 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration