The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
July 2001

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

if it is not late

Posted by wladiw on August 03, 2001 at 6:35 AM

Hi,

I hope ,this piece of code with some corrections will came in handy for you .

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

public class Amplifier extends JPanel{
JPanel mainPane;

public Amplifier(){
mainPane = new JPanel();
//----- for example --------//
JLabel graph = new JLabel("Graph");
JLabel fred = new JLabel("fred");
//---------------------------//
mainPane.setLayout(new BorderLayout());
mainPane.add(new Label("Amplifier", Label.CENTER), BorderLayout.NORTH);
mainPane.add(fred, BorderLayout.WEST); //
mainPane.add(graph, BorderLayout.EAST); //
}

public static void main(String[] args){

Amplifier amplifier = new Amplifier();
//this unnecessary
//Converter fred = new Converter(); t
JFrame f = new JFrame("Project");
f. addWindowListener(
new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
});

f.setContentPane(amplifier.mainPane);
// this is already made in Amplifier constructor
//f.setContentPane(fred.mainPane);

f.pack();
f.setVisible(true);
}
}






Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us