Java Code Examples for java.awt.Component#BaselineResizeBehavior

The following examples show how to use java.awt.Component#BaselineResizeBehavior . These examples are extracted from open source projects. 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 Project: Java8CN   File: TitledBorder.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Returns an enum indicating how the baseline of the border
 * changes as the size changes.
 *
 * @throws NullPointerException {@inheritDoc}
 * @see javax.swing.JComponent#getBaseline(int, int)
 * @since 1.6
 */
public Component.BaselineResizeBehavior getBaselineResizeBehavior(
        Component c) {
    super.getBaselineResizeBehavior(c);
    switch (getPosition()) {
        case TitledBorder.ABOVE_TOP:
        case TitledBorder.TOP:
        case TitledBorder.BELOW_TOP:
            return Component.BaselineResizeBehavior.CONSTANT_ASCENT;
        case TitledBorder.ABOVE_BOTTOM:
        case TitledBorder.BOTTOM:
        case TitledBorder.BELOW_BOTTOM:
            return JComponent.BaselineResizeBehavior.CONSTANT_DESCENT;
    }
    return Component.BaselineResizeBehavior.OTHER;
}
 
Example 2
/**
 * Returns an enum indicating how the baseline of the border
 * changes as the size changes.
 *
 * @throws NullPointerException {@inheritDoc}
 * @see javax.swing.JComponent#getBaseline(int, int)
 * @since 1.6
 */
public Component.BaselineResizeBehavior getBaselineResizeBehavior(
        Component c) {
    super.getBaselineResizeBehavior(c);
    switch (getPosition()) {
        case TitledBorder.ABOVE_TOP:
        case TitledBorder.TOP:
        case TitledBorder.BELOW_TOP:
            return Component.BaselineResizeBehavior.CONSTANT_ASCENT;
        case TitledBorder.ABOVE_BOTTOM:
        case TitledBorder.BOTTOM:
        case TitledBorder.BELOW_BOTTOM:
            return JComponent.BaselineResizeBehavior.CONSTANT_DESCENT;
    }
    return Component.BaselineResizeBehavior.OTHER;
}
 
Example 3
/**
 * Returns an enum indicating how the baseline of the component
 * changes as the size changes.
 *
 * @throws NullPointerException {@inheritDoc}
 * @see javax.swing.JComponent#getBaseline(int, int)
 * @since 1.6
 */
public Component.BaselineResizeBehavior getBaselineResizeBehavior(
        JComponent c) {
    super.getBaselineResizeBehavior(c);
    if (c.getClientProperty(BasicHTML.propertyKey) != null) {
        return Component.BaselineResizeBehavior.OTHER;
    }
    switch(((JLabel)c).getVerticalAlignment()) {
    case JLabel.TOP:
        return Component.BaselineResizeBehavior.CONSTANT_ASCENT;
    case JLabel.BOTTOM:
        return Component.BaselineResizeBehavior.CONSTANT_DESCENT;
    case JLabel.CENTER:
        return Component.BaselineResizeBehavior.CENTER_OFFSET;
    }
    return Component.BaselineResizeBehavior.OTHER;
}
 
Example 4
/**
 * Returns an enum indicating how the baseline of the border
 * changes as the size changes.
 *
 * @throws NullPointerException {@inheritDoc}
 * @see javax.swing.JComponent#getBaseline(int, int)
 * @since 1.6
 */
public Component.BaselineResizeBehavior getBaselineResizeBehavior(
        Component c) {
    super.getBaselineResizeBehavior(c);
    switch (getPosition()) {
        case TitledBorder.ABOVE_TOP:
        case TitledBorder.TOP:
        case TitledBorder.BELOW_TOP:
            return Component.BaselineResizeBehavior.CONSTANT_ASCENT;
        case TitledBorder.ABOVE_BOTTOM:
        case TitledBorder.BOTTOM:
        case TitledBorder.BELOW_BOTTOM:
            return JComponent.BaselineResizeBehavior.CONSTANT_DESCENT;
    }
    return Component.BaselineResizeBehavior.OTHER;
}
 
