List of usage examples for java.awt Frame pack
@SuppressWarnings("deprecation") public void pack()
From source file:grafici.StatisticheBarChart.java
/** * Creates a new demo instance./*from ww w. j av a 2 s. c om*/ * * @param title * the frame title. */ public StatisticheBarChart(Table risultati, Composite parent, int style, int variabile, int valore) { super(parent, style); try { this.titolo = risultati.getColumn(variabile).getText().toUpperCase() + " - " + risultati.getColumn(valore).getText().toUpperCase(); GridData gdThis = new GridData(SWT.FILL); gdThis.horizontalAlignment = SWT.FILL; gdThis.verticalAlignment = SWT.FILL; gdThis.grabExcessHorizontalSpace = true; gdThis.grabExcessVerticalSpace = true; this.setLayoutData(gdThis); this.setLayout(new GridLayout(1, false)); Composite cmp = new Composite(this, SWT.FILL | SWT.EMBEDDED); GridData gdCmp = new GridData(SWT.FILL); gdCmp.horizontalAlignment = SWT.FILL; gdCmp.verticalAlignment = SWT.FILL; gdCmp.grabExcessHorizontalSpace = true; gdCmp.grabExcessVerticalSpace = true; cmp.setLayoutData(gdCmp); cmp.setLayout(new GridLayout(1, false)); CategoryDataset dataset = createDataset(risultati, variabile, valore); JFreeChart chart = createChart(dataset, risultati, variabile, valore); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setFillZoomRectangle(true); // chartPanel.setMouseWheelEnabled(true); // chartPanel.setPreferredSize(new Dimension(1000, 700)); Frame graphFrame = SWT_AWT.new_Frame(cmp); graphFrame.add(chartPanel); graphFrame.pack(); } catch (Exception e) { alertGraficoNonDisp(); } }
From source file:grafici.PazientiBarChart.java
/** * Creates a new demo instance.//ww w. j a va2 s .c o m * * @param title * the frame title. */ public PazientiBarChart(String title, Composite parent, int style, int tipo) { super(parent, style); try { this.titolo = title; GridData gdThis = new GridData(SWT.FILL); gdThis.horizontalAlignment = SWT.FILL; gdThis.verticalAlignment = SWT.FILL; gdThis.grabExcessHorizontalSpace = true; gdThis.grabExcessVerticalSpace = true; this.setLayoutData(gdThis); this.setLayout(new GridLayout(1, false)); Composite cmp = new Composite(this, SWT.FILL | SWT.EMBEDDED); GridData gdCmp = new GridData(SWT.FILL); gdCmp.horizontalAlignment = SWT.FILL; gdCmp.verticalAlignment = SWT.FILL; gdCmp.grabExcessHorizontalSpace = true; gdCmp.grabExcessVerticalSpace = true; cmp.setLayoutData(gdCmp); cmp.setLayout(new GridLayout(1, false)); CategoryDataset dataset = createDataset(tipo); JFreeChart chart = createChart(dataset); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setFillZoomRectangle(true); // chartPanel.setMouseWheelEnabled(true); // chartPanel.setPreferredSize(new Dimension(1000, 700)); Frame graphFrame = SWT_AWT.new_Frame(cmp); graphFrame.add(chartPanel); graphFrame.pack(); } catch (Exception e) { e.printStackTrace(); } }
From source file:grafici.MediciBarChart.java
/** * Creates a new demo instance.//from www . ja v a2 s . c om * * @param title * the frame title. */ public MediciBarChart(String title, Composite parent, int style, int tipo) { super(parent, style); try { this.titolo = title; GridData gdThis = new GridData(SWT.FILL); gdThis.horizontalAlignment = SWT.FILL; gdThis.verticalAlignment = SWT.FILL; gdThis.grabExcessHorizontalSpace = true; gdThis.grabExcessVerticalSpace = true; this.setLayoutData(gdThis); this.setLayout(new GridLayout(1, false)); Composite cmp = new Composite(this, SWT.FILL | SWT.EMBEDDED); GridData gdCmp = new GridData(SWT.FILL); gdCmp.horizontalAlignment = SWT.FILL; gdCmp.verticalAlignment = SWT.FILL; gdCmp.grabExcessHorizontalSpace = true; gdCmp.grabExcessVerticalSpace = true; cmp.setLayoutData(gdCmp); cmp.setLayout(new GridLayout(1, false)); CategoryDataset dataset = createDataset(tipo); JFreeChart chart = createChart(dataset); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setFillZoomRectangle(true); // chartPanel.setMouseWheelEnabled(true); // chartPanel.setPreferredSize(new Dimension(1000, 700)); Frame graphFrame = SWT_AWT.new_Frame(cmp); graphFrame.add(chartPanel); graphFrame.pack(); } catch (Exception e) { e.printStackTrace(); } }
From source file:grafici.PrenotazioniBarChart.java
/** * Creates a new demo instance.//from w w w . jav a 2 s .c o m * * @param title * the frame title. */ public PrenotazioniBarChart(String title, Composite parent, int style, int tipo) { super(parent, style); try { this.titolo = title; GridData gdThis = new GridData(SWT.FILL); gdThis.horizontalAlignment = SWT.FILL; gdThis.verticalAlignment = SWT.FILL; gdThis.grabExcessHorizontalSpace = true; gdThis.grabExcessVerticalSpace = true; this.setLayoutData(gdThis); this.setLayout(new GridLayout(1, false)); Composite cmp = new Composite(this, SWT.FILL | SWT.EMBEDDED); GridData gdCmp = new GridData(SWT.FILL); gdCmp.horizontalAlignment = SWT.FILL; gdCmp.verticalAlignment = SWT.FILL; gdCmp.grabExcessHorizontalSpace = true; gdCmp.grabExcessVerticalSpace = true; cmp.setLayoutData(gdCmp); cmp.setLayout(new GridLayout(1, false)); CategoryDataset dataset = createDataset(tipo); JFreeChart chart = createChart(dataset); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setFillZoomRectangle(true); // chartPanel.setMouseWheelEnabled(true); // chartPanel.setPreferredSize(new Dimension(1000, 700)); Frame graphFrame = SWT_AWT.new_Frame(cmp); graphFrame.add(chartPanel); graphFrame.pack(); } catch (Exception e) { e.printStackTrace(); } }
From source file:de.prozesskraft.pkraft.Createdoc.java
/** * Create contents of the window.//from w ww . j a v a 2 s . c o m */ protected static void createContents(PmodelViewPage page) { shell = new Shell(); shell.setSize(3500, 1500); shell.setText("SWT Application"); shell.setLayout(new GridLayout(1, false)); Composite composite = new Composite(shell, SWT.NONE); GridData gd_composite = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1); gd_composite.minimumWidth = 10; gd_composite.minimumHeight = 10; composite.setLayoutData(gd_composite); composite.setLayout(new GridLayout(1, false)); Composite composite2 = new Composite(composite, SWT.EMBEDDED | SWT.NO_BACKGROUND); GridData gd_composite2 = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1); gd_composite2.minimumWidth = 10; gd_composite2.minimumHeight = 10; composite2.setLayoutData(gd_composite2); Frame frame = SWT_AWT.new_Frame(composite2); // Label lblNewLabel = new Label(composite, SWT.BORDER); // lblNewLabel.setBounds(100, 10, 66, 17); // lblNewLabel.setText("sxsdsds"); frame.add(page, BorderLayout.CENTER); page.init(); frame.pack(); frame.setLocation(0, 0); frame.setVisible(true); page.refresh(); }
From source file:CustomAlphaTest.java
protected void addCanvas3D(Canvas3D c3d) { Frame frame = new Frame("Custom Alpha Test"); Panel aPanel = new Panel(); aPanel.setLayout(new BorderLayout()); aPanel.add(c3d, BorderLayout.CENTER); frame.add(aPanel);//ww w. jav a 2 s . c o m frame.pack(); frame.setSize(new Dimension(320, 320)); frame.validate(); frame.setVisible(true); doLayout(); }
From source file:LightTest.java
protected void createLight(LightObject light, BranchGroup objRoot) { Frame frame = new Frame(light.getName()); Panel aPanel = new Panel(); frame.add(aPanel);/* www .ja v a2 s. com*/ light.addUiToPanel(aPanel); frame.pack(); frame.setSize(new Dimension(400, 250)); frame.validate(); frame.setVisible(true); // add the geometry that depicts the light // to the scenegraph objRoot.addChild(light.createGeometry()); // finally add the light itself to the scenegraph objRoot.addChild(light.getLight()); }
From source file:de.prozesskraft.pmodel.PmodelPartUi1.java
/** * Create contents of the view part.//w ww . j av a2 s . co m */ @PostConstruct public void createControls(Composite composite) { composite.setSize(613, 649); GridData gd_composite = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1); gd_composite.minimumWidth = 10; gd_composite.minimumHeight = 10; composite.setLayoutData(gd_composite); composite.setLayout(new GridLayout(1, false)); Composite composite_1 = new Composite(composite, SWT.NONE); GridLayout gl_composite_1 = new GridLayout(4, false); gl_composite_1.marginWidth = 0; gl_composite_1.marginHeight = 0; composite_1.setLayout(gl_composite_1); GridData gd_composite_1 = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1); gd_composite_1.heightHint = 445; gd_composite_1.widthHint = 122; composite_1.setLayoutData(gd_composite_1); Composite composite_11 = new Composite(composite_1, SWT.NONE); composite_11.setLayout(new GridLayout(1, false)); GridData gd_composite_11 = new GridData(SWT.LEFT, SWT.FILL, false, true, 1, 1); gd_composite_11.heightHint = 437; gd_composite_11.widthHint = 169; composite_11.setLayoutData(gd_composite_11); Group grpVisual = new Group(composite_11, SWT.NONE); grpVisual.setText("visual"); grpVisual.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); grpVisual.setLayout(new GridLayout(2, false)); // ExpandBar barVisual = new ExpandBar(composite_11, SWT.V_SCROLL); // Composite grpVisual = new Composite(barVisual, SWT.NONE); // ExpandItem item0 = new ExpandItem(barVisual, SWT.NONE, 0); // item0.setText("visual settings"); // item0.setHeight(grpVisual.computeSize(SWT.DEFAULT, SWT.DEFAULT).y); // item0.setControl(grpVisual); // item0.setExpanded(true); // barVisual.setSpacing(8); Label lblNewLabel_2 = new Label(grpVisual, SWT.NONE); lblNewLabel_2.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); lblNewLabel_2.setText("size"); scale_size = new Scale(grpVisual, SWT.NONE); scale_size.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); scale_size.setMaximum(200); scale_size.setMinimum(10); scale_size.setSelection(100); scale_size.addMouseWheelListener(listener_mousewheel_size); Label lblNewLabel_21 = new Label(grpVisual, SWT.NONE); lblNewLabel_21.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); lblNewLabel_21.setText("zoom"); scale_zoom = new Scale(grpVisual, SWT.NONE); scale_zoom.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); scale_zoom.setMaximum(200); scale_zoom.setMinimum(10); scale_zoom.setSelection(100); scale_zoom.addMouseWheelListener(listener_mousewheel_zoom); // Label lblNewLabel_3 = new Label(grpVisual, SWT.NONE); // lblNewLabel_3.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); // lblNewLabel_3.setText("label"); // spinner_labelsize = new Spinner(grpVisual, SWT.BORDER); // spinner_labelsize.setMaximum(20); // spinner_labelsize.setSelection(10); // spinner_labelsize.setMinimum(0); Label lblNewLabel_4 = new Label(grpVisual, SWT.NONE); lblNewLabel_4.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); lblNewLabel_4.setText("text"); spinner_textsize = new Spinner(grpVisual, SWT.BORDER); spinner_textsize.setMaximum(20); spinner_textsize.setSelection(10); spinner_textsize.setMinimum(0); button_fix = new Button(grpVisual, SWT.NONE | SWT.TOGGLE); button_fix.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); button_fix.setText("fix"); Button btnNewButton2 = new Button(grpVisual, SWT.NONE); btnNewButton2.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1)); btnNewButton2.setText("autoscale"); btnNewButton2.addSelectionListener(listener_autoscale_button); Group grpFunction = new Group(composite_11, SWT.NONE); grpFunction.setLayout(new GridLayout(2, false)); grpFunction.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1)); grpFunction.setText("function"); button_refresh = new Button(grpFunction, SWT.NONE | SWT.PUSH); button_refresh.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); button_refresh.setText("refresh"); button_refresh.addListener(SWT.Selection, (Listener) listener_refresh_button); button_refresh.setEnabled(true); // button_refresh.getDisplay().asyncExec( new Runnable() // { // public void run() // { // // das Prozess Binary File ueberwachen // // Wenn modifiziert wurde? dann soll Enable=true gesetzt werden // // Path processRootDir = Paths.get(einstellungen.getProcess().getRootdir()); // Path processRootDir = Paths.get("/localhome/avoge/Desktop"); // // System.err.println("watching directory " + processRootDir); // // try { // // Watch Service erstellen // WatchService service = FileSystems.getDefault().newWatchService(); // // // Watch key erstellen // WatchKey key = processRootDir.register(service, ENTRY_MODIFY); // // while(true) // { // try { // Thread.sleep(500); // } catch (InterruptedException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // } // WatchKey key1; // try // { // key1 = service.take(); // } // catch (InterruptedException x) // { // break; // } // // for(WatchEvent<?> event: key1.pollEvents()) // { // WatchEvent.Kind<?> kind = event.kind(); // // if(kind == OVERFLOW) // { // continue; // } // // WatchEvent<Path> ev = (WatchEvent<Path>) event; // Path filename = ev.context(); // Path child = processRootDir.resolve(filename); // log("debug", "directory modified"); // // if(child.equals(Paths.get(einstellungen.getProcess().getRootdir() + "/process.pmb"))) //// if(child.equals(Paths.get("/localhome/avoge/Desktop/testfileNotification"))) // { // button_refresh.setEnabled(true); // log("debug", "binary modified"); // } // } // } // // } catch (IOException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // } // } // }); button_startmanager = new Button(grpFunction, SWT.NONE); button_startmanager.setSelection(true); GridData gd_btnNewButton = new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1); gd_btnNewButton.widthHint = 69; button_startmanager.setLayoutData(gd_btnNewButton); button_startmanager.setText("start new manager"); button_startmanager.addSelectionListener(listener_startmanager_button); button_stopmanager = new Button(grpFunction, SWT.NONE); button_stopmanager.setSelection(true); GridData gd_button_stopmanager = new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1); gd_button_stopmanager.widthHint = 69; button_stopmanager.setLayoutData(gd_button_stopmanager); button_stopmanager.setText("stop manager"); button_stopmanager.addSelectionListener(listener_stopmanager_button); label_marked = new Label(composite_11, SWT.NONE); label_marked.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); label_marked.setText("New Label"); SashForm sashForm = new SashForm(composite_1, SWT.SMOOTH); sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); new Label(composite_1, SWT.NONE); Composite composite_12 = new Composite(sashForm, SWT.EMBEDDED | SWT.NO_BACKGROUND); composite_12.setLayout(new GridLayout(1, false)); GridData gd_composite_12 = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1); gd_composite_12.heightHint = 390; gd_composite_12.minimumWidth = 10; gd_composite_12.minimumHeight = 10; composite_12.setLayoutData(gd_composite_12); Frame frame = SWT_AWT.new_Frame(composite_12); frame.add(applet, BorderLayout.CENTER); applet.init(); frame.pack(); frame.setLocation(0, 0); frame.setVisible(true); Composite composite_13 = new Composite(sashForm, SWT.NONE); composite_13.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); GridLayout gl_composite_13 = new GridLayout(1, false); gl_composite_13.marginWidth = 0; gl_composite_13.marginHeight = 0; composite_13.setLayout(gl_composite_13); // tabFolder_13.addSelectionListener(listener_tabFolder_selection); new Label(composite_1, SWT.NONE); // SashForm sashForm_13 = new SashForm(composite_13, SWT.SMOOTH | SWT.VERTICAL); // composite_13.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); composite_131 = new Composite(composite_13, SWT.BORDER); composite_131.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1)); GridLayout gl_composite_131 = new GridLayout(1, false); gl_composite_131.marginWidth = 0; gl_composite_131.marginHeight = 0; composite_131.setLayout(gl_composite_131); composite_132 = new Composite(composite_13, SWT.BORDER); composite_132.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); GridLayout gl_composite_132 = new GridLayout(1, false); gl_composite_132.marginWidth = 0; gl_composite_132.marginHeight = 0; composite_132.setLayout(gl_composite_132); Composite composite_2 = new Composite(composite, SWT.NONE); composite_2.setLayout(new GridLayout(1, false)); GridData gd_composite_2 = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1); gd_composite_2.heightHint = 164; composite_2.setLayoutData(gd_composite_2); // text_logging = new Text(composite_2, SWT.BORDER | SWT.READ_ONLY | SWT.V_SCROLL | SWT.MULTI); // text_logging.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); text_logging = new StyledText(composite_2, SWT.BORDER | SWT.READ_ONLY | SWT.V_SCROLL | SWT.MULTI); text_logging.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); // virtuelle ablage fuer gerade nicht anzuzeigende composites shell_dummy_insight = new Shell(display); // shell_dummy_insight.setLayout(new FillLayout()); bindingContextVisual = initDataBindingsVisual(); bindingContextMarked = initDataBindingsMarked(); bindingContextRefresh = initDataBindingsRefresh(); // erzeugen der 'step-insight' listeners beim wechsel der markierung generateNewInsight(einstellungen); // erzeugen den insight fuer den Prozess createControlsProcessInsight(composite_131); new Label(composite_131, SWT.NONE); // erzeugen der ersten insight ansicht fuer den aktuell markierten step (root) createControlsStepInsight(composite_132); // die processing darstellung refreshen applet_refresh(); }
From source file:HelloUniverse.java
public VirtualInputDevice(String[] args) { // default user-definable values printvalues = false;//from w w w .j a va 2 s.c o m xscreeninitloc = 400; yscreeninitloc = 0; xscreensize = 400; yscreensize = 200; xobjinitloc = 0.0f; yobjinitloc = 0.0f; zobjinitloc = 2.2f; xaxisrotinit = 0.0f; yaxisrotinit = 0.0f; zaxisrotinit = 0.0f; for (int i = 0; i < args.length; i += 2) { if (args[i] == null) break; else if (args[i] == "printvalues") printvalues = (Boolean.valueOf(args[i + 1])).booleanValue(); else if (args[i] == "xscreeninitloc") xscreeninitloc = (Integer.valueOf(args[i + 1])).intValue(); else if (args[i] == "yscreeninitloc") yscreeninitloc = (Integer.valueOf(args[i + 1])).intValue(); else if (args[i] == "xscreensize") xscreensize = (Integer.valueOf(args[i + 1])).intValue(); else if (args[i] == "yscreensize") yscreensize = (Integer.valueOf(args[i + 1])).intValue(); else if (args[i] == "xobjinitloc") xobjinitloc = (Float.valueOf(args[i + 1])).floatValue(); else if (args[i] == "yobjinitloc") yobjinitloc = (Float.valueOf(args[i + 1])).floatValue(); else if (args[i] == "zobjinitloc") zobjinitloc = (Integer.valueOf(args[i + 1])).floatValue(); } if (printvalues == true) { System.out.println("Initial values for VirtualInputDevice:"); System.out.println("xscreeninitloc = " + xscreeninitloc); System.out.println("yscreeninitloc = " + yscreeninitloc); System.out.println("xscreeninitsize = " + xscreensize); System.out.println("yscreeninitsize = " + yscreensize); System.out.println("xobjinitloc = " + xobjinitloc); System.out.println("yobjinitloc = " + yobjinitloc); System.out.println("zobjinitloc = " + zobjinitloc); System.out.println("xaxisrotinit = " + xaxisrotinit); System.out.println("yaxisrotinit = " + yaxisrotinit); System.out.println("zaxisrotinit = " + zaxisrotinit); } // initialize the InputDevice GUI Frame deviceFrame = new Frame(); deviceFrame.setSize(xscreensize, yscreensize); deviceFrame.setLocation(xscreeninitloc, yscreeninitloc); deviceFrame.setTitle("Virtual Input Device"); ButtonPositionControls positionControls; // initialize position with initial x, y, and z position positionControls = new ButtonPositionControls(xobjinitloc, yobjinitloc, zobjinitloc); WheelControls rotControls; // initialize rotations with initial angles in radians) rotControls = new WheelControls(xaxisrotinit, yaxisrotinit, zaxisrotinit); positionControls.setDevice(this); Panel devicePanel = new Panel(); devicePanel.setLayout(new BorderLayout()); devicePanel.add("East", positionControls); devicePanel.add("West", rotControls); deviceFrame.add(devicePanel); deviceFrame.pack(); deviceFrame.setVisible(true); initPos.set(xobjinitloc, yobjinitloc, zobjinitloc); this.positionControls = positionControls; this.rotControls = rotControls; // default processing mode processingMode = InputDevice.DEMAND_DRIVEN; sensors[0] = new Sensor(this); }
From source file:SplineInterpolatorTest.java
public UiAlpha(Alpha alpha) { m_Alpha = alpha;//from ww w . ja va 2 s .c o m Frame frame = new Frame("Alpha Control Panel"); JPanel panel = new JPanel(); frame.add(panel); addUiToPanel(panel); frame.pack(); frame.setSize(new Dimension(400, 80)); frame.validate(); frame.setVisible(true); }