Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8336873

BasicSplitPaneDivider:oneTouchExpandableChanged() should mention that implementation depends on SplitPane.supportsOneTouchButtons property

XMLWordPrintable

      This is a follow up to JDK-8272229, which missed to mention that the reference implementation of ::oneTouchExpandableChanged behaves the following way on a variety of OpenJDK versions, starting from old ones:

              if (!DefaultLookup.getBoolean(splitPane, splitPaneUI,
                                 "SplitPane.supportsOneTouchButtons", true)) {
                  // Look and feel doesn't want to support one touch buttons, bail.
                  return;
              }
              if (splitPane.isOneTouchExpandable() &&
                  leftButton == null &&
                  rightButton == null) {
                  /* Create the left button and add an action listener to
                     expand/collapse it. */
      ...


      As a result, for example, with -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel installed, the buttons are not initialized.
      Please see code sample attached.

      When running the code on Linux:

      > /jdk-21/bin/java -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel Test.java
      divider.leftButton() = null
      divider.rightButton() = null
      splitPane.isOneTouchExpandable() = true
      divider.leftButton() = null
      divider.rightButton() = null
      > /jdk-21/bin/java /scratch/jdk-cache/21/35/jdk-21/bin/java Test.java
      divider.leftButton() = null
      divider.rightButton() = null
      splitPane.isOneTouchExpandable() = true
      divider.leftButton() = javax.swing.plaf.basic.BasicSplitPaneDivider$1[,0,0,0x0,invalid,alignmentX=0.0,alignmentY=0.5,border=,flags=4194600,maximumSize=,minimumSize=java.awt.Dimension[width=6,height=6],preferredSize=,defaultIcon=,disabledIcon=,disabledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=2,left=14,bottom=2,right=14],paintBorder=false,paintFocus=false,pressedIcon=,rolloverEnabled=true,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=,defaultCapable=true]
      divider.rightButton() = javax.swing.plaf.basic.BasicSplitPaneDivider$1[,0,0,0x0,invalid,alignmentX=0.0,alignmentY=0.5,border=,flags=4194600,maximumSize=,minimumSize=java.awt.Dimension[width=6,height=6],preferredSize=,defaultIcon=,disabledIcon=,disabledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=2,left=14,bottom=2,right=14],paintBorder=false,paintFocus=false,pressedIcon=,rolloverEnabled=true,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=,defaultCapable=true]

            psadhukhan Prasanta Sadhukhan
            dbessono Dmitry Bessonov
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: