Package javax.swing

Examples of javax.swing.JTable$ThreadSafePrintable


  {
    data = new SwingIconsDemoTableModel();

    setLayout(new BorderLayout());
    setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
    final JTable table = new JTable(data);
    table.setDefaultRenderer(Image.class, new ImageCellRenderer());
    table.setRowHeight(26);
    final JScrollPane scrollPane = new JScrollPane(table);
    add(scrollPane, BorderLayout.CENTER);

    final JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new FlowLayout(FlowLayout.TRAILING));
View Full Code Here


     * @param layer The layer whose data is to be displayed
     */
    public void showTable(final EsriLayer layer) {
        JFrame frame = new JFrame("Table");
        DbfTableModel model = layer.getModel();
        JTable table = new JTable(model);
        JScrollPane pane = new JScrollPane(table);
        frame.getContentPane().add(pane, BorderLayout.CENTER);

        ListSelectionModel lsm = table.getSelectionModel();
        lsm.addListSelectionListener(new ListSelectionListener() {
            public void valueChanged(ListSelectionEvent e) {
                //Ignore extra messages.
                if (e.getValueIsAdjusting()) {
                    return;
View Full Code Here

     */
    public JTable getTable() {

        if (table == null) {
            lsm = new DefaultListSelectionModel();
            table = new JTable();
            table.setModel(getModel());
            table.setSelectionModel(lsm);
            table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);

            lsm.addListSelectionListener(new ListSelectionListener() {
View Full Code Here

        }

      }
     
    };
    JTable table = new JTable(model);
    table.setPreferredScrollableViewportSize(new Dimension(400,200));
   
    JScrollPane scrollPane = new JScrollPane(table);
   
    scrollPane.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
   
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.getTableHeader().setDefaultRenderer(unSortedRenderer);
   
    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) {
          if (singleSortingColumn == column)
            ascending = !ascending;
          else
            ascending = true;
          sorter.sortByColumn(column);
          singleSortingColumn = column;
         
          // setting renderer
          for (int i = 0; i < columnModel.getColumnCount(); i++)
            columnModel.getColumn(i).setHeaderRenderer(unSortedRenderer);
          if (ascending)
            sortedRenderer.setIconType(SortedTableHeaderRenderer.ASCENDING);
          else
            sortedRenderer.setIconType(SortedTableHeaderRenderer.DESCENDING);
          columnModel.getColumn(column).setHeaderRenderer(sortedRenderer);
        }
      }
    };
    JTableHeader th = tableView.getTableHeader();
    th.addMouseListener(listMouseListener);
  }
View Full Code Here

  }


  protected JComponent createDefaultTable(final TableModel data)
  {
    final JTable table = new JTable(data);
    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);

    for (int columnIndex = 0; columnIndex < data.getColumnCount(); columnIndex++)
    {
      final TableColumn column = table.getColumnModel().getColumn(columnIndex);
      column.setMinWidth(50);
      final Class c = data.getColumnClass(columnIndex);
      if (c.equals(Number.class))
      {
        column.setCellRenderer(new NumberCellRenderer());
View Full Code Here

    ExceptionDialog.showExceptionDialog(parent, title, message, e);
  }

  protected JComponent createDefaultTable(final TableModel data)
  {
    final JTable table = new JTable(data);
    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);

    for (int columnIndex = 0; columnIndex < data
        .getColumnCount(); columnIndex++)
    {
      final TableColumn column = table.getColumnModel().getColumn(columnIndex);
      column.setMinWidth(50);
      final Class c = data.getColumnClass(columnIndex);
      if (c.equals(Number.class))
      {
        column.setCellRenderer(new NumberCellRenderer());
View Full Code Here

    /**
     * Needs to be called before displaying the DbfTableModel.
     */
    public JTable getTable(ListSelectionModel lsm) {
        JTable t = getTable();
        t.setModel(this);
        t.setSelectionModel(lsm);
        t.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
        return t;
    }
View Full Code Here

     * @param layer The layer whose data is to be displayed
     */
    public void showTable(final EsriLayer layer) {
        JFrame frame = new JFrame("Table");
        DbfTableModel model = layer.getModel();
        JTable table = new JTable(model);
        JScrollPane pane = new JScrollPane(table);
        frame.getContentPane().add(pane, BorderLayout.CENTER);

        ListSelectionModel lsm = table.getSelectionModel();
        lsm.addListSelectionListener(new ListSelectionListener() {
            public void valueChanged(ListSelectionEvent e) {
                //Ignore extra messages.
                if (e.getValueIsAdjusting()) {
                    return;
View Full Code Here

        public String getColumnName(int columnIndex) {return resources.getString("AvailableFilters");}
        public int getColumnCount() { return 1; }
        public int getRowCount() { return (filterList==null) ? 0 : filterList.size();}
        public Object getValueAt(int row, int col) { return ((FileFilter)filterList.get(row)).getDescription(); }
      };
      JTable table = new JTable(dataModel);

      table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
      ListSelectionModel rowSM = table.getSelectionModel();
      rowSM.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
          //Ignore extra messages.
          if (e.getValueIsAdjusting()) return;
       
View Full Code Here

TOP

Related Classes of javax.swing.JTable$ThreadSafePrintable

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.