int getSizeForPrimaryAxis(Dimension size) { ComponentOrientation o = _target.getComponentOrientation(); if (resolveAxis(_axis, o) == X_AXIS) { return size.width; } else { return size.height; } }
int getSizeForSecondaryAxis(Dimension size) { ComponentOrientation o = _target.getComponentOrientation(); if (resolveAxis(_axis, o) == X_AXIS) { return size.height; } else { return size.width; } }
int getSizeForPrimaryAxis(Insets insets, boolean isTop) { ComponentOrientation o = _target.getComponentOrientation(); if (resolveAxis(_axis, o) == X_AXIS) { if (isTop) { return insets.left; } else { return insets.right; } } else { if (isTop) { return insets.top; } else { return insets.bottom; } } }
int getSizeForSecondaryAxis(Insets insets, boolean isTop) { ComponentOrientation o = _target.getComponentOrientation(); if (resolveAxis(_axis, o) == X_AXIS) { if (isTop) { return insets.top; } else { return insets.bottom; } } else { if (isTop) { return insets.left; } else { return insets.right; } } }
if (insets != null) { ComponentOrientation o = _target.getComponentOrientation(); if (resolveAxis(_axis, o) == X_AXIS) { c.setBounds(location, Math.max(insets.top, 0), if (resolveAxis(_axis, o) == X_AXIS) { c.setBounds(location, 0,
protected Dimension getPreferredSizeOf(Component comp, int atIndex) { // for JTextArea, the preferred size only returns the height of one line if the size is never set. if (comp instanceof JTextArea && getSizeForSecondaryAxis(comp.getSize()) == 0) { Insets insets = _target.getInsets(); ComponentOrientation o = _target.getComponentOrientation(); Dimension size = _target.getSize(); if (resolveAxis(_axis, o) == X_AXIS) { comp.setSize(new Dimension(comp.getPreferredSize().width, size.height - insets.top - insets.bottom)); } else { comp.setSize(new Dimension(size.width - insets.left - insets.right, comp.getPreferredSize().height)); } } Dimension preferredSize = comp.getPreferredSize(); Dimension minimumSize = comp.getMinimumSize(); if (preferredSize.height < minimumSize.height) { preferredSize.height = minimumSize.height; } if (preferredSize.width < minimumSize.width) { preferredSize.width = minimumSize.width; } Dimension maximumSize = comp.getMaximumSize(); if (preferredSize.height > maximumSize.height && maximumSize.height != 32767) { // 32767 is hard-coded inside Swing. If you set maximum size to null, the maximum size is 32767. preferredSize.height = maximumSize.height; } if (preferredSize.width > maximumSize.width && maximumSize.height != 32767) { preferredSize.width = maximumSize.width; } return preferredSize; }
if (resolveAxis(_axis, o) == X_AXIS) { return new Dimension(minPrimary + getGapSize(), minSecondary);
if (resolveAxis(_axis, o) == X_AXIS) { return new Dimension(prePrimary + getGapSize(), preSecondary);
int location = getSizeForPrimaryAxis(insets, true); boolean needRedoLayout = false; if (!ltr && resolveAxis(_axis, o) == X_AXIS) { location = containerSize.width - location; Component comp = _target.getComponent(i); int oldSize = getPreferredSizeOfComponent(comp); if (!ltr && resolveAxis(_axis, o) == X_AXIS) { location -= _componentSizes[i]; setComponentToSize(comp, _componentSizes[i], location, insets, containerSize);