Search in sources :

Example 11 with View

use of javax.swing.text.View in project jdk8u_jdk by JetBrains.

the class BasicLabelUI method getMaximumSize.

/**
     * @return getPreferredSize(c)
     */
public Dimension getMaximumSize(JComponent c) {
    Dimension d = getPreferredSize(c);
    View v = (View) c.getClientProperty(BasicHTML.propertyKey);
    if (v != null) {
        d.width += v.getMaximumSpan(View.X_AXIS) - v.getPreferredSpan(View.X_AXIS);
    }
    return d;
}
Also used : Dimension(java.awt.Dimension) View(javax.swing.text.View)

Example 12 with View

use of javax.swing.text.View in project jdk8u_jdk by JetBrains.

the class BasicButtonUI method getMaximumSize.

public Dimension getMaximumSize(JComponent c) {
    Dimension d = getPreferredSize(c);
    View v = (View) c.getClientProperty(BasicHTML.propertyKey);
    if (v != null) {
        d.width += v.getMaximumSpan(View.X_AXIS) - v.getPreferredSpan(View.X_AXIS);
    }
    return d;
}
Also used : View(javax.swing.text.View)

Example 13 with View

use of javax.swing.text.View in project jdk8u_jdk by JetBrains.

the class BasicButtonUI method getMinimumSize.

// ********************************
//          Layout Methods
// ********************************
public Dimension getMinimumSize(JComponent c) {
    Dimension d = getPreferredSize(c);
    View v = (View) c.getClientProperty(BasicHTML.propertyKey);
    if (v != null) {
        d.width -= v.getPreferredSpan(View.X_AXIS) - v.getMinimumSpan(View.X_AXIS);
    }
    return d;
}
Also used : View(javax.swing.text.View)

Example 14 with View

use of javax.swing.text.View in project jdk8u_jdk by JetBrains.

the class BasicTabbedPaneUI method calculateTabWidth.

protected int calculateTabWidth(int tabPlacement, int tabIndex, FontMetrics metrics) {
    Insets tabInsets = getTabInsets(tabPlacement, tabIndex);
    int width = tabInsets.left + tabInsets.right + 3;
    Component tabComponent = tabPane.getTabComponentAt(tabIndex);
    if (tabComponent != null) {
        width += tabComponent.getPreferredSize().width;
    } else {
        Icon icon = getIconForTab(tabIndex);
        if (icon != null) {
            width += icon.getIconWidth() + textIconGap;
        }
        View v = getTextViewForTab(tabIndex);
        if (v != null) {
            // html
            width += (int) v.getPreferredSpan(View.X_AXIS);
        } else {
            // plain text
            String title = tabPane.getTitleAt(tabIndex);
            width += SwingUtilities2.stringWidth(tabPane, metrics, title);
        }
    }
    return width;
}
Also used : View(javax.swing.text.View)

Example 15 with View

use of javax.swing.text.View in project jdk8u_jdk by JetBrains.

the class BasicTabbedPaneUI method layoutLabel.

protected void layoutLabel(int tabPlacement, FontMetrics metrics, int tabIndex, String title, Icon icon, Rectangle tabRect, Rectangle iconRect, Rectangle textRect, boolean isSelected) {
    textRect.x = textRect.y = iconRect.x = iconRect.y = 0;
    View v = getTextViewForTab(tabIndex);
    if (v != null) {
        tabPane.putClientProperty("html", v);
    }
    SwingUtilities.layoutCompoundLabel(tabPane, metrics, title, icon, SwingUtilities.CENTER, SwingUtilities.CENTER, SwingUtilities.CENTER, SwingUtilities.TRAILING, tabRect, iconRect, textRect, textIconGap);
    tabPane.putClientProperty("html", null);
    int xNudge = getTabLabelShiftX(tabPlacement, tabIndex, isSelected);
    int yNudge = getTabLabelShiftY(tabPlacement, tabIndex, isSelected);
    iconRect.x += xNudge;
    iconRect.y += yNudge;
    textRect.x += xNudge;
    textRect.y += yNudge;
}
Also used : View(javax.swing.text.View)

Aggregations

View (javax.swing.text.View)66 Dimension (java.awt.Dimension)4 Rectangle (java.awt.Rectangle)4 UIResource (javax.swing.plaf.UIResource)4 FontMetrics (java.awt.FontMetrics)3 Insets (java.awt.Insets)3 Color (java.awt.Color)2 Border (javax.swing.border.Border)2 JBColor (com.intellij.ui.JBColor)1 JBGradientPaint (com.intellij.ui.JBGradientPaint)1 Container (java.awt.Container)1 Font (java.awt.Font)1 Graphics2D (java.awt.Graphics2D)1 Point (java.awt.Point)1 UnsupportedFlavorException (java.awt.datatransfer.UnsupportedFlavorException)1 PrinterException (java.awt.print.PrinterException)1 IOException (java.io.IOException)1 Reader (java.io.Reader)1 StringReader (java.io.StringReader)1 ColorUIResource (javax.swing.plaf.ColorUIResource)1