Java Utililty Methods JComponent Properties

List of utility methods to do JComponent Properties

Description

The list of methods to do JComponent Properties are organized into topic(s).

Method

booleanisActive(JComponent c)
is Active
if (c == null) {
    return false;
boolean active = true;
if (c instanceof JInternalFrame) {
    active = ((JInternalFrame) c).isSelected();
if (active) {
...
booleanisComponentShowing(final JComponent component)
A convenience method to centralise all isShowing() calls.
if (component != null) {
    return (component.isShowing());
} else {
    return (false);
booleanisHorizontallyVisible(JComponent c, int from, int to)
is Horizontally Visible
Rectangle visible = c.getVisibleRect();
return visible.x <= from && visible.x + visible.width >= to;
booleanisMandatory(JComponent comp)
Returns if the component has been marked as mandatory.
return Boolean.TRUE.equals(comp.getClientProperty(MANDATORY_KEY));
booleanisMarker(JComponent component)
is Marker
return (component instanceof JLabel) && (MARKER_NAME.equals(component.getName()));
booleanisOver(JComponent c)
is Over
java.awt.Point p = MouseInfo.getPointerInfo().getLocation();
return (p.getX() > c.getX() && p.getY() > c.getY() && p.getX() < (c.getWidth() + c.getX())
        && p.getY() < (c.getHeight() + c.getY()));
booleanisOverlapping(JComponent comp1, JComponent comp2)
Utility method.
return isOverlapping(comp1.getBounds(), comp2.getBounds());
booleanisPasteEnabled(JComponent component)
Returns whether the component can perform a paste operation.
return getBooleanClientProperty(component, PASTE_CLIENT_PROPERTY);
booleanisRectangularSelection(JComponent c)
is Rectangular Selection
return Boolean.TRUE.equals(c.getClientProperty(RECTANGULAR_SELECTION_PROPERTY));
booleanisRequired(JComponent component)
Determines if the supplied field is required.
Boolean bool = (Boolean) component.getClientProperty(REQUIRED);
return bool != null ? bool.booleanValue() : false;