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

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

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

JDialog.getContentPane介绍

暂无

代码示例

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

private void initAboutBox() {
 aboutBox = new JDialog(this, "About Tregex");
 aboutBox.getContentPane().setLayout(new BorderLayout());
 aboutBox.getContentPane().add(new JLabel("<html><b>Tregex and Tsurgeon</b></html>", SwingConstants.CENTER), BorderLayout.NORTH);
 aboutBox.getContentPane().add(new JLabel("<html>Tregex by Galen Andrew and Roger Levy<br>Tsurgeon by Roger Levy<br>Graphical interface by Anna Rafferty<br>Additional features and development by Chris Manning<br></html>", SwingConstants.CENTER), BorderLayout.CENTER);
 aboutBox.getContentPane().add(new JLabel("<html><font size=2>\u00A92007 The Board of Trustees of The Leland Stanford Junior University.<br>Distributed under the GNU General Public License</font></html>", SwingConstants.CENTER), BorderLayout.SOUTH);
}

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

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

代码示例来源:origin: camunda/camunda-bpm-platform

public LogFactor5LoadingDialog(JFrame jframe, String message) {
 super(jframe, "LogFactor5", false);
 JPanel bottom = new JPanel();
 bottom.setLayout(new FlowLayout());
 JPanel main = new JPanel();
 main.setLayout(new GridBagLayout());
 wrapStringOnPanel(message, main);
 getContentPane().add(main, BorderLayout.CENTER);
 getContentPane().add(bottom, BorderLayout.SOUTH);
 show();
}
//--------------------------------------------------------------------------

代码示例来源:origin: org.cytoscape/vizmap-gui-impl

private void initComponents(final JDialog dialog) {
    dialog.setLayout(new BorderLayout());
    dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    dialog.getContentPane().add(editorPanel, BorderLayout.CENTER);
    dialog.setPreferredSize(DEF_SIZE);
    dialog.setMinimumSize(MIN_SIZE);
    dialog.pack();
  }
});

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

editorComponent = new JButton();
editorComponent.setBackground(Color.white);
editorComponent.setBorderPainted(false);
  textArea.getInputMap().put(keyStroke, "none");
  JScrollPane scrollPane = new JScrollPane( textArea );
  getContentPane().add( scrollPane );
  JButton cancel = new JButton("Cancel");
  cancel.addActionListener( this );
  JButton ok = new JButton("Ok");
  ok.setPreferredSize( cancel.getPreferredSize() );
  ok.addActionListener( this );
  buttons.add( ok );
  buttons.add( cancel );
  getContentPane().add(buttons, BorderLayout.SOUTH);
  pack();

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

protected void endDialog() {
  Container contentPane = dialog.getContentPane();
  contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
  contentPane.add(messagePane);
  contentPane.add(buttonPane);
  dialog.pack();
  Emulator.getMainGUI().startWindowDialog(dialog);
}

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

private void createDialog(Frame parentFrame) {
 dialog = new JDialog(parentFrame);
 GridBag gridBag = new GridBag(dialog.getContentPane());
 gridBag.add(jList,
       0, 0, 3, 1, 1, 1,
       GridBagConstraints.BOTH,
       GridBagConstraints.CENTER,
       new Insets(10, 10, 10, 10));
 gridBag.add(new JButton(new OkAction()),
       1, 1, 1, 1, 0, 0,
       GridBagConstraints.NONE,
       GridBagConstraints.CENTER,
       new Insets(5, 5, 5, 5));
 gridBag.add(new JButton(new CancelAction()),
       2, 1, 1, 1, 0, 0,
       GridBagConstraints.NONE,
       GridBagConstraints.CENTER,
       new Insets(5, 5, 5, 5));
}

代码示例来源: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: org.apache.log4j/com.springsource.org.apache.log4j

public LogFactor5LoadingDialog(JFrame jframe, String message) {
 super(jframe, "LogFactor5", false);
 JPanel bottom = new JPanel();
 bottom.setLayout(new FlowLayout());
 JPanel main = new JPanel();
 main.setLayout(new GridBagLayout());
 wrapStringOnPanel(message, main);
 getContentPane().add(main, BorderLayout.CENTER);
 getContentPane().add(bottom, BorderLayout.SOUTH);
 show();
}
//--------------------------------------------------------------------------

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

protected JDialog createDialog(Component parent) {
  Frame frame = parent instanceof Frame ? (Frame) parent
      : (Frame) SwingUtilities.getAncestorOfClass(Frame.class, parent);
  JDialog dialog = new JDialog(frame, ("Select Font"), true);
  Action okAction = new DialogOKAction(dialog);
  Action cancelAction = new DialogCancelAction(dialog);
  JButton okButton = new JButton(okAction);
  okButton.setFont(DEFAULT_FONT);
  JButton cancelButton = new JButton(cancelAction);
  cancelButton.setFont(DEFAULT_FONT);
  JPanel buttonsPanel = new JPanel();
  buttonsPanel.setLayout(new GridLayout(2, 1));
  buttonsPanel.add(okButton);
  buttonsPanel.add(cancelButton);
  buttonsPanel.setBorder(BorderFactory.createEmptyBorder(25, 0, 10, 10));
  ActionMap actionMap = buttonsPanel.getActionMap();
  actionMap.put(cancelAction.getValue(Action.DEFAULT), cancelAction);
  actionMap.put(okAction.getValue(Action.DEFAULT), okAction);
  InputMap inputMap = buttonsPanel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
  inputMap.put(KeyStroke.getKeyStroke("ESCAPE"), cancelAction.getValue(Action.DEFAULT));
  inputMap.put(KeyStroke.getKeyStroke("ENTER"), okAction.getValue(Action.DEFAULT));
  JPanel dialogEastPanel = new JPanel();
  dialogEastPanel.setLayout(new BorderLayout());
  dialogEastPanel.add(buttonsPanel, BorderLayout.NORTH);
  dialog.getContentPane().add(this, BorderLayout.CENTER);
  dialog.getContentPane().add(dialogEastPanel, BorderLayout.EAST);
  dialog.pack();
  dialog.setLocationRelativeTo(frame);
  return dialog;
}

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

