當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。