Package javax.swing

Examples of javax.swing.JTable


    // table
    Vector rules = check.getRules();
    RegExpRuleTableModel tableModel
      = new RegExpRuleTableModel(check.getRules());
    JTable table = new JTable(tableModel);
    JScrollPane scrollPane = new JScrollPane(table);
    dialogPanel.add(scrollPane);


    /**
 
View Full Code Here


   
    String[] columnNames = {"Component", "Parameters", "Time", "Status"};
    m_tableModel = new DefaultTableModel(columnNames, 0);
   
    // JTable with error/warning indication for rows.
    m_table = new JTable() {
      public Class getColumnClass(int column) {
        return getValueAt(0, column).getClass();
      }

      public Component prepareRenderer(TableCellRenderer renderer,
View Full Code Here

    // There is no-where else to put this.
    // Add a mouse listener to the Table to trigger a table sort
    // when a column heading is clicked in the JTable.
    public void addMouseListenerToHeaderInTable(JTable table) {
        final TableSorter sorter = this;
        final JTable tableView = table;
        tableView.setColumnSelectionAllowed(false);
        MouseAdapter listMouseListener = new MouseAdapter() {
            public void mouseClicked(MouseEvent e) {
                TableColumnModel columnModel = tableView.getColumnModel();
                int viewColumn = columnModel.getColumnIndexAtX(e.getX());
                int column = tableView.convertColumnIndexToModel(viewColumn);
                if(e.getClickCount() == 1 && column != -1) {
                    int shiftPressed = e.getModifiers()&InputEvent.SHIFT_MASK;
                    boolean ascending = (shiftPressed == 0);
                    sorter.sortByColumn(column, ascending);
                }
                tableView.getTableHeader().repaint();
             }
         };
        JTableHeader th = tableView.getTableHeader();
        th.addMouseListener(listMouseListener);
        th.setDefaultRenderer(createDefaultRenderer());
    }
View Full Code Here

        super("TableSorterDemo");

        MyTableModel myModel = new MyTableModel();
        TableSorter sorter = new TableSorter(myModel); //ADDED THIS
        //JTable table = new JTable(myModel);          //OLD
        JTable table = new JTable(sorter);             //NEW
        sorter.addMouseListenerToHeaderInTable(table); //ADDED THIS
        table.setPreferredScrollableViewportSize(new Dimension(500, 70));

        //Create the scroll pane and add the table to it.
        JScrollPane scrollPane = new JScrollPane(table);

        //Add the scroll pane to this window.
View Full Code Here

      StatisticsTableModel model) {
    super(parent, true);
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    setTitle(Strings.get("statsDialogTitle", circuitName));
   
    JTable table = new StatisticsTable();
    TableSorter mySorter = new TableSorter(model, table.getTableHeader());
    Comparator<String> comp = new CompareString("",
        Strings.get("statsTotalWithout"), Strings.get("statsTotalWith"));
    mySorter.setColumnComparator(String.class, comp);
    table.setModel(mySorter);
    JScrollPane tablePane = new JScrollPane(table);
   
    JButton button = new JButton(Strings.get("statsCloseButton"));
    button.addActionListener(this);
    JPanel buttonPanel = new JPanel();
View Full Code Here

   
   
    mModel = new ReminderTableModel(reminderList, mTitleSelection = new JComboBox());

    mTable = new JTable();
    mTable.addKeyListener(new KeyAdapter() {
      public void keyPressed(KeyEvent e) {
        if (e.getKeyCode() == KeyEvent.VK_ESCAPE || e.getKeyCode() == KeyEvent.VK_ENTER) {
          mTable.getRootPane().dispatchEvent(e);
        }
View Full Code Here

      model.setValueAt(depInfo.getVersion(), i, 1);
      model.setValueAt(depInfo.getLicenseName(), i, 2);
      model.setValueAt(depInfo.getInfo(), i, 3);
    }

    this.table = new JTable(model);
    add(new JScrollPane(this.table));

  }
View Full Code Here

      final Map.Entry entry = entries[i];
      properties.setValueAt(entry.getKey(), i, 0);
      properties.setValueAt(entry.getValue(), i, 1);
    }

    final JTable table = new JTable(properties);
    final TableColumnModel model = table.getColumnModel();
    TableColumn column = model.getColumn(0);
    column.setPreferredWidth(200);
    column = model.getColumn(1);
    column.setPreferredWidth(350);

    table.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
    return table;

  }
View Full Code Here

    final ExitAction exitAction = new ExitAction();
    addWindowListener(exitAction);

    expressionsTableModel = new EditableMetaDataTableModel();
    expressionsTable = new JTable(expressionsTableModel);
    expressionsTable.setDefaultRenderer(String.class, new EditableMetaDataRenderer());

    final JPanel contentPane = new JPanel();
    contentPane.setLayout(new BorderLayout());
    contentPane.add(new JScrollPane(expressionsTable), BorderLayout.CENTER);
View Full Code Here

  {
    setTitle("Expression Property Metadata Editor");
    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

    expressionsTableModel = new EditableMetaDataTableModel();
    expressionsTable = new JTable(expressionsTableModel);
    expressionsTable.setDefaultRenderer(String.class, new EditableMetaDataRenderer());

    final JPanel contentPane = new JPanel();
    contentPane.setLayout(new BorderLayout());
    contentPane.add(new JScrollPane(expressionsTable), BorderLayout.CENTER);
View Full Code Here

TOP

Related Classes of javax.swing.JTable

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.