Esempio n. 1
0
 public org.eclipse.swt.widgets.Shell open(org.eclipse.swt.widgets.Display display) {
   createShell(display);
   createMenuBar();
   createStyledText();
   shell.setSize(500, 400);
   shell.open();
   return shell;
 }
Esempio n. 2
0
 public static void main(java.lang.String[] args) {
   org.eclipse.swt.widgets.Display display = new org.eclipse.swt.widgets.Display();
   org.eclipse.swt.examples.javaviewer.JavaViewer example =
       new org.eclipse.swt.examples.javaviewer.JavaViewer();
   org.eclipse.swt.widgets.Shell shell = example.open(display);
   while (!shell.isDisposed()) {
     if (!display.readAndDispatch()) {
       display.sleep();
     }
   }
   display.dispose();
 }
Esempio n. 3
0
 void createShell(org.eclipse.swt.widgets.Display display) {
   shell = new org.eclipse.swt.widgets.Shell(display);
   shell.setText(resources.getString("Window_title"));
   org.eclipse.swt.layout.GridLayout layout = new org.eclipse.swt.layout.GridLayout();
   layout.numColumns = 1;
   shell.setLayout(layout);
   shell.addShellListener(
       new org.eclipse.swt.events.ShellAdapter() {
         public void shellClosed(org.eclipse.swt.events.ShellEvent e) {
           lineStyler.disposeColors();
           text.removeLineStyleListener(lineStyler);
         }
       });
 }
Esempio n. 4
0
 void createMenuBar() {
   org.eclipse.swt.widgets.Menu bar = new org.eclipse.swt.widgets.Menu(shell, SWT.BAR);
   shell.setMenuBar(bar);
   org.eclipse.swt.widgets.MenuItem fileItem =
       new org.eclipse.swt.widgets.MenuItem(bar, SWT.CASCADE);
   fileItem.setText(resources.getString("File_menuitem"));
   fileItem.setMenu(createFileMenu());
 }
Esempio n. 5
0
 org.eclipse.swt.widgets.Menu createFileMenu() {
   org.eclipse.swt.widgets.Menu bar = shell.getMenuBar();
   org.eclipse.swt.widgets.Menu menu = new org.eclipse.swt.widgets.Menu(bar);
   org.eclipse.swt.widgets.MenuItem item;
   item = new org.eclipse.swt.widgets.MenuItem(menu, SWT.PUSH);
   item.setText(resources.getString("Open_menuitem"));
   item.setAccelerator(SWT.MOD1 + 'O');
   item.addSelectionListener(
       new org.eclipse.swt.events.SelectionAdapter() {
         public void widgetSelected(org.eclipse.swt.events.SelectionEvent event) {
           openFile();
         }
       });
   item = new org.eclipse.swt.widgets.MenuItem(menu, SWT.PUSH);
   item.setText(resources.getString("Exit_menuitem"));
   item.addSelectionListener(
       new org.eclipse.swt.events.SelectionAdapter() {
         public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
           menuFileExit();
         }
       });
   return menu;
 }
Esempio n. 6
0
 void menuFileExit() {
   shell.close();
 }