?? dialog1.java
字號:
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(); GridBagLayout gridBagLayout1 = new GridBagLayout(); 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(gridBagLayout1); 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 GridBagConstraints(0, 0, 2, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 31, 0, 46), 15, 6)); panel1.add(button1, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0 ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(13, 6, 13, 0), 2, 2)); panel1.add(button2, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0 ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(13, 35, 13, 12), 3, 3)); } 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 + -