javax.swing.JDialog.setModal()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(190)

本文整理了Java中javax.swing.JDialog.setModal()方法的一些代码示例,展示了JDialog.setModal()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JDialog.setModal()方法的具体详情如下:
包路径:javax.swing.JDialog
类名称:JDialog
方法名:setModal

JDialog.setModal介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

final JOptionPane optionPane = new JOptionPane("Hello world", JOptionPane.INFORMATION_MESSAGE, JOptionPane.DEFAULT_OPTION, null, new Object[]{}, null);

final JDialog dialog = new JDialog();
dialog.setTitle("Message");
dialog.setModal(true);

dialog.setContentPane(optionPane);

dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
dialog.pack();

//create timer to dispose of dialog after 5 seconds
Timer timer = new Timer(5000, new AbstractAction() {
  @Override
  public void actionPerformed(ActionEvent ae) {
    dialog.dispose();
  }
});
timer.setRepeats(false);//the timer should only go off once

//start timer to close JDialog as dialog modal we must start the timer before its visible
timer.start();

dialog.setVisible(true);

代码示例来源:origin: stackoverflow.com

JDialog dialog = new JDialog ();
dialog.setModal (true);
dialog.setAlwaysOnTop (true);
dialog.setModalityType (ModalityType.APPLICATION_MODAL);

代码示例来源:origin: libgdx/libgdx

dialog.setModal(true);
dialog.setAlwaysOnTop(true);
dialog.setVisible(true);

代码示例来源:origin: libgdx/libgdx

dialog.setModal(true);
dialog.setAlwaysOnTop(true);
dialog.setVisible(true);

代码示例来源:origin: cmusphinx/sphinx4

/** A little test-function which plugs a microphone directly into the vu-meter.
   * @param args arguments to use
   * @throws edu.cmu.sphinx.frontend.DataProcessingException if error occurs
   */
  public static void main(String[] args) throws DataProcessingException {
    Microphone mic = new Microphone( 16000, 16, 1,
             true, true, true, 10, false,
             "selectChannel", 2, "default", 6400);

    mic.initialize();
    mic.startRecording();

    VUMeterMonitor monitor = new VUMeterMonitor();
    monitor.getVuMeterDialog().setModal(true);
    monitor.setPredecessor(mic);

    while (true) {
      monitor.getData();
    }
  }
}

代码示例来源:origin: stackoverflow.com

JDialog dialog = new JDialog(SwingUtilities.windowForComponent(this));
dialog.setModal(true);
dialog.setSize(...);
dialog.setVisible( true );

代码示例来源:origin: protegeproject/protege

/**
 * Sets the modality of the generated javax.swing.JDialog.
 * @param b the modality of the dialog
 */
public void setModal(boolean b) {
  wizardDialog.setModal(b);
}

代码示例来源:origin: edu.stanford.protege/org.protege.editor.core.application

/**
 * Sets the modality of the generated javax.swing.JDialog.
 * @param b the modality of the dialog
 */
public void setModal(boolean b) {
  wizardDialog.setModal(b);
}

代码示例来源:origin: org.protege/protege-editor-core-application

/**
 * Sets the modality of the generated javax.swing.JDialog.
 * @param b the modality of the dialog
 */
public void setModal(boolean b) {
  wizardDialog.setModal(b);
}

代码示例来源:origin: stackoverflow.com

