Stepan Stepan - 6 months ago 14
Java Question

What is the default setting for JScrollPane

What is the default setting for JScrollPane? Which one is it?

VERTICAL_SCROLLBAR_AS_NEEDED
VERTICAL_SCROLLBAR_ALWAYS
VERTICAL_SCROLLBAR_NEVER

Answer

The documentation of JScrollPane says:

Creates an empty (no viewport view) JScrollPane
where both horizontal and vertical scrollbars appear when needed.

And the code is:

public JScrollPane() {
    this(null, VERTICAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_AS_NEEDED);
}

So, it's as needed for both.

Comments