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