// Overridden for performance reasons. ----> @Override public boolean isOpaque() { Color back = getBackground(); Component p = getParent(); if (Objects.nonNull(p)) { p = p.getParent(); } // p should now be the JTable. boolean colorMatch = Objects.nonNull(back) && Objects.nonNull(p) && back.equals(p.getBackground()) && p.isOpaque(); return !colorMatch && super.isOpaque(); }
@Override protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) { // String literal pool // if (propertyName == "document" || ((propertyName == "font" || propertyName == "foreground") // && oldValue != newValue)) { if ("document".equals(propertyName) || !Objects.equals(oldValue, newValue) && ("font".equals(propertyName) || "foreground".equals(propertyName))) { super.firePropertyChange(propertyName, oldValue, newValue); } }
@Override public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { if (isSelected) { setForeground(table.getSelectionForeground()); setBackground(table.getSelectionBackground()); } else { setForeground(table.getForeground()); setBackground(table.getBackground()); } setFont(table.getFont()); setText(Objects.toString(value, "")); return this; }
protected void fireEditingCanceled() { // Guaranteed to return a non-null array Object[] listeners = listenerList.getListenerList(); // Process the listeners last to first, notifying // those that are interested in this event for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == CellEditorListener.class) { // Lazily create the event: if (Objects.isNull(changeEvent)) { changeEvent = new ChangeEvent(this); } ((CellEditorListener) listeners[i + 1]).editingCanceled(changeEvent); } } }
@Override public Component getTableCellEditorComponent( JTable table, Object value, boolean isSelected, int row, int column) { System.out.println("getTableCellEditorComponent"); setFont(table.getFont()); setText(Objects.toString(value, "")); EventQueue.invokeLater( new Runnable() { @Override public void run() { setCaretPosition(getText().length()); requestFocusInWindow(); System.out.println("invokeLater: getTableCellEditorComponent"); } }); return scroll; }