Package javax.swing

Examples of javax.swing.JTable$DoubleRenderer


    // 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);
                }
            }
        };
        JTableHeader th = tableView.getTableHeader();
        th.addMouseListener(listMouseListener);
    }
View Full Code Here


    }

    public void valueChanged(Bundle[] bl) {
      filterLogModel.setBundles(bl);

      JTable table = logPanel.getJLogTable();

      if(table.getRowCount() > 0) {
        table.setRowSelectionInterval(0, 0);
      }
    }
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) {
                    //System.out.println("Sorting ...");
                    int shiftPressed = e.getModifiers()&InputEvent.SHIFT_MASK;
                    boolean ascending = (shiftPressed == 0);
                    sorter.sortByColumn(column, ascending);
                }
            }
        };
        JTableHeader th = tableView.getTableHeader();
        th.addMouseListener(listMouseListener);
    }
View Full Code Here

        tableContainer.setBorder( BorderFactory.createTitledBorder( "Table" ) );
        topHalf.add( tableContainer );

        //Container that displays table showing items in cart
        tableModel = new TableModel( );
        JTable table = new JTable( tableModel );
        //handler removes item to shopping cart
        table.addMouseListener( new TableSelectionHandler( ) );
        ListSelectionModel tableSelectionModel = table.getSelectionModel( );
        tableSelectionModel
                           .setSelectionMode( ListSelectionModel.SINGLE_SELECTION );
        TableColumnModel tableColumnModel = table.getColumnModel( );
        //notice we have a custom renderer for each column as both columns
        // point to the same underlying object
        tableColumnModel.getColumn( 0 ).setCellRenderer( new NameRenderer( ) );
        tableColumnModel.getColumn( 1 ).setCellRenderer( new PriceRenderer( ) );
        tableColumnModel.getColumn( 1 ).setMaxWidth( 50 );
View Full Code Here

     */
    private class TableSelectionHandler extends MouseAdapter
    {
        public void mouseReleased(MouseEvent e)
        {
            JTable jtable = ( JTable ) e.getSource( );
            TableModel tableModel = ( TableModel ) jtable.getModel( );
            tableModel.removeItem( jtable.getSelectedRow( ) );
        }
View Full Code Here

        m_treeScrollPane = new JScrollPane();
        m_imgScrollPane = new JScrollPane();
        m_imgScrollPane.setBorder(null);
        m_listScrollPane = new JScrollPane();

        m_table = new JTable()
        {
            @Override
            public String getToolTipText(MouseEvent ev)
            {
                int row = rowAtPoint(ev.getPoint());
View Full Code Here

    headerNames.add(Pooka.getProperty("NewMessage.customHeaders.header", "Header"));
    headerNames.add(Pooka.getProperty("NewMessage.customHeaders.value", "Value"));

    CustomHeaderTableModel dtm = new CustomHeaderTableModel(headerNames, 4);

    customHeaderTable = new JTable(dtm);

    // get the preconfigured properties

    Properties headers = new Properties();
View Full Code Here

        edgeTable.setShowEdgesNodesLabels(showEdgesNodesLabels);
        refreshCurrentTable();
    }

    public void exportCurrentTable(ExportMode exportMode) {
        JTable table;
        if (classDisplayed == classDisplayed.NODE) {
            table = nodeTable.getOutlineTable();
        } else {
            table = edgeTable.getTable();
        }
View Full Code Here

//END_TEXT_AREA
//TABLE_PLUGS       
        final JScrollPane installedPluginsScrollPanel = new JScrollPane();
        installedPluginsScrollPanel.setPreferredSize(new Dimension(300,100));

        tablePlugins = new JTable();
        PluginsTableModel tablePluginsModel = new PluginsTableModel(plugins);
        String[] i18nColumnsName = {GettextResource.gettext(Configuration.getInstance().getI18nResourceBundle(),"Name"),GettextResource.gettext(Configuration.getInstance().getI18nResourceBundle(),"Version"),GettextResource.gettext(Configuration.getInstance().getI18nResourceBundle(),"Author")};
        tablePluginsModel.setColumnNames(i18nColumnsName);
        tablePlugins.setModel(tablePluginsModel);
        tablePlugins.setGridColor(Color.LIGHT_GRAY);
View Full Code Here

  private String m_text;
  private int m_row = -1;
 
  public JTableColorTextData()
  {
    JTable table = new JTable();
    m_textColor = table.getForeground();
    m_backColor = table.getBackground();
   
    /*
    DefaultTableCellRenderer cr = new DefaultTableCellRenderer();
    m_textColor = cr.getForeground();
    m_backColor = cr.getBackground();
View Full Code Here

TOP

Related Classes of javax.swing.JTable$DoubleRenderer

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.