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

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

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

JDialog.setVisible介绍

暂无

代码示例

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

final JDialog d = new JDialog();
d.setSize(200,200);
d.setLocationRelativeTo(null);
d.setVisible(true);

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

final JDialog frame = new JDialog(parentFrame, frameTitle, true);
frame.getContentPane().add(panel);
frame.pack();
frame.setVisible(true);

代码示例来源:origin: stanfordnlp/CoreNLP

public void about() {
 aboutBox.setSize(360, 240);
 aboutBox.setLocation((int)this.getLocation().getX() + 22, (int)this.getLocation().getY() + 22);
 aboutBox.setResizable(false);
 aboutBox.setVisible(true);
}

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

public VUMeterMonitor() {
  vumeter = new VUMeter();
  vuMeterPanel = new VUMeterPanel();
  vuMeterPanel.setVu(vumeter);
  vuMeterPanel.start();
  vuMeterDialog = new JDialog();
  vuMeterDialog.setBounds(100, 100, 100, 400);
  vuMeterDialog.getContentPane().setLayout(new BorderLayout());
  vuMeterDialog.getContentPane().add(vuMeterPanel);
  vuMeterDialog.setVisible(true);
}

代码示例来源: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: libgdx/libgdx

placeholderLabel.setBorder(new EmptyBorder(border.getBorderInsets(textField)));
JDialog dialog = pane.createDialog(null, title);
pane.selectInitialValue();
dialog.setVisible(true);
dialog.dispose();

代码示例来源:origin: stanfordnlp/CoreNLP

final JDialog dialog = fileFilterDialog.createDialog(null, "Default encoding changed...");
useNewEncoding.addActionListener(arg0 -> {
 FileTreeModel.setCurEncoding(encoding);
  System.out.println("encoding null!!");
 setEncoding.setText(encoding);
 dialog.setVisible(false);
});
useOldEncoding.addActionListener(e -> dialog.setVisible(false));
useAnotherEncoding.addActionListener(e -> {
 dialog.setVisible(false);
 alternateEncodingPrompt(encoding);
});
dialog.getRootPane().setDefaultButton(useNewEncoding);
dialog.pack();
dialog.setLocationRelativeTo(this);
dialog.setVisible(true);

代码示例来源:origin: stanfordnlp/CoreNLP

final JDialog dialog = new JDialog(frame, "Jar File Chooser", true);
dialog.setLocation(location);
final JList fileList = new JList(new Vector<>(files));
okay.setText("Okay");
okay.setToolTipText("Okay");
okay.addActionListener(evt -> dialog.setVisible(false));
JButton cancel = new javax.swing.JButton();
cancel.setText("Cancel");
cancel.addActionListener(evt -> {
 fileList.clearSelection();
 dialog.setVisible(false);
});
gridbag.setConstraints(cancel, constraints);
dialog.add(cancel);
dialog.pack();
dialog.setSize(dialog.getPreferredSize());
dialog.setVisible(true);

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

@Override
  public void actionPerformed (ActionEvent arg0) {
    if(editor.isUsingDefaultTexture()) {
      JOptionPane.showMessageDialog(editor, "Load a Texture or an Atlas first.");
      return;
    }
    
    TextureAtlas atlas = editor.getAtlas();
    if(atlas != null)
      regionPickerPanel.setAtlas(atlas);
    else 
      regionPickerPanel.setTexture(editor.getTexture());
    
    regionPickerPanel.revalidate();
    regionPickerPanel.repaint();
    regionSelectDialog.validate();
    regionSelectDialog.repaint();
    regionSelectDialog.pack();
    regionSelectDialog.setVisible(true);
  }
});

代码示例来源:origin: org.wildfly.core/wildfly-cli

public void actionPerformed(ActionEvent e) {
  JOptionPane helpPane = new JOptionPane(helpScroller, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION);
  JDialog dialog = helpPane.createDialog(HelpButton.this, "Help");
  dialog.setResizable(true);
  dialog.setModal(false);
  dialog.setSize(dialog.getHeight(), helpScroller.getWidth() + 10);
  dialog.setVisible(true);
}

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

final JDialog waitForTrans = new JDialog((JFrame) null, true);

SwingWorker worker = new SwingWorker() {

 public String doInBackground() throws Exception {
  Thread.sleep(5000);
  return null;
 }

 public void done() {
  SwingUtilities.invokeLater(new Runnable() {
   public void run() {
    waitForTrans.setVisible(false);
    waitForTrans.dispose();
   }
  });
 }

};

