Examples of drawString()


Examples of java.awt.Graphics.drawString()

        g.setColor(Color.black);
        FontMetrics fm = g.getFontMetrics();

        int stringWidth = fm.stringWidth(s);
        int stringHeight = f.getSize() - 2;
        g.drawString(s, (width - stringWidth) / 2, height - (height - stringHeight) / 2);
        return new ImageIcon(bi);
    }

    public void actionPerformed(ActionEvent e) {
        Object source = e.getSource();
View Full Code Here

Examples of java.awt.Graphics.drawString()

        Graphics graphics = stringImage.getGraphics();

        //  Draw shadow
        if( shadowEnabled ) {
            graphics.setColor(getShadow());
            graphics.drawString(message, shadowX, stringAscent + shadowY);
        }

        //  Draw foreground
        graphics.setColor(getForeground());
        graphics.drawString(message, 0, stringAscent);
View Full Code Here

Examples of java.awt.Graphics.drawString()

            graphics.drawString(message, shadowX, stringAscent + shadowY);
        }

        //  Draw foreground
        graphics.setColor(getForeground());
        graphics.drawString(message, 0, stringAscent);
    }

    /**
     * Start the TickerTape.
     */
 
View Full Code Here

Examples of java.awt.Graphics.drawString()

    if (i != min)
        offset = fm.stringWidth(label) / 2;
          if (i >= max// Place rightmost label to left
        offset = fm.stringWidth(label);
   
    mygfx.drawString(label, x - offset, size.height/2);
          mygfx.drawLine(x, size.height/2, x, size.height);
    j++;
      } else
    mygfx.drawLine(x, 3 * size.height/4, x, size.height);
        }
View Full Code Here

Examples of java.awt.Graphics.drawString()

                          if (img != null) {
                              g.drawImage(img, px, py + ((itemHeight - img.getHeight(this)) / 2), this);
                              toff = imageTextGap + img.getWidth(this);
                          }
                      }
                      g.drawString(n, px + toff, py + fm.getHeight() - fm.getDescent() + ((itemHeight - fm.getHeight()) / 2));
                      py += itemHeight;
                    }
                    i++;
                }
            }
View Full Code Here

Examples of java.awt.Graphics.drawString()

        g.setColor(Color.white); g.fillRect(0, 0, width, height); g.setColor(Color.BLUE);
        int x = width / 2;
        int y = height / 2;
        int radius = Math.min(x, y);
        g.drawLine(x, y, x + (int) (radius * Math.cos(angle)), y + (int) (radius * Math.sin(angle)));
        g.drawString("giftest", r.nextInt(width), r.nextInt(height));
        return img;
    }

    public static void main(String[] args) {
        System.setProperty("java.awt.headless", "true"); // go into headless awt mode
View Full Code Here

Examples of java.awt.Graphics.drawString()

    if(bShowPerc) {
      s = s + " " + perc + "%";
    }
    Shape clip = memG.getClip();
    memG.setClip(0, 0, d.width-barWidth-12, d.height - 1);
    memG.drawString(s, 5, 14);
    memG.setClip(clip);

    memG.setColor(getBackground());
    memG.draw3DRect(0,0,d.width-barWidth-12,d.height-1, false);
    memG.draw3DRect(d.width-barWidth-10,0,barWidth+9,d.height-1, false);
View Full Code Here

Examples of java.awt.Graphics.drawString()

      titleImage = getGraphicsConfiguration().createCompatibleImage(w, TITLE_HEIGHT, Transparency.OPAQUE);
      Graphics ig = titleImage.getGraphics();
      ig.setColor(Color.BLACK);
      ig.fillRect(0, 0, w, TITLE_HEIGHT);
      ig.setColor(Color.WHITE);
      ig.drawString(title, 0, TITLE_HEIGHT - 3);
      ig.dispose();
    }
    int startX = Math.max(0, (width - titleImage.getWidth(null)) / 2);
    g.drawImage(titleImage, startX, height, null);
  }
View Full Code Here

Examples of java.awt.Graphics2D.drawString()

      setForeground(c);
      grp.setColor(c);
    }
    grp.setFont(ProgramPanel.mTimeFont);
    grp.drawString(mProgramTimeAsString, 1, mTimeFont.getSize());

    mTitleIcon.paintIcon(this, grp, WIDTH_LEFT, 0);

    if (!mSettings.isShowingOnlyDateAndTitle()) {
      mPictureAreaIcon.paintIcon(this,grp, WIDTH_LEFT, mTitleIcon.getIconHeight());
View Full Code Here

Examples of java.awt.Graphics2D.drawString()

        Graphics2D graphics = ((Java2DOutputDevice)outputDevice).getGraphics();
        if ( graphics.getFont().getSize() > threshold && level > NONE ) {
            prevHint = graphics.getRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING);
            graphics.setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING, antiAliasRenderingHint );
        }
        graphics.drawString( string, (int)x, (int)y );
        if ( graphics.getFont().getSize() > threshold && level > NONE ) {
            graphics.setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING, prevHint );
        }
    }
   
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.