java.awt.Dialog#toFront ( )源码实例Demo

下面列出了java.awt.Dialog#toFront ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: netbeans   文件: ProjectImporterWizard.java
/** Starts Eclipse importer wizard. */
public void start() {
    final EclipseWizardIterator iterator = new EclipseWizardIterator();
    final WizardDescriptor wizardDescriptor = new WizardDescriptor(iterator);
    iterator.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            wizardDescriptor.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, // NOI18N
                    iterator.getErrorMessage());
        }
    });
    wizardDescriptor.setTitleFormat(new java.text.MessageFormat("{1}")); // NOI18N
    wizardDescriptor.setTitle(
            ProjectImporterWizard.getMessage("CTL_WizardTitle")); // NOI18N
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
    dialog.setVisible(true);
    dialog.toFront();
    cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION;
    if (!cancelled) {
        projects = iterator.getProjects();
        //showAdditionalInfo(projects);
        destination = iterator.getDestination();
        recursively = iterator.getRecursively();
        numberOfImportedProjects = iterator.getNumberOfImportedProject();
        extraPanels = iterator.getExtraPanels();
    }
}
 
源代码2 项目: netbeans   文件: NodeOperationImpl.java
/** Opens a modal propertySheet on given Node
* @param n the node to show properties for
*/
public void showProperties (Node n) {
    Dialog d = findCachedPropertiesDialog( n );
    if( null == d ) {
        Node[] nds = new Node[] { n };
        openProperties(new NbSheet(), nds);
    } else {
        d.setVisible( true );
        //#131724 - PropertySheet clears its Nodes in removeNotify and keeps
        //only a weakref which is being reused in subsequent addNotify
        //so we should set the Nodes again in case the weakref got garbage collected
        //pls note that PropertySheet code checks for redundant calls of setNodes
        NbSheet sheet = findCachedSheet( d );
        if( null != sheet )
            sheet.setNodes(new Node[] { n });
        d.toFront();
        FocusTraversalPolicy ftp = d.getFocusTraversalPolicy();
        if( null != ftp && null != ftp.getDefaultComponent(d) ) {
            ftp.getDefaultComponent(d).requestFocusInWindow();
        } else {
            d.requestFocusInWindow();
        }
    }
}
 
源代码3 项目: netbeans   文件: NodeOperationImpl.java
/** Opens a modal propertySheet on given set of Nodes
* @param n the array of nodes to show properties for
*/
public void showProperties (Node[] nodes) {
    Dialog d = findCachedPropertiesDialog( nodes );
    if( null == d ) {
        openProperties(new NbSheet(), nodes);
    } else {
        d.setVisible( true );
        //#131724 - PropertySheet clears its Nodes in removeNotify and keeps
        //only a weakref which is being reused in subsequent addNotify
        //so we should set the Nodes again in case the weakref got garbage collected
        //pls note that PropertySheet code checks for redundant calls of setNodes
        NbSheet sheet = findCachedSheet( d );
        if( null != sheet )
            sheet.setNodes(nodes);
        d.toFront();
        FocusTraversalPolicy ftp = d.getFocusTraversalPolicy();
        if( null != ftp && null != ftp.getDefaultComponent(d) ) {
            ftp.getDefaultComponent(d).requestFocusInWindow();
        } else {
            d.requestFocusInWindow();
        }
    }
}
 
源代码4 项目: netbeans   文件: PullWizard.java
boolean show () {
    wizardIterator = new PanelsIterator();
    wizardDescriptor = new WizardDescriptor(wizardIterator);        
    wizardDescriptor.setTitleFormat(new MessageFormat("{0}")); // NOI18N
    wizardDescriptor.setTitle(org.openide.util.NbBundle.getMessage(PullWizard.class, "LBL_PullWizard.title")); // NOI18N
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
    setErrorMessage(wizardIterator.selectUriStep.getErrorMessage());
    dialog.setVisible(true);
    dialog.toFront();
    Object value = wizardDescriptor.getValue();
    boolean finnished = value == WizardDescriptor.FINISH_OPTION;
    if (!finnished) {
        // wizard wasn't properly finnished ...
        if (value == WizardDescriptor.CLOSED_OPTION || value == WizardDescriptor.CANCEL_OPTION ) {
            // wizard was closed or canceled -> reset all steps & kill all running tasks
            wizardIterator.selectUriStep.cancelBackgroundTasks();
        }            
    }
    return finnished;
}
 
