2525import com .formdev .flatlaf .*;
2626import com .formdev .flatlaf .extras .FlatSVGIcon ;
2727import com .formdev .flatlaf .icons .FlatClearIcon ;
28+ import com .formdev .flatlaf .ui .FlatLineBorder ;
2829import com .formdev .flatlaf .util .SystemFileChooser ;
2930import com .formdev .flatlaf .util .UIScale ;
3031import com .jidesoft .plaf .LookAndFeelFactory ;
@@ -586,11 +587,11 @@ public int getNextMatch(final String prefix, final int startIndex, final Positio
586587 final JPanel panel = new JPanel (layout );
587588 panel .add (getLabel (message ),gbc );
588589 gbc .gridy ++;
589- panel .add (getScrollPane (list ), gbc );
590+ panel .add (ScrollPanes . create (list ), gbc );
590591 gbc .gridy ++;
591592 panel .add (new JLabel ("<HTML> " ), gbc ); // spacer
592593 gbc .gridy ++;
593- panel .add (getScrollPane (ta ), gbc );
594+ panel .add (ScrollPanes . create (ta ), gbc );
594595 if (choices .length > 4 ) {
595596 final ListSearchable searchable = new ListSearchable (list ) {
596597 @ Override
@@ -648,15 +649,9 @@ public void keyTyped(final KeyEvent e) {
648649 return list ;
649650 }
650651
651- private JScrollPane getScrollPane (final Component c ) {
652- final JScrollPane sp = new JScrollPane (c );
653- sp .setWheelScrollingEnabled (true );
654- return sp ;
655- }
656-
657652 public List <String > getMultipleChoices (final String title , final String [] choices , final String defaultChoice ) {
658653 final JList <String > list = getJList (choices , defaultChoice );
659- if (JOptionPane .showConfirmDialog (parent , getScrollPane (list ), title ,
654+ if (JOptionPane .showConfirmDialog (parent , ScrollPanes . create (list ), title ,
660655 JOptionPane .OK_CANCEL_OPTION , JOptionPane .QUESTION_MESSAGE ) == JOptionPane .OK_OPTION )
661656 return list .getSelectedValuesList ();
662657 return null ;
@@ -671,7 +666,7 @@ public Object[] getMultipleChoicesAndChoice(final String title,
671666 combo .setSelectedItem (defaultChoice2 );
672667 final JPanel panel = new JPanel ();
673668 panel .setLayout (new BoxLayout (panel , BoxLayout .Y_AXIS ));
674- panel .add (getScrollPane (list1 ));
669+ panel .add (ScrollPanes . create (list1 ));
675670 panel .add (combo );
676671 if (JOptionPane .showConfirmDialog (parent , panel , title ,
677672 JOptionPane .OK_CANCEL_OPTION , JOptionPane .QUESTION_MESSAGE ) == JOptionPane .OK_OPTION ) {
@@ -1492,7 +1487,7 @@ private Object getObj(final String promptMsg, final String promptTitle,
14921487 }
14931488
14941489 private JDialog htmlOptionPane (final String msg , final String title , final boolean modal ) {
1495- final JOptionPane op = new JOptionPane (getScrollPane (htmlEditorPane (msg )),
1490+ final JOptionPane op = new JOptionPane (ScrollPanes . create (htmlEditorPane (msg )),
14961491 JOptionPane .PLAIN_MESSAGE , JOptionPane .DEFAULT_OPTION );
14971492 final JDialog d = op .createDialog (parent , title );
14981493 d .setModal (modal );
@@ -2342,23 +2337,6 @@ public static GridBagConstraints defaultGbc() {
23422337 return cp ;
23432338 }
23442339
2345- public static void recolorTracks (final JScrollPane scrollPane , final Color color , final boolean updateUI ) {
2346- final Component c = scrollPane .getCorner (JScrollPane .LOWER_TRAILING_CORNER );
2347- if (c != null ) {
2348- c .setBackground (color );
2349- } else {
2350- final JPanel dummy = new JPanel ();
2351- dummy .setBackground (color );
2352- scrollPane .setCorner (JScrollPane .LOWER_TRAILING_CORNER , dummy );
2353- }
2354- final Map <String , Object > style = new HashMap <>();
2355- style .put ("track" , color );
2356- style .put ("hoverTrackColor" , color );
2357- scrollPane .getHorizontalScrollBar ().putClientProperty (FlatClientProperties .STYLE , style );
2358- scrollPane .getVerticalScrollBar ().putClientProperty (FlatClientProperties .STYLE , style );
2359- if (updateUI ) scrollPane .updateUI ();
2360- }
2361-
23622340 public static void addClearButton (final JTextField textField ) {
23632341 textField .putClientProperty (FlatClientProperties .TEXT_FIELD_SHOW_CLEAR_BUTTON , true );
23642342 }
@@ -2737,7 +2715,7 @@ public JDialog showHTMLDialog(final String msg, final String title, final boolea
27372715
27382716 public boolean yesNoHTMLDialog (final String htmlMsg , final String title ,
27392717 final String yesLabel , final String noLabel ) {
2740- return yesNoDialog (new Object []{getScrollPane (htmlEditorPane (htmlMsg ))}, title ,
2718+ return yesNoDialog (new Object []{ScrollPanes . create (htmlEditorPane (htmlMsg ))}, title ,
27412719 new String []{yesLabel , noLabel }, JOptionPane .PLAIN_MESSAGE ) == JOptionPane .YES_OPTION ;
27422720 }
27432721
@@ -2804,7 +2782,7 @@ JPanel panel() {
28042782 ++c .gridy ;
28052783 contentPane .add (leftAlignedLabel ("Charts to be combined:" , true ), c );
28062784 ++c .gridy ;
2807- contentPane .add (getScrollPane (titles ), c );
2785+ contentPane .add (ScrollPanes . create (titles ), c );
28082786 ++c .gridy ;
28092787 contentPane .add (leftAlignedLabel ("Montage Layout:" , true ), c );
28102788 ++c .gridy ;
@@ -5021,6 +4999,38 @@ public void setEnabled(final boolean enabled) {
50214999 }
50225000
50235001
5002+ public static class ScrollPanes {
5003+
5004+ private static JScrollPane create (final Component c ) {
5005+ final JScrollPane sp = new JScrollPane (c );
5006+ sp .setWheelScrollingEnabled (true );
5007+ return sp ;
5008+ }
5009+
5010+ public static void setTopBottomBorder (final JScrollPane scrollPane ) {
5011+ scrollPane .setBorder (new FlatLineBorder (new Insets (1 , 0 , 1 , 0 ),
5012+ UIManager .getColor ("Component.borderColor" )));
5013+ }
5014+
5015+ public static void recolorTracks (final JScrollPane scrollPane , final Color color , final boolean updateUI ) {
5016+ final Component c = scrollPane .getCorner (JScrollPane .LOWER_TRAILING_CORNER );
5017+ if (c != null ) {
5018+ c .setBackground (color );
5019+ } else {
5020+ final JPanel dummy = new JPanel ();
5021+ dummy .setBackground (color );
5022+ scrollPane .setCorner (JScrollPane .LOWER_TRAILING_CORNER , dummy );
5023+ }
5024+ final Map <String , Object > style = new HashMap <>();
5025+ style .put ("track" , color );
5026+ style .put ("hoverTrackColor" , color );
5027+ scrollPane .getHorizontalScrollBar ().putClientProperty (FlatClientProperties .STYLE , style );
5028+ scrollPane .getVerticalScrollBar ().putClientProperty (FlatClientProperties .STYLE , style );
5029+ if (updateUI ) scrollPane .updateUI ();
5030+ }
5031+ }
5032+
5033+
50245034 public static class SplitPanes {
50255035
50265036 public static JSplitPane nonDraggableRightSplitPane () {
0 commit comments