예제 #1
0
 private void loadSymbol() {
   File file = graphicsManager.getLoadPath();
   if (file != null) {
     ImageIcon icon = IconFactory.findIcon(file.getAbsolutePath());
     if (icon != null) {
       model.updateSymbolIcon(icon);
       updateImages();
     }
   }
 }
예제 #2
0
  private void generateSymbol() {
    String symbol;
    String name = model.getCharacter().getCharacterLevelName(4);
    StringTokenizer tokens = new StringTokenizer(name, " ");
    if (tokens.countTokens() == 1) {
      symbol = tokens.nextToken().substring(0, 2);
    } else if (tokens.countTokens() > 1) {
      symbol = tokens.nextToken().substring(0, 1) + tokens.nextToken().substring(0, 1);
    } else {
      return;
    }

    BufferedImage bi = new BufferedImage(100, 100, BufferedImage.TYPE_4BYTE_ABGR);
    Graphics2D g = (Graphics2D) bi.getGraphics();
    g.setFont(new Font("Dialog", Font.BOLD, 56));
    g.setColor(Color.black);
    GraphicsUtil.drawCenteredString(g, 0, 0, 100, 100, symbol);
    ImageIcon icon = new ImageIcon(bi);
    model.updateSymbolIcon(icon);
    updateImages();
  }