Documentation of 'smile.swing.table.ButtonCellRenderer' Java class
ButtonCellRenderer
smile.swing.table

Class ButtonCellRenderer

  • All Implemented Interfaces:
    java.awt.event.ActionListener, java.awt.event.MouseListener, java.io.Serializable, java.util.EventListener, javax.swing.CellEditor, javax.swing.table.TableCellEditor, javax.swing.table.TableCellRenderer


    public class ButtonCellRenderer
    extends javax.swing.AbstractCellEditor
    implements javax.swing.table.TableCellRenderer, javax.swing.table.TableCellEditor, java.awt.event.ActionListener, java.awt.event.MouseListener
    The ButtonCellRenderer class provides a renderer and an editor that looks like a JButton. The renderer and editor will then be used for a specified column in the table. The TableModel will contain the String to be displayed on the button. The button can be invoked by a mouse click or by pressing the space bar when the cell has focus. Optionally a mnemonic can be set to invoke the button. When the button is invoked the provided Action is invoked. The source of the Action will be the table. The action command will contain the model row number of the button that was clicked.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor and Description
      ButtonCellRenderer(javax.swing.JTable table, javax.swing.Action action, int column)
      Create the ButtonCellRenderer to be used as a renderer and editor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void actionPerformed(java.awt.event.ActionEvent e) 
      java.lang.Object getCellEditorValue() 
      javax.swing.border.Border getFocusBorder()
      Get foreground color of the button when the cell has focus
      int getMnemonic() 
      java.awt.Component getTableCellEditorComponent(javax.swing.JTable table, java.lang.Object value, boolean isSelected, int row, int column) 
      java.awt.Component getTableCellRendererComponent(javax.swing.JTable table, java.lang.Object value, boolean isSelected, boolean hasFocus, int row, int column) 
      void mouseClicked(java.awt.event.MouseEvent e) 
      void mouseEntered(java.awt.event.MouseEvent e) 
      void mouseExited(java.awt.event.MouseEvent e) 
      void mousePressed(java.awt.event.MouseEvent e) 
      void mouseReleased(java.awt.event.MouseEvent e) 
      void setFocusBorder(javax.swing.border.Border focusBorder)
      The foreground color of the button when the cell has focus
      void setMnemonic(int mnemonic)
      The mnemonic to activate the button when the cell has focus
      • Methods inherited from class javax.swing.AbstractCellEditor

        addCellEditorListener, cancelCellEditing, getCellEditorListeners, isCellEditable, removeCellEditorListener, shouldSelectCell, stopCellEditing
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface javax.swing.CellEditor

        addCellEditorListener, cancelCellEditing, isCellEditable, removeCellEditorListener, shouldSelectCell, stopCellEditing
    • Constructor Detail

      • ButtonCellRenderer

        public ButtonCellRenderer(javax.swing.JTable table,
                                  javax.swing.Action action,
                                  int column)
        Create the ButtonCellRenderer to be used as a renderer and editor. The renderer and editor will automatically be installed on the TableColumn of the specified column.
        Parameters:
        table - the table containing the button renderer/editor
        action - the Action to be invoked when the button is invoked
        column - the column to which the button renderer/editor is added
    • Method Detail

      • getFocusBorder

        public javax.swing.border.Border getFocusBorder()
        Get foreground color of the button when the cell has focus
        Returns:
        the foreground color
      • setFocusBorder

        public void setFocusBorder(javax.swing.border.Border focusBorder)
        The foreground color of the button when the cell has focus
        Parameters:
        focusBorder - the foreground color
      • getMnemonic

        public int getMnemonic()
      • setMnemonic

        public void setMnemonic(int mnemonic)
        The mnemonic to activate the button when the cell has focus
        Parameters:
        mnemonic - the mnemonic
      • getTableCellEditorComponent

        public java.awt.Component getTableCellEditorComponent(javax.swing.JTable table,
                                                              java.lang.Object value,
                                                              boolean isSelected,
                                                              int row,
                                                              int column)
        Specified by:
        getTableCellEditorComponent in interface javax.swing.table.TableCellEditor
      • getCellEditorValue

        public java.lang.Object getCellEditorValue()
        Specified by:
        getCellEditorValue in interface javax.swing.CellEditor
      • getTableCellRendererComponent

        public java.awt.Component getTableCellRendererComponent(javax.swing.JTable table,
                                                                java.lang.Object value,
                                                                boolean isSelected,
                                                                boolean hasFocus,
                                                                int row,
                                                                int column)
        Specified by:
        getTableCellRendererComponent in interface javax.swing.table.TableCellRenderer
      • actionPerformed

        public void actionPerformed(java.awt.event.ActionEvent e)
        Specified by:
        actionPerformed in interface java.awt.event.ActionListener
      • mousePressed

        public void mousePressed(java.awt.event.MouseEvent e)
        Specified by:
        mousePressed in interface java.awt.event.MouseListener
      • mouseReleased

        public void mouseReleased(java.awt.event.MouseEvent e)
        Specified by:
        mouseReleased in interface java.awt.event.MouseListener
      • mouseClicked

        public void mouseClicked(java.awt.event.MouseEvent e)
        Specified by:
        mouseClicked in interface java.awt.event.MouseListener
      • mouseEntered

        public void mouseEntered(java.awt.event.MouseEvent e)
        Specified by:
        mouseEntered in interface java.awt.event.MouseListener
      • mouseExited

        public void mouseExited(java.awt.event.MouseEvent e)
        Specified by:
        mouseExited in interface java.awt.event.MouseListener

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.