Search in sources :

Example 21 with TextAttribute

use of java.awt.font.TextAttribute in project megameklab by MegaMek.

the class ImageHelper method printC3sName.

public static void printC3sName(Graphics2D g2d, float lineStart, float linePoint, Font font, boolean isArmored, boolean mixed) {
    Font c3Font = font.deriveFont(font.getStyle(), font.getSize2D());
    HashMap<TextAttribute, Integer> attrMap = new HashMap<TextAttribute, Integer>();
    attrMap.put(TextAttribute.SUPERSCRIPT, TextAttribute.SUPERSCRIPT_SUPER);
    int stringWidth;
    if (isArmored) {
        g2d.drawString("O C   Slave" + (mixed ? " (IS)" : ""), lineStart, linePoint);
        stringWidth = ImageHelper.getStringWidth(g2d, "O C", c3Font);
    } else {
        g2d.drawString("C   Slave" + (mixed ? " (IS)" : ""), lineStart, linePoint);
        stringWidth = ImageHelper.getStringWidth(g2d, "C", c3Font);
    }
    // stringWidth = ImageHelper.getStringWidth(g2d, "C", font);
    c3Font = font.deriveFont(attrMap);
    g2d.setFont(c3Font);
    g2d.drawString("3", lineStart + stringWidth, linePoint);
    g2d.setFont(font);
}
Also used : HashMap(java.util.HashMap) TextAttribute(java.awt.font.TextAttribute) Font(java.awt.Font)

Example 22 with TextAttribute

use of java.awt.font.TextAttribute in project megameklab by MegaMek.

the class ImageHelper method printC3RemoteSensorAmmoName.

public static void printC3RemoteSensorAmmoName(Graphics2D g2d, float lineStart, float linePoint, Font font) {
    Font c3Font = font.deriveFont(font.getStyle(), font.getSize2D());
    HashMap<TextAttribute, Integer> attrMap = new HashMap<TextAttribute, Integer>();
    attrMap.put(TextAttribute.SUPERSCRIPT, TextAttribute.SUPERSCRIPT_SUPER);
    int stringWidth;
    g2d.drawString("Ammo (C  Remote Sensor) 4", lineStart, linePoint);
    stringWidth = ImageHelper.getStringWidth(g2d, "Ammo (C", c3Font);
    c3Font = font.deriveFont(attrMap);
    g2d.setFont(c3Font);
    g2d.drawString("3", lineStart + stringWidth, linePoint);
    g2d.setFont(font);
}
Also used : HashMap(java.util.HashMap) TextAttribute(java.awt.font.TextAttribute) Font(java.awt.Font)

Example 23 with TextAttribute

use of java.awt.font.TextAttribute in project megameklab by MegaMek.

the class ImageHelper method printNavalC3Name.

public static void printNavalC3Name(Graphics2D g2d, float lineStart, float linePoint, Font font, boolean isArmored, boolean mixed) {
    Font c3Font = font.deriveFont(font.getStyle(), font.getSize2D());
    HashMap<TextAttribute, Integer> attrMap = new HashMap<TextAttribute, Integer>();
    attrMap.put(TextAttribute.SUPERSCRIPT, TextAttribute.SUPERSCRIPT_SUPER);
    int stringWidth;
    if (isArmored) {
        g2d.drawString("O Naval C   CPU" + (mixed ? " (IS)" : ""), lineStart, linePoint);
        stringWidth = ImageHelper.getStringWidth(g2d, "O Naval C", c3Font);
    } else {
        g2d.drawString("Naval C   CPU" + (mixed ? " (IS)" : ""), lineStart, linePoint);
        stringWidth = ImageHelper.getStringWidth(g2d, "Naval C", c3Font);
    }
    c3Font = font.deriveFont(attrMap);
    g2d.setFont(c3Font);
    g2d.drawString("3", lineStart + stringWidth, linePoint);
    g2d.setFont(font);
}
Also used : HashMap(java.util.HashMap) TextAttribute(java.awt.font.TextAttribute) Font(java.awt.Font)

Example 24 with TextAttribute

use of java.awt.font.TextAttribute in project megameklab by MegaMek.

