Java Reference
In-Depth Information
LISTING 5.14
continued
DISPLAY
LISTING 5.15
//********************************************************************
// StyleOptionsPanel.java Author: Lewis/Loftus
//
// Demonstrates the use of check boxes.
//********************************************************************
import
javax.swing.*;
import
java.awt.*;
import
java.awt.event.*;
public class
StyleOptionsPanel
extends
JPanel
{
private
JLabel saying;
private
JCheckBox bold, italic;
//-----------------------------------------------------------------
// Sets up a panel with a label and some check boxes that
// control the style of the label
'
s font.
//-----------------------------------------------------------------
public
StyleOptionsPanel()
{
saying =
new
JLabel ("Say it with style!");
saying.setFont (
new
Font ("Helvetica", Font.PLAIN, 36));
bold =
new
JCheckBox ("Bold");
bold.setBackground (Color.cyan);
Search WWH ::
Custom Search