Example 5
/**
 * Returns an enum indicating how the baseline of the border
 * changes as the size changes.
 *
 * @throws NullPointerException {@inheritDoc}
 * @see javax.swing.JComponent#getBaseline(int, int)
 * @since 1.6
 */
public Component.BaselineResizeBehavior getBaselineResizeBehavior(
        Component c) {
    super.getBaselineResizeBehavior(c);
    switch (getPosition()) {
        case TitledBorder.ABOVE_TOP:
        case TitledBorder.TOP:
        case TitledBorder.BELOW_TOP:
            return Component.BaselineResizeBehavior.CONSTANT_ASCENT;
        case TitledBorder.ABOVE_BOTTOM:
        case TitledBorder.BOTTOM:
        case TitledBorder.BELOW_BOTTOM:
            return JComponent.BaselineResizeBehavior.CONSTANT_DESCENT;
    }
    return Component.BaselineResizeBehavior.OTHER;
}
 
Example 6
/**
 * Returns an enum indicating how the baseline of the component
 * changes as the size changes.
 *
 * @throws NullPointerException {@inheritDoc}
 * @see javax.swing.JComponent#getBaseline(int, int)
 * @since 1.6
 */
public Component.BaselineResizeBehavior getBaselineResizeBehavior(
        JComponent c) {
    super.getBaselineResizeBehavior(c);
    if (c.getClientProperty(BasicHTML.propertyKey) != null) {
        return Component.BaselineResizeBehavior.OTHER;
    }
    switch(((JLabel)c).getVerticalAlignment()) {
    case JLabel.TOP:
        return Component.BaselineResizeBehavior.CONSTANT_ASCENT;
    case JLabel.BOTTOM:
        return Component.BaselineResizeBehavior.CONSTANT_DESCENT;
    case JLabel.CENTER:
        return Component.BaselineResizeBehavior.CENTER_OFFSET;
    }
    return Component.BaselineResizeBehavior.OTHER;
}
 
Example 7
/**
 * Returns an enum indicating how the baseline of the component
 * changes as the size changes.
 *
 * @throws NullPointerException {@inheritDoc}
 * @see javax.swing.JComponent#getBaseline(int, int)
 * @since 1.6
 */
public Component.BaselineResizeBehavior getBaselineResizeBehavior(
        JComponent c) {
    super.getBaselineResizeBehavior(c);
    if (c.getClientProperty(BasicHTML.propertyKey) != null) {
        return Component.BaselineResizeBehavior.OTHER;
    }
    switch(((JLabel)c).getVerticalAlignment()) {
    case JLabel.TOP:
        return Component.BaselineResizeBehavior.CONSTANT_ASCENT;
    case JLabel.BOTTOM:
        return Component.BaselineResizeBehavior.CONSTANT_DESCENT;
    case JLabel.CENTER:
        return Component.BaselineResizeBehavior.CENTER_OFFSET;
    }
    return Component.BaselineResizeBehavior.OTHER;
}
 
Example 8
/**
 * Returns an enum indicating how the baseline of the component
 * changes as the size changes.
 *
 * @throws NullPointerException {@inheritDoc}
 * @see javax.swing.JComponent#getBaseline(int, int)
 * @since 1.6
 */
public Component.BaselineResizeBehavior getBaselineResizeBehavior(
        JComponent c) {
    super.getBaselineResizeBehavior(c);
    // Baseline is either from the header, in which case it's always
    // the same size and therefor can be created as CONSTANT_ASCENT.
    // If the header doesn't have a baseline than the baseline will only
    // be valid if it's BaselineResizeBehavior is
    // CONSTANT_ASCENT, so, return CONSTANT_ASCENT.
    return Component.BaselineResizeBehavior.CONSTANT_ASCENT;
}
 
