📄 helpdialog.java
字号:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class HelpDialog extends Dialog
{
Label lab1,lab2,lab3,lab4,lab5,lab6,lab7;
Mypicture mypic;
Box basebox ,boxV;
HelpDialog(Frame f,String s,boolean b)
{
super(f,s,b);
mypic=new Mypicture("关于");
setBounds(200,200,290,350);
setLayout(new BorderLayout());
add(mypic,BorderLayout.NORTH);
String osname=System.getProperty("os.name","not specified");
lab1=new Label(osname);
String javaname=System.getProperty("java.version","not specified");
lab2=new Label("JavaVersion: "+javaname);
String memory=System.getProperty("user.name","not specified");
lab3=new Label("当前用户: "+memory);
String osarch=System.getProperty("os.arch","not specified");
lab4=new Label("CPU Architure: "+osarch);
String javavendor=System.getProperty("java.vendor");
lab6=new Label("Java Vendor: "+javavendor);
String cpu=System.getProperty("sun.cpu.isalist");
lab7=new Label("CPU: "+cpu);
lab5=new Label("Version 1.01 Create-by YJ.W");
boxV=Box.createVerticalBox();
boxV.add(lab1);
boxV.add(Box.createVerticalStrut(2));
boxV.add(lab3);
boxV.add(Box.createVerticalStrut(2));
boxV.add(lab4);
boxV.add(Box.createVerticalStrut(2));
boxV.add(lab5);
boxV.add(Box.createVerticalStrut(2));
boxV.add(lab6);
boxV.add(Box.createVerticalStrut(2));
boxV.add(lab7);
boxV.add(Box.createVerticalStrut(2));
boxV.add(lab2);
boxV.add(Box.createVerticalStrut(2));
boxV.add(lab5);
Box basebox=Box.createHorizontalBox();
basebox.add(boxV);
add(basebox,BorderLayout.CENTER);
setVisible(false);
validate();
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
setVisible(false);
}
});
}
}
class Mypicture extends Canvas
{
Image img;
Toolkit tool;
static int width,height;
Mypicture(String s)
{
setSize(150,170);
tool=getToolkit();
img=tool.getImage("logo.jpg");
}
public void paint(Graphics g)
{
g.drawImage(img,0,0,img.getWidth(this),img.getHeight(this),this);
}
public static void main(String args[])
{
Mypicture mypic=new Mypicture("关于");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -