当前位置: 首页>>代码示例>>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;未经允许,请勿转载。