Example 9
Source Project: JDKSourceCode1.8   File: BasicScrollPaneUI.java    License: MIT License 5 votes vote down vote up
/**
 * Returns an enum indicating how the baseline of the component
 * changes as the size changes.
 *
 * @throws NullPointerException {@inheritDoc}
 * @see javax.swing.JComponent#getBaseline(int, int)
 * @since 1.6
 */
public Component.BaselineResizeBehavior getBaselineResizeBehavior(
        JComponent c) {
    super.getBaselineResizeBehavior(c);
    // Baseline is either from the header, in which case it's always
    // the same size and therefor can be created as CONSTANT_ASCENT.
    // If the header doesn't have a baseline than the baseline will only
    // be valid if it's BaselineResizeBehavior is
    // CONSTANT_ASCENT, so, return CONSTANT_ASCENT.
    return Component.BaselineResizeBehavior.CONSTANT_ASCENT;
}
 
Example 10
Source Project: Java8CN   File: BasicScrollPaneUI.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Returns an enum indicating how the baseline of the component
 * changes as the size changes.
 *
 * @throws NullPointerException {@inheritDoc}
 * @see javax.swing.JComponent#getBaseline(int, int)
 * @since 1.6
 */
public Component.BaselineResizeBehavior getBaselineResizeBehavior(
        JComponent c) {
    super.getBaselineResizeBehavior(c);
    // Baseline is either from the header, in which case it's always
    // the same size and therefor can be created as CONSTANT_ASCENT.
    // If the header doesn't have a baseline than the baseline will only
    // be valid if it's BaselineResizeBehavior is
    // CONSTANT_ASCENT, so, return CONSTANT_ASCENT.
    return Component.BaselineResizeBehavior.CONSTANT_ASCENT;
}
 
Example 11
/**
 * Returns an enum indicating how the baseline of the component
 * changes as the size changes.
 *
 * @throws NullPointerException {@inheritDoc}
 * @see javax.swing.JComponent#getBaseline(int, int)
 * @since 1.6
 */
public Component.BaselineResizeBehavior getBaselineResizeBehavior(
        JComponent c) {
    super.getBaselineResizeBehavior(c);
    // Baseline is either from the header, in which case it's always
    // the same size and therefor can be created as CONSTANT_ASCENT.
    // If the header doesn't have a baseline than the baseline will only
    // be valid if it's BaselineResizeBehavior is
    // CONSTANT_ASCENT, so, return CONSTANT_ASCENT.
    return Component.BaselineResizeBehavior.CONSTANT_ASCENT;
}
 
Example 12
/**
 * Returns an enum indicating how the baseline of the component
 * changes as the size changes.
 *
 * @throws NullPointerException {@inheritDoc}
 * @see javax.swing.JComponent#getBaseline(int, int)
 * @since 1.6
 */
public Component.BaselineResizeBehavior getBaselineResizeBehavior(
        JComponent c) {
    super.getBaselineResizeBehavior(c);
    // Baseline is either from the header, in which case it's always
    // the same size and therefor can be created as CONSTANT_ASCENT.
    // If the header doesn't have a baseline than the baseline will only
    // be valid if it's BaselineResizeBehavior is
    // CONSTANT_ASCENT, so, return CONSTANT_ASCENT.
    return Component.BaselineResizeBehavior.CONSTANT_ASCENT;
}
 
Example 13
/**
 * Returns an enum indicating how the baseline of he component
 * changes as the size changes.  This method is primarily meant for
 * layout managers and GUI builders.
 * <p>
 * This method returns <code>BaselineResizeBehavior.OTHER</code>.
 * Subclasses that support a baseline should override appropriately.
 *
 * @param c <code>JComponent</code> to return baseline resize behavior for
 * @return an enum indicating how the baseline changes as the component
 *         size changes
 * @throws NullPointerException if <code>c</code> is <code>null</code>
 * @see javax.swing.JComponent#getBaseline(int, int)
 * @since 1.6
 */
