Ejemplo n.º 1
0
        public void draw(
            GFX gfx,
            ListView listView,
            Paint paint,
            int index,
            double x,
            double y,
            double w,
            double h) {
          gfx.translate(x, y);

          if (paint instanceof PatternPaint) {
            PatternPaint pp = (PatternPaint) paint;
            double pw = pp.getImage().getWidth();
            double ph = pp.getImage().getHeight();
            double sx = w / pw;
            double sy = h / ph;
            gfx.scale(sx, sy);
            gfx.setPaint(pp);
            gfx.fillRect(0, 0, pw, ph);
            gfx.scale(1 / sx, 1 / sy);
          } else {
            gfx.setPaint(paint);
            gfx.fillRect(0, 0, w, h);
          }

          gfx.setPaint(FlatColor.BLACK);
          gfx.drawRect(0, 0, w, h);
          gfx.translate(-x, -y);
        }
Ejemplo n.º 2
0
 @Override
 public void draw(GFX g) {
   if (!isVisible()) return;
   g.setPaint(FlatColor.BLACK);
   g.fillRect(0, 0, getWidth(), getHeight());
   g.setPaint(FlatColor.WHITE);
   g.fillRect(0 + 1, 0 + 1, getWidth() - 2, getHeight() - 2);
   g.setPaint(selectedFill);
   g.fillRect(inset, inset, getWidth() - inset * 2, getHeight() - inset * 2);
 }
 public void draw(
     GFX gfx,
     TableView table,
     Song song,
     int row,
     int column,
     double x,
     double y,
     double width,
     double height) {
   if (row % 2 == 0) {
     gfx.setPaint(new FlatColor(0xf8f8ff));
   } else {
     gfx.setPaint(new FlatColor(0xffffff));
   }
   if (row == table.getSelectedRow()) {
     if (table.isFocused()) {
       gfx.setPaint(new FlatColor("#ddddff"));
     } else {
       gfx.setPaint(new FlatColor("#dddddd"));
     }
   }
   gfx.fillRect(x, y, width, height);
   gfx.setPaint(FlatColor.BLACK);
   String text = "";
   if (song != null) {
     switch (column) {
       case 0:
         text = song.name;
         break;
       case 1:
         text = song.artist;
         break;
       case 2:
         text = song.album;
         break;
       case 3:
         text = "" + (int) (song.duration / 60) + ":" + song.duration % 60;
         break;
       case 4:
         text = song.trackNumber + " ";
         break;
       case 5:
         text = song.totalTracks + " ";
         break;
       default:
         text = "--";
     }
   }
   Font.drawCenteredVertically(gfx, text, font, x + 3, y, width, height, false);
   gfx.setPaint(new FlatColor("#d0d0d0"));
   gfx.drawLine(x + width - 1, y, x + width - 1, y + height);
 }