worker.execute();
SwingUtilities.invokeLater(new Runnable() {
 public void run() {
  waitForTrans.add(new JLabel("Please Wait..."));
  waitForTrans.setMinimumSize(new Dimension(300, 100));
  waitForTrans.setVisible(true);
 }
});

代码示例来源:origin: igniterealtime/Openfire

private void installPlugin(final File plugin) {
  final JDialog dialog = new JDialog(frame, "Installing Plugin", true);
  dialog.getContentPane().setLayout(new BorderLayout());
  JProgressBar bar = new JProgressBar();
  bar.setIndeterminate(true);
  bar.setString("Installing Plugin.  Please wait...");
  bar.setStringPainted(true);
  dialog.getContentPane().add(bar, BorderLayout.CENTER);
  dialog.pack();
  dialog.setSize(225, 55);
  dialog.setVisible(true);

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

private void showProgressPanel(List<ComponentDescription> comps, boolean install) {
  final ProgressPanel pp = new ProgressPanel(comps, install);
  final JOptionPane optionPane = new JOptionPane(pp, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION, null,
      new String[] { "Abort" }, "Abort");
  // optionPane.setPreferredSize(new Dimension(640,480));
  final JDialog dialog = new JDialog((Frame) null, "Progress", false);
  dialog.setContentPane(optionPane);
  optionPane.addPropertyChangeListener(new PropertyChangeListener() {
    public void propertyChange(PropertyChangeEvent e) {
      String prop = e.getPropertyName();
      if (dialog.isVisible() && (e.getSource() == optionPane) && (prop.equals(JOptionPane.VALUE_PROPERTY))) {
        pp.requestExit();
        dialog.setVisible(false);
      }
    }
  });
  dialog.pack();
  dialog.setVisible(true);
  new Thread(pp).start();
}

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

placeholderLabel.setBorder(new EmptyBorder(border.getBorderInsets(textField)));
JDialog dialog = pane.createDialog(null, title);
pane.selectInitialValue();
dialog.setVisible(true);
dialog.dispose();

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

final JDialog d = new JDialog();
d.setSize(200, 200);
final Toolkit toolkit = Toolkit.getDefaultToolkit();
final Dimension screenSize = toolkit.getScreenSize();
final int x = (screenSize.width - d.getWidth()) / 2;
final int y = (screenSize.height - d.getHeight()) / 2;
d.setLocation(x, y);
d.setVisible(true);

代码示例来源:origin: stanfordnlp/CoreNLP

final JDialog dialog = fileFilterDialog.createDialog(null, "Set file filters...");
okay.addActionListener(arg0 -> {
 dialog.setVisible(false);
 startFileLoadingThread(filters, cFiles);
});
add.addActionListener(e -> {
 fileFilterPanel.add(getNewFilter());
 dialog.pack();
});
cancel.addActionListener(e -> dialog.setVisible(false));
dialog.getRootPane().setDefaultButton(okay);
dialog.pack();
dialog.setLocationRelativeTo(this);
dialog.setVisible(true);

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

@Override
  public void actionPerformed (ActionEvent arg0) {
    if(editor.isUsingDefaultTexture()) {
      JOptionPane.showMessageDialog(editor, "Load a Texture or an Atlas first.");
      return;
    }
    
    TextureAtlas atlas = editor.getAtlas();
    if(atlas != null)
      regionPickerPanel.setAtlas(atlas);
    else 
      regionPickerPanel.setTexture(editor.getTexture());
    
    regionPickerPanel.revalidate();
    regionPickerPanel.repaint();
    regionSelectDialog.validate();
    regionSelectDialog.repaint();
    regionSelectDialog.pack();
    regionSelectDialog.setVisible(true);
  }
});

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

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

代码示例来源:origin: wildfly/wildfly-core

public void actionPerformed(ActionEvent e) {
  JOptionPane helpPane = new JOptionPane(helpScroller, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION);
  JDialog dialog = helpPane.createDialog(HelpButton.this, "Help");
  dialog.setResizable(true);
  dialog.setModal(false);
  dialog.setSize(dialog.getHeight(), helpScroller.getWidth() + 10);
  dialog.setVisible(true);
}

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

public int show(JFrame frame) {
  dialog = new JDialog(frame, "Save Changes", true);
  Container contentPane = dialog.getContentPane();
  contentPane.setLayout(new BorderLayout());
  contentPane.add(this, BorderLayout.CENTER);
  dialog.setResizable(false);
  dialog.pack();
  dialog.setLocationRelativeTo(frame);
  dialog.getRootPane().setDefaultButton(saveButton);
  dialog.setVisible(true);
  dialog.dispose();
  return selectedValue;
}

相关文章

JDialog类方法