|
|
@ -6,35 +6,33 @@ import com.fr.design.mainframe.EastRegionContainerPane; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.ImageIcon; |
|
|
|
import javax.swing.ImageIcon; |
|
|
|
import javax.swing.JDialog; |
|
|
|
import javax.swing.JDialog; |
|
|
|
|
|
|
|
import java.awt.Dimension; |
|
|
|
import java.awt.Image; |
|
|
|
import java.awt.Image; |
|
|
|
|
|
|
|
import java.awt.Point; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Created by kerry on 2021/10/22 |
|
|
|
* Created by kerry on 2021/10/22 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class PreviewDialog extends JDialog { |
|
|
|
public class PreviewDialog extends JDialog { |
|
|
|
|
|
|
|
private static final int OFFSET_Y = 9; |
|
|
|
|
|
|
|
|
|
|
|
public PreviewDialog() { |
|
|
|
public PreviewDialog() { |
|
|
|
super(DesignerContext.getDesignerFrame()); |
|
|
|
super(DesignerContext.getDesignerFrame()); |
|
|
|
setUndecorated(true); |
|
|
|
setUndecorated(true); |
|
|
|
setSize(300, 300); |
|
|
|
|
|
|
|
adjustLocation(); |
|
|
|
|
|
|
|
this.setVisible(false); |
|
|
|
this.setVisible(false); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setImage(Image image) { |
|
|
|
public void setImage(Image image, Point point) { |
|
|
|
this.getContentPane().removeAll(); |
|
|
|
this.getContentPane().removeAll(); |
|
|
|
this.getContentPane().add(new UILabel(new ImageIcon(image))); |
|
|
|
this.getContentPane().add(new UILabel(new ImageIcon(image))); |
|
|
|
|
|
|
|
int width = image.getWidth(null); |
|
|
|
|
|
|
|
this.setSize(width, image.getHeight(null)); |
|
|
|
|
|
|
|
this.setLocation(point.x - width, point.y + OFFSET_Y); |
|
|
|
this.doLayout(); |
|
|
|
this.doLayout(); |
|
|
|
|
|
|
|
|
|
|
|
this.validate(); |
|
|
|
this.validate(); |
|
|
|
this.repaint(); |
|
|
|
this.repaint(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void adjustLocation() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setLocation( |
|
|
|
|
|
|
|
EastRegionContainerPane.getInstance().getX() - 300, |
|
|
|
|
|
|
|
20 |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|