本文整理匯總了Java中java.awt.Dialog.ModalityType類的典型用法代碼示例。如果您正苦於以下問題:Java ModalityType類的具體用法?Java ModalityType怎麽用?Java ModalityType使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ModalityType類屬於java.awt.Dialog包,在下文中一共展示了ModalityType類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: SQLQueryBuilder
import java.awt.Dialog.ModalityType; //導入依賴的package包/類
public SQLQueryBuilder(Window owner, DatabaseHandler databaseHandler) {
super(owner, "build_sql_query", ModalityType.APPLICATION_MODAL, new Object[0]);
this.tableList = new JList(new DefaultListModel());
this.attributeList = new JList(new DefaultListModel());
this.whereTextArea = new JTextArea(4, 15);
this.sqlQueryTextArea = new SQLEditor();
this.surroundingDialog = null;
this.connectionStatus = new JLabel();
this.gridPanel = new JPanel(createGridLayout(1, 3));
this.attributeNameMap = new LinkedHashMap();
this.databaseHandler = databaseHandler;
this.cache = TableMetaDataCache.getInstance();
if(!"false".equals(ParameterService.getParameterValue("rapidminer.gui.fetch_data_base_table_names"))) {
try {
this.retrieveTableNames();
} catch (SQLException var4) {
SwingTools.showSimpleErrorMessage("db_connection_failed_simple", var4, new Object[0]);
this.databaseHandler = null;
}
}
}
示例2: showMacroEditorDialog
import java.awt.Dialog.ModalityType; //導入依賴的package包/類
public static void showMacroEditorDialog(final ProcessContext context) {
ButtonDialog dialog = new ButtonDialog(ApplicationFrame.getApplicationFrame(), "define_macros",
ModalityType.APPLICATION_MODAL, new Object[] {}) {
private static final long serialVersionUID = 2874661432345426452L;
{
MacroEditor editor = new MacroEditor(false);
editor.setBorder(createBorder());
JButton addMacroButton = new JButton(editor.ADD_MACRO_ACTION);
JButton removeMacroButton = new JButton(editor.REMOVE_MACRO_ACTION);
layoutDefault(editor, NORMAL, addMacroButton, removeMacroButton, makeOkButton());
}
@Override
protected void ok() {
super.ok();
}
};
dialog.setVisible(true);
}
示例3: LicenseUpgradeDialog
import java.awt.Dialog.ModalityType; //導入依賴的package包/類
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);
}
}
}
示例4: showWhoIsDialog
import java.awt.Dialog.ModalityType; //導入依賴的package包/類
/**
* Show a dialog with whois data for the given point
* @param parent
* @param whois
* @param point
*/
public static void showWhoIsDialog(final JComponent parent, final ServiceFactory services, final GeoPoint point) {
final WhoIsPanel panel = new WhoIsPanel(services);
final JDialog dialog = new JDialog(SwingUtilities.getWindowAncestor(parent), "Who is " + point.getIp(), ModalityType.APPLICATION_MODAL) {
private static final long serialVersionUID = 1258611715478157956L;
@Override
public void dispose() {
panel.dispose();
super.dispose();
}
};
dialog.getContentPane().add(panel, BorderLayout.CENTER);
final JPanel bottom = new JPanel();
final JButton close = new JButton(Resources.getLabel("close.button"));
close.addActionListener(e -> dialog.dispose());
bottom.add(close);
dialog.getContentPane().add(bottom, BorderLayout.SOUTH);
services.getWhois().whoIs(point.getIp());
SwingUtilities4.setUp(dialog);
dialog.setVisible(true);
}
示例5: ContentPaneBuilderUsingDialogConfiguration
import java.awt.Dialog.ModalityType; //導入依賴的package包/類
public ContentPaneBuilderUsingDialogConfiguration(
final IPreferences preferences,
final IMessage message,
final IContentPaneBuilder contentPaneBuilder,
final DialogType dialogType) {
super(
preferences,
true,
message,
net.anwiba.commons.swing.icon.GuiIcons.EMPTY_ICON,
DataState.UNKNOWN,
ModalityType.APPLICATION_MODAL,
dialogType,
true,
new ObjectModel<Void>());
this.contentPaneBuilder = contentPaneBuilder;
}
示例6: getHelpDialog
import java.awt.Dialog.ModalityType; //導入依賴的package包/類
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;
}
示例7: openHeroEditor
import java.awt.Dialog.ModalityType; //導入依賴的package包/類
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);
}
示例8: initUI
import java.awt.Dialog.ModalityType; //導入依賴的package包/類
/**
* Setting up the user interface
*/
private void initUI() {
pb = new JProgressBar(JProgressBar.HORIZONTAL, value, maxValue == -1 ? 0 : maxValue);
pb.setStringPainted(Boolean.TRUE);
pb.setIndeterminate(indeterminate);
dialog = new JDialog();
dialog.setTitle(title);
dialog.setModalityType(ModalityType.MODELESS);
dialog.setIconImage(null);
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
dialog.add(pb);
dialog.setSize(this.width, this.height);
dialog.setLocationRelativeTo(null);
dialog.setVisible(Boolean.TRUE);
animationThread().start();
}
示例9: showPostById
import java.awt.Dialog.ModalityType; //導入依賴的package包/類
public void showPostById(int id, java.awt.Component dialogParent){
JOptionPane optionPane = new JOptionPane(Localization.format("retrieval_format", String.valueOf(id)), JOptionPane.INFORMATION_MESSAGE);
JButton button = new JButton(Localization.getString("cancel"));
optionPane.setOptions(new Object[]{button});
JDialog dialog = optionPane.createDialog(dialogParent, Localization.getString("retrieving"));
button.addActionListener(event -> dialog.dispose());
dialog.setModalityType(ModalityType.MODELESS);
dialog.setVisible(true);
executor.execute(() -> {
List<Post> searchPosts = mapi.listPosts(1, 1, "id:" + id);
SwingUtilities.invokeLater(() -> {
if (dialog.isDisplayable()){
dialog.dispose();
if (!searchPosts.isEmpty()){
showPostFrame.showPost(searchPosts.get(0));
}else{
JOptionPane.showMessageDialog(null, Localization.getString("id_doesnot_exists"),
Localization.getString("error"), JOptionPane.ERROR_MESSAGE);
}
}
});
});
}
示例10: actionPerformed
import java.awt.Dialog.ModalityType; //導入依賴的package包/類
@Override
public void actionPerformed(final ActionEvent e) {
final String rawFilepath = PathsAndFiles.JAVA_POLICY.getFullPath();
String filepath;
try {
filepath = new URL(rawFilepath).getPath();
} catch (final MalformedURLException mfue) {
filepath = null;
}
if (policyEditorWindow == null || policyEditorWindow.getPolicyEditor().isClosed()) {
policyEditorWindow = PolicyEditor.getPolicyEditorDialog(filepath);
policyEditorWindow.getPolicyEditor().openPolicyFileSynchronously();
} else {
policyEditorWindow.asWindow().toFront();
policyEditorWindow.asWindow().repaint();
}
policyEditorWindow.setModalityType(ModalityType.DOCUMENT_MODAL);
policyEditorWindow.getPolicyEditor().addNewEntry(new PolicyIdentifier(null, Collections.<PolicyParser.PrincipalEntry>emptySet(), file.getCodeBase().toString()));
policyEditorWindow.asWindow().setVisible(true);
menu.setVisible(false);
}
示例11: layoutDialog
import java.awt.Dialog.ModalityType; //導入依賴的package包/類
protected void layoutDialog() {
Dialog.getInstance().initLaf();
ModalityType modality = this.getModalityType();
if (this.isCallerIsEDT()) {
modality = ModalityType.APPLICATION_MODAL;
}
this.dialog = new InternDialog<T>(this, modality);
if (this.preferredSize != null) {
this.dialog.setPreferredSize(this.preferredSize);
}
this.timerLbl = new JLabel(TimeFormatter.formatMilliSeconds(this.getCountdown(), 0));
this.timerLbl.setEnabled(this.isCountdownPausable());
}
示例12: separateToggleButtonActionPerformed
import java.awt.Dialog.ModalityType; //導入依賴的package包/類
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);
}
}
示例13: build
import java.awt.Dialog.ModalityType; //導入依賴的package包/類
private void build() {
this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
this.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e){
dialog.dispose();
}
});
session = HibernateUtil.instance().openSession();
this.setModalityType(ModalityType.TOOLKIT_MODAL);
this.pack();
this.setLocationRelativeTo(null);
this.setVisible(true);
}
示例14: addModelessWindow
import java.awt.Dialog.ModalityType; //導入依賴的package包/類
static public JDialog addModelessWindow(Window mainWindow, Component jpanel, String title) {
JDialog dialog;
if (mainWindow != null) {
dialog = new JDialog(mainWindow, title);
} else {
dialog = new JDialog();
dialog.setTitle(title);
}
dialog.getContentPane().setLayout(new BorderLayout());
dialog.getContentPane().add(jpanel, BorderLayout.CENTER);
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
dialog.pack();
dialog.setLocationRelativeTo(mainWindow);
dialog.setModalityType(ModalityType.MODELESS);
dialog.setSize(jpanel.getPreferredSize());
dialog.setVisible(true);
return dialog;
}
示例15: showDialog
import java.awt.Dialog.ModalityType; //導入依賴的package包/類
public static File showDialog(boolean sb2, boolean apuc, boolean save) {
loading.setLocationRelativeTo(IdeFrame.instance);
loading.setVisible(true);
loading.paint(loading.getGraphics()); // so much hax
// too lazy to get this off the EDT
JDialog d = new JDialog();
d.setModalityType(ModalityType.APPLICATION_MODAL);
SavePanel p = new SavePanel(sb2, save, apuc, d);
d.setContentPane(new JPanel(new BorderLayout()));
d.getContentPane().add(p, BorderLayout.CENTER);
d.pack();
d.setLocationRelativeTo(p);
loading.setVisible(false);
d.setVisible(true);
return p.selected;
}