Package com.seaglasslookandfeel

Examples of com.seaglasslookandfeel.SeaGlassContext


        context.dispose();
    }

    @Override
    public void paint(Graphics g, JComponent c) {
        SeaGlassContext context = getContext(c);

        paint(context, g);
        context.dispose();
    }
View Full Code Here


     * Update the style.
     *
     * @param c the component.
     */
    private void updateStyle(JTable c) {
        SeaGlassContext context  = getContext(c, ENABLED);
        SynthStyle      oldStyle = style;

        style = SeaGlassLookAndFeel.updateStyle(context, this);

        selectionActiveBottomBorderColor   = UIManager.getColor("seaGlassTableSelectionActiveBottom");
        selectionInactiveBottomBorderColor = UIManager.getColor("seaGlassTableSelectionInactiveBottom");
        transparentColor                   = UIManager.getColor("seaGlassTransparent");

        if (style != oldStyle) {
            table.remove(rendererPane);
            rendererPane = createCustomCellRendererPane();
            table.add(rendererPane);

            context.setComponentState(ENABLED | SELECTED);

            Color sbg = table.getSelectionBackground();

            if (sbg == null || sbg instanceof UIResource) {
                table.setSelectionBackground(style.getColor(context, ColorType.TEXT_BACKGROUND));
            }

            Color sfg = table.getSelectionForeground();

            if (sfg == null || sfg instanceof UIResource) {
                table.setSelectionForeground(style.getColor(context, ColorType.TEXT_FOREGROUND));
            }

            context.setComponentState(ENABLED);

            Color gridColor = table.getGridColor();

            if (gridColor == null || gridColor instanceof UIResource) {
                gridColor = (Color) style.get(context, "Table.gridColor");
                if (gridColor == null) {
                    gridColor = style.getColor(context, ColorType.FOREGROUND);
                }

                table.setGridColor(gridColor);
            }

            useTableColors = style.getBoolean(context, "Table.rendererUseTableColors", true);
            useUIBorder    = style.getBoolean(context, "Table.rendererUseUIBorder", true);

            Object rowHeight = style.get(context, "Table.rowHeight");

            if (rowHeight != null) {
                LookAndFeel.installProperty(table, "rowHeight", rowHeight);
            }

            boolean showGrid = style.getBoolean(context, "Table.showGrid", true);

            if (!showGrid) {
                table.setShowGrid(false);
            }

            Dimension d = table.getIntercellSpacing();
            // if (d == null || d instanceof UIResource) {
            if (d != null) {
                d = (Dimension) style.get(context, "Table.intercellSpacing");
            }

            alternateColor = (Color) style.get(context, "Table.alternateRowColor");
            if (d != null) {
                table.setIntercellSpacing(d);
            }

            table.setOpaque(false);

            if (alternateColor != null) {
                table.setShowHorizontalLines(false);
            }

            // Make header column extend the width of the viewport (if there is
            // a viewport).
            table.getTableHeader().setBorder(createTableHeaderEmptyColumnPainter(table));
            setViewPortListeners(table);

            if (oldStyle != null) {
                uninstallKeyboardActions();
                installKeyboardActions();
            }
        }

        context.dispose();
    }
View Full Code Here

        if (table.getTransferHandler() instanceof UIResource) {
            table.setTransferHandler(null);
        }

        SeaGlassContext context = getContext(table, ENABLED);

        style.uninstallDefaults(context);
        context.dispose();
        style = null;
    }
View Full Code Here

    /**
     * @see javax.swing.plaf.ComponentUI#update(java.awt.Graphics,
     *      javax.swing.JComponent)
     */
    public void update(Graphics g, JComponent c) {
        SeaGlassContext context = getContext(c);

        SeaGlassLookAndFeel.update(context, g);
        context.getPainter().paintTableBackground(context, g, 0, 0, c.getWidth(), c.getHeight());
        paint(context, g);
        context.dispose();
    }
View Full Code Here

    /**
     * @see javax.swing.plaf.basic.BasicTableUI#paint(java.awt.Graphics,
     *      javax.swing.JComponent)
     */
    public void paint(Graphics g, JComponent c) {
        SeaGlassContext context = getContext(c);

        paint(context, g);
        context.dispose();
    }
