Back to index

moin  1.9.0~rc2
Public Member Functions | Private Attributes
CH.ifa.draw.standard.ToolButton Class Reference

A PaletteButton that is associated with a tool. More...

Collaboration diagram for CH.ifa.draw.standard.ToolButton:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ToolButton (PaletteListener listener, String iconName, String name, Tool tool)
Tool tool ()
String name ()
Object attributeValue ()
Dimension getMinimumSize ()
Dimension getPreferredSize ()
void paintBackground (Graphics g)
void paintNormal (Graphics g)
void paintPressed (Graphics g)
void paintSelected (Graphics g)

Private Attributes

String fName
Tool fTool
PaletteIcon fIcon

Detailed Description

A PaletteButton that is associated with a tool.

See also:
Tool

Definition at line 16 of file ToolButton.java.


Constructor & Destructor Documentation

CH.ifa.draw.standard.ToolButton.ToolButton ( PaletteListener  listener,
String  iconName,
String  name,
Tool  tool 
) [inline]

Definition at line 22 of file ToolButton.java.

                                                                                         {
        super(listener);
        // use a Mediatracker to ensure that all the images are initially loaded
        Iconkit kit = Iconkit.instance();
        if (kit == null)
            throw new HJDError("Iconkit instance isn't set");

        Image im[] = new Image[3];

        im[0] = kit.loadImageResource(iconName+"1.gif");
        im[1] = kit.loadImageResource(iconName+"2.gif");
        im[2] = kit.loadImageResource(iconName+"3.gif");

        MediaTracker tracker = new MediaTracker(this);
        for (int i = 0; i < 3; i++) {
            tracker.addImage(im[i], i);
        }
        try {
            tracker.waitForAll();
        } catch (Exception e) { 
           e.printStackTrace();
           throw new RuntimeException("Bugger " + e.getMessage() + " " + iconName);
       }

        fIcon = new PaletteIcon(new Dimension(24,24), im[0], im[1], im[2]);
        fTool = tool;
        fName = name;
    }

Here is the call graph for this function:


Member Function Documentation

Definition at line 59 of file ToolButton.java.

                                   {
        return tool();
    }

Here is the call graph for this function:

Definition at line 63 of file ToolButton.java.

                                      {
        return new Dimension(fIcon.getWidth(), fIcon.getHeight());
    }

Definition at line 67 of file ToolButton.java.

                                        {
        return new Dimension(fIcon.getWidth(), fIcon.getHeight());
    }

Definition at line 55 of file ToolButton.java.

                         {
        return fName;
    }

Here is the caller graph for this function:

void CH.ifa.draw.standard.ToolButton.paintBackground ( Graphics  g) [inline]

Definition at line 71 of file ToolButton.java.

{ }
void CH.ifa.draw.standard.ToolButton.paintNormal ( Graphics  g) [inline]

Definition at line 73 of file ToolButton.java.

                                        {
        if (fIcon.normal() != null)
            g.drawImage(fIcon.normal(), 0, 0, this);
    }
void CH.ifa.draw.standard.ToolButton.paintPressed ( Graphics  g) [inline]

Definition at line 78 of file ToolButton.java.

                                         {
        if (fIcon.pressed() != null)
            g.drawImage(fIcon.pressed(), 0, 0, this);
    }
void CH.ifa.draw.standard.ToolButton.paintSelected ( Graphics  g) [inline]

Definition at line 83 of file ToolButton.java.

                                          {
        if (fIcon.selected() != null)
            g.drawImage(fIcon.selected(), 0, 0, this);
    }

Definition at line 51 of file ToolButton.java.

                       {
        return fTool;
    }

Here is the caller graph for this function:


Member Data Documentation

Definition at line 20 of file ToolButton.java.

Definition at line 18 of file ToolButton.java.

Definition at line 19 of file ToolButton.java.


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