use of main.swing.generic.components.misc.GraphicComponent in project Eidolons by IDemiurge.
the class SkirmishMaster method getBattlefieldImageAndText.
protected static Component getBattlefieldImageAndText(File file, String value, boolean isSelected) {
String typeName = value;
ObjType type = DataManager.getType(typeName, DC_TYPE.DUNGEONS);
if (type == null) {
String data = FileManager.readFile(file);
int beginIndex = data.indexOf(XML_Converter.openXmlFormatted(DungeonBuilder.DUNGEON_TYPE_NODE));
int endIndex = data.indexOf(XML_Converter.closeXmlFormatted(DungeonBuilder.DUNGEON_TYPE_NODE));
if (beginIndex != -1 && endIndex != -1) {
typeName = data.substring(beginIndex, endIndex);
type = DataManager.getType(typeName, DC_TYPE.DUNGEONS);
}
}
// crop entrance suffix etc
Image img = ImageManager.getEmptyUnitIcon().getImage();
if (type != null) {
img = type.getIcon().getImage();
}
int height = 12;
Image image = ImageManager.applyImage(VISUALS.PORTRAIT_BORDER.getImage(), img, 2, height);
BufferedImage buffered = ImageManager.getBufferedImage(image);
if (!StringMaster.isEmpty(value)) {
buffered.getGraphics().drawString(value, 10, height);
}
// };
return new GraphicComponent(buffered);
}
use of main.swing.generic.components.misc.GraphicComponent in project Eidolons by IDemiurge.
the class DialogPanel method paint.
public void paint(Graphics g) {
initLocation();
initButtonAreas();
BufferedImage image = ImageManager.getNewBufferedImage(getPanelWidth(), getPanelHeight());
super.paint(image.getGraphics());
for (Component c : compMap.keySet()) {
if (c instanceof GraphicComponent) {
GraphicComponent graphicComponent = (GraphicComponent) c;
Point p = compMap.get(c);
image.getGraphics().drawImage(graphicComponent.getImg(), p.x, p.y, null);
}
}
if (isDrawBackground()) {
g.setColor(getBackgroundColor());
g.fillRect(getBackgroundX(), getBackgroundY(), getBackgroundWidth(), getBackgroundHeight());
}
g.drawImage(image, getLocation().x, getLocation().y, null);
g.drawImage(IMG, ok.x, ok.y, null);
g.drawImage(VISUALS.CANCEL.getImage(), cancel.x, cancel.y, null);
// CustomButton okButton = new CustomButton(VISUALS.OK) {
// CustomButton closeButton = new CustomButton(VISUALS.CANCEL) {
// comp.add(okButton, "id ok, pos " + x + " 0");
// comp.add(closeButton, "pos ok.x @max_bottom, id close");
}
Aggregations