src/share/classes/com/sun/java/swing/plaf/windows/WindowsTableHeaderUI.java

Print this page




  74     @SuppressWarnings("serial") // JDK-implementation class
  75     private class XPDefaultRenderer extends DefaultTableCellHeaderRenderer {
  76         Skin skin;
  77         boolean isSelected, hasFocus, hasRollover;
  78         int column;
  79 
  80         XPDefaultRenderer() {
  81             setHorizontalAlignment(LEADING);
  82         }
  83 
  84         public Component getTableCellRendererComponent(JTable table, Object value,
  85                                                        boolean isSelected, boolean hasFocus,
  86                                                        int row, int column) {
  87             super.getTableCellRendererComponent(table, value, isSelected,
  88                                                 hasFocus, row, column);
  89             this.isSelected = isSelected;
  90             this.hasFocus = hasFocus;
  91             this.column = column;
  92             this.hasRollover = (column == getRolloverColumn());
  93             if (skin == null) {
  94                 skin = XPStyle.getXP().getSkin(header, Part.HP_HEADERITEM);

  95             }
  96             Insets margins = skin.getContentMargin();
  97             Border border = null;
  98             int contentTop = 0;
  99             int contentLeft = 0;
 100             int contentBottom = 0;
 101             int contentRight = 0;
 102             if (margins != null) {
 103                 contentTop = margins.top;
 104                 contentLeft = margins.left;
 105                 contentBottom = margins.bottom;
 106                 contentRight = margins.right;
 107             }
 108             /* idk:
 109              * Both on Vista and XP there is some offset to the
 110              * HP_HEADERITEM content. It does not seem to come from
 111              * Prop.CONTENTMARGINS. Do not know where it is defined.
 112              * using some hardcoded values.
 113              */
 114             contentLeft += 5;
 115             contentBottom += 4;
 116             contentRight += 5;




  74     @SuppressWarnings("serial") // JDK-implementation class
  75     private class XPDefaultRenderer extends DefaultTableCellHeaderRenderer {
  76         Skin skin;
  77         boolean isSelected, hasFocus, hasRollover;
  78         int column;
  79 
  80         XPDefaultRenderer() {
  81             setHorizontalAlignment(LEADING);
  82         }
  83 
  84         public Component getTableCellRendererComponent(JTable table, Object value,
  85                                                        boolean isSelected, boolean hasFocus,
  86                                                        int row, int column) {
  87             super.getTableCellRendererComponent(table, value, isSelected,
  88                                                 hasFocus, row, column);
  89             this.isSelected = isSelected;
  90             this.hasFocus = hasFocus;
  91             this.column = column;
  92             this.hasRollover = (column == getRolloverColumn());
  93             if (skin == null) {
  94                 XPStyle xp = XPStyle.getXP();
  95                 skin = (xp != null) ? xp.getSkin(header, Part.HP_HEADERITEM) : null;
  96             }
  97             Insets margins = (skin != null) ? skin.getContentMargin() : null;
  98             Border border = null;
  99             int contentTop = 0;
 100             int contentLeft = 0;
 101             int contentBottom = 0;
 102             int contentRight = 0;
 103             if (margins != null) {
 104                 contentTop = margins.top;
 105                 contentLeft = margins.left;
 106                 contentBottom = margins.bottom;
 107                 contentRight = margins.right;
 108             }
 109             /* idk:
 110              * Both on Vista and XP there is some offset to the
 111              * HP_HEADERITEM content. It does not seem to come from
 112              * Prop.CONTENTMARGINS. Do not know where it is defined.
 113              * using some hardcoded values.
 114              */
 115             contentLeft += 5;
 116             contentBottom += 4;
 117             contentRight += 5;