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

XP L&F: JTable header drag 'handle' does not align to column boundary

XMLWordPrintable

    • Fix Understood
    • x86
    • windows_xp

      Name: rmT116609 Date: 03/15/2004


      FULL PRODUCT VERSION :
      java version "1.5.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b32c)
      Java HotSpot(TM) Client VM (build 1.5.0-beta-b32c, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      The render of the header in a JTable does not align with the column boundary compared to say the sheduled tasks application in Windows XP.

      On comparing the two after selecting column 1 in an application you can see in column 0:
      Java:
      background header colour [ in column 0]
      gray line 1 pixel [ in column 0]
      white line 1 pixel [ in column 0]
      background header colour 1pixel [ in column 1]
      white highlight [in column 1]

      Windows schedule tasks application:
      background header colour [ in column 0]
      gray line 1 pixel [ in column 0]
      white line 1 pixel [ in column 0]
      white highlight [in column 1]

      i.e. the white line of the Windows XP application drag handle is directly next to the next column where as in a java app the line is 1 pixel further away

      Note: this is also mentioned as part of bug 4783151, closed as a duplicate of 4774013 but the align of column headers as described above part of the bug was not fixed.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Observe JTable with XP look and feel and compare to Microsoft Schedule Tasks application table headers

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The drag 'handles' in the column headers should be at the right most position in a column and not adrift by 1 pixel. This exagerates the drag 'handle' being out of line because the white line of the handle is to the right hand side of the gray line of the 'handle'
      ACTUAL -
      The drag handle in XP look and feel is 1 pixel too far to the left in column headers

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Not applicable

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.GraphicsConfiguration;
      import java.awt.HeadlessException;
      import javax.swing.JFrame;
      import javax.swing.UIManager;
      import javax.swing.table.DefaultTableModel;

      public class Table extends JFrame
      {
      private javax.swing.JPanel jContentPane = null;
      private javax.swing.JScrollPane jScrollPane = null;
      private javax.swing.JTable jTable = null;

      public Table() throws HeadlessException
      {
      super();
      initialize();
      }

         public static void main(String[] args)
      {
            try {
               UIManager.setLookAndFeel(
                  "com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
            }
            catch(Exception e)
            {
            }
      Table aTable = new Table();

            aTable.addWindowListener(new java.awt.event.WindowAdapter()
      {
      public void windowClosing(java.awt.event.WindowEvent e)
      {
      System.exit(1);
      }
      });
            aTable.setVisible(true);
      }

         private void initialize()
         {
            this.setSize(300, 200);
            this.setContentPane(getJContentPane());
            setup();
         }
      private void setup()
      {
            Object[][] data = new Object[][] {
               {"0", "a", "Some data"},
               {"1", "b", "Some data"},
               {"2", "c", "Some data"}};
            Object[] columns = new Object[] {"Column 1", "Column 2", "Column 3"};
            DefaultTableModel model = new DefaultTableModel(data, columns);
            getJTable().setModel(model);
      }

      private javax.swing.JPanel getJContentPane()
      {
      if (jContentPane == null)
      {
      jContentPane = new javax.swing.JPanel();
      jContentPane.setLayout(new java.awt.BorderLayout());
      jContentPane.add(getJScrollPane(), java.awt.BorderLayout.CENTER);
      }
      return jContentPane;
      }

      private javax.swing.JTable getJTable() {
      if(jTable == null) {
      jTable = new javax.swing.JTable();
      }
      return jTable;
      }

      private javax.swing.JScrollPane getJScrollPane() {
      if(jScrollPane == null) {
      jScrollPane = new javax.swing.JScrollPane();
      jScrollPane.setViewportView(getJTable());
      }
      return jScrollPane;
      }
      }

      ---------- END SOURCE ----------
      (Incident Review ID: 243614)
      ======================================================================

            Unassigned Unassigned
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: