Get Horizontal Scroll Bar Value
Get Minimum Horizontal Scroll Bar Value
Get Maximum Horizontal Scroll Bar Value
Set Horizontal Scroll Bar to Minimum Value
Set Horizontal Scroll Bar to Middle Value
Set Horizontal Scroll Bar to Maximum Value
Get Visible Width of Horizontal Scroll Bar (i.e. Extent)
Set the Visible Horizontal Scroll Bar Amount (Extent)
Get Horizontal Scroll Bar Unit Increment
Set Horizontal Scroll Bar Unit Increment
Get Horizontal Scroll Bar Block Increment
Set Horizontal Scroll Bar Block Increment
Set the Horizontal Scroll Bar Policy
Set Horizontal Scroll Bar Orientation
Set Horizontal Scroll Bar Height
Get Minimum Horizontal Scroll Bar Value
Get Maximum Horizontal Scroll Bar Value
Set Horizontal Scroll Bar to Minimum Value
Set Horizontal Scroll Bar to Middle Value
Set Horizontal Scroll Bar to Maximum Value
Get Visible Width of Horizontal Scroll Bar (i.e. Extent)
Set the Visible Horizontal Scroll Bar Amount (Extent)
Get Horizontal Scroll Bar Unit Increment
Set Horizontal Scroll Bar Unit Increment
Get Horizontal Scroll Bar Block Increment
Set Horizontal Scroll Bar Block Increment
Set the Horizontal Scroll Bar Policy
Set Horizontal Scroll Bar Orientation
Set Horizontal Scroll Bar Height
Get Horizontal Scroll Bar Value
if(jScrollPane1.getHorizontalScrollBar() != null){
System.out.println("Current Value: "+jScrollPane1.getHorizontalScrollBar().getValue());
}
Get Minimum Horizontal Scroll Bar Value
if(jScrollPane1.getHorizontalScrollBar() != null){
System.out.println("Minimum Value: "+jScrollPane1.getHorizontalScrollBar().getMinimum());
}
Get Maximum Horizontal Scroll Bar Value
if(jScrollPane1.getHorizontalScrollBar() != null){
int max = jScrollPane1.getHorizontalScrollBar().getMaximum();
int extentWidth = (int)jScrollPane1.getViewport().getExtentSize().getWidth();
if ((max - extentWidth) >= 0) {
System.out.println("Maximun Value: " + (max - extentWidth));
} else {
System.out.println("Maximun Value: 0");
}
}
Set Horizontal Scroll Bar to Minimum Value
if (jScrollPane1.getHorizontalScrollBar() != null) {
jScrollPane1.getHorizontalScrollBar().setValue(jScrollPane1.getHorizontalScrollBar().getMinimum());
}
Set Horizontal Scroll Bar to Middle Value
if(jScrollPane1.getHorizontalScrollBar() != null){
int max = jScrollPane1.getHorizontalScrollBar().getMaximum();
int extentHeight = (int)jScrollPane1.getViewport().getExtentSize().getWidth();
int midValue = (jScrollPane1.getHorizontalScrollBar().getMinimum() + (max-extentHeight))/2;
jScrollPane1.getHorizontalScrollBar().setValue(midValue);
}
Set Horizontal Scroll Bar to Maximum Value
if(jScrollPane1.getHorizontalScrollBar() != null){
jScrollPane1.getHorizontalScrollBar().setValue(jScrollPane1.getHorizontalScrollBar().getMaximum());
}
Get Visible Width of Horizontal Scroll Bar (i.e. Extent)
if(jScrollPane1.getHorizontalScrollBar() != null){
System.out.println("Extent Value: "+jScrollPane1.getHorizontalScrollBar().getVisibleAmount());
}
Set the Visible Horizontal Scroll Bar Amount (Extent)
if(jScrollPane1.getHorizontalScrollBar() != null){
jScrollPane1.getHorizontalScrollBar().setVisibleAmount(50);
}
Note:
Not really useful to change since it will just be reset during any modification
to the Viewport height.
Get Horizontal Scroll Bar Unit Increment
if(jScrollPane1.getHorizontalScrollBar() != null){
System.out.println("Unit Increment Value: "+jScrollPane1.getHorizontalScrollBar().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 Horizontal Scroll Bar Unit Increment
if(jScrollPane1.getHorizontalScrollBar() != null){
jScrollPane1.getHorizontalScrollBar().setUnitIncrement(47);
}
Description:
The amount of movement from a single click on the scrolling button.
Reset:
if(jScrollPane1.getHorizontalScrollBar() != null){
jScrollPane1.getHorizontalScrollBar().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 Horizontal Scroll Bar Block Increment
if(jScrollPane1.getHorizontalScrollBar() != null){
System.out.println("Block Increment Value: "+jScrollPane1.getHorizontalScrollBar().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 Horizontal Scroll Bar Block Increment
if(jScrollPane1.getHorizontalScrollBar() != null){
jScrollPane1.getHorizontalScrollBar().setBlockIncrement(33);
}
Description:
The amount of movement from a single click on the scrollbar track.
Reset (sort of????)):
if(jScrollPane1.getHorizontalScrollBar() != null){
jScrollPane1.getHorizontalScrollBar().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 Horizontal Scroll Bar Policy
if (jScrollPane1.getHorizontalScrollBar() != null) {
jScrollPane1.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
}
Note:
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED //default
Set Horizontal Scroll Bar Orientation
if (jScrollPane1.getHorizontalScrollBar() != null) {
jScrollPane1.getHorizontalScrollBar().setOrientation(JScrollBar.VERTICAL);
}
Note:
JScrollBar.HORIZONTAL //default
JScrollBar.VERTICAL
Set Horizontal Scroll Bar Height
if (jScrollPane1.getHorizontalScrollBar() != null) {
jScrollPane1.getHorizontalScrollBar().setPreferredSize(new Dimension(5, 100));
jScrollPane1.getHorizontalScrollBar().revalidate();
}
Reset:
if (jScrollPane1.getHorizontalScrollBar() != null) {
jScrollPane1.getHorizontalScrollBar().setPreferredSize(null);
jScrollPane1.getHorizontalScrollBar().revalidate();
}