本文整理汇总了Java中java.awt.Component.BaselineResizeBehavior方法的典型用法代码示例。如果您正苦于以下问题:Java Component.BaselineResizeBehavior方法的具体用法?Java Component.BaselineResizeBehavior怎么用?Java Component.BaselineResizeBehavior使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.Component
的用法示例。
在下文中一共展示了Component.BaselineResizeBehavior方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBaselineResizeBehavior
import java.awt.Component; //导入方法依赖的package包/类
/**
* 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;
}
示例2: getBaselineResizeBehavior
import java.awt.Component; //导入方法依赖的package包/类
/**
* 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;
}
示例3: getBaselineResizeBehavior
import java.awt.Component; //导入方法依赖的package包/类
/**
* 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;
}
示例4: getBaselineResizeBehavior
import java.awt.Component; //导入方法依赖的package包/类
/**
* 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 >= 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;
}
示例5: getBaselineResizeBehavior
import java.awt.Component; //导入方法依赖的package包/类
/**
* 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;
}
示例6: getBaselineResizeBehavior
import java.awt.Component; //导入方法依赖的package包/类
/**
* Returns an enum indicating how the baseline of the 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;
}