Package java.awt

Examples of java.awt.Graphics.drawString()


      String rand = String.valueOf(strArr[random.nextInt(strArr.length)]);
      sRand += rand;
      // 将认证码显示到图象中
      g.setColor(new Color(20 + random.nextInt(110), 20 + random.nextInt(110), 20 + random.nextInt(110)));
      // 调用函数出来的颜色相同,可能是因为种子太接近,所以只能直接生成
      g.drawString(rand, 13 * i + 6, 16);
    }

    // 图象生效
    g.dispose();
   
View Full Code Here


        for (VrpCustomer customer : schedule.getCustomerList()) {
            VrpLocation location = customer.getLocation();
            int x = translator.translateLongitudeToX(location.getLongitude());
            int y = translator.translateLatitudeToY(location.getLatitude());
            g.fillRect(x - 1, y - 1, 3, 3);
            g.drawString(Integer.toString(customer.getDemand()), x + 3, y - 3);
        }
        g.setColor(TangoColors.ALUMINIUM_4);
        for (VrpDepot depot : schedule.getDepotList()) {
            int x = translator.translateLongitudeToX(depot.getLocation().getLongitude());
            int y = translator.translateLatitudeToY(depot.getLocation().getLatitude());
View Full Code Here

                        ^ (previousLocation.getLatitude() < location.getLatitude());

                ImageIcon vehicleImageIcon = vehicleImageIcons[colorIndex];
                int vehicleInfoHeight = vehicleImageIcon.getIconHeight() + 2 + TEXT_SIZE;
                g.drawImage(vehicleImageIcon.getImage(), x + 1, (ascending ? y - vehicleInfoHeight - 1 : y + 1), this);
                g.drawString(load + " / " + vehicle.getCapacity(), x + 1, (ascending ? y - 1 : y + vehicleInfoHeight + 1));
            }
            colorIndex = (colorIndex + 1) % TangoColors.SEQUENCE_2.length;
        }

        // Legend
View Full Code Here

        }

        // Legend
        g.setColor(TangoColors.ALUMINIUM_4);
        g.fillRect(5, (int) height - 12 - TEXT_SIZE - (TEXT_SIZE / 2), 5, 5);
        g.drawString("Depot", 15, (int) height - 10 - TEXT_SIZE);
        g.setColor(TangoColors.ORANGE_2);
        g.fillRect(6, (int) height - 6 - (TEXT_SIZE / 2), 3, 3);
        g.drawString("Customer demand", 15, (int) height - 5);
        // Show soft score
        g.setColor(TangoColors.SCARLET_2);
View Full Code Here

        g.setColor(TangoColors.ALUMINIUM_4);
        g.fillRect(5, (int) height - 12 - TEXT_SIZE - (TEXT_SIZE / 2), 5, 5);
        g.drawString("Depot", 15, (int) height - 10 - TEXT_SIZE);
        g.setColor(TangoColors.ORANGE_2);
        g.fillRect(6, (int) height - 6 - (TEXT_SIZE / 2), 3, 3);
        g.drawString("Customer demand", 15, (int) height - 5);
        // Show soft score
        g.setColor(TangoColors.SCARLET_2);
        HardAndSoftScore score = schedule.getScore();
        if (score != null) {
            String totalDistanceString;
View Full Code Here

                totalDistanceString = "Not feasible";
            } else {
                totalDistanceString = numberFormat.format(- score.getSoftScore()) + " fuel";
            }
            g.setFont( g.getFont().deriveFont(Font.BOLD, (float) TEXT_SIZE * 2));
            g.drawString(totalDistanceString,
                    (int) width - g.getFontMetrics().stringWidth(totalDistanceString) - 10, (int) height - 10);
        }
        repaint();
    }

View Full Code Here

      Graphics clipg = g.create(gx, 0, w, height);
      clipg.setColor(Color.white);
      Graphics2D g2d = (Graphics2D) clipg;
      g2d.setColor(Color.white);
      g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
      clipg.drawString(title, 0, gy);
      clipg.dispose();
    }

    int w = CONTROL_CLOSE.getWidth(c);
    gx = x + width - OUTER_PAD - w - 2;
View Full Code Here

      while(textIt.hasNext()){
        DiagramText text = (DiagramText) textIt.next();
        g2.setFont(text.getFont());
        if(text.hasOutline()){
          g2.setColor(text.getOutlineColor());
          g2.drawString(text.getText(), text.getXPos() + 1, text.getYPos());
          g2.drawString(text.getText(), text.getXPos() - 1, text.getYPos());
          g2.drawString(text.getText(), text.getXPos(), text.getYPos() + 1);
          g2.drawString(text.getText(), text.getXPos(), text.getYPos() - 1);
        }
        g2.setColor(text.getColor());
View Full Code Here

        DiagramText text = (DiagramText) textIt.next();
        g2.setFont(text.getFont());
        if(text.hasOutline()){
          g2.setColor(text.getOutlineColor());
          g2.drawString(text.getText(), text.getXPos() + 1, text.getYPos());
          g2.drawString(text.getText(), text.getXPos() - 1, text.getYPos());
          g2.drawString(text.getText(), text.getXPos(), text.getYPos() + 1);
          g2.drawString(text.getText(), text.getXPos(), text.getYPos() - 1);
        }
        g2.setColor(text.getColor());
        g2.drawString(text.getText(), text.getXPos(), text.getYPos());
View Full Code Here

        g2.setFont(text.getFont());
        if(text.hasOutline()){
          g2.setColor(text.getOutlineColor());
          g2.drawString(text.getText(), text.getXPos() + 1, text.getYPos());
          g2.drawString(text.getText(), text.getXPos() - 1, text.getYPos());
          g2.drawString(text.getText(), text.getXPos(), text.getYPos() + 1);
          g2.drawString(text.getText(), text.getXPos(), text.getYPos() - 1);
        }
        g2.setColor(text.getColor());
        g2.drawString(text.getText(), text.getXPos(), text.getYPos());
      }
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.