Get Vertical Scroll Bar Value
Get Minimum Vertical Scroll Bar Value
Get Maximum Vertical Scroll Bar Value
Set Vertical Scroll Bar to Minimum Value
Set Vertical Scroll Bar to Middle Value
Set Vertical Scroll Bar to Maximum Value
Get Visible Height of Vertical Scroll Bar (i.e. Extent)
Set the Visible Vertical Scroll Bar Amount (Extent)
Get Vertical Scroll Bar Unit Increment
Set Vertical Scroll Bar Unit Increment
Get Vertical Scroll Bar Block Increment
Set Vertical Scroll Bar Block Increment
Set the Vertical Scroll Bar Policy
Set Vertical Scroll Bar Orientation
Set Vertical Scroll Bar Width
Get Minimum Vertical Scroll Bar Value
Get Maximum Vertical Scroll Bar Value
Set Vertical Scroll Bar to Minimum Value
Set Vertical Scroll Bar to Middle Value
Set Vertical Scroll Bar to Maximum Value
Get Visible Height of Vertical Scroll Bar (i.e. Extent)
Set the Visible Vertical Scroll Bar Amount (Extent)
Get Vertical Scroll Bar Unit Increment
Set Vertical Scroll Bar Unit Increment
Get Vertical Scroll Bar Block Increment
Set Vertical Scroll Bar Block Increment
Set the Vertical Scroll Bar Policy
Set Vertical Scroll Bar Orientation
Set Vertical Scroll Bar Width
Get Vertical Scroll Bar Value
if(jScrollPane1.getVerticalScrollBar() != null){
System.out.println("Current Value: "+jScrollPane1.getVerticalScrollBar().getValue());
}
Get Minimum Vertical Scroll Bar Value
if(jScrollPane1.getVerticalScrollBar() != null){
System.out.println("Minimum Value: "+jScrollPane1.getVerticalScrollBar().getMinimum());
}
Get Maximum Vertical Scroll Bar Value
if(jScrollPane1.getVerticalScrollBar() != null){
int max = jScrollPane1.getVerticalScrollBar().getMaximum();
int extentHeight = (int)jScrollPane1.getViewport().getExtentSize().getHeight();
if ((max - extentHeight) >= 0) {
System.out.println("Maximun Value: " + (max - extentHeight));
} else {
System.out.println("Maximun Value: 0");
}
}
Set Vertical Scroll Bar to Minimum Value
if(jScrollPane1.getVerticalScrollBar() != null){
jScrollPane1.getVerticalScrollBar().setValue(jScrollPane1.getVerticalScrollBar().getMinimum()));
}
Set Vertical Scroll Bar to Middle Value
if(jScrollPane1.getVerticalScrollBar() != null){
int max = jScrollPane1.getVerticalScrollBar().getMaximum();
int extentHeight = (int)jScrollPane1.getViewport().getExtentSize().getHeight();
int midValue = (jScrollPane1.getVerticalScrollBar().getMinimum() + (max-extentHeight))/2;
jScrollPane1.getVerticalScrollBar().setValue(midValue);
}
Set Vertical Scroll Bar to Maximum Value
if(jScrollPane1.getVerticalScrollBar() != null){
jScrollPane1.getVerticalScrollBar().setValue(jScrollPane1.getVerticalScrollBar().getMaximum());
}
Get Visible Height of Vertical Scroll Bar (i.e. Extent)
if(jScrollPane1.getVerticalScrollBar() != null){
System.out.println("Extent Value: "+jScrollPane1.getVerticalScrollBar().getVisibleAmount());
}
Set the Visible Vertical Scroll Bar Amount (Extent)
if(jScrollPane1.getVerticalScrollBar() != null){
jScrollPane1.getVerticalScrollBar().setVisibleAmount(50);
}
Note:
Not really useful to change since it will just be reset during any modification
to the Viewport height.
Get Vertical Scroll Bar Unit Increment
if(jScrollPane1.getVerticalScrollBar() != null){
System.out.println("Unit Increment Value: "+jScrollPane1.getVerticalScrollBar().getUnitIncrement());
}
Description:
The amount of movement from a single click on the knob (i.e. scroll button).
Note:
Mouse Wheel Scrolling amount (sort of???):
int unitCounter = (int)(block/unit);
unitCounter is then reset to the closest of these values: 1,2,3 //for Windows
int scrollAmount = unitCounter*unit;
Set Vertical Scroll Bar Unit Increment
if(jScrollPane1.getVerticalScrollBar() != null){
jScrollPane1.getVerticalScrollBar().setUnitIncrement(47);
}
Description:
The amount of movement from a single click on the scrolling button.
Reset:
if(jScrollPane1.getVerticalScrollBar() != null){
jScrollPane1.getVerticalScrollBar().setUnitIncrement(1);
}
Note:
Mouse Wheel Scrolling amount (sort of???):
int unitCounter = (int)(block/unit);
unitCounter is then reset to the closest of these values: 1,2,3 //for Windows
int scrollAmount = unitCounter*unit;
Get Vertical Scroll Bar Block Increment
if(jScrollPane1.getVerticalScrollBar() != null){
System.out.println("Block Increment Value: "+jScrollPane1.getVerticalScrollBar().getBlockIncrement());
}
Description:
The amount of movement from a single click on the scrollbar track.
Note:
Mouse Wheel Scrolling amount (sort of???):
int unitCounter = (int)(block/unit);
unitCounter is then reset to the closest of these values: 1,2,3 //for Windows
int scrollAmount = unitCounter*unit;
Set Vertical Scroll Bar Block Increment
if(jScrollPane1.getVerticalScrollBar() != null){
jScrollPane1.getVerticalScrollBar().setBlockIncrement(33);
}
Description:
The amount of movement from a single click on the scrollbar track.
Reset (sort of????)):
if(jScrollPane1.getVerticalScrollBar() != null){
jScrollPane1.getVerticalScrollBar().setBlockIncrement(10);
}
Note:
Mouse Wheel Scrolling amount (sort of???):
int unitCounter = (int)(block/unit);
unitCounter is then reset to the closest of these values: 1,2,3 //for Windows
int scrollAmount = unitCounter*unit;
Set the Vertical Scroll Bar Policy
if (jScrollPane1.getVerticalScrollBar() != null) {
jScrollPane1.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
}
Note:
ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER
ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED //default
Set Vertical Scroll Bar Orientation
if (jScrollPane1.getVerticalScrollBar() != null) {
jScrollPane1.getVerticalScrollBar().setOrientation(JScrollBar.HORIZONTAL);
}
Note:
JScrollBar.HORIZONTAL
JScrollBar.VERTICAL //default
Set Vertical Scroll Bar Width
if (jScrollPane1.getVerticalScrollBar() != null) {
jScrollPane1.getVerticalScrollBar().setPreferredSize(new Dimension(100, 5));
jScrollPane1.getVerticalScrollBar().revalidate();
}
Reset:
if (jScrollPane1.getVerticalScrollBar() != null) {
jScrollPane1.getVerticalScrollBar().setPreferredSize(null);
jScrollPane1.getVerticalScrollBar().revalidate();
}