dialog = new javax.swing.JDialog(parentDlg, title, true);
} else {
  dialog = new javax.swing.JDialog(frame, title, true);
Container contentPane = dialog.getContentPane();
contentPane.setLayout(new BorderLayout());
contentPane.add(chooser, BorderLayout.CENTER);
dialog.pack();
dialog.setBounds(findCenterBounds(parent.getGraphicsConfiguration(), dialog.getSize()));

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

frame.getContentPane().add(new MyFramePanel());
 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 frame.pack();
private JButton openDialogeBtn = new JButton("Open Dialog");
 field.setFocusable(false);
 add(field);
 add(openDialogeBtn);
   Window win = SwingUtilities.getWindowAncestor(this);
   if (win != null) {
    dialog = new JDialog(win, "My Dialog",
         ModalityType.APPLICATION_MODAL);
    dialog.getContentPane().add(dialogPanel);
    dialog.pack();
    dialog.setLocationRelativeTo(null);
private JButton okButton = new JButton("OK");

代码示例来源: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;
}

代码示例来源:origin: camunda/camunda-bpm-platform

public LogFactor5ErrorDialog(JFrame jframe, String message) {
 super(jframe, "Error", true);
 JButton ok = new JButton("Ok");
 ok.addActionListener(new ActionListener() {
  public void actionPerformed(ActionEvent e) {
   hide();
  }
 });
 JPanel bottom = new JPanel();
 bottom.setLayout(new FlowLayout());
 bottom.add(ok);
 JPanel main = new JPanel();
 main.setLayout(new GridBagLayout());
 wrapStringOnPanel(message, main);
 getContentPane().add(main, BorderLayout.CENTER);
 getContentPane().add(bottom, BorderLayout.SOUTH);
 show();
}
//--------------------------------------------------------------------------

代码示例来源:origin: apache/pdfbox

private JDialog createJumpDialog()
  final JDialog dialog = new JDialog(SwingUtilities.windowForComponent(this), "Jump to index");
  dialog.setLocationRelativeTo(this);
  final JLabel nowLabel = new JLabel("Present index: " + selectedIndex);
  contentPanel.add(panel);
  contentPanel.add(inputPanel);
  dialog.getContentPane().add(contentPanel);
  dialog.pack();
  return dialog;

代码示例来源:origin: camunda/camunda-bpm-platform

bottom.setLayout(new FlowLayout());
main.setLayout(new FlowLayout());
main.add(new JLabel(label));
_textField = new JTextField(size);
main.add(_textField);
JButton ok = new JButton("Ok");
ok.addActionListener(new ActionListener() {
 public void actionPerformed(ActionEvent e) {
JButton cancel = new JButton("Cancel");
cancel.addActionListener(new ActionListener() {
 public void actionPerformed(ActionEvent e) {
bottom.add(ok);
bottom.add(cancel);
getContentPane().add(main, BorderLayout.CENTER);
getContentPane().add(bottom, BorderLayout.SOUTH);
pack();
centerWindow(this);

代码示例来源:origin: magefree/mage

public static void main(String... args) {
    JFrame f = new JFrame();

    f.setSize(600, 400);
    f.setVisible(true);

    MageFloatPane fp = new MageFloatPane();
    fp.setCard("Card");

    MageRoundPane popupContainer = new MageRoundPane();
    popupContainer.setLayout(null);

    popupContainer.add(fp);
    //popupContainer.setVisible(false);
    popupContainer.setBounds(0, 0, 320 + 80, 201 + 80);

    JDialog floatOnParent = new JDialog(f, false);
    floatOnParent.setUndecorated(true);
    floatOnParent.getContentPane().add(popupContainer);

    floatOnParent.setBounds(300, 100, 300, 200);
    floatOnParent.setVisible(true);
  }
}

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

frame.addInternalFrameListener(InternalWindowListener.wrap(listener));
((JDesktopPane) owner).add(frame);
frame.getContentPane().add(panel);
frame.pack();
return frame;
final JDialog dialog = new JDialog((Frame) owner, title);
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
dialog.addWindowListener(listener);
dialog.getContentPane().add(panel);
dialog.pack();
return dialog;
final JDialog dialog = new JDialog((Dialog) owner, title);
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
dialog.addWindowListener(listener);
dialog.getContentPane().add(panel);
dialog.pack();
return dialog;

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

public void run() {
   JFrame frame = new JFrame();
   JButton button = new JButton();
   button.addActionListener(new ActionListener() {
    @Override
   frame.getContentPane().add(button);
   frame.pack();
   frame.setVisible(true);
private JDialog dialog = new JDialog(frame, "Swingworker test", true);
private JProgressBar progressBar = new JProgressBar();
 progressBar.setStringPainted(true);
 progressBar.setIndeterminate(true);
 dialog.getContentPane().add(progressBar);
 dialog.pack();
 dialog.setModal( false );
 System.out.println("done");
 JLabel label = new JLabel("Task Complete");
 dialog.getContentPane().remove(progressBar);
 dialog.getContentPane().add(label);
 dialog.getContentPane().validate();

相关文章

JDialog类方法