View Full Code Here

        if (c.getComponentCount() > 0 && c.getLayout() != null) {
            return null;
        }

        AbstractButton     b             = (AbstractButton) c;
        SeaGlassContext    ss            = getContext(c);
        SynthStyle         style2        = ss.getStyle();
        SynthGraphicsUtils graphicsUtils = style2.getGraphicsUtils(ss);
        Dimension          size          = graphicsUtils.getPreferredSize(ss, style2.getFont(ss), b.getText(), getSizingIcon(b),
                                                                          b.getHorizontalAlignment(),
                                                                          b.getVerticalAlignment(), b.getHorizontalTextPosition(),
                                                                          b.getVerticalTextPosition(), b.getIconTextGap(),
                                                                          b.getDisplayedMnemonicIndex());

        ss.dispose();
        // Make height odd.
        size.height &= ~1;
        return size;
    }
View Full Code Here

        if (c.getComponentCount() > 0 && c.getLayout() != null) {
            return null;
        }

        AbstractButton   b      = (AbstractButton) c;
        SeaGlassContext  ss     = getContext(c);
        final SynthStyle style2 = ss.getStyle();
        Dimension        size   = style2.getGraphicsUtils(ss).getMaximumSize(ss, style2.getFont(ss), b.getText(), getSizingIcon(b),
                                                                             b.getHorizontalAlignment(), b.getVerticalAlignment(),
                                                                             b.getHorizontalTextPosition(), b.getVerticalTextPosition(),
                                                                             b.getIconTextGap(), b.getDisplayedMnemonicIndex());

        ss.dispose();
        return size;
    }
View Full Code Here

        }
        splitPane.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, managingFocusBackwardTraversalKeys);
    }

    private void updateStyle(JSplitPane splitPane) {
        SeaGlassContext context = getContext(splitPane, Region.SPLIT_PANE_DIVIDER, ENABLED);
        SynthStyle oldDividerStyle = dividerStyle;
        dividerStyle = SeaGlassLookAndFeel.updateStyle(context, this);
        context.dispose();

        context = getContext(splitPane, ENABLED);
        SynthStyle oldStyle = style;

        style = SeaGlassLookAndFeel.updateStyle(context, this);

        if (style != oldStyle) {
            Object value = style.get(context, "SplitPane.size");
            if (value == null) {
                value = new Integer(6);
            }
            LookAndFeel.installProperty(splitPane, "dividerSize", value);

            value = style.get(context, "SplitPane.oneTouchExpandable");
            if (value != null) {
                LookAndFeel.installProperty(splitPane, "oneTouchExpandable", value);
            }

            if (divider != null) {
                splitPane.remove(divider);
                divider.setDividerSize(splitPane.getDividerSize());
            }
            if (oldStyle != null) {
                uninstallKeyboardActions();
                installKeyboardActions();
            }
        }
        if (style != oldStyle || dividerStyle != oldDividerStyle) {
            // Only way to force BasicSplitPaneDivider to reread the
            // necessary properties.
            if (divider != null) {
                splitPane.remove(divider);
            }
            divider = createDefaultDivider();
            divider.setBasicSplitPaneUI(this);
            splitPane.add(divider, JSplitPane.DIVIDER);
        }
        context.dispose();
    }
View Full Code Here

    /**
     * Uninstalls the UI defaults.
     */
    protected void uninstallDefaults() {
        SeaGlassContext context = getContext(splitPane, ENABLED);

        style.uninstallDefaults(context);
        context.dispose();
        style = null;

        context = getContext(splitPane, Region.SPLIT_PANE_DIVIDER, ENABLED);
        dividerStyle.uninstallDefaults(context);
        context.dispose();
        dividerStyle = null;

        super.uninstallDefaults();
    }
View Full Code Here

            }
        };
    }

    public void update(Graphics g, JComponent c) {
        SeaGlassContext context = getContext(c);

        SeaGlassLookAndFeel.update(context, g);
        context.getPainter().paintSplitPaneBackground(context, g, 0, 0, c.getWidth(), c.getHeight());
        paint(context, g);
        context.dispose();
    }
View Full Code Here

TOP

Related Classes of com.seaglasslookandfeel.SeaGlassContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.