final TitledBorderPainter titledBorderPainter = new TitledBorderPainter ( "Window settings" );
titledBorderPainter.setTitleOffset ( 10 );
titledBorderPainter.setRound ( Math.max ( 0, ExampleFrame.this.getRound () - 2 ) );
setPainter ( titledBorderPainter );
final WebCheckBox showTitle = new WebCheckBox ( "Show title" )
{
{
setSelected ( ExampleFrame.this.isShowTitleComponent () );
addItemListener ( new ItemListener ()
{
@Override
public void itemStateChanged ( ItemEvent e )
{
ExampleFrame.this.setShowTitleComponent ( isSelected () );
ExampleFrame.this.pack ();
}
} );
}
};
add ( new GroupPanel ( 10, showTitle, new WebTextField ( ExampleFrame.this.getTitle (), 1 )
{
{
putClientProperty ( GroupPanel.FILL_CELL, true );
setEnabled ( showTitle.isSelected () );
showTitle.addItemListener ( new ItemListener ()
{
@Override
public void itemStateChanged ( ItemEvent e )
{
setEnabled ( showTitle.isSelected () );
}
} );
addCaretListener ( new CaretListener ()
{
@Override
public void caretUpdate ( CaretEvent e )
{
if ( !ExampleFrame.this.getTitle ().equals ( getText () ) )
{
ExampleFrame.this.setTitle ( getText () );
ExampleFrame.this.pack ();
}
}
} );
}
} ) );
add ( new WebSeparator ( false, true ) );
final WebCheckBox showWindowButtons = new WebCheckBox ( "Show window buttons" )
{
{
setSelected ( ExampleFrame.this.isShowWindowButtons () );
addItemListener ( new ItemListener ()
{
@Override
public void itemStateChanged ( ItemEvent e )
{
ExampleFrame.this.setShowWindowButtons ( isSelected () );
ExampleFrame.this.pack ();
}
} );
}
};
add ( new GroupPanel ( 10, showWindowButtons, new WebButtonGroup ( new WebToggleButton ( WebRootPaneUI.minimizeIcon )
{
{
setSelected ( ExampleFrame.this.isShowMinimizeButton () );
addItemListener ( new ItemListener ()
{
@Override
public void itemStateChanged ( ItemEvent e )
{
ExampleFrame.this.setShowMinimizeButton ( isSelected () );
}
} );
}
}, new WebToggleButton ( WebRootPaneUI.maximizeIcon )
{
{
setSelected ( ExampleFrame.this.isShowMaximizeButton () );
addItemListener ( new ItemListener ()
{
@Override
public void itemStateChanged ( ItemEvent e )
{
ExampleFrame.this.setShowMaximizeButton ( isSelected () );
}
} );
}
}, new WebToggleButton ( WebRootPaneUI.closeIcon )
{
{
setSelected ( ExampleFrame.this.isShowCloseButton () );
addItemListener ( new ItemListener ()
{
@Override
public void itemStateChanged ( ItemEvent e )
{
ExampleFrame.this.setShowCloseButton ( isSelected () );
}
} );
}
}
)
{
{
setButtonsMargin ( 2, 4, 2, 4 );
setButtonsDrawFocus ( false );
setEnabled ( showWindowButtons.isSelected () );
showWindowButtons.addItemListener ( new ItemListener ()
{
@Override
public void itemStateChanged ( ItemEvent e )
{
setEnabled ( showWindowButtons.isSelected () );
}
} );
}
} ) );
add ( new WebCheckBox ( "Attach window buttons to sides" )
{
{
setSelected ( ExampleFrame.this.isAttachButtons () );
addItemListener ( new ItemListener ()
{
@Override
public void itemStateChanged ( ItemEvent e )
{
ExampleFrame.this.setAttachButtons ( isSelected () );
ExampleFrame.this.pack ();
}
} );
}
} );
add ( new WebCheckBox ( "Group window buttons" )
{
{
setSelected ( ExampleFrame.this.isGroupButtons () );
addItemListener ( new ItemListener ()
{
@Override
public void itemStateChanged ( ItemEvent e )
{
ExampleFrame.this.setGroupButtons ( isSelected () );
ExampleFrame.this.pack ();
}
} );
}
} );
add ( new WebSeparator ( false, true ) );
final WebCheckBox showMenuBar = new WebCheckBox ( "Show menu bar" )
{
{
setSelected ( ExampleFrame.this.isShowMenuBar () );
addItemListener ( new ItemListener ()
{
@Override
public void itemStateChanged ( ItemEvent e )
{
ExampleFrame.this.setShowMenuBar ( isSelected () );
ExampleFrame.this.pack ();
}
} );
}
};
add ( new GroupPanel ( 10, showMenuBar, new WebComboBox ( new String[]{ "undecorated", "attached", "standalone" } )
{
{
addActionListener ( new ActionListener ()
{
@Override
public void actionPerformed ( ActionEvent e )
{
int i = getSelectedIndex ();
if ( i == 0 )
{
menuBar.setUndecorated ( true );
}
else
{
menuBar.setUndecorated ( false );
menuBar.setMenuBarStyle ( i == 1 ? MenuBarStyle.attached : MenuBarStyle.standalone );
}
ExampleFrame.this.pack ();
}
} );
setEnabled ( showMenuBar.isSelected () );
showMenuBar.addItemListener ( new ItemListener ()
{
@Override
public void itemStateChanged ( ItemEvent e )
{
setEnabled ( showMenuBar.isSelected () );
}
} );
}
} ) );
add ( new WebSeparator ( false, true ) );
add ( new WebCheckBox ( "Show resize corner" )
{
{
setSelected ( ExampleFrame.this.isShowResizeCorner () );
addItemListener ( new ItemListener ()
{