public Component.BaselineResizeBehavior getBaselineResizeBehavior(
        JComponent c) {
    if (c == null) {
        throw new NullPointerException("Component must be non-null");
    }
    return Component.BaselineResizeBehavior.OTHER;
}
 
Example 14
/**
 * Returns an enum indicating how the baseline of he component
 * changes as the size changes.  This method is primarily meant for
 * layout managers and GUI builders.
 * <p>
 * This method returns <code>BaselineResizeBehavior.OTHER</code>.
 * Subclasses that support a baseline should override appropriately.
 *
 * @param c <code>JComponent</code> to return baseline resize behavior for
 * @return an enum indicating how the baseline changes as the component
 *         size changes
 * @throws NullPointerException if <code>c</code> is <code>null</code>
 * @see javax.swing.JComponent#getBaseline(int, int)
 * @since 1.6
 */
public Component.BaselineResizeBehavior getBaselineResizeBehavior(
        JComponent c) {
    if (c == null) {
        throw new NullPointerException("Component must be non-null");
    }
    return Component.BaselineResizeBehavior.OTHER;
}
 
Example 15
/**
 * Returns an enum indicating how the baseline of a component
 * changes as the size changes.  This method is primarily meant for
 * layout managers and GUI builders.
 * <p>
 * The default implementation returns
 * <code>BaselineResizeBehavior.OTHER</code>, subclasses that support
 * baseline should override appropriately.  Subclasses should
 * never return <code>null</code>; if the baseline can not be
 * calculated return <code>BaselineResizeBehavior.OTHER</code>.  Callers
 * should first ask for the baseline using
 * <code>getBaseline</code> and if a value &gt;= 0 is returned use
 * this method.  It is acceptable for this method to return a
 * value other than <code>BaselineResizeBehavior.OTHER</code> even if
 * <code>getBaseline</code> returns a value less than 0.
 *
 * @param c <code>Component</code> to return baseline resize behavior for
 * @return an enum indicating how the baseline changes as the border is
 *         resized
 * @see java.awt.Component#getBaseline(int,int)
 * @see java.awt.Component#getBaselineResizeBehavior()
 * @since 1.6
 */
public Component.BaselineResizeBehavior getBaselineResizeBehavior(
        Component c) {
    if (c == null) {
        throw new NullPointerException("Component must be non-null");
    }
    return Component.BaselineResizeBehavior.OTHER;
}
 
Example 16
/**
 * Returns an enum indicating how the baseline of a component
 * changes as the size changes.  This method is primarily meant for
 * layout managers and GUI builders.
 * <p>
 * The default implementation returns
 * <code>BaselineResizeBehavior.OTHER</code>, subclasses that support
 * baseline should override appropriately.  Subclasses should
 * never return <code>null</code>; if the baseline can not be
 * calculated return <code>BaselineResizeBehavior.OTHER</code>.  Callers
 * should first ask for the baseline using
 * <code>getBaseline</code> and if a value &gt;= 0 is returned use
 * this method.  It is acceptable for this method to return a
 * value other than <code>BaselineResizeBehavior.OTHER</code> even if
 * <code>getBaseline</code> returns a value less than 0.
 *
 * @param c <code>Component</code> to return baseline resize behavior for
 * @return an enum indicating how the baseline changes as the border is
 *         resized
 * @see java.awt.Component#getBaseline(int,int)
 * @see java.awt.Component#getBaselineResizeBehavior()
 * @since 1.6
 */
public Component.BaselineResizeBehavior getBaselineResizeBehavior(
        Component c) {
    if (c == null) {
        throw new NullPointerException("Component must be non-null");
    }
    return Component.BaselineResizeBehavior.OTHER;
}
 
