当前位置: 首页>>代码示例>>Java>>正文


Java JFrame.pack方法代码示例

本文整理汇总了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);
        
    }
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:20,代码来源:MultiDavisCameraChip.java

示例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;
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:17,代码来源:OurDialog.java

示例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);
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:19,代码来源:QnactrSimulation.java

示例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();
}
 
开发者ID:gcalica,项目名称:agar.io,代码行数:26,代码来源:EZ.java

示例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;	
	}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:38,代码来源:MapApp.java

示例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();
//		}
	}
 
开发者ID:IngSW-unipv,项目名称:Progetto-C,代码行数:27,代码来源:ParticleEditor.java

示例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);
}
 
开发者ID:Azure-Samples,项目名称:SpeechToText-REST,代码行数:9,代码来源:ExtendedExample.java

示例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);
}
 
开发者ID:JetBrains,项目名称:intellij-deps-ini4j,代码行数:12,代码来源:DemoMain.java

示例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();
	}
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:12,代码来源:FiringModelMap.java

示例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);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:19,代码来源:TableRenderDemo.java

示例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);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:19,代码来源:SimpleTableDemo.java

示例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);
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:13,代码来源:StringEnumConfigurer.java

示例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();
	}
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:13,代码来源:LayerTree.java

示例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 );

    }
 
开发者ID:lauriholmas,项目名称:batmapper,代码行数:12,代码来源:ManualTest1.java

示例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);
}
 
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:10,代码来源:SimpleGraphDraw.java


注:本文中的javax.swing.JFrame.pack方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。