本文整理汇总了Java中java.awt.Dialog类的典型用法代码示例。如果您正苦于以下问题:Java Dialog类的具体用法?Java Dialog怎么用?Java Dialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Dialog类属于java.awt包,在下文中一共展示了Dialog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showConfigurationDialog
import java.awt.Dialog; //导入依赖的package包/类
private void showConfigurationDialog(ITopologyGenerator generator) {
JDialog dialog = new JDialog();
dialog.setModalityType(Dialog.ModalityType.APPLICATION_MODAL);
dialog.setLayout(new BorderLayout());
dialog.setTitle(generator.getName());
dialog.add(generator.getConfigurationDialog(), BorderLayout.CENTER);
Rectangle tbounds = this.getBounds();
Rectangle bounds = new Rectangle();
bounds.setSize(generator.getConfigurationDialog().getPreferredSize());
bounds.x = (int) (tbounds.x + 0.5 * tbounds.width - 0.5 * bounds.width);
bounds.y = (int) (tbounds.y + 0.5 * tbounds.height - 0.5 * bounds.height);
dialog.setBounds(bounds);
dialog.setResizable(false);
dialog.setVisible(true);
}
示例2: isProbablyAContainer
import java.awt.Dialog; //导入依赖的package包/类
/**
* Return true if the given component is likely to be a container such the each
* component within the container should be be considered as a user input.
*
* @param c
* @return true if the component children should have this listener added.
*/
protected boolean isProbablyAContainer (Component c) {
boolean result = extListener != null ? extListener.isContainer(c) : false;
if (!result) {
boolean isSwing = isSwingClass(c);
if (isSwing) {
result = c instanceof JPanel || c instanceof JSplitPane || c instanceof
JToolBar || c instanceof JViewport || c instanceof JScrollPane ||
c instanceof JFrame || c instanceof JRootPane || c instanceof
Window || c instanceof Frame || c instanceof Dialog ||
c instanceof JTabbedPane || c instanceof JInternalFrame ||
c instanceof JDesktopPane || c instanceof JLayeredPane;
} else {
result = c instanceof Container;
}
}
return result;
}
示例3: testSetMessageBeforeCreateDialog
import java.awt.Dialog; //导入依赖的package包/类
public void testSetMessageBeforeCreateDialog () {
DialogDescriptor dd = new DialogDescriptor ("Test", "Test dialog", false, options,
closeButton, NotifyDescriptor.PLAIN_MESSAGE, null, null);
assertNull ("No NotificationLineSupport created.", dd.getNotificationLineSupport ());
NotificationLineSupport supp = dd.createNotificationLineSupport ();
assertNotNull ("NotificationLineSupport is created.", dd.getNotificationLineSupport ());
assertNotNull ("NotificationLineSupport not null", supp);
testSetInformationMessage (supp, "Hello");
Dialog d = DialogDisplayer.getDefault ().createDialog (dd);
d.setVisible (true);
JLabel notificationLabel = findNotificationLabel (d);
assertNotNull (notificationLabel);
assertEquals ("Hello", notificationLabel.getText ());
closeButton.doClick ();
}
示例4: createDialog
import java.awt.Dialog; //导入依赖的package包/类
private JDialog createDialog(Component parentComponent, String title,
int style)
throws HeadlessException {
final JDialog dialog;
Window window = JOptionPane.getWindowForComponent(parentComponent);
if (window instanceof Frame) {
dialog = new JDialog((Frame)window, title, true);
} else {
dialog = new JDialog((Dialog)window, title, true);
}
if (window instanceof SwingUtilities.SharedOwnerFrame) {
WindowListener ownerShutdownListener =
SwingUtilities.getSharedOwnerFrameShutdownListener();
dialog.addWindowListener(ownerShutdownListener);
}
initDialog(dialog, style, parentComponent);
return dialog;
}
示例5: editModuleDependency
import java.awt.Dialog; //导入依赖的package包/类
@Messages("CTL_EditModuleDependencyTitle=Edit Module Dependency")
private void editModuleDependency(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editModuleDependency
ModuleDependency origDep = getDepListModel().getDependency(
dependencyList.getSelectedIndex());
EditDependencyPanel editPanel = new EditDependencyPanel(
origDep, getProperties().getActivePlatform());
DialogDescriptor descriptor = new DialogDescriptor(editPanel,
CTL_EditModuleDependencyTitle());
descriptor.setHelpCtx(new HelpCtx("org.netbeans.modules.apisupport.project.ui.customizer.EditDependencyPanel"));
Dialog d = DialogDisplayer.getDefault().createDialog(descriptor);
d.setVisible(true);
if (descriptor.getValue().equals(DialogDescriptor.OK_OPTION)) {
getDepListModel().editDependency(origDep, editPanel.getEditedDependency());
}
d.dispose();
dependencyList.requestFocusInWindow();
}
示例6: findCachedPropertiesDialog
import java.awt.Dialog; //导入依赖的package包/类
private static Dialog findCachedPropertiesDialog( Node[] nodes ) {
for( Iterator<Node[]> it=nodeCache.iterator(); it.hasNext(); ) {
Node[] cached = it.next();
if( cached.length != nodes.length )
continue;
boolean match = true;
for( int i=0; i<cached.length; i++ ) {
if( !cached[i].equals( nodes[i] ) ) {
match = false;
break;
}
}
if( match ) {
return dialogCache.get( cached );
}
}
return null;
}
示例7: testScale
import java.awt.Dialog; //导入依赖的package包/类
private static void testScale(double scaleX, double scaleY) {
Dialog dialog = new Dialog((Frame) null, true) {
@Override
public void paint(Graphics g) {
super.paint(g);
AffineTransform tx = ((Graphics2D) g).getTransform();
dispose();
if (scaleX != tx.getScaleX() || scaleY != tx.getScaleY()) {
throw new RuntimeException(String.format("Wrong scale:"
+ "[%f, %f] instead of [%f, %f].",
tx.getScaleX(), tx.getScaleY(), scaleX, scaleY));
}
}
};
dialog.setSize(200, 300);
dialog.setVisible(true);
}
示例8: actionPerformed
import java.awt.Dialog; //导入依赖的package包/类
public void actionPerformed( ActionEvent e ) {
for (ActionListener al : uiProperties.getOptionListeners()) {
al.actionPerformed(e);
}
//#95952 some users experience this assertion on a fairly random set of changes in
// the customizer, that leads me to assume that a project can be already marked
// as modified before the project customizer is shown.
// assert !ProjectManager.getDefault().isModified(project) :
// "Some of the customizer panels has written the changed data before OK Button was pressed. Please file it as bug."; //NOI18N
// Close & dispose the the dialog
Dialog dialog = project2Dialog.get(project);
if ( dialog != null ) {
dialog.setVisible(false);
dialog.dispose();
}
}
示例9: getScaleFactor
import java.awt.Dialog; //导入依赖的package包/类
static float getScaleFactor() {
final Dialog dialog = new Dialog((Window) null);
dialog.setSize(100, 100);
dialog.setModal(true);
final float[] scaleFactors = new float[1];
Panel panel = new Panel() {
@Override
public void paint(Graphics g) {
float scaleFactor = 1;
if (g instanceof SunGraphics2D) {
scaleFactor = ((SunGraphics2D) g).surfaceData.getDefaultScale();
}
scaleFactors[0] = scaleFactor;
dialog.setVisible(false);
}
};
dialog.add(panel);
dialog.setVisible(true);
dialog.dispose();
return scaleFactors[0];
}
示例10: showDialog
import java.awt.Dialog; //导入依赖的package包/类
public boolean showDialog (JButton okButton, String title, String branchListDescription) {
this.okButton = okButton;
org.openide.awt.Mnemonics.setLocalizedText(panel.jLabel1, branchListDescription);
DialogDescriptor dialogDescriptor = new DialogDescriptor(panel, title, true, new Object[] {okButton, cancelButton},
okButton, DialogDescriptor.DEFAULT_ALIGN, new HelpCtx(this.getClass()), null);
dialogDescriptor.setValid(false);
Dialog dialog = DialogDisplayer.getDefault().createDialog(dialogDescriptor);
dialog.getAccessibleContext().setAccessibleDescription(title);
loadRevisions();
dialog.setVisible(true);
HgProgressSupport supp = loadingSupport;
if (supp != null) {
supp.cancel();
}
boolean ret = dialogDescriptor.getValue() == okButton;
return ret;
}
示例11: handleAbout
import java.awt.Dialog; //导入依赖的package包/类
void handleAbout() {
//#221571 - check if About window is showing already
Window[] windows = Dialog.getWindows();
if( null != windows ) {
for( Window w : windows ) {
if( w instanceof JDialog ) {
JDialog dlg = (JDialog) w;
if( Boolean.TRUE.equals(dlg.getRootPane().getClientProperty("nb.about.dialog") ) ) { //NOI18N
if( dlg.isVisible() ) {
dlg.toFront();
return;
}
}
}
}
}
performAction("Help", "org.netbeans.core.actions.AboutAction"); // NOI18N
}
示例12: showModalDialog
import java.awt.Dialog; //导入依赖的package包/类
private static void showModalDialog(Frame targetFrame) {
Dialog dialog = new Dialog(targetFrame, true);
dialog.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
passed = true;
dialog.dispose();
}
});
dialog.setSize(400, 300);
dialog.setTitle("Modal Dialog!");
clickOnModalDialog(dialog);
dialog.setVisible(true);
}
示例13: testRemoveNodeInOutlineView
import java.awt.Dialog; //导入依赖的package包/类
public void testRemoveNodeInOutlineView () throws InterruptedException {
StringKeys children = new StringKeys (true);
children.doSetKeys (new String [] {"1", "3", "2"});
Node root = new TestNode (children, "root");
comp = new OutlineViewComponent (root);
ETableColumnModel etcm = (ETableColumnModel) comp.getOutlineView ().getOutline ().getColumnModel ();
ETableColumn etc = (ETableColumn) etcm.getColumn (0); // tree column
etcm.setColumnSorted (etc, true, 1); // ascending order
TreeNode ta = Visualizer.findVisualizer(root);
DialogDescriptor dd = new DialogDescriptor (comp, "", false, null);
Dialog d = DialogDisplayer.getDefault ().createDialog (dd);
d.setVisible (true);
Thread.sleep (1000);
((StringKeys) root.getChildren ()).doSetKeys (new String [] {"1", "2"});
Thread.sleep (1000);
assertEquals ("Node on 0nd position is '1'", "1", ta.getChildAt (0).toString ());
assertEquals ("Node on 1st position is '2'", "2", ta.getChildAt (1).toString ());
d.setVisible (false);
}
示例14: testRemoveNodeInTTV
import java.awt.Dialog; //导入依赖的package包/类
public void testRemoveNodeInTTV () throws InterruptedException {
StringKeys children = new StringKeys (true);
children.doSetKeys (new String [] {"1", "3", "2"});
Node root = new TestNode (children, "root");
view = new TTV (root);
TreeNode ta = Visualizer.findVisualizer(root);
DialogDescriptor dd = new DialogDescriptor (view, "", false, null);
Dialog d = DialogDisplayer.getDefault ().createDialog (dd);
makeVisible(d);
((StringKeys) root.getChildren ()).doSetKeys (new String [] {"1", "2"});
Thread.sleep (1000);
assertEquals ("Node on 0nd position is '1'", "1", ta.getChildAt (0).toString ());
assertEquals ("Node on 1st position is '2'", "2", ta.getChildAt (1).toString ());
d.setVisible (false);
}
示例15: findDefaultButton
import java.awt.Dialog; //导入依赖的package包/类
private static AbstractButton findDefaultButton(Container c, String txt) {
if (c instanceof RootPaneContainer) {
JRootPane root = ((RootPaneContainer) c).getRootPane();
if (root == null) {
return null;
}
AbstractButton btn = root.getDefaultButton();
if (btn == null) {
//Metal L&F does not set default button for JFileChooser
Container parent = c;
while (parent.getParent() != null && !(parent instanceof Dialog)) {
parent = parent.getParent();
}
if (parent instanceof Dialog) {
return findFileChooserAcceptButton ((Dialog) parent, txt);
}
} else {
return btn;
}
}
return null;
}