當前位置: 首頁>>代碼示例>>Java>>正文


Java ModalityType.DOCUMENT_MODAL屬性代碼示例

本文整理匯總了Java中java.awt.Dialog.ModalityType.DOCUMENT_MODAL屬性的典型用法代碼示例。如果您正苦於以下問題:Java ModalityType.DOCUMENT_MODAL屬性的具體用法?Java ModalityType.DOCUMENT_MODAL怎麽用?Java ModalityType.DOCUMENT_MODAL使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在java.awt.Dialog.ModalityType的用法示例。


在下文中一共展示了ModalityType.DOCUMENT_MODAL屬性的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: openHeroEditor

private void openHeroEditor(HearthStoneDb db) {
    if (uiAgent == null) {
        return;
    }
    HeroEditorPanel panel = new HeroEditorPanel(db, uiAgent);

    Window parent = SwingUtilities.getWindowAncestor(this);
    JDialog mainFrame = new JDialog(parent, "Hero Editor", ModalityType.DOCUMENT_MODAL);
    mainFrame.getContentPane().setLayout(new GridLayout(1, 1));
    mainFrame.getContentPane().add(panel);

    mainFrame.pack();
    mainFrame.setLocationRelativeTo(null);
    mainFrame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    mainFrame.setVisible(true);
}
 
開發者ID:AlphaHearth,項目名稱:AlphaHearth,代碼行數:16,代碼來源:PlayerPanel.java

示例2: build

/**
 * Builds and layouts the configured {@link ImportWizard} dialog.
 *
 * @param owner
 *            the dialog owner
 * @return the new {@link ImportWizard} instance
 */
public ImportWizard build(Window owner) {
	DataImportWizard wizard = new DataImportWizard(owner, ModalityType.DOCUMENT_MODAL, null);

	// add common steps
	TypeSelectionStep typeSelectionStep = new TypeSelectionStep(wizard);
	wizard.addStep(typeSelectionStep);
	wizard.addStep(new LocationSelectionStep(wizard));
	wizard.addStep(new StoreToRepositoryStep(wizard));
	wizard.addStep(new ConfigureDataStep(wizard));

	// check whether a local file data source was specified
	if (localFileDataSourceFactory != null) {
		setDataSource(wizard, localFileDataSourceFactory,
				localFileDataSourceFactory.createNew(wizard, filePath, fileDataSourceFactory));
	}

	// Start with type selection
	String startingStep = typeSelectionStep.getI18NKey();

	// unless another starting step ID is specified
	if (startingStepID != null) {
		startingStep = startingStepID;
	}

	wizard.layoutDefault(ButtonDialog.HUGE, startingStep);
	return wizard;
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:34,代碼來源:DataImportWizardBuilder.java

示例3: createWindow

@Override
protected JDialog createWindow()
{
    JDialog window = new JDialog(owner, ModalityType.DOCUMENT_MODAL);

    window.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);

    return window;
}
 
開發者ID:thred,項目名稱:climate-tray,代碼行數:9,代碼來源:DefaultClimateTrayDialogController.java

示例4: getModalityType

/**
 * @return
 */
public ModalityType getModalityType() {
    // document modal:
    // if there are several window stacks, the dialog blocks only it's own
    // windowstack.
    return ModalityType.DOCUMENT_MODAL;
}
 
開發者ID:friedlwo,項目名稱:AppWoksUtils,代碼行數:9,代碼來源:AbstractDialog.java

示例5: getDlgInstance

synchronized JDialog getDlgInstance(Window owner) {
	if (dlg == null) {
		dlg = new JDialog(owner,
				StrUtils.getStr("SearchPanel.replacement"),
				ModalityType.DOCUMENT_MODAL);
		dlg.setSize(500, 500);
		JScrollPane jsp = new JScrollPane(outPutArea);
		jsp.setRowHeaderView(new LineLabel(outPutArea));
		dlg.getContentPane().add(jsp);
		dlg.getContentPane().add(
				new JButton(new AbstractAction(
						StrUtils.getStr("SearchPanel.copyAndClose")) {
					private static final long serialVersionUID = -4859439907152041642L;

					@Override
					public void actionPerformed(ActionEvent e) {
						Toolkit.getDefaultToolkit()
								.getSystemClipboard()
								.setContents(
										new StringSelection(outPutArea
												.getText()), null);
						dlg.dispose();
					}
				}), BorderLayout.SOUTH);
		dlg.setLocationRelativeTo(owner);
	}
	return dlg;
}
 
