Back to index

moin  1.9.0~rc2
Public Member Functions | Static Package Attributes | Private Attributes
CH.ifa.draw.util.PaletteButton Class Reference

A palette button is a three state button. More...

Collaboration diagram for CH.ifa.draw.util.PaletteButton:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 PaletteButton (PaletteListener listener)
 Constructs a PaletteButton.
abstract void paintBackground (Graphics g)
abstract void paintNormal (Graphics g)
abstract void paintPressed (Graphics g)
abstract void paintSelected (Graphics g)
Object value ()
String name ()
void reset ()
void select ()
void mousePressed (MouseEvent e)
void mouseDragged (MouseEvent e)
void mouseReleased (MouseEvent e)
void mouseMoved (MouseEvent e)
void mouseExited (MouseEvent e)
void mouseClicked (MouseEvent e)
void mouseEntered (MouseEvent e)
void update (Graphics g)
void paint (Graphics g)

Static Package Attributes

static final int NORMAL = 1
static final int PRESSED = 2
static final int SELECTED = 3

Private Attributes

PaletteListener fListener
int fState
int fOldState

Detailed Description

A palette button is a three state button.

The states are normal pressed and selected. It uses to the palette listener interface to notify about state changes.

See also:
PaletteListener
PaletteLayout

Definition at line 20 of file PaletteButton.java.


Constructor & Destructor Documentation

Constructs a PaletteButton.

Parameters:
listenerthe listener to be notified.

Definition at line 37 of file PaletteButton.java.

                                                   {
        fListener = listener;
        fState = fOldState = NORMAL;
        addMouseListener(this);
        addMouseMotionListener(this);
    }

Member Function Documentation

void CH.ifa.draw.util.PaletteButton.mouseClicked ( MouseEvent  e) [inline]

Definition at line 98 of file PaletteButton.java.

{}
void CH.ifa.draw.util.PaletteButton.mouseDragged ( MouseEvent  e) [inline]

Definition at line 73 of file PaletteButton.java.

                                           {
        if (contains(e.getX(),e.getY()))
            fState = PRESSED;
        else
            fState = fOldState;
        repaint();
    }

Here is the caller graph for this function:

void CH.ifa.draw.util.PaletteButton.mouseEntered ( MouseEvent  e) [inline]

Definition at line 99 of file PaletteButton.java.

{}
void CH.ifa.draw.util.PaletteButton.mouseExited ( MouseEvent  e) [inline]

Definition at line 92 of file PaletteButton.java.

                                          {
        if (fState == PRESSED) // JDK1.1 on Windows sometimes looses mouse released
            mouseDragged(e);
        fListener.paletteUserOver(this, false);
    }

Here is the call graph for this function:

void CH.ifa.draw.util.PaletteButton.mouseMoved ( MouseEvent  e) [inline]

Definition at line 88 of file PaletteButton.java.

                                         {
        fListener.paletteUserOver(this, true);
    }

Here is the call graph for this function:

void CH.ifa.draw.util.PaletteButton.mousePressed ( MouseEvent  e) [inline]

Definition at line 67 of file PaletteButton.java.

                                           {
        fOldState = fState;
        fState = PRESSED;
        repaint();
    }
void CH.ifa.draw.util.PaletteButton.mouseReleased ( MouseEvent  e) [inline]

Definition at line 81 of file PaletteButton.java.

                                            {
        fState = fOldState;
        repaint();
        if (contains(e.getX(),e.getY()))
            fListener.paletteUserSelected(this);
    }

Here is the call graph for this function:

Definition at line 53 of file PaletteButton.java.

                         {
        return "";
    }
void CH.ifa.draw.util.PaletteButton.paint ( Graphics  g) [inline]

Definition at line 105 of file PaletteButton.java.

                                  {
        paintBackground(g);

        switch (fState) {
        case PRESSED:
            paintPressed(g);
            break;
        case SELECTED:
            paintSelected(g);
            break;
        case NORMAL:
        default:
            paintNormal(g);
            break;
        }
    }

Here is the call graph for this function:

Here is the caller graph for this function:

abstract void CH.ifa.draw.util.PaletteButton.paintBackground ( Graphics  g) [pure virtual]

Here is the caller graph for this function:

abstract void CH.ifa.draw.util.PaletteButton.paintNormal ( Graphics  g) [pure virtual]

Here is the caller graph for this function:

abstract void CH.ifa.draw.util.PaletteButton.paintPressed ( Graphics  g) [pure virtual]

Here is the caller graph for this function:

abstract void CH.ifa.draw.util.PaletteButton.paintSelected ( Graphics  g) [pure virtual]

Here is the caller graph for this function:

Definition at line 57 of file PaletteButton.java.

                        {
        fState = NORMAL;
        repaint();
    }

Here is the caller graph for this function:

Definition at line 62 of file PaletteButton.java.

                         {
        fState = SELECTED;
        repaint();
    }
void CH.ifa.draw.util.PaletteButton.update ( Graphics  g) [inline]

Definition at line 101 of file PaletteButton.java.

                                   {
        paint(g);
    }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 49 of file PaletteButton.java.

                          {
        return null;
    }

Here is the caller graph for this function:


Member Data Documentation

Definition at line 28 of file PaletteButton.java.

Definition at line 30 of file PaletteButton.java.

Definition at line 29 of file PaletteButton.java.

final int CH.ifa.draw.util.PaletteButton.NORMAL = 1 [static, package]

Definition at line 24 of file PaletteButton.java.

final int CH.ifa.draw.util.PaletteButton.PRESSED = 2 [static, package]

Definition at line 25 of file PaletteButton.java.

final int CH.ifa.draw.util.PaletteButton.SELECTED = 3 [static, package]

Definition at line 26 of file PaletteButton.java.


The documentation for this class was generated from the following file: