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


Java ModalityType.MODELESS屬性代碼示例

本文整理匯總了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);
        }

    }
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:18,代碼來源:LicenseUpgradeDialog.java

示例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;
}
 
開發者ID:kddart,項目名稱:kdxplore,代碼行數:26,代碼來源:HelpUtils.java

示例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);
    }
}
 
開發者ID:shuichi,項目名稱:MediaMatrix,代碼行數:16,代碼來源:MediaInspectorPanel.java

示例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));
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:14,代碼來源:PendingPurchasesInstallationDialog.java

示例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;
}
 
開發者ID:4Space,項目名稱:4Space-5,代碼行數:33,代碼來源:DepLoader.java

示例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;
}
 
開發者ID:TheCBProject,項目名稱:CodeChickenCore,代碼行數:34,代碼來源:DepLoader.java

示例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;
}
 
開發者ID:AnimeniacYuuto,項目名稱:InventoryTools,代碼行數:39,代碼來源:DepLoader.java

示例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);
	}
}
 
開發者ID:wnbittle,項目名稱:praisenter,代碼行數:40,代碼來源:GeneralPreferencesPanel.java

示例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);
}
 
開發者ID:MegaApuTurkUltra,項目名稱:Scratch-ApuC,代碼行數:10,代碼來源:SavePanel.java

示例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());
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:6,代碼來源:ExtendedJFileChooser.java

示例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;
}
 
開發者ID:4Space,項目名稱:4Space-5,代碼行數:41,代碼來源:DepLoader.java

示例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);
}
 
開發者ID:shuichi,項目名稱:MediaMatrix,代碼行數:48,代碼來源:DialogUtils.java

示例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);
}
 
開發者ID:wnbittle,項目名稱:praisenter,代碼行數:68,代碼來源:ApplicationLoader.java

示例14: createDialog

private JDialog createDialog() {
    Frame owner = WindowManager.getDefault().getMainWindow();
    JDialog dialog = new JDialog(owner, title, ModalityType.MODELESS);
    dialog.getContentPane().add(this);
    return dialog;
}
 
開發者ID:Depter,項目名稱:JRLib,代碼行數:6,代碼來源:PlotDialog.java


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