JTable table = new JTable(); Color selectionBg = table.getSelectionBackground();
JTable table = new JTable(); table.setSelectionBackground(Color.YELLOW);This example sets the selection background color of the table to yellow using the setSelectionBackground method. You can also use the getSelectionBackground method to retrieve the current selection background color. This method is part of the javax.swing package library, which provides a set of components for creating user interfaces in Java.