Class MolRenderer

    • Constructor Detail

      • MolRenderer

        public MolRenderer()
    • Method Detail

      • getTableCellRendererComponent

        public Component getTableCellRendererComponent​(JTable table,
                                                       Object value,
                                                       boolean isSelected,
                                                       boolean hasFocus,
                                                       int row,
                                                       int column)
        The implementation of this method sets up the rendering component to display the passed-in molecule, and then returns the component.
        Specified by:
        getTableCellRendererComponent in interface TableCellRenderer
        Parameters:
        table - the JTable that is asking the renderer to draw; can be null
        value - the value of the cell to be rendered; it is considered to be a Molecule instance
        isSelected - true if the cell is to be rendered with the selection highlighted; otherwise false
        hasFocus - if true, a special border is put on the cell, if the cell can be edited, it is rendered in the color used to indicate editing
        row - the row index of the cell being drawn. When drawing the header, the value of row is -1
        column - the column index of the cell being drawn
        Returns:
        MolRenderer component that is configured to draw the molecule.
      • setBackgroundColor

        protected void setBackgroundColor​(JTable table,
                                          boolean isSelected,
                                          boolean hasFocus,
                                          int row,
                                          int column)
        Sets the background color for the current cell based on selection. The default implementation sets the same color for the renderer as the colors of the table itself. The method is called by getTableCellRendererComponent(javax.swing.JTable, Object, boolean, boolean, int, int) , overwrite to change the default behavior.
        Parameters:
        table - the JTable that is asking the renderer to draw; can be null
        isSelected - true if the cell is to be rendered with the selection highlighted; otherwise false
        hasFocus - indicates if the cell is focused
        row - the row index of the cell being drawn. When drawing the header, the value of row is -1
        column - the column index of the cell being drawn
      • setBorder

        protected void setBorder​(JTable table,
                                 boolean isSelected,
                                 boolean hasFocus,
                                 int row,
                                 int column)
        Sets the border for the current cell based on selection. The default implementation sets the default border of the table on the renderer. The method is called by getTableCellRendererComponent(javax.swing.JTable, Object, boolean, boolean, int, int) , overwrite to change the default behavior.
        Parameters:
        table - the JTable that is asking the renderer to draw; can be null
        isSelected - true if the cell is to be rendered with the selection highlighted; otherwise false
        hasFocus - if true, a special border is put on the cell, if the cell can be edited, it is rendered in the color used to indicate editing
        row - the row index of the cell being drawn. When drawing the header, the value of row is -1
        column - the column index of the cell being drawn