本文整理汇总了Java中javax.swing.border.CompoundBorder.getInsideBorder方法的典型用法代码示例。如果您正苦于以下问题:Java CompoundBorder.getInsideBorder方法的具体用法?Java CompoundBorder.getInsideBorder怎么用?Java CompoundBorder.getInsideBorder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.border.CompoundBorder
的用法示例。
在下文中一共展示了CompoundBorder.getInsideBorder方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBorderTitle
import javax.swing.border.CompoundBorder; //导入方法依赖的package包/类
/**
* Recursivly searches a border hierarchy (starting at <code>border) for
* a titled border and returns the title if one is found, <code>null</code>
* otherwise.
*
* @param border the border to start search from
*
* @return the border title of a possibly found titled border
*/
protected String getBorderTitle(Border border)
{
String title = null;
if (border instanceof CompoundBorder)
{
CompoundBorder compound = (CompoundBorder) border;
Border inner = compound.getInsideBorder();
title = getBorderTitle(inner);
if (title == null)
{
Border outer = compound.getOutsideBorder();
title = getBorderTitle(outer);
}
}
else if (border instanceof TitledBorder)
{
TitledBorder titled = (TitledBorder) border;
title = titled.getTitle();
}
return title;
}
示例2: getBorderTitle
import javax.swing.border.CompoundBorder; //导入方法依赖的package包/类
/**
* Recursivly searches a border hierarchy (starting at <code>border) for
* a titled border and returns the title if one is found, <code>null</code>
* otherwise.
*
* @param border the border to start search from
*
* @return the border title of a possibly found titled border
*/
protected String getBorderTitle(Border border)
{
String title = null;
if (border instanceof CompoundBorder)
{
CompoundBorder compound = (CompoundBorder) border;
Border inner = compound.getInsideBorder();
title = getBorderTitle(inner);
if (title == null)
{
Border outer = compound.getOutsideBorder();
title = getBorderTitle(outer);
}
}
else if (border instanceof TitledBorder)
{
TitledBorder titled = (TitledBorder) border;
title = titled.getTitle();
}
return title;
}
示例3: disableBorderTitles
import javax.swing.border.CompoundBorder; //导入方法依赖的package包/类
/**
*/
private static void disableBorderTitles(Border border) {
if (border instanceof TitledBorder) {
disableBorderTitle((TitledBorder) border);
return;
}
if (!(border instanceof CompoundBorder)) {
return;
}
Stack<CompoundBorder> stack = new Stack<CompoundBorder>();
stack.push((CompoundBorder) border);
while (!stack.empty()) {
CompoundBorder cb = stack.pop();
Border b;
b = cb.getOutsideBorder();
if (b instanceof CompoundBorder) {
stack.push((CompoundBorder) b);
} else if (b instanceof TitledBorder) {
disableBorderTitle((TitledBorder) b);
}
b = cb.getInsideBorder();
if (b instanceof CompoundBorder) {
stack.push((CompoundBorder) b);
} else if (b instanceof TitledBorder) {
disableBorderTitle((TitledBorder) b);
}
}
}
示例4: setMargin
import javax.swing.border.CompoundBorder; //导入方法依赖的package包/类
public static void setMargin(final JComponent component, final Insets newMargin) {
final Border currentBorder = component.getBorder();
final Border empty = new EmptyBorder(newMargin.top, newMargin.left, newMargin.bottom, newMargin.right);
if (currentBorder == null || currentBorder instanceof EmptyBorder) {
component.setBorder(empty);
} else if (currentBorder instanceof CompoundBorder) {
final CompoundBorder current = (CompoundBorder) currentBorder;
final Border insideBorder = current.getInsideBorder();
component.setBorder(new CompoundBorder(empty, insideBorder));
} else {
component.setBorder(new CompoundBorder(empty, currentBorder));
}
}
示例5: installAcceleratorPreview
import javax.swing.border.CompoundBorder; //导入方法依赖的package包/类
private static void installAcceleratorPreview(JMenuItem item) {
if(item instanceof JMenu) return;
//detect accelerator key
boolean already_has_accel = false;
if(item.getAccelerator() != null) already_has_accel = true;
if(item.getAction() != null && item.getAction().getValue(Action.ACCELERATOR_KEY) != null) already_has_accel = true;
boolean already_has_accel_border = false;
if(item.getBorder() == accel_border) {
already_has_accel_border = true;
//uninstall if needed
if(already_has_accel) {
item.setBorder(null);
return;
}
}
if(item.getBorder() instanceof CompoundBorder) {
CompoundBorder comp = (CompoundBorder)item.getBorder();
if(comp.getInsideBorder() == accel_border) {
already_has_accel_border = true;
//uninstall if needed
if(already_has_accel) {
item.setBorder(comp.getOutsideBorder());
return;
}
}
}
if(already_has_accel_border) return;
if(already_has_accel) return;
if(item.getBorder() == null) {
item.setBorder(accel_border);
return;
}
item.setBorder(BorderFactory.createCompoundBorder(
item.getBorder(),accel_border));
}
示例6: getRolloverMarginBorder
import javax.swing.border.CompoundBorder; //导入方法依赖的package包/类
private Border getRolloverMarginBorder() {
JToggleButton button = new JToggleButton();
CompoundBorder border = (CompoundBorder) getNonRolloverBorder(button);
return border.getInsideBorder();
}