novocode.com
About Novocode.com  |  Contact  |  Site Map  |  Search

Need more information? Shop for books about SWT at Amazon.com:

SWT Controls

This page contains some SWT controls which I have developed as part of Novocode Application Framework. All controls on this page are made available under the terms of the Eclipse Public License v1.0 (see the individual Java source files for details). You can download all controls in one package as part of the NAF distribution.

Here is a Serbo-Croatian translation of this page
  • CustomSeparator: Instances of this class are non-native separator lines.

    Styles:
    SHADOW_IN, SHADOW_OUT, SHADOW_NONE, HORIZONTAL, VERTICAL
    Events:
    (none)

    Note: Only one of SHADOW_IN, SHADOW_OUT and SHADOW_NONE may be specified. If neither ist specified, the default value SHADOW_IN is used. If SHADOW_NONE is specified, a single line is drawn with the control's foreground color. Only one of HORIZONTAL and VERTICAL may be specified. The default is VERTICAL.

  • FramedComposite: Instances of this class are composites with a border around the contents.

    Styles:
    SHADOW_NONE, SHADOW_ETCHED_IN, SHADOW_ETCHED_OUT, SHADOW_IN, SHADOW_OUT
    Events:
    (none)

    Note: Only one of the above styles may be specified. The default, if no style is specified explicitly, is SHADOW_ETCHED_IN. SHADOW_NONE draws a solid 1px border in the widget's foreground color.

  • Hyperlink: A hyperlink text label.

    This control displays a line of text (with an optional underline) which can be clicked to send a Selection event. Colors for the text and underline in their normal, mouse hover and active state can be set independently. The text can contain a mnemonic character for triggering the link via keyboard. Unless the control is created with the NO_FOCUS style, it accepts keyboard focus and can be triggered with RETURN and SPACE while focused.

    Note: This control should not be resized beyond its minimum / preferred size.

    Styles:
    NO_FOCUS
    Events:
    Selection

  • LiveSashForm: Like a regular SashForm, the LiveSashForm lays out its children in a Row or Column arrangement (as specified by the orientation) and places a Sash between the children. One child may be maximized to occupy the entire size of the LiveSashForm. The relative sizes of the children may be specfied using weights.

    LiveSashForm supports the following additional features:

    • Unless the LiveSashForm is created with the NO_LIVE_UPDATE style, the bounds of the children are updated in real time when a Sash is being dragged.
    • Borders can be assigned to the individual child widgets by calling setChildBorder(). This has the same effect as placing the child widgets in FramedComposites except the borders become part of the adjacent sashes, thus making the draggable part bigger without consuming additional screen real estate.

    A Selection event is fired when the weights have changed.

    Styles:
    HORIZONTAL, VERTICAL, LiveSashForm.NO_LIVE_UPDATE
    Events:
    Selection

  • SizeGrip: A non-native size grip which looks (and almost feels) like the native Win32 size grip.

    The SHADOW_IN style causes highlight lines to be drawn at the right and bottom border. This style should be used when placing the size grip on top of the bottom right corner of a FramedComposite with style SHADOW_IN. If the FLAT style is set, the size grip is drawn in a Windows XP style instead of the normal Windows Classic style.

    Styles:
    SHADOW_IN, FLAT
    Events:
    (none)

    NOTE: The visibility of this widget is controlled by the "maximized" state of the shell. The size grip is hidden when the shell is maximized, even if it has been made visible by calling setVisible(true). getVisible() always returns the value set with setVisible(). isVisible() returns the true visibility, as usual.

    New in 1.6: Smoother resizing for a more native look & feel. The window size is not updated more than once every 25ms to reduce the number of unnecessary repaints.

    New in 1.8: You can specify a parent Composite other than the shell which will be resized by the SizeGrip.

  • BalloonWindow: A Shell wrapper which creates balloon popup windows.

    By default, a balloon window has no title bar or system controls. The following styles are supported:

    • SWT.ON_TOP - Keep the window on top of other windows
    • SWT.TOOL - Add a drop shadow to the window (on supported platforms)
    • SWT.CLOSE - Show a "close" control on the title bar (implies SWT.TITLE)
    • SWT.TITLE - Show a title bar

  • InternalShell and DesktopForm: A cross-platform implementation of MDI-like internal shells which can be placed onto a desktop form control inside an SWT shell, similar to JInternalFrame in Swing.

    Unlike the other Controls on this page, the InternalShell implementation consists of several classes, so I do not offer it as a separate download. You can get it as part of the NAF distribution.

Screenshots


A CustomSeparator (shadow: etched in) below the tool bar, a FramedComposite (shadow: in) around the status bar, a LiveSashForm containing Pane 1 + Title and Pane 2, a SizeGrip in the bottom right corner:

[Screenshot]


Dragging the Sash in the LiveSashFrom:

[Screenshot]

Note that the layout has been updated while the Sash is being dragged and that the draggable Sash area includes the adjacent borders.


The Internal Shell demo showing two InternalShells on a DesktopForm:

[Screenshot]


A window with two Hyperlink controls, one of them showing an underline (mouse-over highlighting):

[Screenshot]


A BalloonWindow with a title bar (consisting of an icon, the title text and a "close" control):

[Screenshot]