Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/com/jvisualscripting/editor/NodeListPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ public void changedUpdate(DocumentEvent e) {
}
});
final Color bgColor = new Color(248, 248, 248);
JTable table = new JTable(dm) {
final Color fgColor = new Color(0, 0, 0);
JTable table = new JTable(dm) {

@Override
public Component prepareRenderer(TableCellRenderer renderer, int row, int column) {
Expand All @@ -139,6 +140,7 @@ public Component prepareRenderer(TableCellRenderer renderer, int row, int column
if (!comp.getBackground().equals(getSelectionBackground())) {
comp.setBackground(row % 2 == 0 ? bgColor : Color.WHITE);
}
comp.setForeground(fgColor);
return comp;
}

Comment on lines 140 to 146
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consistency and Maintainability Issue

The method prepareRenderer uses Color.WHITE directly for setting the background of table rows. For consistency and easier maintainability, consider defining all colors used in this method as variables at the beginning of your class or method, similar to how bgColor and fgColor are defined. This approach makes it easier to manage and change colors from a single location in the future.

Suggested Change:

final Color evenRowColor = Color.WHITE; // Define at the start with other colors
comp.setBackground(row % 2 == 0 ? bgColor : evenRowColor);

Expand Down