本文整理汇总了Java中javax.swing.JDialog.setContentPane方法的典型用法代码示例。如果您正苦于以下问题:Java JDialog.setContentPane方法的具体用法?Java JDialog.setContentPane怎么用?Java JDialog.setContentPane使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JDialog
的用法示例。
在下文中一共展示了JDialog.setContentPane方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDialog
import javax.swing.JDialog; //导入方法依赖的package包/类
/**
* Gets the authorization dialog.
*
* @param presetUsername username which should be shown preset when displaying the dialog
* @param owner the window to which the dialog should belong (to center etc.)
* @return the dialog
*/
public JDialog getDialog(String presetUsername, Window owner) {
authDialog = new JDialog(owner);
OIDCPanel oidcPanel = new OIDCPanel(this);
if (presetUsername != null) {
oidcPanel.getJTextFieldUsername().setText(presetUsername);
}
authDialog.setContentPane(oidcPanel);
authDialog.setSize(new Dimension(500, 190));
authDialog.setLocationRelativeTo(null);
return authDialog;
}
示例2: showProgress
import javax.swing.JDialog; //导入方法依赖的package包/类
public static ProgressDialog showProgress(Component parent, String message)
{
JDialog d = ComponentHelper.createJDialog(parent);
ProgressDialog p = new ProgressDialog(d);
d.getRootPane().setWindowDecorationStyle(JRootPane.INFORMATION_DIALOG);
d.setResizable(false);
d.setContentPane(p);
d.setTitle(message);
d.pack();
d.setLocationRelativeTo(parent);
d.setVisible(true);
return p;
}
示例3: getProgressMonitorContainer
import javax.swing.JDialog; //导入方法依赖的package包/类
/**
* Returns the progress monitor container that is either a JDialog or a JInternFrame.
* @return the progress monitor container
*/
private Container getProgressMonitorContainer() {
if (progressMonitorContainer==null) {
Dimension defaultSize = new Dimension(570, 188);
if (this.parentDesktopPane==null) {
JDialog jDialog = new JDialog(this.owner);
jDialog.setSize(defaultSize);
jDialog.setResizable(false);
if (this.owner==null) {
jDialog.setAlwaysOnTop(true);
}
jDialog.setTitle(this.windowTitle);
if (this.iconImage!=null) {
jDialog.setIconImage(this.iconImage.getImage());
}
jDialog.setContentPane(this.getJContentPane());
jDialog.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
this.progressMonitorContainer = jDialog;
this.setLookAndFeel();
} else {
JInternalFrame jInternalFrame = new JInternalFrame();
jInternalFrame.setSize(defaultSize);
jInternalFrame.setResizable(false);
jInternalFrame.setTitle(this.windowTitle);
if (this.iconImage!=null) {
jInternalFrame.setFrameIcon(this.iconImage);
}
jInternalFrame.setContentPane(this.getJContentPane());
jInternalFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
this.progressMonitorContainer = jInternalFrame;
}
}
return progressMonitorContainer;
}
示例4: setEnlargedView
import javax.swing.JDialog; //导入方法依赖的package包/类
/**
* This method shows the enlarged dialog for the current ontology class instances
* in order to provide an easier access for the end user.
*/
private void setEnlargedView() {
JDialog dialog = new JDialog(OntologyVisualisationConfiguration.getOwnerWindow());
dialog.setPreferredSize(new Dimension(100, 200));
dialog.setName("Ontology-Instance-Viewer");
dialog.setTitle(OntologyVisualisationConfiguration.getApplicationTitle() + ": Ontology-Instance-Viewer");
dialog.setModal(true);
dialog.setResizable(true);
dialog.setContentPane(getJContentPane());
// --- Size and center the dialog -----------------
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
int diaWidth = (int) (screenSize.width*0.8);
int diaHeight = (int) (screenSize.height * 0.9);
int left = (screenSize.width - diaWidth) / 2;
int top = (screenSize.height - diaHeight) / 2;
dialog.setSize(new Dimension(diaWidth, diaHeight));
dialog.setLocation(left, top);
// --- Remind and remove THIS from the parent -----
this.getDynTableJPanel().setOntologyClassVisualsationVisible(null);
Container parentContainer = this.getParent();
parentContainer.remove(this);
parentContainer.validate();
parentContainer.repaint();
// --- Add THIS to the dialog ---------------------
this.removeEnlargeTab();
jPanel4TouchDown.add(this, BorderLayout.CENTER);
dialog.setVisible(true);
// - - - - - - - - - - - - - - - - - - - - - - - -
// - - User-Interaction - - - - - - - - - - - - -
// - - - - - - - - - - - - - - - - - - - - - - - -
this.addEnlargeTab();
// --- Add THIS again to the parent ---------------
this.getDynTableJPanel().setOntologyClassVisualsationVisible(null);
parentContainer.add(this);
parentContainer.validate();
parentContainer.repaint();
}
示例5: showOptionDialog
import javax.swing.JDialog; //导入方法依赖的package包/类
protected int showOptionDialog(JFrame mainFrame, String message,
String title, String[] options, int defaultValue) {
final IntHolder holder = new IntHolder();
final JDialog dialog = new JDialog(mainFrame, true);
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
holder.value = defaultValue;
JPanel panel = new JPanel(new BorderLayout());
JPanel m = new JPanel(new FlowLayout());
m.add(new JLabel(message));
panel.add(m, BorderLayout.CENTER);
JPanel bottom = new JPanel(new GridLayout(1, 3, 5, 7));
int i = 0;
for (String s : options) {
final int r = i;
JButton button = new JButton(new AbstractAction(s) {
/**
*
*/
private static final long serialVersionUID = 7269041268620864162L;
@Override
public void actionPerformed(ActionEvent e) {
holder.value = r;
dialog.setVisible(false);
}
});
i++;
bottom.add(button);
}
JPanel p = new JPanel(new FlowLayout());
p.add(bottom);
panel.add(p, BorderLayout.SOUTH);
JPanel pane = new JPanel(new FlowLayout());
pane.add(panel);
dialog.setTitle(title);
dialog.setContentPane(pane);
dialog.pack();
dialog.setResizable(false);
dialog.setLocationRelativeTo(null);
dialog.setVisible(true);
return holder.value;
}