Search in sources :

Example 16 with GraphicComponent

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);
}
Also used : GraphicComponent(main.swing.generic.components.misc.GraphicComponent) ObjType(main.entity.type.ObjType) BufferedImage(java.awt.image.BufferedImage) BufferedImage(java.awt.image.BufferedImage)

Example 17 with GraphicComponent

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");
}
Also used : GraphicComponent(main.swing.generic.components.misc.GraphicComponent) GraphicComponent(main.swing.generic.components.misc.GraphicComponent) BufferedImage(java.awt.image.BufferedImage)

Aggregations

GraphicComponent (main.swing.generic.components.misc.GraphicComponent)17 HC_TabPanel (eidolons.client.cc.gui.neo.tabs.HC_TabPanel)3 HC_Tab (eidolons.client.cc.gui.neo.tabs.HC_Tab)2 TextCompDC (eidolons.swing.components.panels.page.info.element.TextCompDC)2 WrappedTextComp (eidolons.swing.components.panels.page.log.WrappedTextComp)2 BufferedImage (java.awt.image.BufferedImage)2 ArrayList (java.util.ArrayList)2 PARAMETER (main.content.values.parameters.PARAMETER)2 G_Component (main.swing.generic.components.G_Component)2 G_Panel (main.swing.generic.components.G_Panel)2 SpecialValueBar (eidolons.client.cc.gui.neo.bars.SpecialValueBar)1 MouseEvent (java.awt.event.MouseEvent)1 CLASS_GROUP (main.content.enums.entity.HeroEnums.CLASS_GROUP)1 ObjType (main.entity.type.ObjType)1 Coordinates (main.game.bf.Coordinates)1 CompVisuals (main.swing.generic.components.CompVisuals)1 MouseClickListener (main.swing.generic.services.listener.MouseClickListener)1