Skip to content

Instantly share code, notes, and snippets.

@fpaaske
Last active December 15, 2015 02:19
Show Gist options
  • Save fpaaske/5186164 to your computer and use it in GitHub Desktop.
Save fpaaske/5186164 to your computer and use it in GitHub Desktop.
Insubstantial - setting cell selection on a jtable breaks "row mouseover animation"
package gui;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.table.DefaultTableModel;
import org.pushingpixels.substance.api.skin.SubstanceBusinessLookAndFeel;
public class SubstanceTest {
public SubstanceTest() {
JFrame frame = new JFrame("Test");
frame.setSize(640, 480);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Object[][] data = new Object[][]{{"1", "2", "3", "4", "5"}, {"6", "7", "8", "9", "0"}};
Object[] header = new Object[]{"A", "B", "C", "D", "E"};
DefaultTableModel model = new DefaultTableModel(data, header);
JTable table = new JTable(model);
// XXX toggle the line below and mouseover a row to see the issue
// table.setCellSelectionEnabled(false);
frame.add(new JScrollPane(table));
frame.setVisible(true);
}
public static void main(String[] args) throws UnsupportedLookAndFeelException {
UIManager.setLookAndFeel(new SubstanceBusinessLookAndFeel());
SwingUtilities.invokeLater(new Runnable() {
public void run() {
new SubstanceTest();
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment