List of usage examples for java.awt Frame add
public Component add(String name, Component comp)
From source file:de.prozesskraft.pmodel.PmodelPartUi1.java
/** * Create contents of the view part.//from www . ja v a 2 s . com */ @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:pl.edu.icm.visnow.lib.utils.ImageUtilities.java
public static Frame getNonClearingFrame(String name, Component c) { final Frame f = new Frame(name) { @Override//from w w w . jav a 2 s .c o m public void update(Graphics g) { paint(g); } }; sizeContainerToComponent(f, c); centerFrame(f); f.setLayout(new BorderLayout()); f.add(c, BorderLayout.CENTER); f.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { f.dispose(); } }); return f; }