📄 caboutbox.java
字号:
package baseui;/** * <p>Title: Gestion Affichage et processus</p> * <p>Copyright: Copyright (c) 2004</p> * @author: Jean-Philippe Rennard * @version 1.0 */import java.awt.*;import java.awt.event.*;/** * <p>Title: Affichage d'une bo顃e de dialogue "A propos"</p> */public class CaboutBox extends Dialog { Panel panel1 = new Panel(); BorderLayout borderLayout1 = new BorderLayout(); Panel panel2 = new Panel(); Button button1 = new Button(); Panel panel3 = new Panel(); GridLayout gridLayout1 = new GridLayout(); Frame owner; TextArea textArea = new TextArea("",1,1, TextArea.SCROLLBARS_NONE); public CaboutBox(Frame frame, String title, boolean modal) { super(frame, title, modal); owner = frame; enableEvents(AWTEvent.WINDOW_EVENT_MASK); try { jbInit(); add(panel1); pack(); } catch(Exception ex) { ex.printStackTrace(); } } private void jbInit() throws Exception { panel1.setLayout(borderLayout1); button1.setLabel("OK"); button1.addActionListener(new AboutBox_button1_actionAdapter(this)); panel3.setLayout(gridLayout1); gridLayout1.setColumns(1); textArea.setEditable(false); textArea.setText("textArea1"); panel1.add(panel2, BorderLayout.SOUTH); panel2.add(button1, null); panel1.add(panel3, BorderLayout.CENTER); panel3.add(textArea, null); } /** Display Info box */ public void dispInfoBox(String t) { textArea.setText(t); Dimension dim= getToolkit().getScreenSize(); setSize(Math.max(dim.width/3,320),Math.max(dim.height/3,240)); setLocation(owner.getLocation().x+(owner.getSize().width/2)- (getSize().width/2),owner.getLocation().y+(owner.getSize().height/2)- (getSize().height/2)); show(); } protected void processWindowEvent(WindowEvent e) { if (e.getID() == WindowEvent.WINDOW_CLOSING) { cancel(); } super.processWindowEvent(e); } void cancel() { dispose(); } void button1_actionPerformed(ActionEvent e) { cancel(); }}class AboutBox_button1_actionAdapter implements java.awt.event.ActionListener { CaboutBox adaptee; AboutBox_button1_actionAdapter(CaboutBox adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.button1_actionPerformed(e); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -