List of usage examples for java.awt Graphics drawString
public abstract void drawString(AttributedCharacterIterator iterator, int x, int y);
From source file:raspihomeapp.ParamForm.java
private void drawClock(final Graphics g) { g.setColor(Color.white);/*from w w w .j a v a 2 s. c o m*/ g.drawString("Leistung in W", 1, 8); g.drawString("Uhrzeit", 750, 320); g.drawLine(20, 320, 20, 15); // Y -Achse g.drawLine(10, 310, 790, 310); // X-Achse }
From source file:org.chos.transaction.passport.controller.CaptchaController.java
@RequestMapping(value = "/captcha") public void captcha(HttpServletRequest request, HttpServletResponse response) throws IOException { BufferedImage bi = new BufferedImage(40, 18, BufferedImage.TYPE_INT_RGB); Graphics g = bi.getGraphics(); String c = generate();//from w w w . j a v a2 s . co m g.setColor(Color.white); g.fillRect(1, 1, 38, 16); g.setColor(generateColor()); g.drawString(c, 4, 13); response.setContentType("image/jpeg"); ServletOutputStream os = response.getOutputStream(); // os.write(b) // ImageIO.createImageOutputStream(os); ImageIO.write(bi, "jpg", os); os.flush(); os.close(); request.getSession().setAttribute("captcha", c); }
From source file:com.codenvy.corp.MainPage.java
private void addText(File file, String burnDownInfo) throws IOException { BufferedImage image = ImageIO.read(file); Graphics g = image.getGraphics(); g.setColor(Color.RED);/* ww w. j a v a 2 s. c o m*/ g.setFont(g.getFont().deriveFont(30f)); g.drawString(burnDownInfo, 550, 45); g.dispose(); ImageIO.write(image, "png", file); }
From source file:Simple.java
public void paint(Graphics g) { //Draw a Rectangle around the applet's display area. g.drawRect(0, 0, getWidth() - 1, getHeight() - 1); //Draw the current string inside the rectangle. g.drawString(buffer.toString(), 5, 15); }
From source file:EventTester.java
/** This method repaints the text in the window */ public void paint(Graphics g) { for (int i = 0; i < lines.size(); i++) g.drawString((String) lines.elementAt(i), 20, i * 16 + 50); }
From source file:Clock.java
private void drawStructure(Graphics g) { g.setFont(new Font("TimesRoman", Font.PLAIN, 14)); g.setColor(Color.blue);//from w ww . ja v a2 s . com g.drawOval(xcenter - 50, ycenter - 50, 100, 100); g.setColor(Color.darkGray); g.drawString("9", xcenter - 45, ycenter + 3); g.drawString("3", xcenter + 40, ycenter + 3); g.drawString("12", xcenter - 5, ycenter - 37); g.drawString("6", xcenter - 3, ycenter + 45); }
From source file:Center.java
License:asdf
public void paint(Graphics g) { g.translate(100, 100);// w w w .ja v a2 s .co m FontMetrics fm = g.getFontMetrics(); for (int i = 0; i < text.length; i++) { int x, y; x = (getWidth() - fm.stringWidth(text[i])) / 2; y = (i + 1) * fm.getHeight() - 1; g.drawString(text[i], x, y); } }
From source file:MainClass.java
public void paint(Graphics g) { AppletContext ac = getAppletContext(); try {//w w w. j a va 2s . co m URL url = new URL("http://www.java2s.com"); ac.showDocument(url, "frame2"); } catch (Exception e) { showStatus("Exception: " + e); } g.drawString("ShowDocument Applet", 10, 25); }
From source file:EventTestPane.java
/** This method repaints the text in the window */ public void paintComponent(Graphics g) { for (int i = 0; i < lines.size(); i++) g.drawString((String) lines.elementAt(i), 20, i * 16 + 50); }
From source file:Main.java
@Override protected void paintComponent(Graphics g) { super.paintComponent(g); FontMetrics fm = g.getFontMetrics(font); wordWidth = fm.stringWidth(word);/*www . j a va 2 s . co m*/ wordHeight = fm.getAscent(); g.setFont(new Font("impact", Font.PLAIN, 28)); g.setColor(Color.BLUE); g.drawString(word, x, y); }