📄 dialog1.java~14~
字号:
package dialog;import java.awt.*;import java.awt.event.*;import com.borland.jbcl.layout.*;/** * Title: * Description: * Copyright: Copyright (c) 2001 * Company: * @author * @version 1.0 */public class Dialog1 extends Dialog { Panel panel1 = new Panel(); Label label1 = new Label(); Button button1 = new Button(); Button button2 = new Button(); XYLayout xYLayout1 = new XYLayout(); public Dialog1(Frame frame, String title, boolean modal) { super(frame, title, modal); enableEvents(AWTEvent.WINDOW_EVENT_MASK); try { jbInit(); add(panel1); pack(); } catch(Exception ex) { ex.printStackTrace(); } } public Dialog1(Frame frame) { this(frame, "", false); } public Dialog1(Frame frame, boolean modal) { this(frame, "", modal); } public Dialog1(Frame frame, String title) { this(frame, title, false); } void jbInit() throws Exception { label1.setText("这是一个对话框"); panel1.setLayout(xYLayout1); button1.setLabel("确定"); button1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { button_actionPerformed(e); } }); button2.setLabel("取消"); button2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { button_actionPerformed(e); } }); panel1.add(label1, new XYConstraints(31, 0, 99, 24)); panel1.add(button1, new XYConstraints(6, 37, 61, 31)); panel1.add(button2, new XYConstraints(102, 37, 62, 32)); } protected void processWindowEvent(WindowEvent e) { if (e.getID() == WindowEvent.WINDOW_CLOSING) { cancel(); } super.processWindowEvent(e); } void cancel() { dispose(); } void button_actionPerformed(ActionEvent e) { dispose(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -