Package javax.swing.plaf.synth

Examples of javax.swing.plaf.synth.SynthStyle


            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();
View Full Code Here


        }

        public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
            JComponent jc = (JComponent) c;
            SeaGlassContext context = getContext(jc);
            SynthStyle style = context.getStyle();
            if (style == null) {
                assert false : "SynthBorder is being used outside after the " + " UI has been uninstalled";
                return;
            }
            context.getPainter().paintViewportBorder(context, g, x, y, width, height);
View Full Code Here

     *
     * @param c DOCUMENT ME!
     */
    private void updateStyle(JTextComponent c) {
        SeaGlassContext context  = getContext(c, ENABLED);
        SynthStyle      oldStyle = style;

        style = SeaGlassLookAndFeel.updateStyle(context, this);

        updateSearchStyle(c, context, getPropertyPrefix());

View Full Code Here

     * @param  state  DOCUMENT ME!
     *
     * @return DOCUMENT ME!
     */
    private SeaGlassContext getContext(JComponent c, Region region, int state) {
        SynthStyle style = findStyle;

        if (region == SeaGlassRegion.SEARCH_FIELD_CANCEL_BUTTON) {
            style = cancelStyle;
        }

View Full Code Here

     *
     * @param sep DOCUMENT ME!
     */
    private void updateStyle(JSeparator sep) {
        SeaGlassContext context  = getContext(sep, ENABLED);
        SynthStyle      oldStyle = style;

        style = SeaGlassLookAndFeel.updateStyle(context, this);

        if (style != oldStyle) {
            if (sep instanceof JToolBar.Separator) {
View Full Code Here

        // Note: JViewport is special cased as it does not allow for
        // a border to be set. JViewport.setBorder is overriden to throw
        // an IllegalArgumentException. Refer to SynthScrollPaneUI for
        // details of this.
        SynthStyle newStyle = SynthLookAndFeel.getStyle(context.getComponent(), context.getRegion());
        SynthStyle oldStyle = context.getStyle();

        if (newStyle != oldStyle) {
            if (oldStyle != null) {
                oldStyle.uninstallDefaults(context);
            }
            context.setStyle(newStyle);
            newStyle.installDefaults(context);
        }
        this.style = newStyle;
View Full Code Here

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

        style = SeaGlassLookAndFeel.updateStyle(context, this);
        if (style != oldStyle) {
            if (oldStyle != null) {
                uninstallKeyboardActions((JRootPane) c);
View Full Code Here

        super.uninstallListeners(slider);
    }

    private void updateStyle(JSlider c) {
        SeaGlassContext context = getContext(c, ENABLED);
        SynthStyle oldStyle = style;
        style = SeaGlassLookAndFeel.updateStyle(context, this);

        if (style != oldStyle) {
            thumbWidth = style.getInt(context, "Slider.thumbWidth", 30);
View Full Code Here

    public SeaGlassContext getContext(JComponent c, Region subregion) {
        return getContext(c, subregion, getComponentState(c, subregion));
    }

    private SeaGlassContext getContext(JComponent c, Region subregion, int state) {
        SynthStyle style = null;
        Class klass = SeaGlassContext.class;

        if (subregion == Region.SLIDER_TRACK) {
            style = sliderTrackStyle;
        } else if (subregion == Region.SLIDER_THUMB) {
View Full Code Here

        }
    }

    protected void paintText(SeaGlassContext context, Graphics g, String title) {
        if (progressBar.isStringPainted()) {
            SynthStyle style = context.getStyle();
            Font font = style.getFont(context);
            FontMetrics fm = SwingUtilities2.getFontMetrics(progressBar, g, font);
            int strLength = style.getGraphicsUtils(context).computeStringWidth(context, font, fm, title);
            Rectangle bounds = progressBar.getBounds();

            if (rotateText && progressBar.getOrientation() == JProgressBar.VERTICAL) {
                Graphics2D g2 = (Graphics2D) g;
                // Calculate the position for the text.
                Point textPos;
                AffineTransform rotation;
                if (progressBar.getComponentOrientation().isLeftToRight()) {
                    rotation = AffineTransform.getRotateInstance(-Math.PI / 2);
                    textPos = new Point((bounds.width + fm.getAscent() - fm.getDescent()) / 2, (bounds.height + strLength) / 2);
                } else {
                    rotation = AffineTransform.getRotateInstance(Math.PI / 2);
                    textPos = new Point((bounds.width - fm.getAscent() + fm.getDescent()) / 2, (bounds.height - strLength) / 2);
                }

                // Progress bar isn't wide enough for the font. Don't paint it.
                if (textPos.x < 0) {
                    return;
                }

                // Paint the text.
                font = font.deriveFont(rotation);
                g2.setFont(font);
                g2.setColor(style.getColor(context, ColorType.TEXT_FOREGROUND));
                style.getGraphicsUtils(context).paintText(context, g, title, textPos.x, textPos.y, -1);
            } else {
                // Calculate the bounds for the text.
              // Rossi: Move text down by one pixel: Looks better but is a hack that may not look good for other font sizes / fonts
                Rectangle textRect = new Rectangle((bounds.width / 2) - (strLength / 2),
                    (bounds.height - (fm.getAscent() + fm.getDescent())) / 2+1, 0, 0);

                // Progress bar isn't tall enough for the font. Don't paint it.
                if (textRect.y < 0) {
                    return;
                }

                // Paint the text.
                g.setColor(style.getColor(context, ColorType.TEXT_FOREGROUND));
                g.setFont(font);
                style.getGraphicsUtils(context).paintText(context, g, title, textRect.x, textRect.y, -1);
            }
        }
    }
View Full Code Here

TOP

Related Classes of javax.swing.plaf.synth.SynthStyle

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.