Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: Massimo Zappino
Added: Mar 7, 2018 9:42 PM
Modified: Mar 7, 2018 9:47 PM
Views: 32
If you want to expand or collapse JScrollPane component you can click on arrow objects.
Be sure that the scroll pane has setOneTouchExpandable() set to true (you will see the arrows).
Then you can click on the relative arrow button 0 is left and 1 is right
  1. int left = 0;
  2. int right = 1;
  3. JSplitPane split = new JSplitPane();
  4. split.setOneTouchExpandable(true);
  5. BasicSplitPaneUI ui = (BasicSplitPaneUI) split.getUI();
  6. JButton oneClick = (JButton) ui.getDivider().getComponent(left);
  7. oneClick.doClick();