Java Code Examples for java.util.stream.IntStream#anyMatch()
The following examples show how to use
java.util.stream.IntStream#anyMatch() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LogTable.java From LoggerPlusPlus with GNU Affero General Public License v3.0 | 4 votes |
@Override public Component prepareRenderer(TableCellRenderer renderer, int row, int column) { LogEntry entry = null; Integer modelRow = null; try { modelRow = convertRowIndexToModel(row); entry = this.getModel().getRow(modelRow); } catch (NullPointerException ignored) { ignored.printStackTrace(); } Component c = super.prepareRenderer(renderer, row, column); IntStream selectedRows = IntStream.of(this.getSelectedRows()); if(selectedRows.anyMatch(i -> i == row)){ c.setBackground(this.getSelectionBackground()); c.setForeground(this.getSelectionForeground()); }else { if(entry == null){ System.err.println("Could not convert row index to model. Table entry might not be highlighted properly."); return c; } if(entry.getMatchingColorFilters().size() != 0){ ColorFilter colorFilter = null; Map<UUID, ColorFilter> colorFilters = this.preferences.getSetting(Globals.PREF_COLOR_FILTERS); for (UUID uid : entry.getMatchingColorFilters()) { if(colorFilter == null || colorFilter.getPriority() > colorFilters.get(uid).getPriority()){ colorFilter = colorFilters.get(uid); } } if (colorFilter == null) { c.setForeground(this.getForeground()); c.setBackground(this.getBackground()); } else { c.setForeground(colorFilter.getForegroundColor()); c.setBackground(colorFilter.getBackgroundColor()); } }else{ c.setForeground(this.getForeground()); c.setBackground(this.getBackground()); } } return c; }