Ejemplo n.º 1
0
 public static BufferedImage tileImage(BufferedImage im, int width, int height) {
   GraphicsConfiguration gc =
       GraphicsEnvironment.getLocalGraphicsEnvironment()
           .getDefaultScreenDevice()
           .getDefaultConfiguration();
   int transparency = Transparency.OPAQUE; // Transparency.BITMASK;
   BufferedImage compatible = gc.createCompatibleImage(width, height, transparency);
   Graphics2D g = (Graphics2D) compatible.getGraphics();
   g.setPaint(new TexturePaint(im, new Rectangle(0, 0, im.getWidth(), im.getHeight())));
   g.fillRect(0, 0, width, height);
   return compatible;
 }
Ejemplo n.º 2
0
  private static String[] getFontList() {
    String[] nameArray =
        GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
    List<String> nameVector = new ArrayList<String>(nameArray.length);

    for (int i = 0, j; i < nameArray.length; i++) {
      for (j = 0; j < HIDEFONTS.length; j++) {
        if (nameArray[i].contains(HIDEFONTS[j])) break;
      }

      if (j == HIDEFONTS.length) nameVector.add(nameArray[i]);
    }

    String[] _array = new String[nameVector.size()];
    return nameVector.toArray(_array);
  }
Ejemplo n.º 3
0
  private String[] getFontList() {
    String[] nameArray =
        GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
    Vector nameVector = new Vector(nameArray.length);

    for (int i = 0, j; i < nameArray.length; i++) {
      for (j = 0; j < HIDEFONTS.length; j++) {
        if (nameArray[i].indexOf(HIDEFONTS[j]) >= 0) break;
      }

      if (j == HIDEFONTS.length) nameVector.addElement(nameArray[i]);
    }

    String[] _array = new String[nameVector.size()];
    nameVector.copyInto(_array);
    return _array;
  }