Example #1
0
  public void draw(GraphicsWrapper gw) {
    // draw border
    gw.setColor(0, 0, 0);
    gw.drawRect(x0, y0, width, height);

    for (PaletteButton b : buttons) {
      b.draw(x0, y0, gw);
    }
  }
Example #2
0
 // returns -1 if no button contains the given point
 public int indexOfButtonContainingTheGivenPoint(float x, float y) {
   for (int j = 0; j < buttons.size(); ++j) {
     PaletteButton b = buttons.get(j);
     if (b.contains(
         x - x0,
         y
             - y0)) // the subtraction converts the coordinates to the palette's local coordinate
                    // system
     return j;
   }
   return -1;
 }
Example #3
0
 public void paletteUserOver(PaletteButton button, boolean inside) {
   if (inside) {
     showStatus(button.name());
   } else if (fSelectedToolButton != null) {
     showStatus(fSelectedToolButton.name());
   }
 }
Example #4
0
 public void paint(Graphics g) {
   // selecting does not work as expected with JFC1.1
   // see JavaBug: 4228035, 4233965
   if (isSelected()) {
     paintSelected(g);
   } else {
     super.paint(g);
   }
 }