Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Metal LAF JScrollPane rendering bug?

  1. #1
    Junior Member
    Join Date
    Feb 2011
    Posts
    3
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Metal LAF JScrollPane rendering bug?

    Hi all,

    Having played around with the JScrollPane class for a couple of days, I've come across a very strange rendering problem regarding the horizontal JScrollBar compnent. When using these components within the default swing "Metal" look-and-feel, the center gripper pattern of the horizontal scrollbar appears to render incorrectly at specific content/viewport dimensions.

    The code below opens a simple JFrame window with an embedded JScrollPane component, which appears to exhibit strange rendering behaviour as the horizontal scrollbar is dragged towards the rightmost extemity. As the rendering of the horizontal scrollbar gripper appears to be dependent upon the size of the content/viewport, this code opens the parent JFrame with an explicit dimension of 1402x800. Varying dimensions appear to have the same effect, including a maximized window at a 1440x900 resolution, and the problem tends to present itself more readily in a non-composited desktop environment (i.e. Windows XP or Vista/7 running a basic/classic theme).


    public class Main
    {
     public static void main(String[] args)
     {
      ScrollbarTest application = new ScrollbarTest();
      application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
     }
    }
     
     
    public class ScrollbarTest extends JFrame
    {
     
     public ScrollbarTest()
     {
      super("Scrollbar Test");
      Container container = getContentPane();
     
      JScrollPane scrollPane =
        new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                        JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
     
      JPanel contentPanel = new JPanel();
      contentPanel.setPreferredSize(new Dimension(8000, 8000));
     
      scrollPane.getViewport().add(contentPanel);
      container.add(scrollPane);
     
      setSize(1402,800);
      setVisible(true);
     }
    }


    Any comments regarding the reproducibility and/or cause of this anomaly would be gratefully received.

    Best regards, Lee.


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Metal LAF JScrollPane rendering bug?

    I don't see anything wrong with how this renders (I'm using Windows XP).

    Perhaps a screenshot of what's going on would help?
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Junior Member
    Join Date
    Feb 2011
    Posts
    3
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Re: Metal LAF JScrollPane rendering bug?

    Hi Kevin, thanks for the reply.

    I've attached an image depicting the anomaly I'm experiencing. As you can see, the center gripper feature is not rendered as I drag the horizontal scrollbar toward its right extremity.

    Please note that this doesn't appear to happen at all window sizes, but the initial JFrame dimension of 1402x800 certainly does the trick on my system. To be perfectly honest, this problem was not apparent until I moved from a 1280x800 to 1440x900 screen.

    Again, thanks for taking the time to reply.

    Cheers, Lee.
    Attached Images Attached Images

  4. #4
    Junior Member
    Join Date
    Feb 2011
    Posts
    3
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Bug confirmed by Sun

    Thank you all for taking the time to read this post. As we are not professional programmers, we had to seek advice in order to ensure that we were using the java API correctly. We asked the guys at Sun to take a look at our problem, and this does appear to be a bug with the swing "Metal" look-and-feel. Please see below for the relevant correspondence.

    Dear Java Developer,

    Thank you for reporting this issue.

    We have determined that this report is a new bug and entered the bug into our internal bug tracking system under Bug Id: 7017935.

    You can monitor this bug on the Java Bug Database at
    Maintenance Notice.

    It may take a day or two before your bug shows up in this external database. If you are a member of the Sun Developer Network (SDN), there are two additional options once the bug is visible.

    1. Voting for the bug
    Click Maintenance Notice.

    2. Adding the report to your Bug Watch list.
    You will receive an email notification when this bug is updated.
    Click Maintenance Notice.

    The Sun Developer Network (Oracle Technology Network | World's Largest Community for Developers, DBAs, and Architects) is a free service that Sun offers. To join, visit https://softwarereg.sun.com/registra...en_US/new_user.

    Regards,
    Java Developer Support
    Best regards, Lee.

  5. The Following User Says Thank You to tpsuk For This Useful Post:

    copeg (February 8th, 2011)

Similar Threads

  1. Problems with rendering a jprogressbar
    By albertof in forum What's Wrong With My Code?
    Replies: 1
    Last Post: November 10th, 2010, 04:47 AM
  2. JMonkeyEngine 3 not rendering.
    By scribbleno1 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: May 13th, 2010, 02:29 AM
  3. JScrollPane
    By MysticDeath in forum AWT / Java Swing
    Replies: 1
    Last Post: February 17th, 2010, 10:21 PM
  4. JTable in JScrollPane
    By alwayslearner in forum File I/O & Other I/O Streams
    Replies: 0
    Last Post: January 29th, 2010, 11:42 AM
  5. Problem in JSP rendering
    By srkumarj2ee@gmail.com in forum JavaServer Pages: JSP & JSTL
    Replies: 1
    Last Post: September 13th, 2009, 02:26 PM