?? helpdialog.java
字號(hào):
import java.awt.*;
import javax.swing.*;
import javax.swing.border.*;
import java.awt.event.*;
/** This class displays the about dialog. */
class HelpDialog extends JDialog{
HelpDialog(Frame f){
super(f,"About Typing Fingers");
Dimension d=getToolkit().getScreenSize();
int w=492,h=380;
setBounds((d.width-w)/2,(d.height-h)/2,w,h);
Box box=Box.createVerticalBox();
String message="Developed for http://www.qualitycodes.com";
DialogLabel l=new DialogLabel(message,SwingConstants.CENTER);
l.setFont(new Font("Times new roman",Font.PLAIN,14));
getContentPane().add(l,BorderLayout.NORTH);
ImagePanel iPanel=new ImagePanel(new ImageIcon(System.getProperty("user.dir")+"/Images/keyboard.gif"));
l=new DialogLabel("Typing Fingers",SwingConstants.CENTER);
l.setFont(new Font("Times new roman",Font.BOLD,30));
JPanel p=new JPanel(new FlowLayout(FlowLayout.CENTER,20,20));
p.add(iPanel);
p.add(l);
box.add(Box.createVerticalStrut(40));
box.add(p);
JButton ok=new JButton("Ok");
getContentPane().add(ok,BorderLayout.SOUTH);
ok.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent a){
dispose();
}
});
box.add(Box.createVerticalStrut(40));
box.add(new MainPanel());
getContentPane().add(box);
}
HelpDialog(Frame f,String s){
super(f,"Help contents");
Dimension d=getToolkit().getScreenSize();
int w=510,h=380;
setBounds((d.width-w)/2,(d.height-h)/2,w,h);
TextArea ta;
JButton close;
getContentPane().add(ta=new TextArea());
ta.setEditable(false);
ta.setText(s);
getContentPane().add(close=new JButton("Close"),BorderLayout.SOUTH);
close.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent a){
dispose();
}
});
}
}
class MainPanel extends JPanel{
private String message[]={
"Developed for QualityCodes .",
"Copyrights reserved .",
"---------------------------------------------",
"If you have dislikes or suggestions about the",
"software contact at...",
"author@qualitycodes.com"
};
MainPanel(){
Box box=Box.createHorizontalBox();
box.setBorder(new BevelBorder(BevelBorder.LOWERED));
ImagePanel iPanel=new ImagePanel(new ImageIcon(System.getProperty("user.dir")+"/Images/author.jpg"));
box.add(iPanel);
JPanel p=new JPanel();
p.setLayout(new GridLayout(message.length,1,0,0));
for(int i=0;i<message.length;i++){
JLabel l=new JLabel(message[i]);
l.setFont(new Font("MonoSpaced",Font.PLAIN,12));
p.add(l);
}
box.add(Box.createHorizontalStrut(60));
box.add(p);
JPanel temp=new JPanel();
temp.add(box);
add(temp);
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -