コード例 #1
0
  public void installUI(JComponent c) {
    super.installUI(c);

    if (XPStyle.getXP() != null) {
      originalHeaderRenderer = header.getDefaultRenderer();
      if (originalHeaderRenderer instanceof UIResource) {
        header.setDefaultRenderer(new XPDefaultRenderer());
      }
    }
  }
コード例 #2
0
    public Component getTableCellRendererComponent(
        JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
      if (table != null) {
        JTableHeader header = table.getTableHeader();
        if (header != null) {
          setFont(header.getFont());
        }
      }
      this.isSelected = isSelected;
      this.hasFocus = hasFocus;
      this.column = column;
      this.hasRollover = (column == rolloverColumn);
      if (skin == null || skin.getContentMargin() == null) {
        skin = XPStyle.getXP().getSkin(header, "header.headeritem");
      }
      setText((value == null) ? "" : value.toString());
      setBorder(new EmptyBorder(skin.getContentMargin()));

      return this;
    }
コード例 #3
0
  protected MouseInputListener createMouseInputListener() {
    if (XPStyle.getXP() != null) {
      return new MouseInputHandler() {
        public void mouseMoved(MouseEvent e) {
          super.mouseMoved(e);
          updateRolloverColumn(e);
        }

        public void mouseEntered(MouseEvent e) {
          super.mouseEntered(e);
          updateRolloverColumn(e);
        }

        public void mouseExited(MouseEvent e) {
          super.mouseExited(e);
          rolloverColumn = -1;
          header.repaint();
        }

        public void mousePressed(MouseEvent e) {
          super.mousePressed(e);
          if (header.getReorderingAllowed()) {
            rolloverColumn = -1;
            header.repaint();
          }
        }

        public void mouseDragged(MouseEvent e) {
          super.mouseDragged(e);
          updateRolloverColumn(e);
        }

        public void mouseReleased(MouseEvent e) {
          super.mouseReleased(e);
          updateRolloverColumn(e);
        }
      };
    } else {
      return super.createMouseInputListener();
    }
  }