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

Scrollbars are not drawn proper

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Cannot Reproduce
    • Affects Version/s: 6u39, 7u13
    • Fix Version/s: 9
    • Component/s: client-libs
    • Labels:
    • OS:
      windows_8

      Description

      FULL PRODUCT VERSION :
      Java 1.6.0_39 and also Java 1.7.0_13

      ADDITIONAL OS VERSION INFORMATION :
      Windows 8 6.2

      A DESCRIPTION OF THE PROBLEM :
      The JScrollPane shows scrollbars with unmotivated 3 black lines inside (dirty regions).

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      start the application and watch the scrollbar in the JDialog with a JTree inside. 3 black lines are shown across he scrollbar.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      no black lines across a scrollbar
      ACTUAL -
      3 black lines across a scrollbar

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package com.classwizard.cw;


      import java.awt.BorderLayout;
      import java.awt.Container;
      import java.awt.Dimension;
      import java.awt.event.WindowAdapter;
      import java.awt.event.WindowEvent;

      import javax.swing.JDesktopPane;
      import javax.swing.JDialog;
      import javax.swing.JFrame;
      import javax.swing.JPanel;
      import javax.swing.JScrollPane;
      import javax.swing.JTree;
      import javax.swing.WindowConstants;
      import javax.swing.tree.DefaultMutableTreeNode;
      import javax.swing.tree.DefaultTreeCellRenderer;
      import javax.swing.tree.DefaultTreeModel;
      import javax.swing.tree.TreeModel;
      import javax.swing.tree.TreeSelectionModel;


      public class ClassWizard extends Object{
          public static void main(String args[]) throws Exception{
              try{
                  DialogTest ket = new DialogTest();
                  GJApp.launch(ket, " TreeTest " ,0,0,700,700,null);
              }
              catch (Exception e){
                  System.out.println(e.getMessage());
                  e.printStackTrace();
              }
          }
      }
      class GJApp extends WindowAdapter{
          public static void launch(final DialogTest f, String title,final int x, final int y,final int w, int h,String propertiesFilename){
              f.setTitle(title);
              f.setBounds(x,y,w,h);
              f.setVisible(true);
              f.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
              f.addWindowListener(new WindowAdapter(){
                  public void windowClosed(WindowEvent e){
                      System.exit(0);
                  }
              });
          }
      }

      class DialogTest extends JFrame{
          protected JDesktopPane desktopPane = new JDesktopPane();
          CustomerJTree _tree = null;
          DefaultTreeModel _treeModel = null;
          TreeDialog _treedlg = null;
          
          public DialogTest() throws Exception{
              String osname = System.getProperty( " os.name " );
              String osversion = System.getProperty( " os.version " );
              String java_version = System.getProperty( " java.version " );
              System.out.println(osname + " " + osversion + " java: " + java_version + "
       " );
              
              // make a tree
              DefaultMutableTreeNode root = new DefaultMutableTreeNode( " root " );
              _treeModel = new DefaultTreeModel(root);
              for(int i=0; i< 15; i++){
                  DefaultMutableTreeNode nodex = new DefaultMutableTreeNode( " node " + i);
                  _treeModel.insertNodeInto(nodex, root, root.getChildCount());
              }
               _tree = new CustomerJTree(_treeModel,this);
              
              // make a dialog for the tree
              _treedlg = new TreeDialog( " tree " ,false,this);
              _treedlg.init(_tree);
              _treedlg.setVisible(true);
              _treedlg.setLocation(100, 100);
          }
      }

      class CustomerJTree extends JTree{
          DialogTest _owner = null;
          
          public CustomerJTree(TreeModel newModel,DialogTest owner){
              super(newModel);
              _owner = owner;
          }
      }
      class TreeDialog extends JDialog{
          DialogTest _owner = null;
          TreeDialog _dialog = this;
          JTree _tree = null;
          public TreeDialog(String title, boolean modal,DialogTest owner){
              super(owner,title,modal);
              _owner = owner;
          }
          
          private JPanel getNewTabPanel(JTree tree){
              JPanel panel = new JPanel(new BorderLayout(0, 0));
              if(tree != null){
                  JScrollPane spane = new JScrollPane(
                      tree,
                      JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                      JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
                  panel.add(spane, BorderLayout.CENTER);
              }
              return panel;
          }

          public void init(JTree tree){
              try{
                  tree.setCellRenderer(new DefaultTreeCellRenderer());
                  _tree = tree;
                  TreeSelectionModel model = tree.getSelectionModel();
                  model.setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
                  _tree.putClientProperty( " JTree.lineStyle " , " Angled " );
                  Container diacontent = this.getContentPane();
                  diacontent.setLayout(new BorderLayout(0, 0));
                  JPanel paraPanel = getNewTabPanel(tree);
                  diacontent.add(paraPanel, BorderLayout.CENTER);
              }
              catch (Exception ex){
                  System.out.println(ex.getMessage());
                  ex.printStackTrace();
              }
              setPreferredSize(new Dimension(100, 300));
              setResizable(true);
              pack();
          }
      }

      ---------- END SOURCE ----------

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              ssadetsky Semyon Sadetsky (Inactive)
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: