public static JButton getWindowButton(JRootPane rootPane, String name) {
JLayeredPane jlp = rootPane.getLayeredPane();
for (int i=0;i<jlp.getComponentCount();i++) {
Component comp = jlp.getComponent(i);
if (comp instanceof SkinTitlePane) {
SkinTitlePane stp = (SkinTitlePane) comp;
for (int j=0;j<stp.getComponentCount();j++) {
Component comp2 = stp.getComponent(j);
if (comp2 instanceof SkinWindowButton) {
SkinWindowButton swb = (SkinWindowButton) comp2;
if (name.equals(swb.getActionCommand()))
return swb;
}