<< 返回
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JTextArea;
@SuppressWarnings("serial")
public class MenuAbout extends JDialog implements WindowListener{
private JTabbedPane tab = null;
private JTextArea textArea = null;
private JScrollPane scrollPane = null;
private JPanel panel = null;
private JLabel version = null;
private JLabel author = null;
public MenuAbout() {
this.tab = new JTabbedPane();
this.textArea = new JTextArea();
this.scrollPane = new JScrollPane(this.textArea,
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,//始终显示垂直滚动条
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);//仅在需要的时候显示水平滚动条
this.panel = new JPanel();
this.version = new JLabel("Notepad Alpha 1.0 (2012.3.22) ");
this.author = new JLabel("Tieper");
this.panel.add(this.version);
this.panel.add(this.author);
this.textArea.setEditable(false); //不可编辑
this.textArea.setLineWrap(true); //自动换行
this.textArea.setText("Tieper\nhttp://blog.csdn.net/tieper/article/details/7384333");
tab.addTab("版权与作者", this.panel);
tab.addTab("程序说明", this.scrollPane);
this.add(this.tab);
this.setTitle("关于 \"记事本\"");
this.setSize(400, 300);
this.setLocation(300, 200);
this.setResizable(false);
this.setIconImage(null);
this.setVisible(true);
}
@Override
public void windowActivated(WindowEvent arg0) {}
@Override
public void windowClosed(WindowEvent arg0) {}
@Override
public void windowClosing(WindowEvent arg0) {
this.dispose();
}
@Override
public void windowDeactivated(WindowEvent arg0) {}
@Override
public void windowDeiconified(WindowEvent arg0) {}
@Override
public void windowIconified(WindowEvent arg0) {}
@Override
public void windowOpened(WindowEvent arg0) {}
}
<< 返回