Skip to content

Instantly share code, notes, and snippets.

@exoad
Created June 6, 2023 22:36
Show Gist options
  • Save exoad/201ae46f612c7e5f00f49c9a38ea9bb7 to your computer and use it in GitHub Desktop.
Save exoad/201ae46f612c7e5f00f49c9a38ea9bb7 to your computer and use it in GitHub Desktop.
Swing Component Property List
import java.util.Arrays;
import java.util.Enumeration;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.WindowConstants;
public class test_ListSwingtags
{
public static void main(String[] args)
{
System.setProperty("sun.java2d.opengl", "true");
UIDefaults defaults = UIManager.getDefaults();
String[] colName = { "Key", "Type", "Value" };
String[] tempRowName = new String[defaults.size()];
int i = 0;
for (Enumeration< ? > e = defaults.keys(); e.hasMoreElements(); i++)
{
Object key = e.nextElement();
tempRowName[i] = key.toString();
}
Arrays.sort(tempRowName);
String[][] rowData = new String[tempRowName.length][3];
for (int j = 0; j < tempRowName.length; j++)
{
rowData[j][0] = tempRowName[j];
rowData[j][1] = "" + (defaults.get(tempRowName[j]) == null ? defaults.get(tempRowName[j])
: defaults.get(tempRowName[j]).getClass().getSimpleName());
rowData[j][2] = "" + defaults.get(tempRowName[j]);
}
JFrame f = new JFrame("UIManager properties default values");
JTable t = new JTable(rowData, colName);
f.setContentPane(new JScrollPane(t));
f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
f.pack();
f.setVisible(true);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment