Blixinator
05-04-2009, 09:20 AM
Yes, another thread in which I ask for help.
So I've been doing some stuff with applications and I'm trying to create multiple JFrames.
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import javax.swing.*;
import java.util.*;
public class Application3 extends JFrame implements ActionListener
{
static JButton button = new JButton("Button");
static JPanel p = new JPanel();
static JPanel p2 = new JPanel();
static JFrame test1 = new JFrame();
static JFrame test2 = new JFrame();
static JLabel label1 = new JLabel("TEST");
public Application3()
{
test1.getContentPane().add(p,BorderLayout.CENTER);
p.add(button);
test2.getContentPane().add(p2,BorderLayout.CENTER) ;
p2.add(label1);
}
public static void main(String[] args) throws AWTException, IOException
{
Application3 app = new Application3();
app.test1.show();
app.test1.setSize(500,500);
app.test1.setLocation(100,100);
app.test1.setTitle("Test1");
app.test2.show();
app.test2.setSize(500,500);
app.test2.setLocation(600,100);
app.test2.setTitle("Test2");
}
public void actionPerformed(ActionEvent ae)
{
}
}
Both frames open, but I don't see either the button in Test1 or the label in Test2, and I can't figure out what's up.
So I've been doing some stuff with applications and I'm trying to create multiple JFrames.
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import javax.swing.*;
import java.util.*;
public class Application3 extends JFrame implements ActionListener
{
static JButton button = new JButton("Button");
static JPanel p = new JPanel();
static JPanel p2 = new JPanel();
static JFrame test1 = new JFrame();
static JFrame test2 = new JFrame();
static JLabel label1 = new JLabel("TEST");
public Application3()
{
test1.getContentPane().add(p,BorderLayout.CENTER);
p.add(button);
test2.getContentPane().add(p2,BorderLayout.CENTER) ;
p2.add(label1);
}
public static void main(String[] args) throws AWTException, IOException
{
Application3 app = new Application3();
app.test1.show();
app.test1.setSize(500,500);
app.test1.setLocation(100,100);
app.test1.setTitle("Test1");
app.test2.show();
app.test2.setSize(500,500);
app.test2.setLocation(600,100);
app.test2.setTitle("Test2");
}
public void actionPerformed(ActionEvent ae)
{
}
}
Both frames open, but I don't see either the button in Test1 or the label in Test2, and I can't figure out what's up.