本文整理了Java中javax.swing.JDialog.setContentPane()
方法的一些代码示例,展示了JDialog.setContentPane()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JDialog.setContentPane()
方法的具体详情如下:
包路径:javax.swing.JDialog
类名称:JDialog
方法名:setContentPane
暂无
代码示例来源:origin: libgdx/libgdx
JScrollPane scrollPane = new JScrollPane();
scrollPane.setViewportView(regionPickerPanel);
regionSelectDialog.setContentPane(scrollPane);
regionSelectDialog.setDefaultCloseOperation( JDialog.HIDE_ON_CLOSE);
代码示例来源:origin: libgdx/libgdx
JScrollPane scrollPane = new JScrollPane();
scrollPane.setViewportView(regionPickerPanel);
regionSelectDialog.setContentPane(scrollPane);
regionSelectDialog.setDefaultCloseOperation( JDialog.HIDE_ON_CLOSE);
代码示例来源: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: 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: kiegroup/optaplanner
public ConferenceCFPImportWorker(SolutionBusiness<ConferenceSolution> solutionBusiness,
SolutionPanel<ConferenceSolution> solutionPanel, String conferenceBaseUrl) {
this.solutionBusiness = solutionBusiness;
this.solutionPanel = solutionPanel;
this.conferenceBaseUrl = conferenceBaseUrl;
dialog = new JDialog(solutionPanel.getSolverAndPersistenceFrame(), true);
JPanel contentPane = new JPanel(new BorderLayout(10, 10));
contentPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
contentPane.add(new JLabel("Importing CFP data in progress..."), BorderLayout.NORTH);
JProgressBar progressBar = new JProgressBar(SwingConstants.HORIZONTAL);
progressBar.setIndeterminate(true);
contentPane.add(progressBar, BorderLayout.CENTER);
JButton button = new JButton("Cancel");
button.addActionListener(e -> cancel(false));
contentPane.add(button, BorderLayout.SOUTH);
dialog.setContentPane(contentPane);
dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
dialog.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
cancel(false);
}
});
dialog.pack();
dialog.setLocationRelativeTo(solutionPanel.getSolverAndPersistenceFrame());
}
代码示例来源: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: marytts/marytts
private void miProxy1ActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_miProxy1ActionPerformed
ProxyPanel prp = new ProxyPanel(System.getProperty("http.proxyHost"), System.getProperty("http.proxyPort"));
final JOptionPane optionPane = new JOptionPane(prp, JOptionPane.PLAIN_MESSAGE, JOptionPane.YES_NO_OPTION, null,
new String[] { "OK", "Cancel" }, "OK");
final JDialog dialog = new JDialog((Frame) null, "", true);
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))) {
dialog.setVisible(false);
}
}
});
dialog.pack();
dialog.setVisible(true);
if ("OK".equals(optionPane.getValue())) {
System.setProperty("http.proxyHost", prp.getProxyHost());
System.setProperty("http.proxyPort", prp.getProxyPort());
}
}// GEN-LAST:event_miProxy1ActionPerformed
代码示例来源:origin: marytts/marytts
private void miProxy1ActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_miProxy1ActionPerformed
ProxyPanel prp = new ProxyPanel(System.getProperty("http.proxyHost"), System.getProperty("http.proxyPort"));
final JOptionPane optionPane = new JOptionPane(prp, JOptionPane.PLAIN_MESSAGE, JOptionPane.YES_NO_OPTION, null,
new String[] { "OK", "Cancel" }, "OK");
final JDialog dialog = new JDialog((Frame) null, "", true);
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))) {
dialog.setVisible(false);
}
}
});
dialog.pack();
dialog.setVisible(true);
if ("OK".equals(optionPane.getValue())) {
System.setProperty("http.proxyHost", prp.getProxyHost());
System.setProperty("http.proxyPort", prp.getProxyPort());
}
}// GEN-LAST:event_miProxy1ActionPerformed
代码示例来源:origin: marytts/marytts
optionPane.setPreferredSize(new Dimension(800, 600));
final JDialog dialog = new JDialog((Frame) null, "Do you accept the following license?", true);
dialog.setContentPane(optionPane);
optionPane.addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent e) {
代码示例来源:origin: marytts/marytts
@Override
protected PasswordAuthentication getPasswordAuthentication() {
PasswordPanel passP = new PasswordPanel();
final JOptionPane optionPane = new JOptionPane(passP, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION,
null, new String[] { "OK", "Cancel" }, "OK");
final JDialog dialog = new JDialog((Frame) null, "", true);
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))) {
dialog.setVisible(false);
}
}
});
dialog.pack();
dialog.setVisible(true);
if ("OK".equals(optionPane.getValue())) {
return new PasswordAuthentication(passP.getUser(), passP.getPassword());
}
return null;
}
});
代码示例来源:origin: marytts/marytts
optionPane.setPreferredSize(new Dimension(800, 600));
final JDialog dialog = new JDialog((Frame) null, "Do you accept the following license?", true);
dialog.setContentPane(optionPane);
optionPane.addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent e) {
代码示例来源:origin: marytts/marytts
@Override
protected PasswordAuthentication getPasswordAuthentication() {
PasswordPanel passP = new PasswordPanel();
final JOptionPane optionPane = new JOptionPane(passP, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION,
null, new String[] { "OK", "Cancel" }, "OK");
final JDialog dialog = new JDialog((Frame) null, "", true);
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))) {
dialog.setVisible(false);
}
}
});
dialog.pack();
dialog.setVisible(true);
if ("OK".equals(optionPane.getValue())) {
return new PasswordAuthentication(passP.getUser(), passP.getPassword());
}
return null;
}
});
代码示例来源:origin: stackoverflow.com
new float[]{0f, 0.3f, 1f}, new Color[]{new Color(0.8f, 0.8f, 1f),
new Color(0.7f, 0.7f, 1f), new Color(0.6f, 0.6f, 1f)});
dialog.setContentPane(panel);
dialog.setVisible(true);
代码示例来源:origin: stackoverflow.com
setContentPane(optionPane);
代码示例来源:origin: stackoverflow.com
setContentPane(new BackgroundPanel());
代码示例来源:origin: stackoverflow.com
this.setContentPane(pnl);
this.pack();
this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
代码示例来源:origin: stackoverflow.com
JDialog dialog = new JDialog();
JPanel reallyComplexPanel = new JPanel(new BorderLayout());
// add in stuff here, e.g buttons at the bottom
Something mySomething = new Something();
reallyComplexPanel .add(mySomething, BorderLayout.NORTH); // my stuff at the top
dialog.setContentPane(reallyComplexPanel);
代码示例来源:origin: edu.stanford.protege/protege-editor-owl
/**
* Constructs a ProgressDialog. A ProgressDialog contains a message and an optional sub-message.
*/
public ProgressDialog() {
dlg.setUndecorated(true);
JPanel contentPane = new JPanel();
contentPane.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.LIGHT_GRAY));
dlg.setContentPane(contentPane);
contentPane.setLayout(new BorderLayout());
contentPane.add(view.asJComponent(), BorderLayout.NORTH);
}
代码示例来源:origin: protegeproject/protege
/**
* Constructs a ProgressDialog. A ProgressDialog contains a message and an optional sub-message.
*/
public ProgressDialog() {
dlg.setUndecorated(true);
JPanel contentPane = new JPanel();
contentPane.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.LIGHT_GRAY));
dlg.setContentPane(contentPane);
contentPane.setLayout(new BorderLayout());
contentPane.add(view.asJComponent(), BorderLayout.NORTH);
}
代码示例来源:origin: matsim-org/matsim
private static JDialog newChartDialog(JFreeChart chart, String title, boolean modal) {
chart.setTitle(title);
JDialog dialog = new JDialog();
dialog.setTitle(title);
dialog.setContentPane(new ChartPanel(chart));
dialog.setModal(modal);
dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
return dialog;
}
}
内容来源于网络,如有侵权,请联系作者删除!