@ -35,7 +35,6 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener ;
import java.awt.event.MouseAdapter ;
import java.awt.event.MouseEvent ;
import java.awt.event.MouseListener ;
import java.awt.geom.RoundRectangle2D ;
/ * *
@ -96,14 +95,21 @@ public class TitleInsetImagePane extends JPanel implements UIObserver {
imagePreviewPane . setBounds ( 0 , 0 , IMAGE_PREVIEW_SIZE , IMAGE_PREVIEW_SIZE ) ;
imagePreviewOverlayPane . setBounds ( 1 , 1 , IMAGE_PREVIEW_SIZE - 2 , IMAGE_PREVIEW_SIZE - 2 ) ;
imageDeleteButton . setBounds ( IMAGE_PREVIEW_SIZE - DELETE_BUTTON_SIZE , 0 , DELETE_BUTTON_SIZE , DELETE_BUTTON_SIZE ) ;
deletableImagePreviewPane . add ( imageDeleteButton , 0 ) ;
deletableImagePreviewPane . add ( imagePreviewOverlayPane , 1 ) ;
deletableImagePreviewPane . add ( imagePreviewPane , 2 ) ;
JPanel mousePane = new JPanel ( ) ;
mousePane . setBounds ( 0 , 0 , IMAGE_PREVIEW_SIZE , IMAGE_PREVIEW_SIZE ) ;
mousePane . setOpaque ( false ) ;
mousePane . setBackground ( null ) ;
deletableImagePreviewPane . add ( mousePane , 0 ) ;
deletableImagePreviewPane . add ( imageDeleteButton , 1 ) ;
deletableImagePreviewPane . add ( imagePreviewOverlayPane , 2 ) ;
deletableImagePreviewPane . add ( imagePreviewPane , 3 ) ;
imagePreviewOverlayPane . setVisible ( false ) ;
imageDeleteButton . setVisible ( false ) ;
imageDeleteButton . setEnabled ( false ) ;
deletableImagePreviewPane . addMouseListener ( new MouseAdapter ( ) {
mouse Pane. addMouseListener ( new MouseAdapter ( ) {
@Override
public void mouseEntered ( MouseEvent e ) {
super . mouseEntered ( e ) ;
@ -115,12 +121,27 @@ public class TitleInsetImagePane extends JPanel implements UIObserver {
@Override
public void mouseExited ( MouseEvent e ) {
super . mouseExited ( e ) ;
imagePreviewOverlayPane . setVisible ( false ) ;
imageDeleteButton . setVisible ( false ) ;
imageDeleteButton . setEnabled ( false ) ;
}
@Override
public void mouseClicked ( MouseEvent e ) {
super . mouseClicked ( e ) ;
int x = e . getX ( ) ;
int y = e . getY ( ) ;
if ( x < = 0 | | getWidth ( ) < = x | | y < = 0 | | y > = getHeight ( ) ) {
Rectangle bounds = imageDeleteButton . getBounds ( ) ;
if ( bounds . x < x & & x < bounds . x + bounds . width & & bounds . y < y & & y < bounds . y + bounds . height ) {
imagePreviewPane . setImageWithSuffix ( null ) ;
imageLocationPane . setSelectedIndex ( DEFAULT_INSET_LOCATION_INDEX ) ;
imagePaddingPane . setValue ( DEFAULT_INSET_PADDING ) ;
imagePreviewOverlayPane . setVisible ( false ) ;
imageDeleteButton . setVisible ( false ) ;
imageDeleteButton . setEnabled ( false ) ;
getComponent ( 1 ) . setVisible ( false ) ;
fireStateChanged ( ) ;
}
}
} ) ;
@ -211,20 +232,6 @@ public class TitleInsetImagePane extends JPanel implements UIObserver {
} ) . dealWithImageFile ( returnVal ) ;
}
} ) ;
this . imageDeleteButton . addActionListener ( new ActionListener ( ) {
@Override
public void actionPerformed ( ActionEvent e ) {
imagePreviewPane . setImageWithSuffix ( null ) ;
imageLocationPane . setSelectedIndex ( DEFAULT_INSET_LOCATION_INDEX ) ;
imagePaddingPane . setValue ( DEFAULT_INSET_PADDING ) ;
imagePreviewOverlayPane . setVisible ( false ) ;
imageDeleteButton . setVisible ( false ) ;
imageDeleteButton . setEnabled ( false ) ;
getComponent ( 1 ) . setVisible ( false ) ;
fireStateChanged ( ) ;
}
} ) ;
}
public void populateBean ( TitlePacker packer ) {