源代码5 项目: netbeans   文件: CheckoutWizard.java
public boolean show() {
    wizardIterator = new PanelsIterator();
    wizardDescriptor = new WizardDescriptor(wizardIterator);        
    wizardDescriptor.setTitleFormat(new MessageFormat("{0}")); // NOI18N
    wizardDescriptor.setTitle(org.openide.util.NbBundle.getMessage(CheckoutWizard.class, "CTL_Checkout")); // NOI18N
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
    dialog.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(CheckoutWizard.class, "CTL_Checkout"));
    dialog.setVisible(true);
    dialog.toFront();
    Object value = wizardDescriptor.getValue();
    boolean finnished = value == WizardDescriptor.FINISH_OPTION;
    
    if(finnished) {
        onFinished();
    } else {
        // wizard wasn't properly finnished ...
        if(value == WizardDescriptor.CLOSED_OPTION || 
           value == WizardDescriptor.CANCEL_OPTION ) 
        {
            // wizard was closed or canceled -> reset all steps & kill all running tasks
            repositoryStep.stop();                          
        }            
    }
    return finnished;
}
 
public void actionPerformed(ActionEvent ev) {
    final WizardDescriptor wizardDescriptor = new WizardDescriptor(getPanels());
    // {0} will be replaced by WizardDesriptor.Panel.getComponent().getName()
    wizardDescriptor.setTitleFormat(new MessageFormat("{0}"));
    wizardDescriptor.setTitle("Convert Ogre Binary Meshes");
    wizardDescriptor.putProperty("project", context);
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
    dialog.setVisible(true);
    dialog.toFront();
    boolean cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION;
    final boolean deleteFiles = (Boolean) wizardDescriptor.getProperty("deleteoriginal");
    if (!cancelled) {
        new Thread(new Runnable() {

            public void run() {
                scanDir(((AssetPackProject) context).getAssetsFolder().getPath(), deleteFiles);
            }
        }).start();
    }
}
 
源代码7 项目: MikuMikuStudio   文件: SkyboxWizardAction.java
public void performAction() {
    WizardDescriptor wizardDescriptor = new WizardDescriptor(getPanels());
    // {0} will be replaced by WizardDesriptor.Panel.getComponent().getName()
    wizardDescriptor.setTitleFormat(new MessageFormat("{0}"));
    wizardDescriptor.setTitle("Skybox Wizard");
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
    dialog.setVisible(true);
    dialog.toFront();
    boolean cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION;
    if (!cancelled) {
        topComponent.generateSkybox(wizardDescriptor);
    }
}
 
源代码8 项目: netbeans   文件: InstallUnitWizard.java
private boolean implInvokeWizard (WizardDescriptor.Iterator<WizardDescriptor> iterator) {
    WizardDescriptor wizardDescriptor = new WizardDescriptor (iterator);
    wizardDescriptor.setModal (true);
    
    wizardDescriptor.setTitleFormat (new MessageFormat(NbBundle.getMessage (InstallUnitWizard.class, "InstallUnitWizard_MessageFormat")));
    wizardDescriptor.setTitle (NbBundle.getMessage (InstallUnitWizard.class, "InstallUnitWizard_Title"));
    
    Dialog dialog = DialogDisplayer.getDefault ().createDialog (wizardDescriptor);
    dialog.setVisible (true);
    dialog.toFront ();
    boolean cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION;
    log.log (Level.FINE, "InstallUnitWizard returns with value " + wizardDescriptor.getValue ());
    return !cancelled;
}
 
源代码9 项目: netbeans   文件: Clusterize.java
private boolean perform() {
    wizardDescriptor.createNotificationLineSupport();
    wizardDescriptor.setTitleFormat(new MessageFormat("{0}"));
    wizardDescriptor.setTitle(NbBundle.getMessage(Clusterize.class, "LAB_ClusterizeWizard"));
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
    dialog.setVisible(true);
    dialog.toFront();
    return wizardDescriptor.getValue() == WizardDescriptor.FINISH_OPTION;
}
 
源代码10 项目: MikuMikuStudio   文件: BloomWizardAction.java
public @Override
void actionPerformed(ActionEvent e) {
    WizardDescriptor wizardDescriptor = new WizardDescriptor(getPanels());
    // {0} will be replaced by WizardDesriptor.Panel.getComponent().getName()
    wizardDescriptor.setTitleFormat(new MessageFormat("{0}"));
    wizardDescriptor.setTitle("Your wizard dialog title here");
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
    dialog.setVisible(true);
    dialog.toFront();
    boolean cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION;
    if (!cancelled) {
        // do something
    }
}
 
源代码11 项目: MikuMikuStudio   文件: AddTerrainAction.java
@Override
protected Object showWizard(org.openide.nodes.Node node) {
    WizardDescriptor wizardDescriptor = new WizardDescriptor(getPanels());
    wizardDescriptor.setTitleFormat(new MessageFormat("{0}"));
    wizardDescriptor.setTitle("Terrain Wizard");
    wizardDescriptor.putProperty("main_node", node);
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
    dialog.setVisible(true);
    dialog.toFront();
    boolean cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION;
    if (!cancelled) {
        return wizardDescriptor;
    }
    return null;
}
 
