?? aboutdialog.java
字號(hào):
package org.jr.jzj;
/**
* <p>Copyright: Copyright (c) 2002-2003</p>
* <p>Company: JavaResearch(http://www.javaresearch.org)</p>
* <p>最后更新日期:2003年1月9日
* @author Cherami,Barney,Brain
* @version 0.8
*/
import java.util.prefs.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import org.jr.swing.*;
/**
* 關(guān)于對(duì)話框,生成界面并完成事件的監(jiān)聽和處理。
*/
class AboutDialog
extends JDialog {
private static JZJLogger logger = new JZJLogger(AboutDialog.class);
Preferences preference = JZipJar.preference;
String title;
JLabel commentsLabel;
JButton okButton;
JPanel buttonPanel = new JPanel();
JZJResources resource = JZJResources.getResources();
/**
* 構(gòu)造方法,建立對(duì)話框。
* @param parent 對(duì)話框依賴的父框架
*/
AboutDialog(JFrame parent) {
super(parent);
title = resource.getString("a_title");
setTitle(title);
buttonProperty = (ButtonProperty) resource.getObject("a_b_ok");
okButton = new JButton(buttonProperty.text);
okButton.setToolTipText(buttonProperty.tooltip);
Container content = getContentPane();
ImageIcon logoIcon = new ImageIcon(MainFrame.class.getResource(ImageNames.
img_l_jrlogo));
commentsLabel = new JLabel(logoIcon);
content.add(commentsLabel);
buttonPanel.add(okButton);
//添加事件監(jiān)聽器,確定按鈕按下的時(shí)候簡(jiǎn)單的隱藏此對(duì)話框
okButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
AboutDialog.this.setVisible(false);
}
}
);
okButton.registerKeyboardAction(new ActionListener() {
public void actionPerformed(ActionEvent e) {
AboutDialog.this.setVisible(false);
}
}
, KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),
JComponent.WHEN_IN_FOCUSED_WINDOW);
content.add(buttonPanel, "South");
setSize(preference.getInt("width", 300), preference.getInt("height", 200));
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -