-
Bug
-
Resolution: Fixed
-
P3
-
7u3, 7u60, 8u5, 9
-
b24
-
generic
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8056759 | emb-9 | Unassigned | P3 | Resolved | Fixed | b24 |
FULL PRODUCT VERSION :
jdk1.7.0_03
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]
A DESCRIPTION OF THE PROBLEM :
One touch expandable button of JSplitPane will reduce the vertical scroll bar value by 15 if vertical scroll bar is scrolled to maximum value and then, clicked one-touch Expandable button to minimise the left pane.
Anyone can verify this by seeing GUI where scroll bar position is changed. Same can also be verified using console output.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package de.dbsystems.tpn.anita.client.konstr;
import java.awt.event.AdjustmentEvent;
import java.awt.event.AdjustmentListener;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTree;
import javax.swing.SwingUtilities;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.TreePath;
/**
* Sample code.
*
* @author Saurav.Kumar
*
*/
public class OneTouchBug {
public void playUI() {
DefaultMutableTreeNode root;
root = new DefaultMutableTreeNode(0);
final JTree tree = new JTree(root);
JLabel bugLabel = new JLabel(
" <html>One touch button will reduce the vScroll <br> " +
" value by 15 if it is scrolled to maximum value and <br> " +
" then click one-touch Expandable " );
JPanel p = new JPanel();
p.add(bugLabel);
final JScrollPane jScrollPane = new JScrollPane(tree, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
final JSplitPane sptPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jScrollPane, p);
sptPane.setDividerLocation(90);
sptPane.setOneTouchExpandable(true);
jScrollPane.getVerticalScrollBar().addAdjustmentListener(new AdjustmentListener() {
@Override
public void adjustmentValueChanged(AdjustmentEvent e) {
System.out.println( " ======================= " + e.getValue());
}
});
JFrame f = new JFrame();
f.getContentPane().add(sptPane);
f.setSize(400, 200);
f.setLocationRelativeTo(null);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);
populateTree(root);
tree.scrollPathToVisible(new TreePath(root.getLastLeaf().getPath()));
}
private void populateTree(DefaultMutableTreeNode root) {
DefaultMutableTreeNode currentNode = root;
int counter = 0;
while (counter++ < 9) {
DefaultMutableTreeNode nextNode = new DefaultMutableTreeNode( " " + counter);
currentNode.add(nextNode);
currentNode = nextNode;
}
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
new OneTouchBug().playUI();
}
});
}
}
---------- END SOURCE ----------
jdk1.7.0_03
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]
A DESCRIPTION OF THE PROBLEM :
One touch expandable button of JSplitPane will reduce the vertical scroll bar value by 15 if vertical scroll bar is scrolled to maximum value and then, clicked one-touch Expandable button to minimise the left pane.
Anyone can verify this by seeing GUI where scroll bar position is changed. Same can also be verified using console output.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package de.dbsystems.tpn.anita.client.konstr;
import java.awt.event.AdjustmentEvent;
import java.awt.event.AdjustmentListener;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTree;
import javax.swing.SwingUtilities;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.TreePath;
/**
* Sample code.
*
* @author Saurav.Kumar
*
*/
public class OneTouchBug {
public void playUI() {
DefaultMutableTreeNode root;
root = new DefaultMutableTreeNode(0);
final JTree tree = new JTree(root);
JLabel bugLabel = new JLabel(
" <html>One touch button will reduce the vScroll <br> " +
" value by 15 if it is scrolled to maximum value and <br> " +
" then click one-touch Expandable " );
JPanel p = new JPanel();
p.add(bugLabel);
final JScrollPane jScrollPane = new JScrollPane(tree, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
final JSplitPane sptPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jScrollPane, p);
sptPane.setDividerLocation(90);
sptPane.setOneTouchExpandable(true);
jScrollPane.getVerticalScrollBar().addAdjustmentListener(new AdjustmentListener() {
@Override
public void adjustmentValueChanged(AdjustmentEvent e) {
System.out.println( " ======================= " + e.getValue());
}
});
JFrame f = new JFrame();
f.getContentPane().add(sptPane);
f.setSize(400, 200);
f.setLocationRelativeTo(null);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);
populateTree(root);
tree.scrollPathToVisible(new TreePath(root.getLastLeaf().getPath()));
}
private void populateTree(DefaultMutableTreeNode root) {
DefaultMutableTreeNode currentNode = root;
int counter = 0;
while (counter++ < 9) {
DefaultMutableTreeNode nextNode = new DefaultMutableTreeNode( " " + counter);
currentNode.add(nextNode);
currentNode = nextNode;
}
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
new OneTouchBug().playUI();
}
});
}
}
---------- END SOURCE ----------
- backported by
-
JDK-8056759 setOneTouchExpandable functionality of JSplitPane will reduce vertical Scrollbar
-
- Resolved
-
- relates to
-
JDK-4502121 Problem rendering scrollbar in JScrollPane with rowheaders and/or columnheaders
-
- Closed
-