Package javax.swing.table

Examples of javax.swing.table.JTableHeader$AccessibleJTableHeader


                    sorter.sortByColumn(column, ascending);
                }
                tableView.getTableHeader().repaint();
             }
         };
        JTableHeader th = tableView.getTableHeader();
        th.addMouseListener(listMouseListener);
        th.setDefaultRenderer(createDefaultRenderer());
    }
View Full Code Here


                new DefaultTableCellRenderer() {
            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) {
                        setForeground(header.getForeground());
                        setBackground(header.getBackground());
                        setFont(header.getFont());
                        if (column == sortingColumn) {
                            if (ascending) {
                                setIcon(new ImageIcon(getClass().getResource(
                                    "/resources/arrowDown.gif")));
                            } else {
View Full Code Here

    }
  }

  private class MouseHandler extends MouseAdapter {
    public void mouseClicked(MouseEvent e) {
      JTableHeader h = (JTableHeader) e.getSource();
      TableColumnModel columnModel = h.getColumnModel();
      int viewColumn = columnModel.getColumnIndexAtX(e.getX());
      int column = columnModel.getColumn(viewColumn).getModelIndex();
      if (column != -1) {
        int status = getSortingStatus(column);
        if (!e.isControlDown()) {
View Full Code Here

            sortedRenderer.setIconType(SortedTableHeaderRenderer.DESCENDING);
          columnModel.getColumn(column).setHeaderRenderer(sortedRenderer);
        }
      }
    };
    JTableHeader th = tableView.getTableHeader();
    th.addMouseListener(listMouseListener);
  }
View Full Code Here

     * Wake up on a right click on table header.
     */
    private class MouseHandler extends MouseAdapter {
        public void mouseClicked(MouseEvent e) {
            if (e.getButton() == MouseEvent.BUTTON3) {
                JTableHeader h = (JTableHeader) e.getSource();
                TableColumnModel columnModel = h.getColumnModel();
                int viewColumn = columnModel.getColumnIndexAtX(e.getX());
                int column = columnModel.getColumn(viewColumn).getModelIndex();
                if (column != -1) {
                    //We know we have clicked on a column.
                    //Show up a dialog to enter the new filter.
View Full Code Here

    new TimerMultiPlayerControl(trackList));
  multiPlayer.addMultiPlayerListener(this);

  trackTable = new TrackTable(trackModel);

  JTableHeader header = trackTable.getTableHeader();

  TrackPanel trackPanel = new TrackPanel(trackModel);

  JPanel tablePanel = new JPanel();
  tablePanel.setLayout(new BorderLayout());
View Full Code Here

  setCellSelectionEnabled(true);
  setRowSelectionAllowed(false);
  setColumnSelectionAllowed(false);
  setSelectionMode(0);
        TableColumnModel tcm = getColumnModel();
  JTableHeader header = new JTableHeader(tcm);
   header.setReorderingAllowed(false)

  setTableHeader(header);
  header.setResizingAllowed(true);

  tcm.setColumnMargin(5);
  DefaultTableCellRenderer renderer = new DefaultTableCellRenderer() {
      public void setValue(Object o) {
    setText((o == null) ? "" : o.toString());
View Full Code Here

    tableScrollPaneLeft.setBorder(BorderFactory.createTitledBorder("REAL ASPECT MANAGER"));
    tableScrollPaneRight.setBorder(BorderFactory.createTitledBorder("TEST ASPECT MANAGER"));
    leftTable.setIntercellSpacing(new java.awt.Dimension(2, 2));
    leftTable.setColumnSelectionAllowed(true);
    leftTable.setTableHeader(new JTableHeader(leftTable.getColumnModel()));
    leftTable.getTableHeader().setBackground(NOT_SEL_COLOR);
    leftTable.getTableHeader().addMouseListener(new java.awt.event.MouseAdapter() {
      public void mousePressed(java.awt.event.MouseEvent evt) {
        onMousePressed(evt);
      }
    });

    leftTable.setPreferredSize(new Dimension(this.getWidth(), ((WorksheetSingleClientModel)leftTable.getModel()).getRowCount()
        * leftTable.getRowHeight()));
    leftTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_ALL_COLUMNS);
    leftTable.setMaximumSize(new java.awt.Dimension(32767, 32767));
    leftTable.setName("leftTable");
    leftTable.setAutoCreateColumnsFromModel(false);
    leftTable.setMinimumSize(new java.awt.Dimension(450, 100));
    leftTable.setPreferredSize(new java.awt.Dimension(450, 400));
    customizeTable(leftTable);
    leftTable.addMouseListener(new java.awt.event.MouseAdapter() {
      public void mouseClicked(java.awt.event.MouseEvent evt) {
        tableMouseClicked(evt);
        tableMouseRightClicked(evt);
      }
    });

    tableScrollPaneLeft.setViewportView(leftTable);

    setLeftComponent(tableScrollPaneLeft);

    tableScrollPaneRight.setVerticalScrollBarPolicy(javax.swing.JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    tableScrollPaneRight.setPreferredSize(new java.awt.Dimension(400, 450));
    tableScrollPaneRight.setName("scrollPane");
    tableScrollPaneRight.setMinimumSize(new java.awt.Dimension(0, 0));
    rightTable.setModel(myModel.createTableModel(proseName,host,port,false));
    rightTable.setIntercellSpacing(new java.awt.Dimension(2, 2));
    rightTable.setColumnSelectionAllowed(true);
    rightTable.setTableHeader(new JTableHeader(rightTable.getColumnModel()));
    rightTable.getTableHeader().setBackground(NOT_SEL_COLOR);
    rightTable.getTableHeader().addMouseListener(new java.awt.event.MouseAdapter() {
      public void mousePressed(java.awt.event.MouseEvent evt) {
        onMousePressed(evt);
      }
View Full Code Here

      }
    }
   
    @Override
    protected JTableHeader createDefaultTableHeader() {
      return new JTableHeader(columnModel) {
        public String getToolTipText(final MouseEvent e) {
          final java.awt.Point p = e.getPoint();
          final int index = columnModel.getColumnIndexAtX(p.x);
          final int realIndex = columnModel.getColumn(index).getModelIndex();
          return columnTooltips[realIndex];
View Full Code Here

                    boolean ascending = (shiftPressed == 0);
                    sorter.sortByColumn(column, ascending);
                }
            }
        };
        JTableHeader th = tableView.getTableHeader();
        th.addMouseListener(listMouseListener);
    }
View Full Code Here

TOP

Related Classes of javax.swing.table.JTableHeader$AccessibleJTableHeader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.