@Override
public void actionPerformed ( final ActionEvent e )
{
if ( wfc == null )
{
wfc = new WebFileChooser ( imageSrc );
wfc.setDialogTitleKey ( "weblaf.ex.npeditor.openImage.title" );
wfc.setMultiSelectionEnabled ( false );
wfc.addChoosableFileFilter ( GlobalConstants.IMAGES_FILTER );
wfc.setFileFilter ( GlobalConstants.IMAGES_FILTER );
}
if ( imageSrc != null )
{
wfc.setSelectedFile ( imageSrc );
}
if ( wfc.showOpenDialog ( SwingUtils.getWindowAncestor ( NinePatchEditorPanel.this ) ) == WebFileChooser.APPROVE_OPTION )
{
openImage ( wfc.getSelectedFile () );
}
}
} );
toolBar.add ( open );
toolBar.addSeparator ();
save = new WebButton ( SAVE_ICON );
save.setLanguage ( "weblaf.ex.npeditor.saveImage" );
save.addHotkey ( NinePatchEditorPanel.this, Hotkey.CTRL_S );
save.setRolloverDecoratedOnly ( true );
save.setEnabled ( false );
save.addActionListener ( new ActionListener ()
{
@Override
public void actionPerformed ( final ActionEvent e )
{
if ( imageSrc != null )
{
try
{
saveImage ( new File ( imageSrc ) );
}
catch ( final IOException e1 )
{
Log.error ( this, e1 );
}
}
}
} );
toolBar.add ( save );
saveAs = new WebButton ( SAVE_AS_ICON );
saveAs.setLanguage ( "weblaf.ex.npeditor.saveImageAs" );
saveAs.addHotkey ( NinePatchEditorPanel.this, Hotkey.CTRL_SHIFT_S );
saveAs.setRolloverDecoratedOnly ( true );
saveAs.addActionListener ( new ActionListener ()
{
private WebFileChooser wfc = null;
@Override
public void actionPerformed ( final ActionEvent e )
{
if ( wfc == null )
{
wfc = new WebFileChooser ( imageSrc );
wfc.setDialogTitleKey ( "weblaf.ex.npeditor.saveImageAs.title" );
wfc.setMultiSelectionEnabled ( false );
}
if ( imageSrc != null )
{