FileDocCategorySizeDatePackage
BevelExample.javaAPI DocExample1650Mon Nov 09 12:45:48 GMT 1998None

BevelExample

public class BevelExample extends JPanel implements MouseListener

Fields Summary
BevelBorder
bevel
EmptyBorder
empty
JLabel[]
label
Constructors Summary
public BevelExample()


      
        super(true);
        setLayout(new GridLayout(1, 4));

        bevel = new BevelBorder(BevelBorder.RAISED);
        empty = new EmptyBorder(5, 5, 5, 5);

        label[0] = new JLabel("Home");
        label[1] = new JLabel("Back");
        label[2] = new JLabel("Forward");
        label[3] = new JLabel("Stop");

        for (int i = 0; i < label.length; i++) {
            label[i].setHorizontalAlignment(JLabel.CENTER);
            label[i].addMouseListener(this);
            label[i].setBorder(empty);
            add(label[i]);
        }
    
Methods Summary
public static voidmain(java.lang.String[] s)

         JFrame frame = new JFrame("Bevel Border");
         frame.addWindowListener(new BasicWindowMonitor());
         frame.setSize(400, 100);
         frame.setContentPane(new BevelExample());
         frame.setVisible(true);
    
public voidmouseClicked(java.awt.event.MouseEvent e)

        String text = ((JLabel)e.getComponent()).getText();
        System.out.println("You clicked " + text + "!");
    
public voidmouseEntered(java.awt.event.MouseEvent e)

        ((JLabel)e.getComponent()).setBorder(bevel);
        repaint();
    
public voidmouseExited(java.awt.event.MouseEvent e)

        ((JLabel)e.getComponent()).setBorder(empty);
        repaint();
    
public voidmousePressed(java.awt.event.MouseEvent e)

public voidmouseReleased(java.awt.event.MouseEvent e)