本文整理汇总了Java中java.awt.Dialog.ModalityType.MODELESS属性的典型用法代码示例。如果您正苦于以下问题:Java ModalityType.MODELESS属性的具体用法?Java ModalityType.MODELESS怎么用?Java ModalityType.MODELESS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.awt.Dialog.ModalityType
的用法示例。
在下文中一共展示了ModalityType.MODELESS属性的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: LicenseUpgradeDialog
public LicenseUpgradeDialog(ResourceAction action, boolean isDowngradeInformation, String key, boolean modal, boolean forceLicenseInstall, boolean useResourceAction, int size, Object... arguments) {
super(ApplicationFrame.getApplicationFrame(), key, modal?ModalityType.APPLICATION_MODAL:ModalityType.MODELESS, arguments);
this.setResizable(false);
this.action = action;
this.useResourceAction = useResourceAction;
if(arguments.length < 2) {
throw new IllegalArgumentException("You need to specify at least the name and the edition of the product that needs to be upgraded.");
} else {
this.setModal(modal);
this.productName = String.valueOf(arguments[0]);
this.productEdition = isDowngradeInformation?String.valueOf(arguments[2]):String.valueOf(arguments[1]);
this.layoutDefault(this.makeButtonPanel(), size, new AbstractButton[0]);
if(forceLicenseInstall) {
this.setDefaultCloseOperation(0);
}
}
}
示例2: getHelpDialog
static public JDialog getHelpDialog(
Window owner,
String title,
Class<?> resourceClass, String resourceName)
{
JDialog helpDialog = new JDialog(owner, title, ModalityType.MODELESS);
helpDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
String helpText = getHelpText(resourceClass, resourceName);
JLabel label = new JLabel(helpText);
label.setBackground(PALE_YELLOW);
label.setOpaque(true);
JScrollPane contentPane = new JScrollPane(label);
contentPane.setBorder(
BorderFactory.createCompoundBorder(new LineBorder(Color.BLUE),
new EmptyBorder(4, 4, 4, 4)));
helpDialog.setContentPane(contentPane);
helpDialog.pack();
return helpDialog;
}
示例3: separateToggleButtonActionPerformed
private void separateToggleButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_separateToggleButtonActionPerformed
if (separateToggleButton.isSelected()) {
lensDialog = new JDialog(SwingUtilities.getWindowAncestor(this), ModalityType.MODELESS);
lensDialog.setTitle("Lens");
contentSplitPane.remove(lensPanel);
lensDialog.getContentPane().setLayout(new BorderLayout());
lensDialog.getContentPane().add(lensPanel, BorderLayout.CENTER);
lensDialog.setSize(400, 400);
lensDialog.setLocationRelativeTo(null);
lensDialog.setVisible(true);
} else {
lensDialog.getContentPane().remove(lensPanel);
lensDialog.dispose();
contentSplitPane.setBottomComponent(lensPanel);
}
}
示例4: PendingPurchasesInstallationDialog
public PendingPurchasesInstallationDialog(List<String> packages) {
super(ApplicationFrame.getApplicationFrame(), "purchased_not_installed", ModalityType.MODELESS, new Object[0]);
this.purchasedModel = new PendingPurchasesInstallationDialog.PurchasedNotInstalledModel(this.packageDescriptorCache);
this.neverAskAgain = new JCheckBox(I18N.getMessage(I18N.getGUIBundle(), "gui.dialog.purchased_not_installed.not_check_on_startup", new Object[0]));
this.packages = packages;
this.remindNeverButton = this.remindNeverButton();
this.remindLaterButton = this.remindLaterButton();
this.okButton = this.makeOkButton("install_purchased");
this.layoutDefault(this.makeContentPanel(), 1, new AbstractButton[]{this.okButton, this.remindNeverButton, this.remindLaterButton});
this.setPreferredSize(new Dimension(404, 430));
this.setMaximumSize(new Dimension(404, 430));
this.setMinimumSize(new Dimension(404, 300));
this.setSize(new Dimension(404, 430));
}
示例5: makeDialog
@Override
public JDialog makeDialog() {
if (container != null)
return container;
setMessageType(JOptionPane.INFORMATION_MESSAGE);
setMessage(makeProgressPanel());
setOptions(new Object[]{"Stop"});
addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getSource() == Downloader.this && evt.getPropertyName() == VALUE_PROPERTY) {
requestClose("This will stop minecraft from launching\nAre you sure you want to do this?");
}
}
});
container = new JDialog(null, "Hello", ModalityType.MODELESS);
container.setResizable(false);
container.setLocationRelativeTo(null);
container.add(this);
this.updateUI();
container.pack();
container.setMinimumSize(container.getPreferredSize());
container.setVisible(true);
container.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
container.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
requestClose("Closing this window will stop minecraft from launching\nAre you sure you wish to do this?");
}
});
return container;
}
示例6: makeDialog
@Override
public JDialog makeDialog() {
if (container != null) {
return container;
}
setMessageType(JOptionPane.INFORMATION_MESSAGE);
setMessage(makeProgressPanel());
setOptions(new Object[] { "Stop" });
addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getSource() == Downloader.this && evt.getPropertyName() == VALUE_PROPERTY) {
requestClose("This will stop minecraft from launching\nAre you sure you want to do this?");
}
}
});
container = new JDialog(null, "Hello", ModalityType.MODELESS);
container.setResizable(false);
container.setLocationRelativeTo(null);
container.add(this);
this.updateUI();
container.pack();
container.setMinimumSize(container.getPreferredSize());
container.setVisible(true);
container.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
container.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
requestClose("Closing this window will stop minecraft from launching\nAre you sure you wish to do this?");
}
});
return container;
}
示例7: makeDialog
@Override
public JDialog makeDialog()
{
if (container != null)
return container;
setMessageType(JOptionPane.INFORMATION_MESSAGE);
setMessage(makeProgressPanel());
setOptions(new Object[]{"Stop"});
addPropertyChangeListener(new PropertyChangeListener()
{
@Override
public void propertyChange(PropertyChangeEvent evt)
{
if (evt.getSource() == Downloader.this && evt.getPropertyName() == VALUE_PROPERTY)
{
requestClose("This will stop minecraft from launching\nAre you sure you want to do this?");
}
}
});
container = new JDialog(null, "Hello", ModalityType.MODELESS);
container.setResizable(false);
container.setLocationRelativeTo(null);
container.add(this);
this.updateUI();
container.pack();
container.setMinimumSize(container.getPreferredSize());
container.setVisible(true);
container.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
container.addWindowListener(new WindowAdapter()
{
@Override
public void windowClosing(WindowEvent e)
{
requestClose("Closing this window will stop minecraft from launching\nAre you sure you wish to do this?");
}
});
return container;
}
示例8: actionPerformed
@Override
public void actionPerformed(ActionEvent e) {
String command = e.getActionCommand();
if ("identify".equals(command)) {
// implementation note:
// we use JDialog here instead of JFrame because we don't want the task bar
// to show focusable windows. Using a JDialog allows it to part of the application
// and not a separate window.
int n = this.devices.length;
// identify the devices
JDialog[] dialogs = new JDialog[n];
// create the frames
for (int i = 0; i < n; i++) {
// get the device
GraphicsDevice device = this.devices[i];
// create a frame for each device
JDialog dialog = dialogs[i] = new JDialog(WindowUtilities.getParentWindow(this), "", ModalityType.MODELESS, WindowUtilities.getTranslucentConfiguration(device));
// create a label for each device
JLabel lblName = new JLabel(WindowUtilities.getDeviceName(device, i, Messages.getString("display.name.format")));
lblName.setFont(new Font(lblName.getFont().getName(), Font.PLAIN, 50));
lblName.setHorizontalAlignment(SwingConstants.CENTER);
// make sure the frame is sized and positioned correctly
GraphicsConfiguration gc = device.getDefaultConfiguration();
Rectangle r = gc.getBounds();
dialog.setUndecorated(true);
dialog.setFocusable(false);
dialog.setLayout(new BorderLayout());
dialog.add(lblName, BorderLayout.CENTER);
dialog.setLocation(r.x, r.y);
dialog.setMinimumSize(new Dimension(r.width, r.height));
// enable translucency if available
if (device.isWindowTranslucencySupported(WindowTranslucency.PERPIXEL_TRANSLUCENT)) {
dialog.setBackground(new Color(0.0f, 0.0f, 0.0f, 0.0f));
}
dialog.setVisible(true);
}
// close the frames in a different thread
DelayCloseWindowTask.execute(1000, dialogs);
}
}
示例9: init
public static void init() {
loading = new JDialog(IdeFrame.instance, "Loading...",
ModalityType.MODELESS);
loading.getContentPane().setLayout(new BorderLayout());
loading.getContentPane().add(
new JLabel("File choosers take some time for some reason"),
BorderLayout.CENTER);
loading.setSize(300, 100);
loading.setLocationRelativeTo(IdeFrame.instance);
}
示例10: FileChooserButtonDialog
public FileChooserButtonDialog(Window owner, String key, boolean modal, ExtendedJFileChooser chooser,
Object... arguments) {
super(owner, key, modal ? ModalityType.APPLICATION_MODAL : ModalityType.MODELESS, arguments);
chooser.setControlButtonsAreShown(false);
layoutDefault(chooser, NORMAL, getButtons());
}
示例11: makeDialog
@Override
public JDialog makeDialog()
{
if (container != null)
{
return container;
}
setMessageType(JOptionPane.INFORMATION_MESSAGE);
setMessage(makeProgressPanel());
setOptions(new Object[] { "Stop" });
addPropertyChangeListener(new PropertyChangeListener()
{
@Override
public void propertyChange(PropertyChangeEvent evt)
{
if (evt.getSource() == Downloader.this && evt.getPropertyName() == VALUE_PROPERTY)
{
requestClose("This will stop minecraft from launching\nAre you sure you want to do this?");
}
}
});
container = new JDialog(null, "Hello", ModalityType.MODELESS);
container.setResizable(false);
container.setLocationRelativeTo(null);
container.add(this);
this.updateUI();
container.pack();
container.setMinimumSize(container.getPreferredSize());
container.setVisible(true);
container.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
container.addWindowListener(new WindowAdapter()
{
@Override
public void windowClosing(WindowEvent e)
{
requestClose("Closing this window will stop minecraft from launching\nAre you sure you wish to do this?");
}
});
return container;
}
示例12: showDialog
public static void showDialog(String title, JComponent comp, Window window) {
final JDialog dialog = new JDialog(window, ModalityType.MODELESS);
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
dialog.setTitle(title);
try {
dialog.setIconImage(ImageIO.read(DialogUtils.class.getResource("/mediamatrix/resources/Icon.png")));
} catch (IOException ignored) {
}
dialog.getContentPane().setLayout(new BorderLayout());
dialog.getContentPane().add(comp, BorderLayout.CENTER);
dialog.pack();
final Rectangle maxRectangle = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
int x = 0;
int y = 0;
int w = dialog.getWidth();
int h = dialog.getHeight();
if (w + x > maxRectangle.width) {
x = 0;
w = maxRectangle.width;
}
if (h < 400) {
h = 400;
}
if (w < 400) {
w = 400;
}
if (h > 400) {
h = 400;
}
if (w > 400) {
w = 400;
}
if (h + y > maxRectangle.height) {
y = 0;
h = maxRectangle.height;
}
if (x < 0) {
x = 0;
}
if (System.getProperty("os.name").indexOf("Mac") >= 0 && y < 20) {
y = 20;
}
dialog.setBounds(x, y, w, h);
dialog.setLocationRelativeTo(null);
dialog.setVisible(true);
}
示例13: ApplicationLoader
/**
* Default constructor.
*/
private ApplicationLoader() {
// create a new dialog
this.dialog = new JDialog(null, Messages.getString("dialog.preload.title"), ModalityType.MODELESS);
this.dialog.setIconImages(Icons.APPLICATION_ICON_LIST);
// all the user to close it during startup
this.dialog.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
this.dialog.setResizable(false);
this.dialog.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
stop = true;
}
});
this.stop = false;
// create the progress bar
this.barProgress = new JProgressBar(0, 100);
this.barProgress.setStringPainted(true);
this.barProgress.setMinimumSize(new Dimension(0, 50));
this.lblLoading = new JLabel(Messages.getString("dialog.preload.title"));
// create a label
this.lblLoadingText = new JLabel(" ");
this.lblLoadingText.setMinimumSize(new Dimension(0, 30));
// layout the loading
Container container = this.dialog.getContentPane();
GroupLayout layout = new GroupLayout(container);
container.setLayout(layout);
layout.setAutoCreateContainerGaps(true);
layout.setAutoCreateGaps(true);
layout.setHorizontalGroup(layout.createParallelGroup(Alignment.CENTER)
.addComponent(this.barProgress)
.addComponent(this.lblLoading)
.addComponent(this.lblLoadingText));
layout.setVerticalGroup(layout.createSequentialGroup()
.addComponent(this.barProgress)
.addComponent(this.lblLoading)
.addComponent(this.lblLoadingText));
this.praisenter = null;
// set the minimum size (so we can see all of the font)
this.dialog.setMinimumSize(new Dimension(400, 0));
// size the window
this.dialog.pack();
// start the background thread
// this must be started before the modal dialog is
// set to visible
this.start();
// make sure we are in the center of the parent window
this.dialog.setLocationRelativeTo(null);
// show the dialog
this.dialog.setVisible(true);
}
示例14: createDialog
private JDialog createDialog() {
Frame owner = WindowManager.getDefault().getMainWindow();
JDialog dialog = new JDialog(owner, title, ModalityType.MODELESS);
dialog.getContentPane().add(this);
return dialog;
}