Menu

#3368 Horizontal Scrollbar Abnormal in Nimbus Look and Feel

minor bug
closed-fixed
5
2018-07-09
2010-01-06
Wayne Zhang
No

I have reported this bug in 2008 (id 2063480) and it was closed by marked as invalid. But I found this bug still exist in 4.3 final version:

But the horizontal scroll bar enabled,
it's stays on the RIGHT, and you CAN'T drag it to the LEFT.

It's using Sun JDK 1.6 Update 10 RC (build 28) and
Nimbus Look and Feel. Other Look and Feel is OK.

Don't know it's an issue of JEdit or Nimbus LnF.
The question is:

1) Nimbus doesn't has this issue on OTHER Java applications;
2) JEdit doesn't has this issue for OTHER Java look and feels.

It's only happens when JEdit using Nimbus look and feel!

Bug reproduce conditions:
1. It works fine if the window (view port) is shorter than the max length of text, horizontal scroll bar appears and can be scrolled; (img1.jpg)
2. It works if the window is not wider enough, NO HORIZONTAL SCROLLBAR (img2.jpg);
3. BUT the horizontal bar appeared (which SHOULD NOT because text length is shorter than the window), and it can't be scrolled. That it it stays on the RIGHT, when you scroll left, it scrolls to the RIGHT when you release the mouse button (img3.jpg)

Discussion

  • Wayne Zhang

    Wayne Zhang - 2010-01-06

    works

     
  • Wayne Zhang

    Wayne Zhang - 2010-01-06

    works

     
  • Wayne Zhang

    Wayne Zhang - 2010-01-06

    BUG

     
  • Anonymous

    Anonymous - 2010-01-06

    I closed this bug, because it's not in jEdit, it's in Nimbus. See:
    http://forums.sun.com/thread.jspa?threadID=5419985
    Although jEdit doesn't use the horizontal scrollbar exactly the same way as the example I gave, it shows a defect in Nimbus that is shown in jEdit as well, and most likely causes the problem you see. I closed it because I think it should be opened in the Java/Swing bug tracker and not in jEdit. There's not much jEdit can (or should) do about it.

    A link to the previous bug:
    https://sourceforge.net/tracker/index.php?func=detail&aid=2063480&group_id=588&atid=100588

     
  • Wayne

    Wayne - 2011-06-16

    But this issue never happened in other Java applications I have used - NetBeans, SquirrelSQL (with Nimbus LnF). It seems JEdit specific.

     
  • Wayne

    Wayne - 2011-06-16

    I have tested Try.java and it seems this issue is Nimbus LnF specific. May JEdit uses some specific scrolling code than other Java applications do normally. I will report bug to Oracle.

     
  • Matthieu Casanova

    I have no idea about how to fix that but it still happens with buttons of dockables. I'm unassigning myself.

     
  • Matthieu Casanova

    • assigned_to: kpouer --> nobody
     
  • Wayne

    Wayne - 2018-06-15

    Create the following method in jEdit.java class, and calling this method instead of UIManager.setLookAndFeel in initPLAF() method will fix this issue:

    /**
     * Set Look and Feel, fix the Nimbus scrollbar bug by the way
     */
    private static void setLookAndFeel(String sLaf) 
    {       
        try
        {
    
            LookAndFeel laf = (LookAndFeel)Class.forName(sLaf).newInstance();
    
            if("Nimbus".equals(laf.getName())){     
                // See: https://stackoverflow.com/questions/11493273/scroll-horizontally-in-jtable-with-nimbus-look-and-feel
                //      https://bugs.openjdk.java.net/browse/JDK-8072677
                javax.swing.plaf.DimensionUIResource dim = new javax.swing.plaf.DimensionUIResource(4096, 4096);
                laf.getDefaults().put("ScrollBar.maximumThumbSize", dim);   
            }
    
            UIManager.setLookAndFeel(laf);
        }
        catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e)
        {
            // ignored, there really isn't anything to do and this may be
            // bogus, the lnf may be from the Look And Feel plugin
        }       
    }
    
     
  • Wayne

    Wayne - 2018-06-15

    SVN patch for this bug fix

     

    Last edit: Wayne 2018-06-15
  • Dale Anson

    Dale Anson - 2018-06-15
    • assigned_to: Dale Anson
    • Group: --> minor bug
     
  • Dale Anson

    Dale Anson - 2018-06-15

    I'll check into this, but I'm also wondering if you happen to have found a fix for the button sizes with Nimbus? The OK/Cancel/Yes/No/Apply/etc buttons in most dialogs are always the wrong size. The scrollbar problem you've mentioned plus the button size problem is the main reason I don't use Nimbus, it's just unattractive compared to Substance, for example, or for that matter, just about any of the look and feels provided by the Look and Feel plugin.

     
  • Dale Anson

    Dale Anson - 2018-06-15

    What java version are you using? As far as I can tell, the bug is fixed in java 9, although looking through the java 9 source code, it looks like the max thumb button size is still set to 1000x1000 [1] rather than 4096x4096 as suggested by the SO article. The button sizes are also looking correct when running jEdit with java 9. I didn't dig super deep into the java 9 source code, so I'm not sure exactly what the fix was, but it does seem to be fixed.

    My thought is to move your suggested fix into the look and feel plugin and apply it only when the java version is less than 9. I doubt this would also fix the button size problem, but perhaps setting a different UI default would take care of that situation also.

    [1] http://hg.openjdk.java.net/jdk9/client/jdk/file/65464a307408/src/java.desktop/share/classes/javax/swing/plaf/nimbus/skin.laf#l16979

     
  • Wayne

    Wayne - 2018-06-15

    Hi Dale,
    I am using Java 8 most of the time, but I have installed Java 9 and 10 as well as I am a Java developer. I tested it with Java 9 and found that this bug isn't been fixed (see the attached image). You may reference Java bug in OpenJDK (https://bugs.openjdk.java.net/browse/JDK-8072677), it still haven't been schedulled to any release.

    Also, I don't have the button size issue in Nimbus LnF. Button size in any dialog is OK on my PC (since very early relases, for example, 5.1).

    I have created a patch for this bug (https://sourceforge.net/p/jedit/patches/618/), hope you can apply it in the next release.

    Your response is so quick, jEdit has a very healthy community. I like Nimbus look and feel, I used it in most of my Java applications - NetBeans, Squirrel-SQL, etc. This scrollbar bug is the only reason I didn't use Nimbus in jEdit, util I found this fix on the web.

    Have a good weekend!

    Cheers,
    Wayne

     
  • Wayne

    Wayne - 2018-06-15

    Nimbus scrollbar issuen on Java 9.

     
  • Wayne

    Wayne - 2018-06-15

    Also, the scrollbar issue only happens when jEdit windows size > 1000 (width and/or height). There is no PC with a screen size that narrower than 1000 px, but if the jEdit window size is not in full screen mode, it may still 'hide' this issue.

     
  • Dale Anson

    Dale Anson - 2018-07-09

    The 2.1 version of the Look and Feel plugin has your fix for this, go to Plugins - Plugin Options - Look and Feel, select Nimbus, check both option setting boxes.

     
  • Dale Anson

    Dale Anson - 2018-07-09
    • status: open --> closed-fixed
     

Log in to post a comment.