開發者ID:trytocatch,項目名稱:RegexReplacer,代碼行數:28,代碼來源:SearchPanel.java

示例6: createBackgroundImageDialog

/**
 * Creates a dialog to set the background image of the given process.
 * 
 * @param process
 *            the process for which the background image should be set
 * @param model
 *            the process renderer model instance
 * @return the dialog
 */
private static ButtonDialog createBackgroundImageDialog(final ExecutionUnit process, final ProcessRendererModel model) {
	if (process == null) {
		throw new IllegalArgumentException("process must not be null!");
	}
	if (model == null) {
		throw new IllegalArgumentException("model must not be null!");
	}

	final JPanel mainPanel = new JPanel(new BorderLayout());

	ProcessBackgroundImage prevImg = model.getBackgroundImage(process);
	final RepositoryLocationChooser chooser = new RepositoryLocationChooser(null, null,
			prevImg != null ? prevImg.getLocation() : "");
	mainPanel.add(chooser, BorderLayout.CENTER);

	ButtonDialog dialog = new ButtonDialog(ApplicationFrame.getApplicationFrame(), "process_background",
			ModalityType.DOCUMENT_MODAL, new Object[] {}) {

		private static final long serialVersionUID = 1L;

		{
			layoutDefault(mainPanel, NORMAL, makeOkButton(), makeCancelButton());
		}

		@Override
		protected void ok() {
			ProcessBackgroundImage img = null;
			try {
				img = new ProcessBackgroundImage(-1, -1, -1, -1, chooser.getRepositoryLocation(), process);
			} catch (MalformedRepositoryLocationException e) {
				// ignore
			}

			if (img != null) {
				model.setBackgroundImage(img);
				model.fireMiscChanged();

				// dirty hack to trigger a process update
				process.getEnclosingOperator().rename(process.getEnclosingOperator().getName());
			}

			super.ok();
		}
	};
	return dialog;
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:55,代碼來源:ProcessBackgroundImageVisualizer.java

示例7: popupCustomizer

/**
 * Popup the customizer for this bean
 * 
 * @param custClass the class of the customizer
 * @param bc the bean to be customized
 */
private void popupCustomizer(Class<?> custClass, JComponent bc) {
  try {
    // instantiate
    final Object customizer = custClass.newInstance();
    // set environment **before** setting object!!
    if (customizer instanceof EnvironmentHandler) {
      ((EnvironmentHandler) customizer).setEnvironment(m_flowEnvironment);
    }

    if (customizer instanceof BeanCustomizer) {
      ((BeanCustomizer) customizer).setModifiedListener(this);
    }

    ((Customizer) customizer).setObject(bc);
    // final javax.swing.JFrame jf = new javax.swing.JFrame();
    final JDialog d = new JDialog(
      (java.awt.Frame) KnowledgeFlowApp.this.getTopLevelAncestor(),
      ModalityType.DOCUMENT_MODAL);
    d.setLayout(new BorderLayout());
    d.getContentPane().add((JComponent) customizer, BorderLayout.CENTER);

    // jf.getContentPane().setLayout(new BorderLayout());
    // jf.getContentPane().add((JComponent)customizer, BorderLayout.CENTER);
    if (customizer instanceof CustomizerCloseRequester) {
      ((CustomizerCloseRequester) customizer).setParentWindow(d);
    }
    d.addWindowListener(new java.awt.event.WindowAdapter() {
      @Override
      public void windowClosing(java.awt.event.WindowEvent e) {
        if (customizer instanceof CustomizerClosingListener) {
          ((CustomizerClosingListener) customizer).customizerClosing();
        }
        d.dispose();
      }
    });
    // jf.pack();
    // jf.setVisible(true);
    d.pack();
    d.setLocationRelativeTo(KnowledgeFlowApp.this);
    d.setVisible(true);
  } catch (Exception ex) {
    ex.printStackTrace();
  }
}
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:50,代碼來源:KnowledgeFlowApp.java

示例8: popupCustomizer

/**
 * Popup the customizer for this bean
 *
 * @param custClass the class of the customizer
 * @param bc the bean to be customized
 */
private void popupCustomizer(Class custClass, JComponent bc) {
  try {
    // instantiate
    final Object customizer = custClass.newInstance();
    // set environment **before** setting object!!
    if (customizer instanceof EnvironmentHandler) {
      ((EnvironmentHandler)customizer).setEnvironment(m_flowEnvironment);
    }

    if (customizer instanceof BeanCustomizer) {
      ((BeanCustomizer)customizer).setModifiedListener(this);
    }

    ((Customizer)customizer).setObject(bc);
    // final javax.swing.JFrame jf = new javax.swing.JFrame();
    final JDialog d = new JDialog((java.awt.Frame)KnowledgeFlowApp.this.getTopLevelAncestor(), ModalityType.DOCUMENT_MODAL);
    d.setLayout(new BorderLayout());
    d.getContentPane().add((JComponent)customizer, BorderLayout.CENTER);

    //      jf.getContentPane().setLayout(new BorderLayout());
    //    jf.getContentPane().add((JComponent)customizer, BorderLayout.CENTER);
    if (customizer instanceof CustomizerCloseRequester) {
      ((CustomizerCloseRequester)customizer).setParentWindow(d);
    }
    d.addWindowListener(new java.awt.event.WindowAdapter() {
      public void windowClosing(java.awt.event.WindowEvent e) {
        if (customizer instanceof CustomizerClosingListener) {
          ((CustomizerClosingListener)customizer).customizerClosing();
        }
        d.dispose();
      }
    });
    //      jf.pack();
    //    jf.setVisible(true);
    d.pack();
    d.setLocationRelativeTo(KnowledgeFlowApp.this);
    d.setVisible(true);
  } catch (Exception ex) {
    ex.printStackTrace();
  }
}
 
開發者ID:dsibournemouth,項目名稱:autoweka,代碼行數:47,代碼來源:KnowledgeFlowApp.java

示例9: trackProgress

/**
 * Creates a modal progress bar dialog, and executes and monitors the progress of the supplied input {@code function}
 *
 * @param owner
 *             the {@link Window} from which the dialog is displayed or
 *             {@code null} if this dialog has no owner
 * @param title
 *             the {@link String} to display in the dialog's title bar or
 *             {@code null} if the dialog has no title
 * @param function
 *             Function that serves as a monitorable callback. Progress updates are reflected in the dialog's UI
 * @return Value returned by the {@code function}
 * @throws InterruptedException
 *             if the current thread was interrupted while waiting
 * @throws ExecutionException
 *             if the computation threw an exception
 */
public static <R> R trackProgress(final Frame owner, final String title, final ThrowingFunction<TaskMonitor, R> function) throws InterruptedException, ExecutionException
{
    final JDialog progressDialog = new JDialog(owner, title, ModalityType.DOCUMENT_MODAL);

    progressDialog.setResizable(false);
    progressDialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    progressDialog.setLayout(new FlowLayout(FlowLayout.CENTER));

    final JProgressBar progressBar = new JProgressBar();
    final JButton cancelButton = new JButton("Cancel");

    progressBar.setSize(200, 15);
    progressBar.setStringPainted(true);
    progressBar.setMinimum(0);

    progressDialog.add(progressBar);
    progressDialog.add(cancelButton);
    progressDialog.pack();
    progressDialog.setLocationRelativeTo(owner);

    final SwingWorker<R, Void> task = new SwingWorker<R, Void>()
                                      {
                                          @Override
                                          protected R doInBackground() throws Exception
                                          {
                                              return function.apply(new TaskMonitor()
                                                                    {
                                                                        @Override
                                                                        public void setProgress(final int value)
                                                                        {
                                                                            progressBar.setValue(value);
                                                                            progressBar.setString(String.format("%d/%d",
                                                                                                                value,
                                                                                                                progressBar.getMaximum()));
                                                                        }

                                                                        @Override
                                                                        public void setMaximum(final int max)
                                                                        {
                                                                            progressBar.setMaximum(max);
                                                                        }
                                                                    });
                                          }
                                          @Override
                                          protected void done()
                                          {
                                              progressDialog.dispose();
                                          }
                                      };
    cancelButton.addActionListener(e->Packager.cancel());
    task.execute();
    progressDialog.setVisible(true);
    return task.get();
}
 
開發者ID:GitHubRGI,項目名稱:swagd,代碼行數:71,代碼來源:ProgressDialog.java


注:本文中的java.awt.Dialog.ModalityType.DOCUMENT_MODAL屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。