Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

6510914: JScrollBar.getMinimumSize() breaks the contract of JComponent.setMinimumSize() #15325

Closed
wants to merge 21 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/java.desktop/share/classes/javax/swing/JScrollBar.java
Original file line number Diff line number Diff line change
@@ -782,8 +782,8 @@ public void setMaximumSize(Dimension maximumSize) {
/**
* The scrollbar is flexible along its scrolling axis and
* rigid along the other axis.
* As specified in {@code setMinimumSize} JScrollBar will derive the
* minimum size from the preferred size in one axis and a
* As specified in {@code setMinimumSize} JScrollBar will derive the
Copy link
Member

@aivanov-jdk aivanov-jdk Jan 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't look good to me. It is getMinimumSize that specifies what is returned; setMinimumSize just warns the programmer that getMinimumSize ignores the value passed to the set- method.

It's the other way around: getMinimumSize should specify and specifies what it returnssetMinimumSize is being updated to align with the implementation of the get-.

* minimum size from the preferred size in one axis and a
* fixed minimum size in the other.
*
* @return the minimum size as specified above.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @return the minimum size as specified above.
* @return the minimum size as specified above

@return tags usually don't have a period in the end. Let's follow it for consistency.

@@ -800,8 +800,8 @@ public Dimension getMinimumSize() {
/**
* The scrollbar is flexible along its scrolling axis and
* rigid along the other axis.
* As specified in {@code setMaximumSize} JScrollBar will derive the
* maximum size from the preferred size in one axis and a
* As specified in {@code setMaximumSize} JScrollBar will derive the
* maximum size from the preferred size in one axis and a
* fixed maximum size in the other.
*
* @return the maximum size as specified above.