public static void labelTab() {
   TabItem tab = new TabItem(folder, SWT.CLOSE);
   tab.setText("A Label"); // Text on the tab
   tab.setToolTipText("A simple label");
   Label label = new Label(folder, SWT.CENTER);
   label.setText("Label text");
   tab.setControl(label);
 }
 public static void scribbleTab() {
   TabItem tab = new TabItem(folder, SWT.CLOSE);
   tab.setText("Scribble");
   tab.setToolTipText("Simple graphics: drawing");
   final Canvas canvas = new Canvas(folder, SWT.NONE);
   ScribbleMouseListener sml = new ScribbleMouseListener();
   canvas.addMouseListener(sml);
   canvas.addMouseMoveListener(sml);
   tab.setControl(canvas);
 }
 public static void sliderTab() {
   TabItem tab = new TabItem(folder, SWT.CLOSE);
   tab.setText("Sliders and Progress bars");
   tab.setToolTipText("Tied Slider to ProgressBar");
   Composite composite = new Composite(folder, SWT.NONE);
   composite.setLayout(new GridLayout(2, true));
   final Slider slider = new Slider(composite, SWT.HORIZONTAL);
   final ProgressBar progress = new ProgressBar(composite, SWT.HORIZONTAL);
   slider.addSelectionListener(
       new SelectionAdapter() {
         public void widgetSelected(SelectionEvent event) {
           progress.setSelection(slider.getSelection());
         }
       });
   tab.setControl(composite);
 }
 public static void buttonTab() {
   TabItem tab = new TabItem(folder, SWT.CLOSE);
   tab.setText("Buttons");
   tab.setToolTipText("Different kinds of Buttons");
   Composite composite = new Composite(folder, SWT.NONE);
   composite.setLayout(new GridLayout(4, true));
   for (int dir : new int[] {SWT.UP, SWT.RIGHT, SWT.LEFT, SWT.DOWN}) {
     Button b = new Button(composite, SWT.ARROW | dir);
     b.addListener(SWT.MouseDown, listener);
   }
   newButton(composite, SWT.CHECK, "Check button");
   newButton(composite, SWT.PUSH, "Push button");
   newButton(composite, SWT.RADIO, "Radio button");
   newButton(composite, SWT.TOGGLE, "Toggle button");
   newButton(composite, SWT.FLAT, "Flat button");
   tab.setControl(composite);
 }
 public static void directoryDialogTab() {
   TabItem tab = new TabItem(folder, SWT.CLOSE);
   tab.setText("Directory Dialog");
   tab.setToolTipText("Select a directory");
   final Button b = new Button(folder, SWT.PUSH);
   b.setText("Select a Directory");
   b.addListener(
       SWT.MouseDown,
       new Listener() {
         public void handleEvent(Event e) {
           DirectoryDialog dd = new DirectoryDialog(shell);
           String path = dd.open();
           if (path != null) b.setText(path);
         }
       });
   tab.setControl(b);
 }
 public static void browserTab() {
   TabItem tab = new TabItem(folder, SWT.CLOSE);
   tab.setText("A Browser");
   tab.setToolTipText("A Web browser");
   Browser browser = null;
   try {
     browser = new Browser(folder, SWT.NONE);
   } catch (SWTError e) {
     Label label = new Label(folder, SWT.BORDER);
     label.setText("Could not initialize browser");
     tab.setControl(label);
   }
   if (browser != null) {
     browser.setUrl("http://www.mindview.net");
     tab.setControl(browser);
   }
 }
Ejemplo n.º 7
0
  /** Creates the "Example" widgets. */
  void createExampleWidgets() {

    /* Compute the widget style */
    int style = getDefaultStyle();
    if (topButton.getSelection()) style |= SWT.TOP;
    if (bottomButton.getSelection()) style |= SWT.BOTTOM;
    if (borderButton.getSelection()) style |= SWT.BORDER;

    /* Create the example widgets */
    tabFolder1 = new TabFolder(tabFolderGroup, style);
    for (int i = 0; i < TabItems1.length; i++) {
      TabItem item = new TabItem(tabFolder1, SWT.NONE);
      item.setText(TabItems1[i]);
      item.setToolTipText(ControlExample.getResourceString("Tooltip", new String[] {TabItems1[i]}));
      Text content = new Text(tabFolder1, SWT.WRAP | SWT.MULTI);
      content.setText(ControlExample.getResourceString("TabItem_content") + ": " + i);
      item.setControl(content);
    }
  }