Menu

#210 GridControl scrollbar doesn't paint in Nimbus LaF

open
nobody
None
5
2012-12-13
2011-09-13
Anonymous
No

GridControl scrollbar doesn't paint when I use Nimbus Look and Feel.

ClientSettings.LOOK_AND_FEEL_CLASS_NAME = "com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel";

If I don't set the look and feel, openswing will use Metal LaF by default. The scroll bar, down/up arrow and prev/next page arrow are painted correctly.

My environment is:
Ubuntu 11.04

$ java -version
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) Server VM (build 20.1-b02, mixed mode)

Openswing2.4.2

Please see attached picture.

Regards,
Jingglang

Discussion

  • Anonymous

    Anonymous - 2011-11-22

    Hi All,

    I think I found the source of the problem which is in PaginationVerticalScrollbar class.
    ---------------------
    public void updateUI() {
    if (!ClientSettings.SHOW_PAGINATION_BUTTONS_ON_GRID) {
    super.updateUI();
    return;
    }
    try {
    ScrollBarUI ui = (ScrollBarUI) UIManager.getUI(new JScrollBar());
    if (ui.getClass().getName().endsWith("MetalScrollBarUI")) {
    setUI(MetalPaginationVerticalScrollbarUI.createUI(this));
    }
    else if (ui.getClass().getName().endsWith("MacScrollBarUI")) {
    ComponentUI cui = (ComponentUI)Class.forName("org.openswing.swing.table.client.MacPaginationVerticalScrollBarUI").getMethod("createUI",new Class[]{JComponent.class}).invoke(null,new Object[]{this});
    setUI(cui);
    }
    else {
    setUI(WindowsPaginationVerticalScrollbarUI.createUI(this));
    }
    }
    catch (Throwable ex) {
    setUI(WindowsPaginationVerticalScrollbarUI.createUI(this));
    }
    }
    --------------------

    In above code, WindowsPaginationVerticalScrollbarUI is the default UI if appropriate vertical scrollbar UI is not defined. In my opinion the default should be MetalScrollBarUI since it is cross platform. I changed that method as follow and has tested in Ubuntu and Windows XP.

    -----------
    public void updateUI() {
    if (!ClientSettings.SHOW_PAGINATION_BUTTONS_ON_GRID) {
    super.updateUI();
    return;
    }
    try {
    ScrollBarUI ui = (ScrollBarUI) UIManager.getUI(new JScrollBar());
    if (ui.getClass().getName().endsWith("WindowsScrollBarUI")) {
    setUI(WindowsPaginationVerticalScrollbarUI.createUI(this));
    } else if (ui.getClass().getName().endsWith("MacScrollBarUI")) {
    ComponentUI cui = (ComponentUI)Class.forName("org.openswing.swing.table.client.MacPaginationVerticalScrollBarUI").getMethod("createUI",new Class[]{JComponent.class}).invoke(null,new Object[]{this});
    setUI(cui);
    } else {
    setUI(MetalPaginationVerticalScrollbarUI.createUI(this));
    }
    }
    catch (Throwable ex) {
    setUI(MetalPaginationVerticalScrollbarUI.createUI(this));
    }
    }
    -----------

     
  • Nobody/Anonymous

    I beloved up to youll obtain carried out proper here. The comic strip is attractive, your authored subject matter stylish. nevertheless, you command get bought an edginess over that you would like be handing over the following. ill no doubt come more previously once more as exactly the same just about a lot incessantly inside of case you protect this hike.
    <a href="http://www.artipot.com/authors/455438/Tijs-French" title="Identify">Identify</a>

     

Log in to post a comment.