📄 titledtabproperties.java
字号:
}
/**
* Removes the last added super object.
*
* @return this
*/
public TitledTabProperties removeSuperObject() {
getMap().removeSuperMap();
return this;
}
/**
* Removes the given super object.
*
* @param superObject super object to remove
* @return this
* @since ITP 1.3.0
*/
public TitledTabProperties removeSuperObject(TitledTabProperties superObject) {
getMap().removeSuperMap(superObject.getMap());
return this;
}
/**
* Replaces the given super objects.
*
* @param oldSuperObject super object to replace
* @param newSuperObject new super object
* @return this
* @since ITP 1.4.0
*/
public TitledTabProperties replaceSuperObject(TitledTabProperties oldSuperObject, TitledTabProperties newSuperObject) {
getMap().replaceSuperMap(oldSuperObject.getMap(), newSuperObject.getMap());
return this;
}
/**
* Creates a properties object with default properties based on the current look and feel
*
* @return properties object
*/
public static TitledTabProperties getDefaultProperties() {
return new TitledTabProperties(DEFAULT_VALUES);
}
/**
* Gets the properties for the normal state
*
* @return the normal state properties
*/
public TitledTabStateProperties getNormalProperties() {
return new TitledTabStateProperties(NORMAL_PROPERTIES.get(getMap()));
}
/**
* Gets the properties for the highlighted state
*
* @return the highlighted state properties
*/
public TitledTabStateProperties getHighlightedProperties() {
return new TitledTabStateProperties(HIGHLIGHTED_PROPERTIES.get(getMap()));
}
/**
* Gets the properties for the disabled state
*
* @return the disabled state properties
*/
public TitledTabStateProperties getDisabledProperties() {
return new TitledTabStateProperties(DISABLED_PROPERTIES.get(getMap()));
}
/**
* Sets if this TitledTab should be focusable
*
* @param value true for focusable, otherwise false
* @return this TitledTabProperties
*/
public TitledTabProperties setFocusable(boolean value) {
FOCUSABLE.set(getMap(), value);
return this;
}
/**
* Gets if this TitledTab is focusable
*
* @return true for focusable, otherwise false
*/
public boolean getFocusable() {
return FOCUSABLE.get(getMap());
}
/**
* <p>
* Sets if this TitledTab should show its built-in focus marker when this tab has focus.
* </p>
*
* <p>
* <strong>Note:</strong> Disabling the focus marker is useful when for example creating a
* theme that draws its own focus marker.
* </p>
*
* @param value true for enabled, otherwise false
* @return this TitledTabProperties
* @since ITP 1.4.0
*/
public TitledTabProperties setFocusMarkerEnabled(boolean value) {
FOCUS_MARKER_ENABLED.set(getMap(), value);
return this;
}
/**
* <p>
* Gets if this TitledTab should show its built-in focus marker when this tab has focus.
* </p>
*
* <p>
* <strong>Note:</strong> Disabling the focus marker is useful when for example creating a
* theme that draws its own focus marker.
* </p>
*
* @return true for enabled, otherwise false
* @since ITP 1.4.0
*/
public boolean getFocusMarkerEnabled() {
return FOCUS_MARKER_ENABLED.get(getMap());
}
/**
* Sets the size policy for this TitledTab
*
* @param sizePolicy the size policy
* @return this TitledTabProperties
*/
public TitledTabProperties setSizePolicy(TitledTabSizePolicy sizePolicy) {
SIZE_POLICY.set(getMap(), sizePolicy);
return this;
}
/**
* Gets the size policy for this TitledTab
*
* @return the size policy
*/
public TitledTabSizePolicy getSizePolicy() {
return SIZE_POLICY.get(getMap());
}
/**
* Sets the border size policy for this TitledTab
*
* @param sizePolicy the border size policy
* @return this TitledTabProperties
*/
public TitledTabProperties setBorderSizePolicy(TitledTabBorderSizePolicy sizePolicy) {
BORDER_SIZE_POLICY.set(getMap(), sizePolicy);
return this;
}
/**
* Gets the border size policy for this TitledTab
*
* @return the border size policy
*/
public TitledTabBorderSizePolicy getBorderSizePolicy() {
return BORDER_SIZE_POLICY.get(getMap());
}
/**
* Sets the tab's minimum size dimension provider
*
* @param size the minimum size dimension provider or null if tab's default minimum size should be used instead
* @return this TitledTabProperties
*/
public TitledTabProperties setMinimumSizeProvider(DimensionProvider size) {
MINIMUM_SIZE_PROVIDER.set(getMap(), size);
return this;
}
/**
* Gets the dimension provider for the tab's minimum size
*
* @return the minimum size provider or null if default tab minimum size is to be used instead
*/
public DimensionProvider getMinimumSizeProvider() {
return MINIMUM_SIZE_PROVIDER.get(getMap());
}
/**
* Sets how many pixels higher this TitledTab will be when it is in its highlighted state compared to its normal and
* disabled state
*
* @param amount number of pixels
* @return this TitledTabProperties
*/
public TitledTabProperties setHighlightedRaised(int amount) {
HIGHLIGHTED_RAISED_AMOUNT.set(getMap(), amount);
return this;
}
/**
* Gets how many pixels higher this TitledTab will be when it is in its highlighted state compared to its normal and
* disabled state
*
* @return number of pixels
*/
public int getHighlightedRaised() {
return HIGHLIGHTED_RAISED_AMOUNT.get(getMap());
}
/**
* <p>
* Sets if this TitledTab should be enabled or not.
* </p>
*
* <p>
* <strong>Note:</strong> Calling {@link TitledTab#setEnabled(boolean)} will modify this property for the tab.
* </p>
*
* @param value true for enabled, otherwise false
* @return this TitledTabProperties
* @since ITP 1.5.0
*/
public TitledTabProperties setEnabled(boolean value) {
ENABLED.set(getMap(), value);
return this;
}
/**
* Gets if this TitledTab is enabled or disabled
*
* @return true for enabled, otherwise false
* @since ITP 1.5.0
*/
public boolean getEnabled() {
return ENABLED.get(getMap());
}
/**
* <p>Sets the hover listener that will be triggered when the tab is hovered by the mouse.</p>
*
* <p>The hovered titled tab will be the source of the hover event sent to the hover listener.</p>
*
* @param listener the hover listener
* @return this TitledTabProperties
* @since ITP 1.3.0
*/
public TitledTabProperties setHoverListener(HoverListener listener) {
HOVER_LISTENER.set(getMap(), listener);
return this;
}
/**
* <p>Gets the hover listener that will be triggered when the tab is hovered by the mouse.</p>
*
* <p>The hovered titled tab will be the source of the hover event sent to the hover listener.</p>
*
* @return the hover listener
* @since ITP 1.3.0
*/
public HoverListener getHoverListener() {
return HOVER_LISTENER.get(getMap());
}
private static void updateVisualProperties() {
PropertyMapManager.runBatch(new Runnable() {
public void run() {
int gap = TabbedUIDefaults.getIconTextGap();
DEFAULT_VALUES.getNormalProperties().getShapedPanelProperties().setOpaque(true);
DEFAULT_VALUES.getNormalProperties().setIconTextGap(gap).setTextTitleComponentGap(gap)
.setIconVisible(true).setTextVisible(true).setTitleComponentVisible(true).getComponentProperties()
.setFont(TabbedUIDefaults.getFont())
.setForegroundColor(TabbedUIDefaults.getNormalStateForeground())
.setBackgroundColor(TabbedUIDefaults.getNormalStateBackground())
.setBorder(new TabAreaLineBorder())
.setInsets(TabbedUIDefaults.getTabInsets());
DEFAULT_VALUES.getHighlightedProperties().getComponentProperties()
.setBackgroundColor(TabbedUIDefaults.getHighlightedStateBackground())
.setBorder(new CompoundBorder(new TabAreaLineBorder(),
new TabHighlightBorder(TabbedUIDefaults.getHighlight(), true)));
DEFAULT_VALUES.getDisabledProperties().getComponentProperties()
.setForegroundColor(TabbedUIDefaults.getDisabledForeground()).setBackgroundColor(
TabbedUIDefaults.getDisabledBackground());
}
});
}
private static void updateFunctionalProperties() {
DEFAULT_VALUES.setEnabled(true).setFocusable(true).setFocusMarkerEnabled(true).setSizePolicy(TitledTabSizePolicy.EQUAL_SIZE)
.setBorderSizePolicy(TitledTabBorderSizePolicy.EQUAL_SIZE).setHighlightedRaised(2);
DEFAULT_VALUES.getNormalProperties().setHorizontalAlignment(Alignment.LEFT).setVerticalAlignment(Alignment.CENTER)
.setIconTextRelativeAlignment(Alignment.LEFT).setTitleComponentTextRelativeAlignment(Alignment.RIGHT)
.setDirection(Direction.RIGHT);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -