7.6. COLORS
85
For example, the following program extends our previous example, by specifying
that the text on the label should be displayed in a 60 point bold face Helvetica
font:
(define w
(window "Hello"
(label "Hello again" (HelveticaBold 60))))
(.pack w)
(.show w)
The (.pack w) expression changes the size of the window so that it is just large
enough to fit the label.
One can also specify other fonts using the Font. procedure. This requires
you to specify the name of the font, the style (bold, italic, plain), and the size
(in points).
(define w
(window "Hello"
(label "Hello again"
(Font. "New Century Schoolbook" Font.BOLD$ 32))))
(.pack w)
(.show w)
The style is specified by using one of the following style names:
Font.BOLD$
Font.Plain$
Font.Italic$
The name of the font is a string (enclosed in curly braces), and the point size
is any positive integer. Note: this will cause an error if you ask for a font that
the computer does not have access to.
7.6
Colors
There are several ways to specify colors. The simplest is to use one of the named
colors. The current set of named colors for JLIB is
white, lightGray gray darkGray black
red pink orange yellow green magentan cyan blue
You can also specify a color by specifying how much red, green, and blue light
should be mixed to form the color:
(color RED GREEN BLUE)
where RED, GREEN, BLUE are numbers between 0 and 255. Note that this is
additive color mixing which is quite different from the subtractive color mixing
of paints. For example to get yellow you mix red and green, to get white you
mix red, green, and blue. Some of the color mixes are shown below:




  

Home

About Services Network Support FAQ Order Contact
 

Tomcat Web Hosting

Our partners:Jsp Web Hosting Unlimited Web Hosting Cheapest Web Hosting  Java Web Hosting Web Templates Best Web Templates PHP Mysql Web Hosting Interland Web Hosting Cheap Web Hosting PHP Web Hosting Tomcat Web Hosting Quality Web Hosting Best Web Hosting  Mac Web Hosting 

Lunarwebhost.net  Business web hosting division of Vision Web Hosting Inc. All rights reserved