本文整理汇总了Java中javax.swing.JFrame.pack方法的典型用法代码示例。如果您正苦于以下问题:Java JFrame.pack方法的具体用法?Java JFrame.pack怎么用?Java JFrame.pack使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JFrame
的用法示例。
在下文中一共展示了JFrame.pack方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: actionPerformed
import javax.swing.JFrame; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
displayAPSEnable=true;
resetBuffer = new float[sx * sy][NUM_CAMERAS];
signalBuffer = new float[sx * sy][NUM_CAMERAS];
displayFrame = new float[sx * sy][NUM_CAMERAS];
displayBuffer = new float[sx * sy][NUM_CAMERAS];
apsDisplayPixmapBuffer = new float[3 * sx * sy][NUM_CAMERAS];
for (int c=0; c< NUM_CAMERAS; c++){
apsDisplay[c] = ImageDisplay.createOpenGLCanvas();
apsFrame = new JFrame("APS Camera " + c);
apsFrame.setPreferredSize(new Dimension(400, 400));
apsFrame.getContentPane().add(apsDisplay[c], BorderLayout.CENTER);
apsFrame.setVisible(true);
apsFrame.pack();
apsDisplay[c].setImageSize(sx, sy);
}
}
示例2: showtext
import javax.swing.JFrame; //导入方法依赖的package包/类
/** Display a simple non-modal window showing some text. */
public static JFrame showtext(String title, String text) {
JFrame window = new JFrame(title);
JButton done = new JButton("Close");
done.addActionListener(Runner.createDispose(window));
JScrollPane scrollPane = OurUtil.scrollpane(OurUtil.textarea(text, 20, 60, false, false));
window.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
window.getContentPane().setLayout(new BorderLayout());
window.getContentPane().add(scrollPane, BorderLayout.CENTER);
window.getContentPane().add(done, BorderLayout.SOUTH);
window.pack();
window.setSize(500, 500);
window.setLocationRelativeTo(null);
window.setVisible(true);
return window;
}
示例3: createAndShowTaskVisualization3DViewerGUI
import javax.swing.JFrame; //导入方法依赖的package包/类
public static void createAndShowTaskVisualization3DViewerGUI() {
frameTaskVisualization3DViewer = new JFrame("TaskVisualization3DViewer");
frameTaskVisualization3DViewer.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
taskVisualization3D = new TaskVisualization3D();
taskVisualization3D.setOpaque(true); //content panes must be opaque
frameTaskVisualization3DViewer.setContentPane(taskVisualization3D);
frameTaskVisualization3DViewer.pack();
frameTaskVisualization3DViewer.setLocationByPlatform(true);
frameTaskVisualization3DViewer.setVisible(true);
int x = taskVisualization3DSizeX;
int y = taskVisualization3DSizeY;
frameTaskVisualization3DViewer.setSize(x, y);
frameTaskVisualization3DViewer.setBackground(Color.WHITE);
}
示例4: initialize
import javax.swing.JFrame; //导入方法依赖的package包/类
/**
* This will setup EZ for usage. Without calling this method first, none of the other EZ methods will work correctly.
* Parameters will be used to determine width and height of window. Do not call this method more than once in a
* program run.
*
* @param width for the content area of the window.
* @param height for the content area of the window.
*/
public static void initialize(int width, int height) {
String windowName = "ICS111";
JFrame frame = new JFrame(windowName);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// Create and set up the content pane.
EZ newContentPane = new EZ(width, height);
newContentPane.setOpaque(true); // content panes must be opaque
frame.setContentPane(newContentPane);
// Size the frame according to largest element, then display the window.
frame.setResizable(false);
frame.pack();
frame.setVisible(true);
timeDelta = 0;
lastUpdate = System.currentTimeMillis();
}
示例5: initLayerManager
import javax.swing.JFrame; //导入方法依赖的package包/类
protected void initLayerManager() {
JFrame d = new JFrame();
d.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
((JCheckBoxMenuItem)(XML_Menu.commandToMenuItemHash.get("layer_manager_cmd"))).setSelected(false);
}
});
LayerManager lm;
//use existing layer manager if it already exists
if (layerManager != null) {
lm = layerManager;
} else {
lm = new LayerManager();
}
lm.setLayerList( toLayerList(map.overlays) );
lm.setMap(map);
lm.setDialog(d);
JScrollPane sp = new JScrollPane(lm);
sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
d.setTitle("Layer Manager");
d.setContentPane(sp);
// d.getContentPane().add(sp);
d.pack();
d.setSize(new Dimension(lm.getPreferredSize().width+20,lm.getPreferredSize().height+55));
d.setMaximumSize(new Dimension(400,300));
d.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
d.setLocationRelativeTo(frame);
d.setState(Frame.NORMAL);
d.setAlwaysOnTop(true);
this.layerManager = lm;
this.layerManagerDialog = d;
}
示例6: initGraphEditorWindow
import javax.swing.JFrame; //导入方法依赖的package包/类
/**
* init the graph editor window
*/
private void initGraphEditorWindow()
{
// create the window
GraphEditorWindow editor = new GraphEditorWindow();
whiskasPanel.setEditor(editor);
graphEditorFrame= new JFrame("Whiskas Gradient Editor");
graphEditorFrame.getContentPane().add(editor);
graphEditorFrame.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
graphEditorFrame.pack();
graphEditorFrame.setSize(600, 300);
graphEditorFrame.setLocation(this.getX(), this.getY()+this.getHeight());
graphEditorFrame.setVisible(true);
// try {
// InputStream in = ParticleEditor.class.getClassLoader().getResourceAsStream("org/newdawn/slick/tools/peditor/data/icon.gif");
//
// //graphEditorFrame.setIconImage(ImageIO.read(in));
// } catch (IOException e) {
// e.printStackTrace();
// }
}
示例7: createAndShowGUI
import javax.swing.JFrame; //导入方法依赖的package包/类
private static void createAndShowGUI() {
JFrame frame = new JFrame("Extended Speech Services Example");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(new ExtendedExample());
frame.pack();
frame.setVisible(true);
frame.setLocationRelativeTo(null);
}
示例8: run
import javax.swing.JFrame; //导入方法依赖的package包/类
@Override public void run()
{
JFrame frame = new JFrame("TopLevelDemo");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setPreferredSize(new Dimension(800, 600));
_demo = new Demo(frame.getContentPane());
_demo.init();
frame.pack();
frame.setVisible(true);
}
示例9: kernelRemoved
import javax.swing.JFrame; //导入方法依赖的package包/类
public void kernelRemoved(int index) {
if (index >= 0 && index < panelCounter) {
ParameterBrowserPanel panel = panels.get(index);
panels.remove(index);
kernelPanel.remove(panel);
panelCounter--;
JFrame frame = (JFrame) SwingUtilities.getRoot(this);
if (frame != null)
frame.pack();
}
}
示例10: createAndShowGUI
import javax.swing.JFrame; //导入方法依赖的package包/类
/**
* Create the GUI and show it. For thread safety, this method should be
* invoked from the event-dispatching thread.
*/
private static void createAndShowGUI() {
// Create and set up the window.
JFrame frame = new JFrame("TableRenderDemo");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// Create and set up the content pane.
TableRenderDemo newContentPane = new TableRenderDemo();
newContentPane.setOpaque(true); // content panes must be opaque
frame.setContentPane(newContentPane);
// Display the window.
frame.pack();
frame.setVisible(true);
}
示例11: createAndShowGUI
import javax.swing.JFrame; //导入方法依赖的package包/类
/**
* Create the GUI and show it. For thread safety, this method should be
* invoked from the event-dispatching thread.
*/
private static void createAndShowGUI() {
// Create and set up the window.
JFrame frame = new JFrame("SimpleTableDemo");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// Create and set up the content pane.
SimpleTableDemo newContentPane = new SimpleTableDemo();
newContentPane.setOpaque(true); // content panes must be opaque
frame.setContentPane(newContentPane);
// Display the window.
frame.pack();
frame.setVisible(true);
}
示例12: main
import javax.swing.JFrame; //导入方法依赖的package包/类
public static void main(String[] args) {
JFrame f = new JFrame();
StringEnumConfigurer c = new StringEnumConfigurer(null, "Pick one: ", new String[]{"one", "two", "three"});
c.addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
System.err.println(evt.getPropertyName() + " = " + evt.getNewValue());
}
});
f.add(c.getControls());
f.pack();
f.setVisible(true);
}
示例13: main
import javax.swing.JFrame; //导入方法依赖的package包/类
public static void main(String[] args) {
try {
LayerTree model = new LayerTree();
JFrame frame = new JFrame("layers");
frame.getContentPane().add( new JScrollPane(model.getLayerTree()));
frame.pack();
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
} catch(IOException e) {
e.printStackTrace();
}
}
示例14: main
import javax.swing.JFrame; //导入方法依赖的package包/类
public static void main( String[] args ) {
JFrame frame = new JFrame( "Simple Graph View" );
frame.setLayout( new FlowLayout() );
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
frame.getContentPane().add( new ManualPanel() );
frame.pack();
frame.setVisible( true );
}
示例15: main
import javax.swing.JFrame; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {
JFrame jf = new JFrame();
Graph g = getGraph();
VisualizationViewer vv = new VisualizationViewer(new SpringLayout(g), new PluggableRenderer());
jf.getContentPane().add(vv);
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jf.pack();
jf.setVisible(true);
}