?? customizerdialog.java
字號:
/* ********************************************************************** * * Use, duplication, or disclosure by the Government is subject to * restricted rights as set forth in the DFARS. * * BBNT Solutions LLC * A Part of * Verizon * 10 Moulton Street * Cambridge, MA 02138 * (617) 873-3000 * * Copyright (C) 2002 by BBNT Solutions, LLC * All Rights Reserved. * ********************************************************************** */package com.bbn.openmap.tools.beanbox;import java.awt.*;import java.awt.event.*;import java.beans.*;/** * Utility class that takes a generic component editor and wraps it in * a Dialog box. This includes adding the Frame and the "ok" and * "cancel" buttons. This class is used by the * {@link com.bbn.openmap.tools.beanbox.GenericPropertySheet}to show * a bean customizer. */public class CustomizerDialog extends Dialog implements ActionListener { private Component body; private Button doneButton; private static int vPad = 5; private static int hPad = 4; /** * Constructor taking the parent frame, the customizer component * and the target bean as arguments. */ public CustomizerDialog(Frame frame, Customizer customizer, Object target) { super(frame, customizer.getClass().getName(), true); setLayout(null); body = (Component) customizer; add(body); doneButton = new Button("Done"); doneButton.addActionListener(this); add(doneButton); int x = frame.getLocation().x + 30; int y = frame.getLocation().y + 100; setLocation(x, y); show(); } public void doLayout() { Insets ins = getInsets(); Dimension bodySize = body.getPreferredSize(); Dimension buttonSize = doneButton.getPreferredSize(); int width = ins.left + 2 * hPad + ins.right + bodySize.width; int height = ins.top + 3 * vPad + ins.bottom + bodySize.height + buttonSize.height; body.setBounds(ins.left + hPad, ins.top + vPad, bodySize.width, bodySize.height); doneButton.setBounds((width - buttonSize.width) / 2, ins.top + (2 * hPad) + bodySize.height, buttonSize.width, buttonSize.height); setSize(width, height); } /** * Disposes this dialog. */ public void actionPerformed(ActionEvent evt) { // Our "done" button got pushed. dispose(); }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -