当前位置: 首页>>代码示例>>Java>>正文


Java Dialog.setVisible方法代码示例

本文整理汇总了Java中java.awt.Dialog.setVisible方法的典型用法代码示例。如果您正苦于以下问题:Java Dialog.setVisible方法的具体用法?Java Dialog.setVisible怎么用?Java Dialog.setVisible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.Dialog的用法示例。


在下文中一共展示了Dialog.setVisible方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: show

import java.awt.Dialog; //导入方法依赖的package包/类
boolean show (HelpCtx helpCtx) {
    okButton = new JButton(getOkButtonLabel());
    org.openide.awt.Mnemonics.setLocalizedText(okButton, okButton.getText());
    dd = new DialogDescriptor(panel, getDialogTitle(), true, new Object[] { okButton, DialogDescriptor.CANCEL_OPTION }, okButton, DialogDescriptor.DEFAULT_ALIGN, helpCtx, null);
    validateBranchCB();
    revisionPicker.addPropertyChangeListener(new PropertyChangeListener() {
        @Override
        public void propertyChange (PropertyChangeEvent evt) {
            if (evt.getPropertyName() == RevisionDialogController.PROP_VALID) {
                setRevisionValid(Boolean.TRUE.equals(evt.getNewValue()));
            } else if (evt.getPropertyName() == RevisionDialogController.PROP_REVISION_ACCEPTED) {
                if (dd.isValid()) {
                    okButton.doClick();
                }
            }
        }
    });
    panel.branchNameField.getDocument().addDocumentListener(this);
    panel.cbCheckoutAsNewBranch.addActionListener(this);
    Dialog d = DialogDisplayer.getDefault().createDialog(dd);
    d.setVisible(true);
    return okButton == dd.getValue();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:AbstractCheckoutRevision.java

示例2: 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 = getScreenScaleFactor();
                }
                scaleFactors[0] = scaleFactor;
                dialog.setVisible(false);
            }
        };

        dialog.add(panel);
        dialog.setVisible(true);
        dialog.dispose();

        return scaleFactors[0];
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:MultiResolutionSplashTest.java

示例3: actionPerformed

import java.awt.Dialog; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
    LOGGER.log(Level.INFO, "Initializing chipKIT Import procedure");
    
    LanguageToolchain languageToolchain = checkLanguageToolchain();
    if ( languageToolchain == null ) {
        return;
    }
    
    ArduinoConfig arduinoConfig = ArduinoConfig.getInstance();

    ChipKitImportWizardIterator wizIterator = new ChipKitImportWizardIterator( languageToolchain, arduinoConfig );
    WizardDescriptor wiz = new WizardDescriptor(wizIterator);

    Dialog dialog = DialogDisplayer.getDefault().createDialog(wiz);
    dialog.setVisible(true);
    dialog.toFront();

    if ( wiz.getValue() == WizardDescriptor.FINISH_OPTION ) {
        openImportedProject(wiz);
    }
}
 
开发者ID:chipKIT32,项目名称:chipKIT-importer,代码行数:23,代码来源:ShowChipKitImportWizardAction.java

示例4: runProjectWizard

import java.awt.Dialog; //导入方法依赖的package包/类
public static @CheckForNull NbModuleProject runProjectWizard(
        final NewNbModuleWizardIterator iterator, final String titleBundleKey) {
    WizardDescriptor wd = new WizardDescriptor(iterator);
    wd.setTitleFormat(new MessageFormat("{0}")); // NOI18N
    wd.setTitle(NbBundle.getMessage(ApisupportAntUIUtils.class, titleBundleKey));
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wd);
    dialog.setVisible(true);
    dialog.toFront();
    NbModuleProject project = null;
    boolean cancelled = wd.getValue() != WizardDescriptor.FINISH_OPTION;
    if (!cancelled) {
        FileObject folder = iterator.getCreateProjectFolder();
        if (folder == null) {
            return null;
        }
        try {
            project = (NbModuleProject) ProjectManager.getDefault().findProject(folder);
            OpenProjects.getDefault().open(new Project[] { project }, false);
        } catch (IOException e) {
            ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e);
        }
    }
    return project;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:ApisupportAntUIUtils.java

示例5: main