源代码12 项目: MikuMikuStudio   文件: CreateTerrainWizardAction.java
public void performAction() {
    WizardDescriptor wizardDescriptor = new WizardDescriptor(getPanels());
    // {0} will be replaced by WizardDesriptor.Panel.getComponent().getName()
    wizardDescriptor.setTitleFormat(new MessageFormat("{0}"));
    wizardDescriptor.setTitle("Terrain Wizard");
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
    dialog.setVisible(true);
    dialog.toFront();
    boolean cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION;
    if (!cancelled) {
        controller.generateTerrain(wizardDescriptor);
    }
}
 
源代码13 项目: MikuMikuStudio   文件: AddSkyboxAction.java
@Override
protected Object showWizard(org.openide.nodes.Node node) {
    WizardDescriptor wizardDescriptor = new WizardDescriptor(getPanels());
    wizardDescriptor.setTitleFormat(new MessageFormat("{0}"));
    wizardDescriptor.setTitle("Skybox Wizard");
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
    dialog.setVisible(true);
    dialog.toFront();
    boolean cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION;
    if (!cancelled) {
        return wizardDescriptor;
    }
    return null;
}
 
源代码14 项目: netbeans   文件: CloneWizard.java
boolean show () {
    wizardIterator = new PanelsIterator();
    wizardDescriptor = new WizardDescriptor(wizardIterator);        
    wizardDescriptor.setTitleFormat(new MessageFormat("{0}")); // NOI18N
    wizardDescriptor.setTitle(org.openide.util.NbBundle.getMessage(CloneWizard.class, "LBL_CloneWizard.title")); // NOI18N
    
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
    if(pa != null && forPath != null) {
        Git.getInstance().getRequestProcessor().post(new Runnable() {
            @Override
            public void run () {
                wizardIterator.repositoryStep.waitPopulated();
                // url and credential already provided, so try 
                // to reach the next step ...
                EventQueue.invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        wizardDescriptor.doNextClick();
                    }
                });
            }
        });
    }
    setErrorMessage(wizardIterator.repositoryStep.getErrorMessage());
    dialog.setVisible(true);
    dialog.toFront();
    Object value = wizardDescriptor.getValue();
    boolean finished = value == WizardDescriptor.FINISH_OPTION;
    if (finished) {
        onFinished();
    } else {
        // wizard wasn't properly finnished ...
        if (value == WizardDescriptor.CLOSED_OPTION || value == WizardDescriptor.CANCEL_OPTION ) {
            // wizard was closed or canceled -> reset all steps & kill all running tasks
            wizardIterator.repositoryStep.cancelBackgroundTasks();
        }            
    }
    return finished;
}
 
源代码15 项目: netbeans   文件: URLPatternWizard.java
public boolean show() {
    wizardIterator = new PanelsIterator();
    wizardDescriptor = new WizardDescriptor(wizardIterator);        
    wizardDescriptor.setTitleFormat(new MessageFormat("{0}")); // NOI18N
    wizardDescriptor.setTitle(org.openide.util.NbBundle.getMessage(URLPatternWizard.class, "CTL_URLPattern")); // NOI18N
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
    dialog.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(URLPatternWizard.class, "CTL_URLPattern")); // NOI18N
    dialog.setVisible(true);
    dialog.toFront();
    
    return wizardDescriptor.getValue() == WizardDescriptor.FINISH_OPTION;
}
 
源代码16 项目: netbeans   文件: ImportWizard.java
public boolean show() {
    wizardIterator = new PanelsIterator();
    wizardDescriptor = new WizardDescriptor(wizardIterator);
    wizardDescriptor.setTitleFormat(new MessageFormat("{0}")); // NOI18N
    wizardDescriptor.setTitle(org.openide.util.NbBundle.getMessage(ImportWizard.class, "CTL_Import")); // NOI18N
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
    dialog.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(ImportWizard.class, "CTL_Import"));
    dialog.setVisible(true);
    dialog.toFront();
    Object value = wizardDescriptor.getValue();
    boolean finnished = value == WizardDescriptor.FINISH_OPTION;
    
    if(!finnished) {
        // wizard wasn't properly finnished ...
        if(value == WizardDescriptor.CLOSED_OPTION || 
           value == WizardDescriptor.CANCEL_OPTION ) 
        {
            // wizard was closed or canceled -> reset all steps & kill all running tasks                
            repositoryStep.stop();
            importStep.stop();
            importPreviewStep.stop();
        }            
    } else if (value == WizardDescriptor.FINISH_OPTION) {
        if(wizardIterator.current() == importStep) {
            setupImportPreviewStep(true);
        } else if (wizardIterator.current() == importPreviewStep) {
            importPreviewStep.storeTableSorter();
            importPreviewStep.startCommitTask(repositoryStep.getRepositoryFile().getRepositoryUrl());
        }            
    }
    return finnished;
}
 
