for (Component co : up.getContentPane().getComponents())
{
System.out.println(co.getClass().toString()); //得到co的类型
if (co.getClass().toString().toLowerCase().contains("jpanel"))
{
for (Component control : ((JPanel)co).getComponents())
{
System.out.println(control.getClass().toString()); //得到co的类型
if (!control.getClass().toString().toLowerCase().contains("jlabel"))
{
control.setEnabled(false);
}
}
}
}
http://blog.csdn.net/xdlxia/article/details/6504077
http://zuoqiang.iteye.com/blog/1461287
UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
} catch (Exception e) {
e.printStackTrace();
}
swing Nimbus