import javax.swing.*;import java.awt.*;public class NotHelloWorld
{
public static void main(String[] args)
{
NotHelloWorldFrame frame = new NotHelloWorldFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.show();
}
}class NotHelloWorldFrame extends JFrame
{
public NotHelloWorldFrame()
{
setTitle("NotHelloWorld");
setSize(DEFAULT_WIDHT, DEFAULT_HEIGHT);
NotHelloWorldPanel panel=new NotHelloWorldPanel();
Container contentPane=getContentPane();
contentPane.add(panel);
}
public static final int DEFAULT_WIDHT=300;
public static final int DEFAULT_HEIGHT=200;
}class NotHelloWorldPanel extends JPanel
{
public void paintComponetn(Graphics g)
{
super.paintComponent(g);
g.drawString("Not a Hello, World program",
MESSAGE_X,MESSAGE_Y);
}
public static final int MESSAGE_X=75;
public static final int MESSAGE_Y=100;
}
{
public static void main(String[] args)
{
NotHelloWorldFrame frame = new NotHelloWorldFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.show();
}
}class NotHelloWorldFrame extends JFrame
{
public NotHelloWorldFrame()
{
setTitle("NotHelloWorld");
setSize(DEFAULT_WIDHT, DEFAULT_HEIGHT);
NotHelloWorldPanel panel=new NotHelloWorldPanel();
Container contentPane=getContentPane();
contentPane.add(panel);
}
public static final int DEFAULT_WIDHT=300;
public static final int DEFAULT_HEIGHT=200;
}class NotHelloWorldPanel extends JPanel
{
public void paintComponetn(Graphics g)
{
super.paintComponent(g);
g.drawString("Not a Hello, World program",
MESSAGE_X,MESSAGE_Y);
}
public static final int MESSAGE_X=75;
public static final int MESSAGE_Y=100;
}
解决方案 »
- 什么是线程安全?
- 如果我想要这样的结果,你能做到吗?
- 问利用AudioClip能否装载 .mp3 格式的文件?
- java与c的socket的传输问题
- <jsp:plugin>参数传递问题?
- QQ视频一开,为什么CPU就100%了?
- Implement Baccarat Game 希望有人能帮帮忙 新手上路
- 在JBuilder 7(Windows2000)中,我一运行汉字输入法(如:全拼、双拼等),JBuilder 7程序就会死。昨办呢????
- 谁能讲讲网页发手机短信的原理?使用applet发送的吗?
- Calendar 類 的 getDate 為甚麼不正確 ?
- rs.deleteRow()删除一个记录集中的一行 报‘无效的游标状态‘错误
- 关于一个“变态”面试题的疑问
public void paintComponent(Graphics g)