the class ImageHelper method printC3RemoteSensorName.

public static void printC3RemoteSensorName(Graphics2D g2d, float lineStart, float linePoint, Font font, boolean isArmored, boolean mixed) {
    Font c3Font = font.deriveFont(font.getStyle(), font.getSize2D());
    HashMap<TextAttribute, Integer> attrMap = new HashMap<TextAttribute, Integer>();
    attrMap.put(TextAttribute.SUPERSCRIPT, TextAttribute.SUPERSCRIPT_SUPER);
    int stringWidth;
    if (isArmored) {
        g2d.drawString("O C   Remote Sensor Launcher" + (mixed ? " (IS)" : ""), lineStart, linePoint);
        stringWidth = ImageHelper.getStringWidth(g2d, "O C", c3Font);
    } else {
        g2d.drawString("C   Remote Sensor Launcher" + (mixed ? " (IS)" : ""), lineStart, linePoint);
        stringWidth = ImageHelper.getStringWidth(g2d, "C", c3Font);
    }
    c3Font = font.deriveFont(attrMap);
    g2d.setFont(c3Font);
    g2d.drawString("3", lineStart + stringWidth, linePoint);
    g2d.setFont(font);
}
Also used : HashMap(java.util.HashMap) TextAttribute(java.awt.font.TextAttribute) Font(java.awt.Font)

Example 25 with TextAttribute

use of java.awt.font.TextAttribute in project megameklab by MegaMek.

the class ImageHelper method printC3iName.

public static void printC3iName(Graphics2D g2d, float lineStart, float linePoint, Font font, boolean isArmored, boolean mixed) {
    Font c3Font = font.deriveFont(font.getStyle(), font.getSize2D());
    HashMap<TextAttribute, Integer> attrMap = new HashMap<TextAttribute, Integer>();
    attrMap.put(TextAttribute.SUPERSCRIPT, TextAttribute.SUPERSCRIPT_SUPER);
    int stringWidth;
    if (isArmored) {
        g2d.drawString("O Improved C   CPU" + (mixed ? " (IS)" : ""), lineStart, linePoint);
        stringWidth = ImageHelper.getStringWidth(g2d, "O Improved C", c3Font);
    } else {
        g2d.drawString("Improved C   CPU" + (mixed ? " (IS)" : ""), lineStart, linePoint);
        stringWidth = ImageHelper.getStringWidth(g2d, "Improved C", c3Font);
    }
    c3Font = font.deriveFont(attrMap);
    g2d.setFont(c3Font);
    g2d.drawString("3", lineStart + stringWidth, linePoint);
    g2d.setFont(font);
}
Also used : HashMap(java.util.HashMap) TextAttribute(java.awt.font.TextAttribute) Font(java.awt.Font)

Aggregations

TextAttribute (java.awt.font.TextAttribute)31 Font (java.awt.Font)22 HashMap (java.util.HashMap)22 Configuration (com.haulmont.cuba.core.global.Configuration)2 DesktopConfig (com.haulmont.cuba.desktop.DesktopConfig)2 FontMetrics (java.awt.FontMetrics)2 Paint (java.awt.Paint)2 MouseEvent (java.awt.event.MouseEvent)2 AffineTransform (java.awt.geom.AffineTransform)2 Hashtable (java.util.Hashtable)2 DesktopResources (com.haulmont.cuba.desktop.DesktopResources)1 CollapsiblePanel (com.haulmont.cuba.desktop.sys.vcl.CollapsiblePanel)1 WebColors (com.revolsys.awt.WebColors)1 Geometry (com.revolsys.geometry.model.Geometry)1 SwingUtil (com.revolsys.swing.SwingUtil)1 ClipboardUtil (com.revolsys.swing.dnd.ClipboardUtil)1 AbstractRecordLayer (com.revolsys.swing.map.layer.record.AbstractRecordLayer)1 LayerRecord (com.revolsys.swing.map.layer.record.LayerRecord)1 LayerRecordMenu (com.revolsys.swing.map.layer.record.LayerRecordMenu)1 RecordLayerTableModel (com.revolsys.swing.map.layer.record.table.model.RecordLayerTableModel)1