import java.awt.Dialog; //导入方法依赖的package包/类
public static void main(String[] args) {

        final Frame frame = new Frame("Test");
        frame.setSize(400, 400);
        frame.setBackground(FRAME_COLOR);
        frame.setVisible(true);

        final Dialog modalDialog = new Dialog(null, true);
        modalDialog.setTitle("Modal Dialog");
        modalDialog.setSize(400, 200);
        modalDialog.setBackground(DIALOG_COLOR);
        modalDialog.setModal(true);

        new Thread(new Runnable() {

            @Override
            public void run() {
                runTest(modalDialog, frame);
            }
        }).start();

        modalDialog.setVisible(true);
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:24,代码来源:ModalDialogOrderingTest.java

示例6: 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();
            }
        }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:CustomizerProviderImpl.java

示例7: addOptionButtonActionPerformed

import java.awt.Dialog; //导入方法依赖的package包/类
private void addOptionButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addOptionButtonActionPerformed
    final AddProcessorOption panel = new AddProcessorOption();
    final DialogDescriptor desc = new DialogDescriptor(panel, NbBundle.getMessage (CustomizerCompile.class, "LBL_AddProcessorOption_Title")); //NOI18N
    desc.setValid(false);
    panel.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            String key = panel.getOptionKey();
            for(String s : key.split("\\.", -1)) { //NOI18N
                if (!SourceVersion.isIdentifier(s)) {
                    desc.setValid(false);
                    return;
                }
            }
            desc.setValid(true);
        }
    });
    Dialog dlg = DialogDisplayer.getDefault().createDialog(desc);
    dlg.setVisible (true);
    if (desc.getValue() == DialogDescriptor.OK_OPTION) {
        ((DefaultTableModel)processorOptionsTable.getModel()).addRow(new String[] {panel.getOptionKey(), panel.getOptionValue()});
    }
    dlg.dispose();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:CustomizerCompile.java

示例8: prepare

