示例#1
0
  public BrowserExample(org.eclipse.swt.widgets.Composite parent, boolean top) {
    this.parent = parent;
    try {
      browser = new org.eclipse.swt.browser.Browser(parent, SWT.BORDER);
    } catch (org.eclipse.swt.SWTError e) {
      error = e;
      parent.setLayout(new org.eclipse.swt.layout.FillLayout());
      org.eclipse.swt.widgets.Label label =
          new org.eclipse.swt.widgets.Label(parent, SWT.CENTER | SWT.WRAP);
      label.setText(getResourceString("BrowserNotCreated"));
      parent.layout(true);
      return;
    }
    initResources();
    final org.eclipse.swt.widgets.Display display = parent.getDisplay();
    browser.setData("org.eclipse.swt.examples.browserexample.BrowserApplication", this);
    browser.addOpenWindowListener(
        new org.eclipse.swt.browser.OpenWindowListener() {
          public void open(org.eclipse.swt.browser.WindowEvent event) {
            org.eclipse.swt.widgets.Shell shell = new org.eclipse.swt.widgets.Shell(display);
            if (icon != null) {
              shell.setImage(icon);
            }
            shell.setLayout(new org.eclipse.swt.layout.FillLayout());
            org.eclipse.swt.examples.browserexample.BrowserExample app =
                new org.eclipse.swt.examples.browserexample.BrowserExample(shell, false);
            app.setShellDecoration(icon, true);
            event.browser = app.getBrowser();
          }
        });
    if (top) {
      browser.setUrl(getResourceString("Startup"));
      show(false, null, null, true, true, true, true);
    } else {
      browser.addVisibilityWindowListener(
          new org.eclipse.swt.browser.VisibilityWindowListener() {
            public void hide(org.eclipse.swt.browser.WindowEvent e) {}

            public void show(org.eclipse.swt.browser.WindowEvent e) {
              org.eclipse.swt.browser.Browser browser = (org.eclipse.swt.browser.Browser) e.widget;
              org.eclipse.swt.examples.browserexample.BrowserExample app =
                  (org.eclipse.swt.examples.browserexample.BrowserExample)
                      browser.getData("org.eclipse.swt.examples.browserexample.BrowserApplication");
              app.show(true, e.location, e.size, e.addressBar, e.menuBar, e.statusBar, e.toolBar);
            }
          });
      browser.addCloseWindowListener(
          new org.eclipse.swt.browser.CloseWindowListener() {
            public void close(org.eclipse.swt.browser.WindowEvent event) {
              org.eclipse.swt.browser.Browser browser =
                  (org.eclipse.swt.browser.Browser) event.widget;
              org.eclipse.swt.widgets.Shell shell = browser.getShell();
              shell.close();
            }
          });
    }
  }
示例#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.widgets.Shell shell = new org.eclipse.swt.widgets.Shell(display);
   shell.setText(getResourceString("window.title"));
   shell.setLayout(new org.eclipse.swt.layout.GridLayout());
   org.eclipse.swt.examples.paint.PaintExample instance =
       new org.eclipse.swt.examples.paint.PaintExample(shell);
   instance.createToolBar(shell);
   org.eclipse.swt.widgets.Composite composite =
       new org.eclipse.swt.widgets.Composite(shell, SWT.NONE);
   composite.setLayout(new org.eclipse.swt.layout.FillLayout());
   composite.setLayoutData(new org.eclipse.swt.layout.GridData(SWT.FILL, SWT.FILL, true, true));
   instance.createGUI(composite);
   instance.setDefaults();
   setShellSize(display, shell);
   shell.open();
   while (!shell.isDisposed()) {
     if (!display.readAndDispatch()) {
       display.sleep();
     }
   }
   instance.dispose();
 }
