📄 aboutdialog.java
字号:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
/**
* 关于对话框
*/
public class AboutDialog extends JDialog
{
Color c;
Panel panel1 = new Panel();
Panel panel2 = new Panel();
JLabel jLabel1 = new JLabel();
JLabel jLabel2 = new JLabel();
JLabel jLabel3 = new JLabel();
JLabel jLabel4 = new JLabel();
JLabel jLabel5 = new JLabel();
JLabel jLabel6 = new JLabel();
JLabel jLabel7 = new JLabel();
JLabel jLabel8 = new JLabel();
JLabel jLabel9 = new JLabel();
JLabel jLabel10 = new JLabel();
JLabel jLabel11 = new JLabel();
JButton jButton1 = new JButton();
public AboutDialog(){};
public AboutDialog(Frame frame, String title,Color newFrontColor)
{
super(frame,title);
try
{
this.c=newFrontColor;
jLabel1.setForeground(c);
jLabel1.setText("关于该俄罗斯方块游戏的控制说明:");
jLabel2.setForeground(c);
jLabel2.setText(" 旋 转 键: up/w");
jLabel3.setForeground(c);
jLabel3.setText(" 向 左 键: left/a");
jLabel4.setForeground(c);
jLabel4.setText(" 向 右 键: right/d");
jLabel5.setForeground(c);
jLabel5.setText(" 向 下 键: down/s");
jLabel6.setText(" Author: 任广坤");
jLabel7.setText(" Version: 1.4");
jButton1.setText("确定");
panel1.setLayout(new GridLayout(11,1));
jButton1.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
dispose();
}
});
Dimension scrSize = Toolkit.getDefaultToolkit().getScreenSize();
getContentPane().add(panel1,BorderLayout.NORTH);
getContentPane().add(panel2,BorderLayout.SOUTH);
panel1.add(jLabel1);
panel1.add(jLabel2);
panel1.add(jLabel3);
panel1.add(jLabel4);
panel1.add(jLabel5);
panel1.add(jLabel8);
panel1.add(jLabel9);
panel1.add(jLabel10);
panel1.add(jLabel11);
panel1.add(jLabel6);
panel1.add(jLabel7);
panel2.add(jButton1);
setSize(300,300);
this.setResizable(false);
this.setLocation((scrSize.width-getSize().width)/2,(scrSize.height-getSize().height)/2);
show();
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -