|
|
|
@ -47,6 +47,7 @@ public class TitleInsetImagePane extends JPanel implements UIObserver {
|
|
|
|
|
private final int SETTING_LABEL_WIDTH = LayoutStylePane.SETTING_LABEL_WIDTH; |
|
|
|
|
private final int DELETE_BUTTON_SIZE = 24; |
|
|
|
|
private final int IMAGE_PREVIEW_SIZE = 145; |
|
|
|
|
private final Color IMAGE_PREVIEW_OVERLAY_COLOR = new Color(255, 255, 255, 51); |
|
|
|
|
private final Style DEFAULT_IMAGE_LAYOUT_STYLE = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_DEFAULT); |
|
|
|
|
private final int DEFAULT_INSET_LOCATION_INDEX = 0; |
|
|
|
|
private final int DEFAULT_INSET_PADDING = 10; |
|
|
|
@ -88,17 +89,24 @@ public class TitleInsetImagePane extends JPanel implements UIObserver {
|
|
|
|
|
deletableImagePreviewPane.setLayout(null); |
|
|
|
|
deletableImagePreviewPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 5)); |
|
|
|
|
deletableImagePreviewPane.setPreferredSize(new Dimension(IMAGE_PREVIEW_SIZE, IMAGE_PREVIEW_SIZE)); |
|
|
|
|
JPanel overlayPane = new JPanel(); |
|
|
|
|
overlayPane.setPreferredSize(new Dimension(IMAGE_PREVIEW_SIZE - 2, IMAGE_PREVIEW_SIZE - 2)); |
|
|
|
|
overlayPane.setBackground(IMAGE_PREVIEW_OVERLAY_COLOR); |
|
|
|
|
imagePreviewPane.setBounds(0, 0, IMAGE_PREVIEW_SIZE, IMAGE_PREVIEW_SIZE); |
|
|
|
|
overlayPane.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(imagePreviewPane, 1); |
|
|
|
|
deletableImagePreviewPane.add(overlayPane, 1); |
|
|
|
|
deletableImagePreviewPane.add(imagePreviewPane, 2); |
|
|
|
|
|
|
|
|
|
overlayPane.setVisible(false); |
|
|
|
|
imageDeleteButton.setVisible(false); |
|
|
|
|
imageDeleteButton.setEnabled(false); |
|
|
|
|
deletableImagePreviewPane.addMouseListener(new MouseAdapter() { |
|
|
|
|
@Override |
|
|
|
|
public void mouseEntered(MouseEvent e) { |
|
|
|
|
super.mouseEntered(e); |
|
|
|
|
overlayPane.setVisible(true); |
|
|
|
|
imageDeleteButton.setVisible(true); |
|
|
|
|
imageDeleteButton.setEnabled(true); |
|
|
|
|
} |
|
|
|
@ -109,6 +117,7 @@ public class TitleInsetImagePane extends JPanel implements UIObserver {
|
|
|
|
|
int x = e.getX(); |
|
|
|
|
int y = e.getY(); |
|
|
|
|
if (x <= 0 || getWidth() <= x || y <= 0 || y >= getHeight()) { |
|
|
|
|
overlayPane.setVisible(false); |
|
|
|
|
imageDeleteButton.setVisible(false); |
|
|
|
|
imageDeleteButton.setEnabled(false); |
|
|
|
|
} |
|
|
|
|