JDialog dialog = new JDialog(your_frame_reference, "Licence"); 
dialog .setModal(true); 
dialog .setLocationRelativeTo(null); 
dialog. getContentPane().add(new JLabel(your_text);
dialog .setVisible(true);

代码示例来源:origin: stackoverflow.com

@Override
public void actionPerformed(ActionEvent e) {
  JDialog dlg = new JDialog(jf, "modal");
  dlg.add(new JLabel("hello"));
  dlg.setModal(true);
  dlg.pack();
  dlg.setLocationRelativeTo(canvas);
  dlg.setVisible(true);
  button.getModel().setRollover(false);
}

代码示例来源:origin: org.n52.wps/52n-wps-install-wizard

/**
 * Convienence method that displays a modal wizard dialog and blocks until the dialog
 * has completed.
 * @return Indicates how the dialog was closed. Compare this value against the RETURN_CODE
 * constants at the beginning of the class.
 */    
public int showModalDialog() {
  
  wizardDialog.setModal(true);
  wizardDialog.pack();
  wizardDialog.show();
  
  return returnCode;
}

代码示例来源:origin: stackoverflow.com

JButton nextButton = new JButton("Next");
nextButton.addActionListener(new ActionListener() {
  @Override
  public void actionPerformed(ActionEvent e) {
    JDialog dialog = new JDialog();
    dialog.setTitle("Title");
    dialog.setModal(true);
    dialog.getContentPane().add(...); // add components here
    dialog.pack();
    dialog.setVisible(true);
}

代码示例来源:origin: org.netbeans.api/org-openide-explorer

public void showProperties(Node[] nodes) {
  PropertySheet ps = new PropertySheet();
  ps.setNodes(nodes);
  JDialog d = new JDialog();
  d.setTitle("Properties"); // XXX I18N
  d.setModal(true);
  d.getContentPane().setLayout(new BorderLayout());
  d.getContentPane().add(ps, BorderLayout.CENTER);
  d.pack();
  d.setVisible(true);
  d.dispose();
}

代码示例来源:origin: stackoverflow.com

JOptionPane pane = new JOptionPane(arguments);
pane.set.Xxxx(...); // Configure
JDialog dialog = pane.createDialog(parentComponent, title);
dialog.setLocation(....);  // added!
dialog.setModal(....);  // added! Do you want it modal or not?
// ....
dialog.setVisible(true);

代码示例来源:origin: org.japura/japura-gui

JDialog getModalDialog() {
 if (modalDialog == null) {
  modalDialog = new JDialog();
  ImageIcon ii = new ImageIcon(GUIImages.CALENDAR);
  modalDialog.setIconImage(ii.getImage());
  modalDialog.add(this);
  modalDialog.pack();
  modalDialog.setResizable(false);
  modalDialog.setModal(true);
 }
 return modalDialog;
}

代码示例来源:origin: stackoverflow.com

JDialog jd=new JDialog(loginpage.this,"User Registration");
jd.setModal(true);
jd.setLayout(null); // THIS IS A BAD IDEA //
jd.setLocationRelativeTo(null);
// This is somewhat pointless, you've set relative location, but know overridden it...
// You should also be relying on the layout manager and pack to determine the size...
jd.setBounds(400,300, 479, 329); 
jd.setResizable(false);
setLocationRelativeTo(loginpage.this);

// Add you other components

jd.setVisible(true);

代码示例来源:origin: chatty/chatty

public static void showNonModalMessage(Component parent, String title, String message, int type, boolean allowHtml) {
  if (!allowHtml) {
    message = Helper.htmlspecialchars_encode(message);
  }
  message = "<html><body style='font-family: Monospaced;width:400px;'>"+message;
  JOptionPane pane = new JOptionPane(message, type);
  JDialog dialog = pane.createDialog(parent, title);
  dialog.setModal(false);
  dialog.setVisible(true);
}

代码示例来源:origin: net.sf.taverna.t2.activities/biomoby-activity-ui

public void actionPerformed(ActionEvent e) {
  
  BiomobyActionHelper helper = new BiomobyActionHelper();
  Dimension size = helper.getFrameSize();
  
  Component component = helper.getComponent(activity);
  final JDialog dialog = new JDialog(owner, false);
  dialog.getContentPane().add(component);
  dialog.pack();
  dialog.setTitle(helper.getDescription());
  dialog.setSize(size);
  dialog.setModal(false);
  dialog.setVisible(true);
}

代码示例来源:origin: freeplane/freeplane

public static JDialog createCancelDialog(final Component component, final String titel, final String text) {
  final String[] options = { TextUtils.getText("cancel") };
  final JOptionPane infoPane = new JOptionPane(text, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION, null,
    options);
  JDialog dialog = infoPane.createDialog(component, titel);
  dialog.setModal(false);
  return dialog;
}

相关文章

JDialog类方法