API for seesaw.border - Seesaw

by Dave Ray

Full namespace name: seesaw.border

Overview

Functions for creating widget borders.

Public Variables and Functions



compound-border

function
Usage: (compound-border b)
       (compound-border b0 b1)
       (compound-border b0 b1 & more)
Create a compount border from the given arguments. Order is from inner to outer.
Each argument is passed through (seesaw.border/to-border).

Examples:
  
    ; Create an 4 pixel empty border, red line border, and title border.
    (compound-border 4 (line-border :color :red :thickness 4) "Title")

See:
  http://download.oracle.com/javase/6/docs/api/javax/swing/BorderFactory.html


custom-border

function
Usage: (custom-border & args)
Define a custom border with the following properties:
 
   :paint A function that takes the same arguments as Border.paintBorder:
            java.awt.Component c - The target component
             java.awt.Graphics g - The graphics context to draw to
                           int x - x position of border
                           int y - y position of border
                           int w - width of border
                           int h - height of border

   :insets Returns the insets of the border. Can be a zero-arg function that
             returns something that is passed through (seesaw.util/to-insets)
             or a constant value passed through the same. Defaults to 0.

   :opaque? Whether the border is opaque. A constant truthy value or a zero-arg
            function that returns a truthy value.

 See:
   http://download.oracle.com/javase/6/docs/api/javax/swing/border/Border.html
   (seesaw.util/to-insets)
 


empty-border

function
Usage: (empty-border & {:keys [thickness top left bottom right]})
Create an empty border. The following properties are supported:

  :thickness The thickness of the border (all sides) in pixels. This property
             is only used if :top, :bottom, etc are omitted. Defaults to 1.

  :top       Thickness of the top border in pixels. Defaults to 0.
  :left      Thickness of the left border in pixels. Defaluts to 0.
  :bottom    Thickness of the bottom border in pixels. Defaluts to 0.
  :right     Thickness of the right border in pixels. Defaluts to 0.

Examples:

    ; Create an empty 10 pixel border
    (empty-border :thickness 10)

    ; Create an empty border 5 pixels on top and left, 0 on other sides
    (empty-border :left 5 :top 5)


line-border

function
Usage: (line-border & {:keys [color thickness top left bottom right], :or {thickness 1, color Color/BLACK}})
Create a colored border with following properties:
 
   :color The color, passed through (seesaw.color/to-color). Defaults to black.
   :thickness The thickness of the border in pixels. This property is only used
              if :top, :bottom, etc are omitted. Defaults to 1.
   :top       Thickness of the top border in pixels. Defaults to 0.
   :left      Thickness of the left border in pixels. Defaluts to 0.
   :bottom    Thickness of the bottom border in pixels. Defaluts to 0.
   :right     Thickness of the right border in pixels. Defaluts to 0.

 Examples: 
   
     ; Create a green border, 3 pixels on top, 5 pixels on the botttom
     (line-border :color "#0f0" :top 3 :bottom 5)
 


to-border

function
Usage: (to-border b)
       (to-border b & args)
Construct a border. The border returned depends on the input:

  nil - returns nil
  a Border - returns b
  a number - returns an empty border with the given thickness
  a vector or list - returns a compound border by applying to-border
                     to each element, inner to outer.
  a i18n keyword   - returns a titled border using the given resource
  a string         - returns a titled border using the given stirng

If given more than one argument, a compound border is created by applying
to-border to each argument, inner to outer.


Note:

to-border is used implicitly by the :border option supported by all widgets
to it is rarely necessary to call directly.
Logo & site design by Tom Hickey.
Clojure auto-documentation system by Tom Faulhaber.