示例#3
0
  void show(
      boolean owned,
      org.eclipse.swt.graphics.Point location,
      org.eclipse.swt.graphics.Point size,
      boolean addressBar,
      boolean menuBar,
      boolean statusBar,
      boolean toolBar) {
    final org.eclipse.swt.widgets.Shell shell = browser.getShell();
    if (owned) {
      if (location != null) {
        shell.setLocation(location);
      }
      if (size != null) {
        shell.setSize(shell.computeSize(size.x, size.y));
      }
    }
    org.eclipse.swt.layout.FormData data = null;
    if (toolBar) {
      toolbar = new org.eclipse.swt.widgets.ToolBar(parent, SWT.NONE);
      data = new org.eclipse.swt.layout.FormData();
      data.top = new org.eclipse.swt.layout.FormAttachment(0, 5);
      toolbar.setLayoutData(data);
      itemBack = new org.eclipse.swt.widgets.ToolItem(toolbar, SWT.PUSH);
      itemBack.setText(getResourceString("Back"));
      itemForward = new org.eclipse.swt.widgets.ToolItem(toolbar, SWT.PUSH);
      itemForward.setText(getResourceString("Forward"));
      final org.eclipse.swt.widgets.ToolItem itemStop =
          new org.eclipse.swt.widgets.ToolItem(toolbar, SWT.PUSH);
      itemStop.setText(getResourceString("Stop"));
      final org.eclipse.swt.widgets.ToolItem itemRefresh =
          new org.eclipse.swt.widgets.ToolItem(toolbar, SWT.PUSH);
      itemRefresh.setText(getResourceString("Refresh"));
      final org.eclipse.swt.widgets.ToolItem itemGo =
          new org.eclipse.swt.widgets.ToolItem(toolbar, SWT.PUSH);
      itemGo.setText(getResourceString("Go"));
      itemBack.setEnabled(browser.isBackEnabled());
      itemForward.setEnabled(!browser.isForwardEnabled());
      org.eclipse.swt.widgets.Listener listener =
          new org.eclipse.swt.widgets.Listener() {
            public void handleEvent(org.eclipse.swt.widgets.Event event) {
              org.eclipse.swt.widgets.ToolItem item =
                  (org.eclipse.swt.widgets.ToolItem) event.widget;
              if (item == itemBack) {
                browser.back();
              } else {
                if (item == itemForward) {
                  browser.forward();
                } else {
                  if (item == itemStop) {
                    browser.stop();
                  } else {
                    if (item == itemRefresh) {
                      browser.refresh();
                    } else {
                      if (item == itemGo) {
                        browser.setUrl(locationBar.getText());
                      }
                    }
                  }
                }
              }
            }
          };
      itemBack.addListener(SWT.Selection, listener);
      itemForward.addListener(SWT.Selection, listener);
      itemStop.addListener(SWT.Selection, listener);
      itemRefresh.addListener(SWT.Selection, listener);
      itemGo.addListener(SWT.Selection, listener);
      canvas = new org.eclipse.swt.widgets.Canvas(parent, SWT.NO_BACKGROUND);
      data = new org.eclipse.swt.layout.FormData();
      data.width = 24;
      data.height = 24;
      data.top = new org.eclipse.swt.layout.FormAttachment(0, 5);
      data.right = new org.eclipse.swt.layout.FormAttachment(100, -5);
      canvas.setLayoutData(data);
      final org.eclipse.swt.graphics.Rectangle rect = images[0].getBounds();
      canvas.addListener(
          SWT.Paint,
          new org.eclipse.swt.widgets.Listener() {
            public void handleEvent(org.eclipse.swt.widgets.Event e) {
              org.eclipse.swt.graphics.Point pt =
                  ((org.eclipse.swt.widgets.Canvas) e.widget).getSize();
              e.gc.drawImage(images[index], 0, 0, rect.width, rect.height, 0, 0, pt.x, pt.y);
            }
          });
      canvas.addListener(
          SWT.MouseDown,
          new org.eclipse.swt.widgets.Listener() {
            public void handleEvent(org.eclipse.swt.widgets.Event e) {
              browser.setUrl(getResourceString("Startup"));
            }
          });
      final org.eclipse.swt.widgets.Display display = parent.getDisplay();
      display.asyncExec(
          new java.lang.Runnable() {
            public void run() {
              if (canvas.isDisposed()) {
                return;
              }
              if (busy) {
                index++;
                if (index == images.length) {
                  index = 0;
                }
                canvas.redraw();
              }
              display.timerExec(150, this);
            }
          });
    }
    if (addressBar) {
      locationBar = new org.eclipse.swt.widgets.Text(parent, SWT.BORDER);
      data = new org.eclipse.swt.layout.FormData();
      if (toolbar != null) {
        data.top = new org.eclipse.swt.layout.FormAttachment(toolbar, 0, SWT.TOP);
        data.left = new org.eclipse.swt.layout.FormAttachment(toolbar, 5, SWT.RIGHT);
        data.right = new org.eclipse.swt.layout.FormAttachment(canvas, -5, SWT.DEFAULT);
      } else {
        data.top = new org.eclipse.swt.layout.FormAttachment(0, 0);
        data.left = new org.eclipse.swt.layout.FormAttachment(0, 0);
        data.right = new org.eclipse.swt.layout.FormAttachment(100, 0);
      }
      locationBar.setLayoutData(data);
      locationBar.addListener(
          SWT.DefaultSelection,
          new org.eclipse.swt.widgets.Listener() {
            public void handleEvent(org.eclipse.swt.widgets.Event e) {
              browser.setUrl(locationBar.getText());
            }
          });
    }
    if (statusBar) {
      status = new org.eclipse.swt.widgets.Label(parent, SWT.NONE);
      progressBar = new org.eclipse.swt.widgets.ProgressBar(parent, SWT.NONE);
      data = new org.eclipse.swt.layout.FormData();
      data.left = new org.eclipse.swt.layout.FormAttachment(0, 5);
      data.right = new org.eclipse.swt.layout.FormAttachment(progressBar, 0, SWT.DEFAULT);
      data.bottom = new org.eclipse.swt.layout.FormAttachment(100, -5);
      status.setLayoutData(data);
      data = new org.eclipse.swt.layout.FormData();
      data.right = new org.eclipse.swt.layout.FormAttachment(100, -5);
      data.bottom = new org.eclipse.swt.layout.FormAttachment(100, -5);
      progressBar.setLayoutData(data);
      browser.addStatusTextListener(
          new org.eclipse.swt.browser.StatusTextListener() {
            public void changed(org.eclipse.swt.browser.StatusTextEvent event) {
              status.setText(event.text);
            }
          });
    }
    parent.setLayout(new org.eclipse.swt.layout.FormLayout());
    org.eclipse.swt.widgets.Control aboveBrowser =
        toolBar
            ? (org.eclipse.swt.widgets.Control) canvas
            : addressBar ? (org.eclipse.swt.widgets.Control) locationBar : null;
    data = new org.eclipse.swt.layout.FormData();
    data.left = new org.eclipse.swt.layout.FormAttachment(0, 0);
    data.top =
        aboveBrowser != null
            ? new org.eclipse.swt.layout.FormAttachment(aboveBrowser, 5, SWT.DEFAULT)
            : new org.eclipse.swt.layout.FormAttachment(0, 0);
    data.right = new org.eclipse.swt.layout.FormAttachment(100, 0);
    data.bottom =
        status != null
            ? new org.eclipse.swt.layout.FormAttachment(status, -5, SWT.DEFAULT)
            : new org.eclipse.swt.layout.FormAttachment(100, 0);
    browser.setLayoutData(data);
    if (statusBar || toolBar) {
      browser.addProgressListener(
          new org.eclipse.swt.browser.ProgressListener() {
            public void changed(org.eclipse.swt.browser.ProgressEvent event) {
              if (event.total == 0) {
                return;
              }
              int ratio = event.current * 100 / event.total;
              if (progressBar != null) {
                progressBar.setSelection(ratio);
              }
              busy = event.current != event.total;
              if (!busy) {
                index = 0;
                if (canvas != null) {
                  canvas.redraw();
                }
              }
            }

            public void completed(org.eclipse.swt.browser.ProgressEvent event) {
              if (progressBar != null) {
                progressBar.setSelection(0);
              }
              busy = false;
              index = 0;
              if (canvas != null) {
                itemBack.setEnabled(browser.isBackEnabled());
                itemForward.setEnabled(browser.isForwardEnabled());
                canvas.redraw();
              }
            }
          });
    }
    if (addressBar || statusBar || toolBar) {
      browser.addLocationListener(
          new org.eclipse.swt.browser.LocationListener() {
            public void changed(org.eclipse.swt.browser.LocationEvent event) {
              busy = true;
              if (event.top && locationBar != null) {
                locationBar.setText(event.location);
              }
            }

            public void changing(org.eclipse.swt.browser.LocationEvent event) {}
          });
    }
    if (title) {
      browser.addTitleListener(
          new org.eclipse.swt.browser.TitleListener() {
            public void changed(org.eclipse.swt.browser.TitleEvent event) {
              shell.setText(event.title + " - " + getResourceString("window.title"));
            }
          });
    }
    parent.layout(true);
    if (owned) {
      shell.open();
    }
  }
