View Single Post
Old 04-07-2003, 07:24 PM   #5 (permalink)
SkittlesAreYum
Registered User
 
Join Date: Apr 2003
Posts: 8
SkittlesAreYum is on a distinguished road
Okay, here's the full code of an example I'm trying to get to work, just as a test program. Just paste the whole thing into TextPad or whatever, it should run.



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

public class X
{
private static JFrame xFrame;
public static void main(String[] args)
{
xFrame = new JFrame();
xFrame.setSize(100,100);
JButton xButton = new JButton("X");
xButton.addActionListener(new XListener());
xFrame.getContentPane().add(xButton);
xFrame.setVisible(true);
}

private static class XListener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
xFrame.removeAll();
xFrame.validate();
xFrame.hide();
xFrame.show();

xFrame.getContentPane().add(new JLabel("Java is stupid"));
}
}
}
SkittlesAreYum is offline   Reply With Quote