Java 小问题,等代求教
//在面板上显示一条信息
import javax.swing.*;
import java.awt.*;
//import java.awt.event.*;
import java.awt.geom.*;
public class SimpleFrameTest
{
public static void main(String[] args)
{
SimpleFrame frame = new SimpleFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.show();
}
}
//框架类
class SimpleFrame extends JFrame
{
public SimpleFrame()
{
setTitle("This is a Title");
setSize(WIDTH,HEIGHT);
//加入一个面板到框架
HelloPanel panel = new HelloPanel ();
Container contentPane = getContentPane();
contentPane.add(panel);
}
public static final int WIDTH = 400;
public static final int HEIGHT = 400;
}