示例#4
0
 public void createPartControl(org.eclipse.swt.widgets.Composite frame) {
   final org.eclipse.swt.examples.hoverhelp.HoverHelp.ToolTipHandler tooltip =
       new org.eclipse.swt.examples.hoverhelp.HoverHelp.ToolTipHandler(frame.getShell());
   org.eclipse.swt.layout.GridLayout layout = new org.eclipse.swt.layout.GridLayout();
   layout.numColumns = 3;
   frame.setLayout(layout);
   java.lang.String platform = SWT.getPlatform();
   java.lang.String helpKey = "F1";
   if (platform.equals("gtk")) {
     helpKey = "Ctrl+F1";
   }
   if (platform.equals("carbon") || platform.equals("cocoa")) {
     helpKey = "Help";
   }
   org.eclipse.swt.widgets.ToolBar bar = new org.eclipse.swt.widgets.ToolBar(frame, SWT.BORDER);
   for (int i = 0; i < 5; i++) {
     org.eclipse.swt.widgets.ToolItem item = new org.eclipse.swt.widgets.ToolItem(bar, SWT.PUSH);
     item.setText(
         getResourceString("ToolItem.text", new java.lang.Object[] {new java.lang.Integer(i)}));
     item.setData(
         "TIP_TEXT",
         getResourceString("ToolItem.tooltip", new java.lang.Object[] {item.getText(), helpKey}));
     item.setData(
         "TIP_HELPTEXTHANDLER",
         new org.eclipse.swt.examples.hoverhelp.HoverHelp.ToolTipHelpTextHandler() {
           public java.lang.String getHelpText(org.eclipse.swt.widgets.Widget widget) {
             org.eclipse.swt.widgets.Item item = (org.eclipse.swt.widgets.Item) widget;
             return getResourceString("ToolItem.help", new java.lang.Object[] {item.getText()});
           }
         });
   }
   org.eclipse.swt.layout.GridData gridData = new org.eclipse.swt.layout.GridData();
   gridData.horizontalSpan = 3;
   bar.setLayoutData(gridData);
   tooltip.activateHoverHelp(bar);
   org.eclipse.swt.widgets.Table table = new org.eclipse.swt.widgets.Table(frame, SWT.BORDER);
   for (int i = 0; i < 4; i++) {
     org.eclipse.swt.widgets.TableItem item =
         new org.eclipse.swt.widgets.TableItem(table, SWT.PUSH);
     item.setText(getResourceString("Item", new java.lang.Object[] {new java.lang.Integer(i)}));
     item.setData("TIP_IMAGE", images[hhiInformation]);
     item.setText(
         getResourceString("TableItem.text", new java.lang.Object[] {new java.lang.Integer(i)}));
     item.setData(
         "TIP_TEXT",
         getResourceString("TableItem.tooltip", new java.lang.Object[] {item.getText(), helpKey}));
     item.setData(
         "TIP_HELPTEXTHANDLER",
         new org.eclipse.swt.examples.hoverhelp.HoverHelp.ToolTipHelpTextHandler() {
           public java.lang.String getHelpText(org.eclipse.swt.widgets.Widget widget) {
             org.eclipse.swt.widgets.Item item = (org.eclipse.swt.widgets.Item) widget;
             return getResourceString("TableItem.help", new java.lang.Object[] {item.getText()});
           }
         });
   }
   table.setLayoutData(new org.eclipse.swt.layout.GridData(GridData.VERTICAL_ALIGN_FILL));
   tooltip.activateHoverHelp(table);
   org.eclipse.swt.widgets.Tree tree = new org.eclipse.swt.widgets.Tree(frame, SWT.BORDER);
   for (int i = 0; i < 4; i++) {
     org.eclipse.swt.widgets.TreeItem item = new org.eclipse.swt.widgets.TreeItem(tree, SWT.PUSH);
     item.setText(getResourceString("Item", new java.lang.Object[] {new java.lang.Integer(i)}));
     item.setData("TIP_IMAGE", images[hhiWarning]);
     item.setText(
         getResourceString("TreeItem.text", new java.lang.Object[] {new java.lang.Integer(i)}));
     item.setData(
         "TIP_TEXT",
         getResourceString("TreeItem.tooltip", new java.lang.Object[] {item.getText(), helpKey}));
     item.setData(
         "TIP_HELPTEXTHANDLER",
         new org.eclipse.swt.examples.hoverhelp.HoverHelp.ToolTipHelpTextHandler() {
           public java.lang.String getHelpText(org.eclipse.swt.widgets.Widget widget) {
             org.eclipse.swt.widgets.Item item = (org.eclipse.swt.widgets.Item) widget;
             return getResourceString("TreeItem.help", new java.lang.Object[] {item.getText()});
           }
         });
   }
   tree.setLayoutData(new org.eclipse.swt.layout.GridData(GridData.VERTICAL_ALIGN_FILL));
   tooltip.activateHoverHelp(tree);
   org.eclipse.swt.widgets.Button button = new org.eclipse.swt.widgets.Button(frame, SWT.PUSH);
   button.setText(getResourceString("Hello.text"));
   button.setData("TIP_TEXT", getResourceString("Hello.tooltip"));
   tooltip.activateHoverHelp(button);
 }
