日期:2014-05-20 浏览次数:20933 次
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
public class AboutDialog extends JDialog{
static JFrame jf=new JFrame();
/**
* @param args
*/
static JFrame tf=new JFrame();
public static void main(String[] args) {
// TODO Auto-generated method stub
new AboutDialog(jf);
}
public AboutDialog(JFrame owner){
super(owner,"关于记事本",true);
tf.setVisible(true);
tf.setLocation(600, 600);
tf.setSize(100,100);
JMenuBar jb=new JMenuBar();
JMenu jm=new JMenu("FIle");
JMenuItem ji=new JMenuItem("About");
jb.add(jm);
jm.add(ji);
jf.setJMenuBar(jb);
ji.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
setVisible(true);
}
});
jf.setVisible(true);
jf.setSize(300,300);
add(new JLabel("<html><h1>Window7 旗舰版</i></h1><hr><p>Microsoft Windows</p><p>....</p></html>"),BorderLayout.CENTER);
JPanel panel=new JPanel();
JButton ok=new JButton("Ok");
ok.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
setVisible(false);
}
});
panel.add(ok);
add(panel,BorderLayout.SOUTH);
setSize(250,150);
}
}