import java.awt.Dialog; //导入方法依赖的package包/类
@Override
public boolean prepare(PaletteItem item, FileObject classPathRep) {
    ChooseBeanPanel panel = new ChooseBeanPanel();
    DialogDescriptor dd = new DialogDescriptor(panel,
            NbBundle.getMessage(ChooseBeanInitializer.class, "TITLE_Choose_Bean")); // NOI18N
    dd.setOptionType(DialogDescriptor.OK_CANCEL_OPTION);
    HelpCtx.setHelpIDString(panel, "f1_gui_choose_bean_html"); // NOI18N
    Dialog dialog = DialogDisplayer.getDefault().createDialog(dd);
    String className = null;
    boolean invalidInput;
    do {
        invalidInput = false;
        dialog.setVisible(true);
        if (dd.getValue() == DialogDescriptor.OK_OPTION) {
            className = panel.getEnteredName();
            String checkName;
            if (className != null && className.endsWith(">") && className.indexOf("<") > 0) { // NOI18N
                checkName = className.substring(0, className.indexOf("<")); // NOI18N
            } else {
                checkName = className;
            }
            if (!SourceVersion.isName(checkName)) {
                invalidInput = true;
                DialogDisplayer.getDefault().notify(
                    new NotifyDescriptor.Message(NbBundle.getMessage(ChooseBeanInitializer.class, "MSG_InvalidClassName"), // NOI18N
                                                 NotifyDescriptor.WARNING_MESSAGE));
            } else if (!PaletteItem.checkDefaultPackage(checkName, classPathRep)) {
                invalidInput = true;
            }
        } else {
            return false;
        }
    } while (invalidInput);
    item.setClassFromCurrentProject(className, classPathRep);
    return true;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:37,代码来源:ChooseBeanInitializer.java

示例9: testChildPropertiesWithFrameAsParent

import java.awt.Dialog; //导入方法依赖的package包/类
public void testChildPropertiesWithFrameAsParent() {

        parentFrame = new Frame("parent Frame");
        parentFrame.setSize(WIDTH, HEIGHT);
        parentFrame.setLocation(100, 400);
        parentFrame.setBackground(Color.BLUE);
        parentLabel = new Label("ParentForegroundAndFont");
        parentFont = new Font("Courier New", Font.ITALIC, 15);
        parentFrame.setForeground(Color.RED);
        parentFrame.setFont(parentFont);
        parentFrame.add(parentLabel);
        parentFrame.setVisible(true);

        frameChildDialog = new Dialog(parentFrame, "Frame's child");
        frameChildDialog.setSize(WIDTH, HEIGHT);
        frameChildDialog.setLocation(WIDTH + 200, 400);
        childLabel = new Label("ChildForegroundAndFont");
        frameChildDialog.add(childLabel);
        frameChildDialog.setVisible(true);

        if (parentFrame.getBackground() == frameChildDialog.getBackground()) {
            dispose();
            throw new RuntimeException("Child Dialog Should NOT Inherit "
                    + "Parent Frame's Background Color");
        }

        if (parentFrame.getForeground() == frameChildDialog.getForeground()) {
            dispose();
            throw new RuntimeException("Child Dialog Should NOT Inherit "
                    + "Parent Frame's Foreground Color");
        }

        if (parentFrame.getFont() == frameChildDialog.getFont()) {
            dispose();
            throw new RuntimeException("Child Dialog Should NOT Inherit "
                    + "Parent Frame's Font Style/Color");
        }
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:39,代码来源:ChildDialogProperties.java

示例10: show

import java.awt.Dialog; //导入方法依赖的package包/类
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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:URLPatternWizard.java

示例11: open

import java.awt.Dialog; //导入方法依赖的package包/类
boolean open() {
    final DialogDescriptor dd = 
        new DialogDescriptor (
            this, 
            NbBundle.getMessage(RevertDeletedAction.class, "LBL_SELECT_FILES"), // NOI18N
            true, 
            DialogDescriptor.OK_CANCEL_OPTION, 
            DialogDescriptor.OK_OPTION, 
            null); 
    final Dialog dialog = DialogDisplayer.getDefault().createDialog(dd);
    dialog.setVisible(true);
    return dd.getValue() == DialogDescriptor.OK_OPTION;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:RevertPanel.java

示例12: showCustomizer

import java.awt.Dialog; //导入方法依赖的package包/类
public boolean showCustomizer() {
    DialogDescriptor descriptor = new DialogDescriptor( this, NbBundle.getMessage(ResizeOptionsCustomizer.class, "Title_CUSTOMIZE_WINDOW_SETTINGS"), true, DialogDescriptor.DEFAULT_OPTION, null, null );
    descriptor.setHelpCtx( new HelpCtx("org.netbeans.modules.web.browser.ui.ResizeOptionsCustomizer") );
    Dialog dlg = DialogDisplayer.getDefault().createDialog( descriptor );
    dlg.setVisible( true );
    return descriptor.getValue() == DialogDescriptor.OK_OPTION;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:ResizeOptionsCustomizer.java

示例13: implement

import java.awt.Dialog; //导入方法依赖的package包/类
public ChangeInfo implement(){
    PickOrCreateFieldPanel pnlPickOrCreateField = new PickOrCreateFieldPanel();
    pnlPickOrCreateField.setAvailableFields(getAvailableFields());
    pnlPickOrCreateField.setFileObject(fileObject);
    
    DialogDescriptor ddesc = new DialogDescriptor(pnlPickOrCreateField,
            NbBundle.getMessage(CreateId.class, "LBL_AddIDAnnotationDlgTitle"));
    ddesc.createNotificationLineSupport();
    
    Dialog dlg = DialogDisplayer.getDefault().createDialog(ddesc);
    
    pnlPickOrCreateField.setDlgDescriptor(ddesc);
    dlg.setLocationRelativeTo(null);
    dlg.setVisible(true);
    
    if (ddesc.getValue() == DialogDescriptor.OK_OPTION){
        if (pnlPickOrCreateField.wasCreateNewFieldSelected()){
            createIDField(pnlPickOrCreateField.getNewIdName(),
                    pnlPickOrCreateField.getSelectedIdType());
        } else{
            // pick existing
            String fieldName = (String) pnlPickOrCreateField.getSelectedField();
            createIDField(fieldName, null);
        }
    }
    
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:29,代码来源:CreateId.java

示例14: performContextAction

import java.awt.Dialog; //导入方法依赖的package包/类
@Override
protected void performContextAction(Node[] nodes) {
    VCSContext ctx = HgUtils.getCurrentContext(nodes);
    final File roots[] = HgUtils.getActionRoots(ctx);
    if (roots == null || roots.length == 0) {
        return;
    }
    final File root = Mercurial.getInstance().getRepositoryRoot(roots[0]);

    final JFileChooser fileChooser = new AccessibleJFileChooser(Bundle.ACSD_ApplyDiffPatchBrowseFolder(), null);
    fileChooser.setDialogTitle(Bundle.ApplyDiffPatchBrowse_title());
    fileChooser.setMultiSelectionEnabled(false);
    fileChooser.setDialogType(JFileChooser.OPEN_DIALOG);
    fileChooser.setApproveButtonMnemonic(Bundle.ApplyDiffPatch_Apply().charAt(0));
    fileChooser.setApproveButtonText(Bundle.ApplyDiffPatch_Apply());
    fileChooser.setCurrentDirectory(new File(HgModuleConfig.getDefault().getImportFolder()));
    // setup filters, default one filters patch files
    FileFilter patchFilter = new javax.swing.filechooser.FileFilter() {
        @Override
        public boolean accept(File f) {
            return f.getName().endsWith("diff") || f.getName().endsWith("patch") || f.isDirectory();  // NOI18N
        }
        @Override
        public String getDescription() {
            return Bundle.CTL_PatchDialog_FileFilter();
        }
    };
    fileChooser.addChoosableFileFilter(patchFilter);
    fileChooser.setFileFilter(patchFilter);

    DialogDescriptor dd = new DialogDescriptor(fileChooser, Bundle.ApplyDiffPatchBrowse_title());
    dd.setOptions(new Object[0]);
    final Dialog dialog = DialogDisplayer.getDefault().createDialog(dd);
    
    fileChooser.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            String state = e.getActionCommand();
            if (state.equals(JFileChooser.APPROVE_SELECTION)) {
                final File patchFile = fileChooser.getSelectedFile();
                final RequestProcessor rp = Mercurial.getInstance().getRequestProcessor(root);
                new HgProgressSupport() {

                    @Override
                    protected void perform () {
                        if (isNetBeansPatch(patchFile)) {
                            PatchAction.performPatch(patchFile, roots[0]);
                        } else {
                            new ImportDiffAction.ImportDiffProgressSupport(root, patchFile, false, ImportDiffAction.ImportDiffProgressSupport.Kind.PATCH)
                                    .start(rp, root, Bundle.MSG_ApplyDiffPatch_importingPatch());
                        }
                    }
                }.start(rp, root, Bundle.MSG_ApplyDiffPatch_checkingFile());
            }
            dialog.dispose();
        }
    });
    dialog.setVisible(true);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:60,代码来源:ApplyDiffPatchAction.java

示例15: implement

import java.awt.Dialog; //导入方法依赖的package包/类
public ChangeInfo implement(){
    examineTargetClass();
    boolean owningSide = isOwningSideByDefault();
    String mappedBy = getExistingFieldInRelation();
    
    if (mappedBy == null){
        // couldn't get the corresponding field automatically, display dialog
        
        CreateRelationshipPanel pnlPickOrCreateField = new CreateRelationshipPanel();
        
        pnlPickOrCreateField.setEntityClassNames(
                Utilities.getShortClassName(classHandle.getQualifiedName()),
                Utilities.getShortClassName(targetEntityClassName));
        
        pnlPickOrCreateField.setAvailableSelection(getAvailableRelationTypeSelection());
        pnlPickOrCreateField.setAvailableFields(compatibleFieldsExistingAtTargetClass);
        pnlPickOrCreateField.setDefaultFieldName(genDefaultFieldName());
        pnlPickOrCreateField.setExistingFieldNames(fieldsExistingAtTargetClass);
        
        DialogDescriptor ddesc = new DialogDescriptor(pnlPickOrCreateField,
                NbBundle.getMessage(AbstractCreateRelationshipHint.class, "LBL_CreateRelationDlgTitle",
                relationName, targetEntityClassName));
        
        pnlPickOrCreateField.setDlgDescriptor(ddesc);
        Dialog dlg = DialogDisplayer.getDefault().createDialog(ddesc);
        dlg.setLocationRelativeTo(null);
        dlg.setVisible(true);
        
        if (ddesc.getValue() == DialogDescriptor.OK_OPTION){
            String fieldName = null;
            
            if (pnlPickOrCreateField.wasCreateNewFieldSelected()){
                // create new
                fieldName = pnlPickOrCreateField.getNewIdName();
            }else{
                // pick existing
                fieldName = pnlPickOrCreateField.getSelectedField().toString();
            }
            
            owningSide = pnlPickOrCreateField.owningSide();
            mappedBy = fieldName;
        } else {
            mappedBy = null;
        }
    } else {
        owningSide = false;
    }
    
    if (mappedBy != null){
        modifyFiles(owningSide, mappedBy);
    }
    
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:55,代码来源:AbstractCreateRelationshipHint.java


注:本文中的java.awt.Dialog.setVisible方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。