示例#5
0
  public void createGUI(org.eclipse.swt.widgets.Composite parent) {
    org.eclipse.swt.layout.GridLayout gridLayout;
    org.eclipse.swt.layout.GridData gridData;
    org.eclipse.swt.widgets.Composite displayArea =
        new org.eclipse.swt.widgets.Composite(parent, SWT.NONE);
    gridLayout = new org.eclipse.swt.layout.GridLayout();
    gridLayout.numColumns = 1;
    displayArea.setLayout(gridLayout);
    final org.eclipse.swt.widgets.Canvas paintCanvas =
        new org.eclipse.swt.widgets.Canvas(
            displayArea,
            (-(SWT.BORDER | SWT.V_SCROLL))
                | SWT.H_SCROLL
                | SWT.NO_REDRAW_RESIZE
                | SWT.NO_BACKGROUND);
    gridData =
        new org.eclipse.swt.layout.GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
    paintCanvas.setLayoutData(gridData);
    paintCanvas.setBackground(paintColorWhite);
    final org.eclipse.swt.widgets.Composite colorFrame =
        new org.eclipse.swt.widgets.Composite(displayArea, SWT.NONE);
    gridData =
        new org.eclipse.swt.layout.GridData(
            GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
    colorFrame.setLayoutData(gridData);
    final org.eclipse.swt.widgets.Composite toolSettingsFrame =
        new org.eclipse.swt.widgets.Composite(displayArea, SWT.NONE);
    gridData =
        new org.eclipse.swt.layout.GridData(
            GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
    toolSettingsFrame.setLayoutData(gridData);
    final org.eclipse.swt.widgets.Text statusText =
        new org.eclipse.swt.widgets.Text(displayArea, SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY);
    gridData =
        new org.eclipse.swt.layout.GridData(
            GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
    statusText.setLayoutData(gridData);
    paintSurface =
        new org.eclipse.swt.examples.paint.PaintSurface(paintCanvas, statusText, paintColorWhite);
    tools[Pencil_tool].data =
        new org.eclipse.swt.examples.paint.PencilTool(toolSettings, paintSurface);
    tools[Airbrush_tool].data =
        new org.eclipse.swt.examples.paint.AirbrushTool(toolSettings, paintSurface);
    tools[Line_tool].data = new org.eclipse.swt.examples.paint.LineTool(toolSettings, paintSurface);
    tools[PolyLine_tool].data =
        new org.eclipse.swt.examples.paint.PolyLineTool(toolSettings, paintSurface);
    tools[Rectangle_tool].data =
        new org.eclipse.swt.examples.paint.RectangleTool(toolSettings, paintSurface);
    tools[RoundedRectangle_tool].data =
        new org.eclipse.swt.examples.paint.RoundedRectangleTool(toolSettings, paintSurface);
    tools[Ellipse_tool].data =
        new org.eclipse.swt.examples.paint.EllipseTool(toolSettings, paintSurface);
    tools[Text_tool].data = new org.eclipse.swt.examples.paint.TextTool(toolSettings, paintSurface);
    gridLayout = new org.eclipse.swt.layout.GridLayout();
    gridLayout.numColumns = 3;
    gridLayout.marginHeight = 0;
    gridLayout.marginWidth = 0;
    colorFrame.setLayout(gridLayout);
    activeForegroundColorCanvas = new org.eclipse.swt.widgets.Canvas(colorFrame, SWT.BORDER);
    gridData = new org.eclipse.swt.layout.GridData(GridData.HORIZONTAL_ALIGN_FILL);
    gridData.heightHint = 24;
    gridData.widthHint = 24;
    activeForegroundColorCanvas.setLayoutData(gridData);
    activeBackgroundColorCanvas = new org.eclipse.swt.widgets.Canvas(colorFrame, SWT.BORDER);
    gridData = new org.eclipse.swt.layout.GridData(GridData.HORIZONTAL_ALIGN_FILL);
    gridData.heightHint = 24;
    gridData.widthHint = 24;
    activeBackgroundColorCanvas.setLayoutData(gridData);
    final org.eclipse.swt.widgets.Canvas paletteCanvas =
        new org.eclipse.swt.widgets.Canvas(colorFrame, SWT.BORDER | SWT.NO_BACKGROUND);
    gridData = new org.eclipse.swt.layout.GridData(GridData.FILL_HORIZONTAL);
    gridData.heightHint = 24;
    paletteCanvas.setLayoutData(gridData);
    paletteCanvas.addListener(
        SWT.MouseDown,
        new org.eclipse.swt.widgets.Listener() {
          public void handleEvent(org.eclipse.swt.widgets.Event e) {
            org.eclipse.swt.graphics.Rectangle bounds = paletteCanvas.getClientArea();
            org.eclipse.swt.graphics.Color color = getColorAt(bounds, e.x, e.y);
            if (e.button == 1) {
              setForegroundColor(color);
            } else {
              setBackgroundColor(color);
            }
          }

          private org.eclipse.swt.graphics.Color getColorAt(
              org.eclipse.swt.graphics.Rectangle bounds, int x, int y) {
            if (bounds.height <= 1 && bounds.width <= 1) {
              return paintColorWhite;
            }
            final int row = (y - bounds.y) * numPaletteRows / bounds.height;
            final int col = (x - bounds.x) * numPaletteCols / bounds.width;
            return paintColors[
                Math.min(Math.max(row * numPaletteCols + col, 0), paintColors.length - 1)];
          }
        });
    org.eclipse.swt.widgets.Listener refreshListener =
        new org.eclipse.swt.widgets.Listener() {
          public void handleEvent(org.eclipse.swt.widgets.Event e) {
            if (e.gc == null) {
              return;
            }
            org.eclipse.swt.graphics.Rectangle bounds = paletteCanvas.getClientArea();
            for (int row = 0; row < numPaletteRows; ++row) {
              for (int col = 0; col < numPaletteCols; ++col) {
                final int x = bounds.width * col / numPaletteCols;
                final int y = bounds.height * row / numPaletteRows;
                final int width = Math.max(bounds.width * (col + 1) / numPaletteCols - x, 1);
                final int height = Math.max(bounds.height * (row + 1) / numPaletteRows - y, 1);
                e.gc.setBackground(paintColors[row * numPaletteCols + col]);
                e.gc.fillRectangle(bounds.x + x, bounds.y + y, width, height);
              }
            }
          }
        };
    paletteCanvas.addListener(SWT.Resize, refreshListener);
    paletteCanvas.addListener(SWT.Paint, refreshListener);
    gridLayout = new org.eclipse.swt.layout.GridLayout();
    gridLayout.numColumns = 4;
    gridLayout.marginHeight = 0;
    gridLayout.marginWidth = 0;
    toolSettingsFrame.setLayout(gridLayout);
    org.eclipse.swt.widgets.Label label =
        new org.eclipse.swt.widgets.Label(toolSettingsFrame, SWT.NONE);
    label.setText(getResourceString("settings.AirbrushRadius.text"));
    final org.eclipse.swt.widgets.Scale airbrushRadiusScale =
        new org.eclipse.swt.widgets.Scale(toolSettingsFrame, SWT.HORIZONTAL);
    airbrushRadiusScale.setMinimum(5);
    airbrushRadiusScale.setMaximum(50);
    airbrushRadiusScale.setSelection(toolSettings.airbrushRadius);
    airbrushRadiusScale.setLayoutData(
        new org.eclipse.swt.layout.GridData(
            GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
    airbrushRadiusScale.addSelectionListener(
        new org.eclipse.swt.events.SelectionAdapter() {
          public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            toolSettings.airbrushRadius = airbrushRadiusScale.getSelection();
            updateToolSettings();
          }
        });
    label = new org.eclipse.swt.widgets.Label(toolSettingsFrame, SWT.NONE);
    label.setText(getResourceString("settings.AirbrushIntensity.text"));
    final org.eclipse.swt.widgets.Scale airbrushIntensityScale =
        new org.eclipse.swt.widgets.Scale(toolSettingsFrame, SWT.HORIZONTAL);
    airbrushIntensityScale.setMinimum(1);
    airbrushIntensityScale.setMaximum(100);
    airbrushIntensityScale.setSelection(toolSettings.airbrushIntensity);
    airbrushIntensityScale.setLayoutData(
        new org.eclipse.swt.layout.GridData(
            GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
    airbrushIntensityScale.addSelectionListener(
        new org.eclipse.swt.events.SelectionAdapter() {
          public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            toolSettings.airbrushIntensity = airbrushIntensityScale.getSelection();
            updateToolSettings();
          }
        });
  }