|
|
@ -24,7 +24,6 @@ import com.fr.general.Background; |
|
|
|
import com.fr.general.IOUtils; |
|
|
|
import com.fr.general.IOUtils; |
|
|
|
import com.fr.general.ImageWithSuffix; |
|
|
|
import com.fr.general.ImageWithSuffix; |
|
|
|
import com.fr.general.act.TitlePacker; |
|
|
|
import com.fr.general.act.TitlePacker; |
|
|
|
import com.fr.report.core.cal.Rect; |
|
|
|
|
|
|
|
import com.fr.stable.Constants; |
|
|
|
import com.fr.stable.Constants; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.*; |
|
|
|
import javax.swing.*; |
|
|
@ -36,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; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -97,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); |
|
|
@ -116,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(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
@ -151,7 +171,6 @@ public class TitleInsetImagePane extends JPanel implements UIObserver { |
|
|
|
IOUtils.readIcon("/com/fr/design/images/buttonicon/icon_delete_inset.png"), |
|
|
|
IOUtils.readIcon("/com/fr/design/images/buttonicon/icon_delete_inset.png"), |
|
|
|
new Color(51, 51, 52, 178), |
|
|
|
new Color(51, 51, 52, 178), |
|
|
|
2); |
|
|
|
2); |
|
|
|
imageDeleteButton.setEnabled(false); |
|
|
|
|
|
|
|
imageDeleteButton.setPreferredSize(new Dimension(DELETE_BUTTON_SIZE, DELETE_BUTTON_SIZE)); |
|
|
|
imageDeleteButton.setPreferredSize(new Dimension(DELETE_BUTTON_SIZE, DELETE_BUTTON_SIZE)); |
|
|
|
|
|
|
|
|
|
|
|
imagePreviewPane = new ImagePreviewPane(); |
|
|
|
imagePreviewPane = new ImagePreviewPane(); |
|
|
|