?? nothelloworld.java
字號:
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.setVisible(true);
}
}
/**
A frame that contains a message panel
*/
class NotHelloWorldFrame extends JFrame
{
public NotHelloWorldFrame()
{
Toolkit kit=Toolkit.getDefaultToolkit();
Dimension screenSize=kit.getScreenSize();
int screenHeight=screenSize.height;
int screenWidth=screenSize.width;
setSize(screenWidth/2,screenHeight/2);
setLocation(screenWidth/4,screenHeight/4);
Image img=kit.getImage("icon.gif");
setIconImage(img);
setTitle("NotHelloWorld");
//setSize(DEFAULT_WIDTH,DEFAULT_HEIGHT);
NotHelloWorldPanel panel=new NotHelloWorldPanel();
add(panel);
}
//public static final int DEFAULT_WIDTH=300;
//public static final int DEFAULT_HEIGHT=200;
}
class NotHelloWorldPanel extends JPanel
{
public void paintComponent(Graphics g)
{
super.paintComponent(g);
g.drawString("有夢想就有希望!!!!!",MESSAGE_X,MESSAGE_Y);
}
public static final int MESSAGE_X=75;
public static final int MESSAGE_Y=100;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -