|
|
@ -35,7 +35,6 @@ import java.awt.event.ActionEvent; |
|
|
|
import java.awt.event.ActionListener; |
|
|
|
import java.awt.event.ActionListener; |
|
|
|
import java.awt.event.MouseAdapter; |
|
|
|
import java.awt.event.MouseAdapter; |
|
|
|
import java.awt.event.MouseEvent; |
|
|
|
import java.awt.event.MouseEvent; |
|
|
|
import java.awt.event.MouseListener; |
|
|
|
|
|
|
|
import java.awt.geom.RoundRectangle2D; |
|
|
|
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); |
|
|
|
imagePreviewPane.setBounds(0, 0, IMAGE_PREVIEW_SIZE, IMAGE_PREVIEW_SIZE); |
|
|
|
imagePreviewOverlayPane.setBounds(1, 1, IMAGE_PREVIEW_SIZE - 2, IMAGE_PREVIEW_SIZE - 2); |
|
|
|
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); |
|
|
|
imageDeleteButton.setBounds(IMAGE_PREVIEW_SIZE - DELETE_BUTTON_SIZE, 0, DELETE_BUTTON_SIZE, DELETE_BUTTON_SIZE); |
|
|
|
deletableImagePreviewPane.add(imageDeleteButton, 0); |
|
|
|
|
|
|
|
deletableImagePreviewPane.add(imagePreviewOverlayPane, 1); |
|
|
|
JPanel mousePane = new JPanel(); |
|
|
|
deletableImagePreviewPane.add(imagePreviewPane, 2); |
|
|
|
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); |
|
|
|
imagePreviewOverlayPane.setVisible(false); |
|
|
|
imageDeleteButton.setVisible(false); |
|
|
|
imageDeleteButton.setVisible(false); |
|
|
|
imageDeleteButton.setEnabled(false); |
|
|
|
imageDeleteButton.setEnabled(false); |
|
|
|
deletableImagePreviewPane.addMouseListener(new MouseAdapter() { |
|
|
|
mousePane.addMouseListener(new MouseAdapter() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void mouseEntered(MouseEvent e) { |
|
|
|
public void mouseEntered(MouseEvent e) { |
|
|
|
super.mouseEntered(e); |
|
|
|
super.mouseEntered(e); |
|
|
@ -115,12 +121,27 @@ public class TitleInsetImagePane extends JPanel implements UIObserver { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void mouseExited(MouseEvent e) { |
|
|
|
public void mouseExited(MouseEvent e) { |
|
|
|
super.mouseExited(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 x = e.getX(); |
|
|
|
int y = e.getY(); |
|
|
|
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); |
|
|
|
imagePreviewOverlayPane.setVisible(false); |
|
|
|
imageDeleteButton.setVisible(false); |
|
|
|
imageDeleteButton.setVisible(false); |
|
|
|
imageDeleteButton.setEnabled(false); |
|
|
|
imageDeleteButton.setEnabled(false); |
|
|
|
|
|
|
|
getComponent(1).setVisible(false); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fireStateChanged(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
@ -211,20 +232,6 @@ public class TitleInsetImagePane extends JPanel implements UIObserver { |
|
|
|
}).dealWithImageFile(returnVal); |
|
|
|
}).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) { |
|
|
|
public void populateBean(TitlePacker packer) { |
|
|
|