Search in sources :

Example 1 with CartridgeInfo

use of org.javatari.atari.cartridge.CartridgeInfo in project javatari by ppeccin.

the class ConsolePanel method cartridgeInserted.

@Override
public void cartridgeInserted(Cartridge cartridge) {
    cartridgeInserted = cartridge != null;
    String label = null;
    int fore = -1, back = -1, bord = -1;
    Color b;
    if (cartridgeInserted) {
        CartridgeInfo info = cartridge.getInfo();
        label = info.label;
        fore = info.labelColor;
        back = info.labelBackColor;
        bord = info.labelBorderColor;
    }
    if (label == null)
        label = DEFAULT_CARTRIDGE_LABEL;
    if (fore == -1)
        fore = DEFAULT_CARTRIDGE_LABEL_COLOR;
    if (back == -1)
        back = DEFAULT_CARTRIDGE_BACK_COLOR;
    cartridgeLabelComponent.setText(label);
    cartridgeLabelComponent.setForeground(new Color(fore));
    cartridgeLabelComponent.setBackground(b = new Color(back));
    float bf = .9f;
    cartridgeLabelComponent.setBorder(bord == -1 ? new LineBorder(new Color((int) (b.getRed() * bf), (int) (b.getGreen() * bf), (int) (b.getBlue() * bf)), 1) : new LineBorder(new Color(bord), 1));
    removeHotspot(cartridgeInsertedHotspot);
    removeHotspot(cartridgeMissingHotspot);
    addHotspot(cartridgeInserted ? cartridgeInsertedHotspot : cartridgeMissingHotspot);
    removeHotspot(fileHotspot);
    removeHotspot(urlHotspot);
    if (screen.isCartridgeChangeEnabled()) {
        addHotspot(fileHotspot);
        addHotspot(urlHotspot);
    }
    if (isVisible())
        repaint();
}
Also used : Color(java.awt.Color) LineBorder(javax.swing.border.LineBorder) CartridgeInfo(org.javatari.atari.cartridge.CartridgeInfo)

Aggregations

Color (java.awt.Color)1 LineBorder (javax.swing.border.LineBorder)1 CartridgeInfo (org.javatari.atari.cartridge.CartridgeInfo)1