com.publicobject.misc.swing.LookAndFeelTweaks Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of glazedlists_java15 Show documentation
Show all versions of glazedlists_java15 Show documentation
Event-driven lists for dynamically filtered and sorted tables
/* Glazed Lists (c) 2003-2006 */
/* http://publicobject.com/glazedlists/ publicobject.com,*/
/* O'Dell Engineering Ltd.*/
package com.publicobject.misc.swing;
import ca.odell.glazedlists.impl.PLAFDetector;
import javax.swing.*;
import java.awt.*;
/**
* Tweak the appearance of a JTable for the current look and feel.
*
* @author Jesse Wilson
*/
public class LookAndFeelTweaks {
public static void tweakTable(JTable table) {
String lookAndFeelName = UIManager.getLookAndFeel().getName();
if(lookAndFeelName.equals("Windows")) {
String theme = PLAFDetector.getWindowsTheme();
// on Vista, there's no horizontal grid lines
if("Windows Vista".equals(theme)) {
table.setShowHorizontalLines(false);
table.setShowVerticalLines(true);
table.setGridColor(new Color(237, 237, 237));
table.setBackground(Color.WHITE);
}
}
}
}