本文整理匯總了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);
}
示例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;
}
示例3: createWindow
@Override
protected JDialog createWindow()
{
JDialog window = new JDialog(owner, ModalityType.DOCUMENT_MODAL);
window.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
return window;
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
}
示例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();
}
}
示例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();
}