You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.2 KiB
42 lines
1.2 KiB
package com.fr.design.report; |
|
|
|
import com.fr.base.iofile.attr.WatermarkAttr; |
|
import com.fr.general.IOUtils; |
|
import com.fr.page.WatermarkPainter; |
|
|
|
import javax.swing.JPanel; |
|
import java.awt.Graphics; |
|
import java.awt.Graphics2D; |
|
import java.awt.image.BufferedImage; |
|
|
|
/** |
|
* Created by plough on 2018/5/15. |
|
*/ |
|
public class WatermarkPreviewPane extends JPanel { |
|
|
|
public static final BufferedImage WATERMARK_BACKGROUND = IOUtils.readImage("/com/fr/design/images/dialog/watermark/" |
|
+ com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_WaterMark_Background_Icon_File_Name")); |
|
private WatermarkAttr watermark; |
|
|
|
public WatermarkPreviewPane() { |
|
this.watermark = new WatermarkAttr(); |
|
repaint(); |
|
} |
|
|
|
/** |
|
* 重新画 |
|
*/ |
|
public void repaint(WatermarkAttr watermark){ |
|
this.watermark = watermark; |
|
super.repaint(); |
|
} |
|
|
|
@Override |
|
public void paint(Graphics g) { |
|
super.paint(g); |
|
Graphics2D g2d = (Graphics2D)g; |
|
g2d.drawImage(WATERMARK_BACKGROUND, 0, 0, this.getWidth(), this.getHeight(), null); |
|
WatermarkPainter painter = WatermarkPainter.createPainter(watermark); |
|
painter.paint(g2d, this.getWidth(), this.getHeight()); |
|
} |
|
}
|
|
|