Back Previous Next


Linguist graphics package - create

Syntax:

   create {window}
      [parent {window}]
      [title {string}]
      [at {location}]
      [size {size}]
      [style plain]
      [resizable]
   create {button} in {container}
      [type toggle]
      [text {string}]
      [at {location}]
      [size {size}]
   create {label} in {container}
      [text {string}]
      [at {location}]
      [size {size}]
   create {canvas} in {container}
      [at {location}]
      [size {size}]
   create {styledtext} in {container}
      [text {string}]
      [at {location}]
      [size {size}]
   create {textarea}/{textfield} in {container}
      [text {string}]
      [at {location}]
      [size {size}]
   create {textpanel} in {container}
      [text {string}]
      [at {location}]
      [size {size}]
      [scrolling]
   create {combobox} in {container}
      [at {location}]
      [size {size}]
   create {cursor} default/hand/wait...
   create {color} {colordef}
   create {font}
      [name {value}]
      [style {value}]
      [size {value}]
      [color {color}/colo[u]r {red} {green} {blue}]
   create {border} style empty
      [top {value}]
      [left {value}]
      [bottom {value}]
      [right {value}]
   create {border} style etched in/out
      [highlight {color}]
      [shadow {color}]
   create {border} style bevel raised/lowered
      [highlight {color}]
      [shadow {color}]
   create {border} style line
      [color {color}]
      [thickness {thickness}]
   create {border} style titled
      [title {title}]
      [justification left/right/center/centre]
      [position [above/below] top/bottom ]
      [color {color}]
   create {popupmenu} in {container}
   create {menu} {text}
   create {menuitem} {text}

Keyword handler:

   net.eclecity.linguist.graphics.keyword.GraphicsKCreate.class

Runtime handler(s):

   net.eclecity.linguist.graphics.handler.GraphicsHCreate.class

Function:

Create something. There are many forms of the command, as follows:

create {window} creates a new window. All of the parameters are optional and default to sensible values if omitted. The window will be placed in the centre of the screen if no location is given. If the plain style is requested the window will have no frame, which will also be the case if it is exactly the same size as the screen. A resizable window has a frame that allows you to stretch and contract its outline.

create {button} creates a new button. Since this is a lightweight component it must be created in a container (such as a window) - it cannot have an independent existence of its own. The parameters are optional; if no text is given you will normally assign one or more icons to the button using set. A button can be either momentary or toggle type; the latter stays activated after you click it until a second click restores it to the off position.

create {label} creates a new label. Since this is a lightweight component it must be created in a container (such as a window) - it cannot have an independent existence of its own. The parameters are optional; if no text is given you will normally assign an icon to the label using set. A label is much like a button except that it only has a single icon and therefore cannot change its appearance automatically when you move the mouse over it or click it.

create {canvas} creates a new canvas. This is a component that can hold an image and over which you have control of the alpha value, making it vary from fully opaque to fully transparent.

create {styledtext} creates a new styledtext. This is a component that can hold a single line of text and over which you have control of the alpha value, making it vary from fully opaque to fully transparent.

create {textarea}/{textfield} creates a new textarea or textfield. These are standard JFC Graphics components which hold multiple or single lines of text that can be edited by the user.

create {textpanel} creates a new textpanel. This is not in fact a standard JFC Graphics component but an extension that provides the ability to create text styles and apply them on the fly to any passage of text. This is not the same as an HTML component, where the text style is applied by the component itself; here it is governed by the script, which decides how to represent each style in a dynamic manner. A textpanel can be instructed to scroll; this is done automatically when the cursor is moved over the text near the top or bottom of the textpanel area.

create {cursor} creates a new cursor. At the time of writing, Linguist is based on Java 1.1 which only supports a limited range of fixed cursors. The functionality of cursor will later be extended to include custom cursors. A cursor can be attached to a button or to a style so that no explicit programming is needed to cause the appropriate cursor to appear.

create {font} creates a new font. This has the same component parts as an AWT Font, viz family name, style and size, but also adds color, which can be either a color variable or an explicit value for red, green and blue.

create {border} creates a new border object. There are several different kinds of border, as follows:

An empty border adds blank space around whatever is contained by the component to which this border is applied. You specify the width or height of each of the four sides.

An etched border creates an impression of a raised or lowered component. You can specify the highlight and shadow colors.

A bevel border also creates an impression of a raised or lowered component. You can specify the highlight and shadow colors.

A line border simply draws a line around the component, having the specified color and thickness (default is one pixel).

A titled border draws a title string at a given position around the component.

Example(s):

   create MainWindow title "My Application" size 640 480
   create OKButton in MainWindow text "OK" at 100 100
   create FileIconLabel in MainWindow at 200 100
   create ContentsPanel in MainWindow
      at 300 200 size 300 300 scrolling
   create HandCursor hand
   create Red color 255 0 0
   create RedTitleFont name "Serif"
      style bold size 20 color Red
   create EmptyBorder style empty
      top 4 left 4 bottom 4 right 4
   create EtchedInBorder style etched in
      highlight LightGray shadow DarkGray
   create LoweredBevelBorder style bevel lowered
      highlight LightGray shadow DarkGray
   create RedLineBorder2 style line
      color Red thickness 2
   create TitleBorder style titled title "Thumbnail"
      justification center position bottom color Blue


Back Previous Next