public void createUI(GLEx g) { if (visible) { LFont oldFont = g.getFont(); int oldColor = g.getColorRGB(); g.setFont(font); g.setColor(color); this.width = font.stringWidth(label); this.height = font.getSize(); if (alpha > 0 && alpha < 1) { g.setAlpha(alpha); g.drawEastString(label, x(), y()); g.setAlpha(1.0F); } else { g.drawEastString(label, x(), y()); } g.setFont(oldFont); g.setColor(oldColor); } }
/** * 设定选择器的基本构成(背景图,文字信息,信息连接顺序,字体,坐标) * * @param image * @param messages * @param joint * @param font * @param x * @param y */ public void set(LImage image, String[][] messages, int[] joint, LFont font, int x, int y) { super.exist = true; super.cancelflag = false; this.dialogImage = image; this.defFont = font; this.choice = messages; this.joint = joint; this.posX = x; this.posY = y; this.tab = 10; this.mesList = new int[messages[0].length]; for (int i = 0; i < mesList.length; i++) { mesList[i] = 0; } for (int i = 0; i < messages.length; i++) { for (int j = 0; j < messages[i].length; j++) { int width = defFont.stringWidth(messages[i][j]); if (mesList[j] < width) { mesList[j] = width; } } } // 单独一行高度 this.height = defFont.getHeight(); // 获得默认的上下文间隔大小 this.space = height + defFont.getSize() / 2; this.width = getWidthTotal(mesList, tab); // 颜色集合(用以改变指定行选项颜色) this.colors = new Color[messages.length]; for (int i = 0; i < colors.length; i++) { colors[i] = null; } this.view = 0; this.maxSize = choice.length; this.select = 0; this.visible = true; }