|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2000 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.core.windows.services; import org.openide.util.HelpCtx; import org.openide.util.Utilities; import org.openide.windows.WindowManager; import javax.swing.*; import java.awt.*; // XXX before as org.netbeans.core.CoronaDialog; /** The CoronaDialog is a standard dialog that contains a ButtonBar on the South. * All the "add(Component)" and "setLayout(LayoutManager)" requests should be * performed on the Container acquired from getContentPane() (similar to * getContentPane() in JFrame and JDialog). * The dialog can be both instantiated OR subclassed. * * @author Ian Formanek, Jaroslav Tulach, Jan Jancura, Petr Hamernik * @version 0.56, May 16, 1998 */ class CoronaDialog extends JDialog { /** generated Serialized Version UID */ static final long serialVersionUID = 5301615034186604735L; /** Constructs a new modal CoronaDialog with empty button bar. * Descendants can initialize the ButtonBar later by calling setButtons() * on the buttonBar acquired by protected method getButtonBar. * @param parent The Frame parent of the dialog or null if the parent should be the Corona's MainWIndow * @param modal If the dialog is modal */ public CoronaDialog (Frame parent, boolean modal) { this(parent, ButtonBar.EMPTY, modal); } /** Constructs a new modal CoronaDialog with empty button bar. * Descendants can initialize the ButtonBar later by calling setButtons() * on the buttonBar acquired by protected method getButtonBar. * @param parent The Frame parent of the dialog or null if the parent should be the Corona's MainWIndow */ public CoronaDialog (Frame parent) { this(parent, ButtonBar.EMPTY, true); } /** Constructs a new modal CoronaDialog with given preset mode of ButtonBar. * @param mode The ButtonBar mode * @param parent The Frame parent of the dialog or null if the parent should be the Corona's MainWIndow */ public CoronaDialog (Frame parent, int mode) { this(parent, mode, true); } /** Constructs a new CoronaDialog with given preset mode of ButtonBar. * @param parent The Frame parent of the dialog or null if the parent should be the Corona's MainWIndow * @param bb button bar to use * @param modal If the dialog is modal */ public CoronaDialog (Frame parent, ButtonBar bb, boolean modal) { super( parent == null ? WindowManager.getDefault().getMainWindow() : parent, modal ); getContentPane().setLayout(new BorderLayout()); buttonBar = bb; buttonBar.addButtonBarListener(new ButtonBar.ButtonBarListener() { public void buttonPressed(ButtonBar.ButtonBarEvent evt) { CoronaDialog.this.buttonPressed(evt); } } ); inside = new JPanel(); inside.setLayout(new BorderLayout()); getContentPane().add (inside, BorderLayout.CENTER); getContentPane().add (buttonBar, (bb.getOrientation() == ButtonBar.HORIZONTAL) ? BorderLayout.SOUTH : BorderLayout.EAST); } /** Constructs a new CoronaDialog with given preset mode of ButtonBar. * @param parent The Frame parent of the dialog or null if the parent should be the Corona's MainWIndow * @param mode The ButtonBar mode * @param modal If the dialog is modal */ public CoronaDialog (Frame parent, int mode, boolean modal) { this (parent, new ButtonBar (mode), modal); } /** Method that allows getting the inside pane that can be used * for adding/removing components to the Dialog. * This pane should be used *exclusively* for this - it is a * equivalent of getContentpane in swing windows. * @return The pane to be used for setting layout and adding components */ public JPanel getCustomPane() { return inside; } /** A method that allows descendants to acquire a reference to ButtonBar * so that the ButtonBar can be initialized / altered. * @return The ButtonBar of this dialog */ protected ButtonBar getButtonBar() { return buttonBar; } /** Default implementation of close() from TopWindow - returns true. * * Called when one wants to close the window and never * restore it anymore. Can initiate interaction with user and * he can stop closing. * In such a case the method should return |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.