コード例 #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);
        }
コード例 #2
0
 private void _update(Graphics2D graphics2D, JComponent jComponent) {
   GFX ctx = new Java2DGFX(graphics2D);
   graphics2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
   graphics2D.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
   graphics2D.setRenderingHint(
       RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
   graphics2D.setRenderingHint(
       RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
   // graphics2D.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
   // RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
   ctx.setPaint(backgroundFill);
   ctx.fillRect(0, 0, jComponent.getWidth(), jComponent.getHeight());
   // draw the scene
   root.draw(ctx);
 }
コード例 #3
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);
 }