Package javax.swing.table

Examples of javax.swing.table.JTableHeader


      final Object eventSource = event.getSource();
      if (eventSource instanceof JTableHeader == false)
      {
        return;
      }
      final JTableHeader tableHeader = (JTableHeader) eventSource;

      removeColumnAction.setEnabled(table.getColumnCount() > 1);
      removeRowAction.setEnabled(false);

      final TableCellEditor theTableCellEditor = table.getCellEditor();
View Full Code Here


    final Box          b;
    final ModificationButton  ggPlus, ggMinus;
    final JButton        ggAssistent;
    final JTable        table;
    final JPanel        p;
    final JTableHeader      th;
    final SortedTableModel    stm;
   
    audioBoxesFromPrefs();
   
    p      = new JPanel( new BorderLayout() );
   
    abtm    = new AudioBoxTableModel();
    stm      = new SortedTableModel( abtm );
    table    = new JTable( stm );
    th      = table.getTableHeader();
    stm.setTableHeader( th );
    th.setReorderingAllowed( false );
    th.setResizingAllowed( true );
//    table.setAutoResizeMode( JTable.AUTO_RESIZE_OFF );
    table.setCellSelectionEnabled( true );
    table.setColumnSelectionAllowed( false );
    table.setShowGrid( true );
    table.setGridColor( Color.lightGray );
View Full Code Here

           
            //Imprimimos los datos del modelo de la tabla
            Graphics graphicTabla = pagina.create(70, 220, 500, 530);
            ModeloPoblacionTabla modeloTabla = poblacion.getModeloPoblacionTabla();
            TablaPoblacion tablaPoblacion = new TablaPoblacion(modeloTabla);
            JTableHeader header = tablaPoblacion.getTableHeader();
           
            tablaPoblacion.setSize(1, 470);
            header.setSize(tablaPoblacion.getWidth(), 30);

            tablaPoblacion.setPreferredScrollableViewportSize(
                    tablaPoblacion.getPreferredSize());

           
           
            header.paint(graphicTabla);
            graphicTabla.translate(0, header.getHeight());
            tablaPoblacion.paint(graphicTabla);
        }
       
       
        //Terminamos la impresión
View Full Code Here

           
            //Imprimimos los datos del modelo de la tabla
            Graphics graphicTabla = pagina.create(70, 220, 500, 530);
            ModeloPoblacionTabla modeloTabla = poblacion.getModeloPoblacionTabla();
            TablaPoblacion tablaPoblacion = new TablaPoblacion(modeloTabla);
            JTableHeader header = tablaPoblacion.getTableHeader();
           
            tablaPoblacion.setSize(1, 470);
            header.setSize(tablaPoblacion.getWidth(), 30);

            tablaPoblacion.setPreferredScrollableViewportSize(
                    tablaPoblacion.getPreferredSize());

           
           
            header.paint(graphicTabla);
            graphicTabla.translate(0, header.getHeight());
            tablaPoblacion.paint(graphicTabla);
        }
       
       
        //Terminamos la impresión
View Full Code Here

    }
  
   @Override
    protected JTableHeader createDefaultTableHeader()
   {
      return new JTableHeader(super.columnModel)
      {
        @Override
        public String getToolTipText(MouseEvent evtMouse)
        {
            java.awt.Point pnt = evtMouse.getPoint();
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  = h.columnAtPoint(e.getPoint());
            int column = columnModel.getColumn(viewColumn).getModelIndex();

            if (column != -1) {
                int status = getSortingStatus(column);
View Full Code Here

    class MyHeaderMouseAdapter extends MouseAdapter {
        public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() == 1) {

                Point point = e.getPoint();
                JTableHeader tableHeader = table.getTableHeader();
                int columnCount = table.getColumnCount();

                for (int i = 0; i < columnCount; ++i) {
                    Rectangle headerRect = tableHeader.getHeaderRect(i);

                    if (headerRect.contains(point)) {
                        String columnName = table.getColumnName(i);
                        TableColumn column = table.getColumn(columnName);
View Full Code Here

   *
   * @param table
   */
  public static void calcColumnWidths(JTable table)
  {
      JTableHeader header = table.getTableHeader();

      TableCellRenderer defaultHeaderRenderer = null;

      if (header != null)
          defaultHeaderRenderer = header.getDefaultRenderer();

      TableColumnModel columns = table.getColumnModel();
      TableModel data = table.getModel();

      int margin = columns.getColumnMargin(); // only JDK1.3
View Full Code Here

      // if (header != null)
      //     header.repaint(); only makes sense when the header is visible (only <1.3)
  }
 
  public static void setFixedWidths(JTable table) {
      JTableHeader header = table.getTableHeader();

      TableCellRenderer defaultHeaderRenderer = null;

      if (header != null)
          defaultHeaderRenderer = header.getDefaultRenderer();

      TableColumnModel columns = table.getColumnModel();
      TableModel data = table.getModel();

      int rowCount = data.getRowCount();
View Full Code Here

  /**
   * Erzeugt einen Panel mit View und Header eines JTables.
   *
   */
  public static JComponent makeTable(JTable table, JComponent cont) {
    JTableHeader header = table.getTableHeader();
   
    cont.setLayout(new BorderLayout());
    cont.add(header, BorderLayout.NORTH);
    cont.add(table, BorderLayout.CENTER);
   
View Full Code Here

TOP

Related Classes of javax.swing.table.JTableHeader

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.