Java Code Examples for java.awt.SystemColor#control()

The following examples show how to use java.awt.SystemColor#control() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: View.java    From jpexs-decompiler with GNU General Public License v3.0 5 votes vote down vote up
public static Color getDefaultBackgroundColor() {
    if (Configuration.useRibbonInterface.get()) {
        return SubstanceLookAndFeel.getCurrentSkin().getColorScheme(DecorationAreaType.GENERAL, ColorSchemeAssociationKind.FILL, ComponentState.ENABLED).getBackgroundFillColor();
    } else {
        return SystemColor.control;
    }
}
 
Example 2
Source File: TimelineBodyPanel.java    From jpexs-decompiler with GNU General Public License v3.0 5 votes vote down vote up
private static Color getControlColor() {
    if (Configuration.useRibbonInterface.get()) {
        return SubstanceLookAndFeel.getCurrentSkin().getColorScheme(DecorationAreaType.GENERAL, ColorSchemeAssociationKind.FILL, ComponentState.ENABLED).getBackgroundFillColor();
    } else {
        return SystemColor.control;
    }
}
 
Example 3
Source File: TimelinePanel.java    From jpexs-decompiler with GNU General Public License v3.0 5 votes vote down vote up
public static Color getBackgroundColor() {
    if (Configuration.useRibbonInterface.get()) {
        return SubstanceLookAndFeel.getCurrentSkin().getColorScheme(DecorationAreaType.GENERAL, ColorSchemeAssociationKind.FILL, ComponentState.ENABLED).getBackgroundFillColor();
    } else {
        return SystemColor.control;
    }
}
 
Example 4
Source File: FolderPreviewPanel.java    From jpexs-decompiler with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void paint(Graphics g) {
    super.paint(g);
    repaintQueued = false;
    Rectangle r = getVisibleRect();
    int width = getWidth();

    int cols = width / CELL_WIDTH;
    int rows = (int) Math.ceil(items.size() / (float) cols);
    int height = rows * CELL_HEIGHT;

    int start_y = r.y / CELL_HEIGHT;
    JLabel l = new JLabel();
    Font f = l.getFont().deriveFont(AffineTransform.getScaleInstance(0.8, 0.8));
    int finish_y = (int) Math.ceil((r.y + r.height) / (float) CELL_HEIGHT);
    Color color;
    Color selectedColor;
    Color selectedTextColor;
    Color borderColor;
    Color textColor;
    if (Configuration.useRibbonInterface.get()) {
        SubstanceSkin skin = SubstanceLookAndFeel.getCurrentSkin();
        color = skin.getColorScheme(DecorationAreaType.GENERAL, ColorSchemeAssociationKind.FILL, ComponentState.ENABLED).getBackgroundFillColor();
        selectedColor = skin.getColorScheme(DecorationAreaType.GENERAL, ColorSchemeAssociationKind.FILL, ComponentState.ROLLOVER_SELECTED).getBackgroundFillColor();
        borderColor = skin.getColorScheme(DecorationAreaType.GENERAL, ColorSchemeAssociationKind.BORDER, ComponentState.ROLLOVER_SELECTED).getUltraDarkColor();
        textColor = skin.getColorScheme(DecorationAreaType.GENERAL, ColorSchemeAssociationKind.FILL, ComponentState.ENABLED).getForegroundColor();
        selectedTextColor = skin.getColorScheme(DecorationAreaType.GENERAL, ColorSchemeAssociationKind.FILL, ComponentState.ROLLOVER_SELECTED).getForegroundColor();
    } else {
        color = SystemColor.control;
        selectedColor = SystemColor.textHighlight;
        borderColor = SystemColor.controlShadow;
        textColor = SystemColor.controlText;
        selectedTextColor = SystemColor.textHighlightText;
    }

    //g.setColor(SubstanceLookAndFeel.getCurrentSkin().getColorScheme(DecorationAreaType.GENERAL, ColorSchemeAssociationKind.FILL, ComponentState.ENABLED));
    for (int y = start_y; y <= finish_y; y++) {
        for (int x = 0; x < cols; x++) {
            int index = y * cols + x;
            if (index < items.size()) {

                g.setColor(color);
                if (selectedItems.containsKey(index)) {
                    g.setColor(selectedColor);
                }
                g.fillRect(x * CELL_WIDTH, y * CELL_HEIGHT, CELL_WIDTH, CELL_HEIGHT);
                if (cachedPreviews.contains(index)) {
                    SerializableImage sImg = cachedPreviews.get(index);
                    if (sImg != null) {
                        BufferedImage img = cachedPreviews.get(index).getBufferedImage();
                        g.drawImage(img, x * CELL_WIDTH + BORDER_SIZE + PREVIEW_SIZE / 2 - img.getWidth() / 2, y * CELL_HEIGHT + BORDER_SIZE + PREVIEW_SIZE / 2 - img.getHeight() / 2, null);
                    }
                } else {
                    cachedPreviews.put(index, noImage);
                    renderImageTask(index, items.get(index));
                }
                String s;
                TreeItem treeItem = items.get(index);
                if (treeItem instanceof Tag) {
                    s = ((Tag) treeItem).getTagName();
                    if (treeItem instanceof CharacterTag) {
                        s = s + " (" + ((CharacterTag) treeItem).getCharacterId() + ")";
                    }
                } else {
                    s = treeItem.toString();
                }
                g.setFont(f);
                g.setColor(borderColor);
                g.drawLine(x * CELL_WIDTH, y * CELL_HEIGHT + BORDER_SIZE + PREVIEW_SIZE, x * CELL_WIDTH + CELL_WIDTH, y * CELL_HEIGHT + BORDER_SIZE + PREVIEW_SIZE);
                g.drawRect(x * CELL_WIDTH, y * CELL_HEIGHT, CELL_WIDTH, CELL_HEIGHT);
                g.setColor(textColor);
                if (selectedItems.containsKey(index)) {
                    g.setColor(selectedTextColor);
                }
                g.drawString(s, x * CELL_WIDTH + BORDER_SIZE, y * CELL_HEIGHT + BORDER_SIZE + PREVIEW_SIZE + LABEL_HEIGHT);

            }
        }
    }

    if (lastWidth != width || lastHeight != height) {
        lastWidth = width;
        lastHeight = height;
        setSize(new Dimension(width, height));
    }
}