本文整理汇总了Java中javax.swing.JDialog.getContentPane方法的典型用法代码示例。如果您正苦于以下问题:Java JDialog.getContentPane方法的具体用法?Java JDialog.getContentPane怎么用?Java JDialog.getContentPane使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JDialog
的用法示例。
在下文中一共展示了JDialog.getContentPane方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addTo
import javax.swing.JDialog; //导入方法依赖的package包/类
/**
* Expects to be added to a GameModule. Adds a JButton to the control window's toolbar. Pushing the button displays
* the window
*/
public void addTo(Buildable b) {
rebuild();
launch.setAlignmentY(0.0F);
GameModule.getGameModule().getToolBar().add(launch);
frame = new JDialog(GameModule.getGameModule().getFrame());
GameModule.getGameModule().addKeyStrokeSource(new KeyStrokeSource(frame.getRootPane(), JComponent.WHEN_IN_FOCUSED_WINDOW));
while (root.getComponentCount() > 0) {
frame.add(root.getComponent(0));
}
root = frame.getContentPane();
frame.setTitle(launch.getAttributeValueString(DEPRECATED_NAME));
int count = GameModule.getGameModule().getComponentsOf(ChartWindow.class).size();
id = "ChartWindow" + count; //$NON-NLS-1$
}
示例2: initSpyDialog
import javax.swing.JDialog; //导入方法依赖的package包/类
/**
* Initializes Spy dialog.
*/
protected void initSpyDialog(Component rootComponent, Component component) {
if (rootComponent instanceof Dialog) {
spyDialog = new CaddyDialog((Dialog) rootComponent) {
@Override
protected JRootPane createRootPane() {
return createSpyRootPane();
}
};
} else if (rootComponent instanceof Frame) {
spyDialog = new CaddyDialog((Frame) rootComponent) {
@Override
protected JRootPane createRootPane() {
return createSpyRootPane();
}
};
} else {
spyDialog = new JDialog() {
@Override
protected JRootPane createRootPane() {
return createSpyRootPane();
}
};
}
spyDialog.setName("SwingSpy");
spyDialog.setTitle("SwingSpy");
spyDialog.setModal(false);
spyDialog.setAlwaysOnTop(true);
Container contentPane = spyDialog.getContentPane();
contentPane.setLayout(new BorderLayout());
spyPanel = new SwingSpyPanel();
spyPanel.reload(rootComponent, component);
contentPane.add(spyPanel);
spyDialog.pack();
spyDialog.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
super.windowClosed(e);
spyGlass.setVisible(false);
spyDialog = null;
}
});
spyDialog.setLocationRelativeTo(null);
spyDialog.setVisible(true);
}
示例3: MainFrame
import javax.swing.JDialog; //导入方法依赖的package包/类
/**
* Construct the frame.
* @param gc graphics configuration used,
* see {@link javax.swing.JFrame#JFrame(java.awt.GraphicsConfiguration)}
*/
private MainFrame(GraphicsConfiguration gc) {
super(gc);
// I thought this should only be needed if the method was called
// from outside the getInstance() method, but if we don't do this
// then the GUI never appears. We probably should figure out why.
instance = this;
// set the WM class
try {
Toolkit xToolkit = Toolkit.getDefaultToolkit();
java.lang.reflect.Field awtAppClassNameField =
xToolkit.getClass().getDeclaredField("awtAppClassName");
awtAppClassNameField.setAccessible(true);
awtAppClassNameField.set(xToolkit, "GATE Developer " + Main.version);
} catch(Exception e) {
// this happens every time on Windows and Mac so hide the exception
// unless we are debugging something
log.debug("Could not set WM Class (note that this is normal if you " +
"are not on an X11-based window system)", e);
}
guiRoots.add(this);
if(fileChooser == null) {
fileChooser = new XJFileChooser();
fileChooser.setMultiSelectionEnabled(false);
fileChooser.setAcceptAllFileFilterUsed(true);
guiRoots.add(fileChooser);
// the JFileChooser seems to size itself better once it's been
// added to a top level container such as a dialog.
JDialog dialog = new JDialog(this, "", true);
java.awt.Container contentPane = dialog.getContentPane();
contentPane.setLayout(new BorderLayout());
contentPane.add(fileChooser, BorderLayout.CENTER);
dialog.pack();
dialog.getContentPane().removeAll();
dialog.dispose();
dialog = null;
}
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
initLocalData();
initGuiComponents();
initListeners();
}