源代码17 项目: netbeans   文件: CatalogAction.java
public @Override void actionPerformed(ActionEvent e) {
    
    Dialog dialog = dialogWRef.get ();

    if (dialog == null || ! dialog.isShowing ()) {

        final CatalogPanel cp = new CatalogPanel ();
        JButton closeButton = new JButton ();
        Mnemonics.setLocalizedText (closeButton,NbBundle.getMessage (CatalogAction.class, "BTN_CatalogPanel_CloseButton")); // NOI18N
        JButton openInEditor = new JButton ();
        openInEditor.setEnabled (false);
        OpenInEditorListener l = new OpenInEditorListener (cp, openInEditor);
        openInEditor.addActionListener (l);
        cp.getExplorerManager ().addPropertyChangeListener (l);
        Mnemonics.setLocalizedText (openInEditor,NbBundle.getMessage (CatalogAction.class, "BTN_CatalogPanel_OpenInEditorButton")); // NOI18N
        DialogDescriptor dd = new DialogDescriptor (cp,NbBundle.getMessage (CatalogAction.class, "LBL_CatalogPanel_Title"),  // NOI18N
                                false, // modal
                                new Object [] { openInEditor, closeButton },
                                closeButton,
                                DialogDescriptor.DEFAULT_ALIGN,
                                null,
                                null);
        dd.setClosingOptions (null);
        // set helpctx to null again, DialogDescriptor replaces null with HelpCtx.DEFAULT_HELP
        dd.setHelpCtx (null);
        
        dialog = DialogDisplayer.getDefault ().createDialog (dd);
        dialog.setVisible (true);
        dialogWRef = new WeakReference<Dialog> (dialog);
        
    } else {
        dialog.toFront ();
    }
    
}
 
源代码18 项目: MikuMikuStudio   文件: ImportModel.java
public void actionPerformed(ActionEvent ev) {
    final WizardDescriptor wiz = new WizardDescriptor(getPanels());
    // {0} will be replaced by WizardDesriptor.Panel.getComponent().getName()
    wiz.setTitleFormat(new MessageFormat("{0}"));
    wiz.setTitle("Import Model to Project");
    wiz.putProperty("project", context);
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wiz);
    dialog.setVisible(true);
    dialog.toFront();
    boolean cancelled = wiz.getValue() != WizardDescriptor.FINISH_OPTION;
    ((ModelImporterWizardPanel1) panels[0]).cleanup();
    if (!cancelled) {
        new Thread(new Runnable() {

            public void run() {
                ProgressHandle handle = ProgressHandleFactory.createHandle("Importing Model..");
                handle.start();
                try {
                    copyModel(wiz);
                } catch (Exception e) {
                    Exceptions.printStackTrace(e);
                }
                handle.finish();
            }
        }).start();
    }
}
 
源代码19 项目: MikuMikuStudio   文件: PublishAssetPackAction.java
public void actionPerformed(ActionEvent ev) {
    final WizardDescriptor wizardDescriptor = new WizardDescriptor(getPanels());
    // {0} will be replaced by WizardDesriptor.Panel.getComponent().getName()
    wizardDescriptor.setTitleFormat(new MessageFormat("{0}"));
    wizardDescriptor.setTitle("Publish AssetPack");
    wizardDescriptor.putProperty("project", context);
    String projectName = ((AssetPackProject) context).getProjectName().replaceAll(" ", "_") + ".zip";
    wizardDescriptor.putProperty("filename", projectName);
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
    dialog.setVisible(true);
    dialog.toFront();
    boolean cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION;
    if (!cancelled) {
        new Thread(new Runnable() {

            public void run() {
                ProgressHandle handle = ProgressHandleFactory.createHandle("Publishing AssetPack..");
                handle.start();
                packZip(wizardDescriptor);
                copyData(wizardDescriptor);
                handle.progress("Uploading AssetPack..");
                uploadData(wizardDescriptor);
                cleanup(wizardDescriptor);
                handle.finish();
            }
        }).start();
    }
}
 
源代码20 项目: MikuMikuStudio   文件: ImportAssetAction.java
public void actionPerformed(ActionEvent ev) {
    WizardDescriptor wizardDescriptor = new WizardDescriptor(getPanels());
    // {0} will be replaced by WizardDesriptor.Panel.getComponent().getName()
    wizardDescriptor.setTitleFormat(new MessageFormat("{0}"));
    wizardDescriptor.setTitle("Import Asset to AssetPack..");
    wizardDescriptor.putProperty("project", context);
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
    dialog.setVisible(true);
    dialog.toFront();
    boolean cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION;
    if (!cancelled) {
        importAsset(wizardDescriptor);
    }
}