Example 17
/**
 * Returns an enum indicating how the baseline of a component
 * changes as the size changes.  This method is primarily meant for
 * layout managers and GUI builders.
 * <p>
 * The default implementation returns
 * <code>BaselineResizeBehavior.OTHER</code>, subclasses that support
 * baseline should override appropriately.  Subclasses should
 * never return <code>null</code>; if the baseline can not be
 * calculated return <code>BaselineResizeBehavior.OTHER</code>.  Callers
 * should first ask for the baseline using
 * <code>getBaseline</code> and if a value &gt;= 0 is returned use
 * this method.  It is acceptable for this method to return a
 * value other than <code>BaselineResizeBehavior.OTHER</code> even if
 * <code>getBaseline</code> returns a value less than 0.
 *
 * @param c <code>Component</code> to return baseline resize behavior for
 * @return an enum indicating how the baseline changes as the border is
 *         resized
 * @see java.awt.Component#getBaseline(int,int)
 * @see java.awt.Component#getBaselineResizeBehavior()
 * @since 1.6
 */
public Component.BaselineResizeBehavior getBaselineResizeBehavior(
        Component c) {
    if (c == null) {
        throw new NullPointerException("Component must be non-null");
    }
    return Component.BaselineResizeBehavior.OTHER;
}
 
Example 18
/**
 * Returns an enum indicating how the baseline of he component
 * changes as the size changes.  This method is primarily meant for
 * layout managers and GUI builders.
 * <p>
 * This method returns <code>BaselineResizeBehavior.OTHER</code>.
 * Subclasses that support a baseline should override appropriately.
 *
 * @param c <code>JComponent</code> to return baseline resize behavior for
 * @return an enum indicating how the baseline changes as the component
 *         size changes
 * @throws NullPointerException if <code>c</code> is <code>null</code>
 * @see javax.swing.JComponent#getBaseline(int, int)
 * @since 1.6
 */
public Component.BaselineResizeBehavior getBaselineResizeBehavior(
        JComponent c) {
    if (c == null) {
        throw new NullPointerException("Component must be non-null");
    }
    return Component.BaselineResizeBehavior.OTHER;
}
 
Example 19
/**
 * Returns an enum indicating how the baseline of he component
 * changes as the size changes.  This method is primarily meant for
 * layout managers and GUI builders.
 * <p>
 * This method returns <code>BaselineResizeBehavior.OTHER</code>.
 * Subclasses that support a baseline should override appropriately.
 *
 * @param c <code>JComponent</code> to return baseline resize behavior for
 * @return an enum indicating how the baseline changes as the component
 *         size changes
 * @throws NullPointerException if <code>c</code> is <code>null</code>
 * @see javax.swing.JComponent#getBaseline(int, int)
 * @since 1.6
 */
public Component.BaselineResizeBehavior getBaselineResizeBehavior(
        JComponent c) {
    if (c == null) {
        throw new NullPointerException("Component must be non-null");
    }
    return Component.BaselineResizeBehavior.OTHER;
}
 
Example 20
/**
 * Returns an enum indicating how the baseline of a component
 * changes as the size changes.  This method is primarily meant for
 * layout managers and GUI builders.
 * <p>
 * The default implementation returns
 * <code>BaselineResizeBehavior.OTHER</code>, subclasses that support
 * baseline should override appropriately.  Subclasses should
 * never return <code>null</code>; if the baseline can not be
 * calculated return <code>BaselineResizeBehavior.OTHER</code>.  Callers
 * should first ask for the baseline using
 * <code>getBaseline</code> and if a value &gt;= 0 is returned use
 * this method.  It is acceptable for this method to return a
 * value other than <code>BaselineResizeBehavior.OTHER</code> even if
 * <code>getBaseline</code> returns a value less than 0.
 *
 * @param c <code>Component</code> to return baseline resize behavior for
 * @return an enum indicating how the baseline changes as the border is
 *         resized
 * @see java.awt.Component#getBaseline(int,int)
 * @see java.awt.Component#getBaselineResizeBehavior()
 * @since 1.6
 */
public Component.BaselineResizeBehavior getBaselineResizeBehavior(
        Component c) {
    if (c == null) {
        throw new NullPointerException("Component must be non-null");
    }
    return Component.BaselineResizeBehavior.OTHER;
}