|
|
|
@ -31,6 +31,7 @@ import java.awt.Dimension;
|
|
|
|
|
import java.awt.Graphics; |
|
|
|
|
import java.awt.Graphics2D; |
|
|
|
|
import java.awt.Image; |
|
|
|
|
import java.awt.Insets; |
|
|
|
|
import java.awt.RenderingHints; |
|
|
|
|
import java.awt.Shape; |
|
|
|
|
import java.awt.Stroke; |
|
|
|
@ -99,7 +100,20 @@ public abstract class ComponentPreviewPane extends UINoOpaquePanel implements Th
|
|
|
|
|
Utils.clipByRoundBorder(g2d, getWidth(), getHeight(), roundedBorder.getRoundedCorner(), roundedBorder.getThickness()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int titleHeight = titlePane == null ? 0 : titlePane.getHeight(); |
|
|
|
|
Border containerBorder = container.getBorder(); |
|
|
|
|
Insets insets = containerBorder.getBorderInsets(container); |
|
|
|
|
int titleHeight = titlePane == null ? 0 : titlePane.getHeight() + insets.top; |
|
|
|
|
//绘制标题背景
|
|
|
|
|
if (titlePane != null) { |
|
|
|
|
Label data = titlePane.getData(); |
|
|
|
|
float opacity = data.getBackgroundOpacity(); |
|
|
|
|
Background background = data.getBackground(); |
|
|
|
|
if (background != null) { |
|
|
|
|
Utils.paintBackground((Graphics2D) g, background, new Rectangle2D.Double(0, 0, getWidth(), titleHeight), opacity); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//绘制主体背景
|
|
|
|
|
Utils.paintBackground(g2d, style.getBackground(), new Rectangle2D.Double(0, titleHeight, getWidth(), getHeight() - titleHeight), style.getAlpha()); |
|
|
|
|
|
|
|
|
|
Utils.paintBackground(g2d, style.getBorderImage(), new Rectangle2D.Double(0, 0, getWidth(), getHeight()), style.getBorderImageOpacity()); |
|
|
|
@ -133,17 +147,14 @@ public abstract class ComponentPreviewPane extends UINoOpaquePanel implements Th
|
|
|
|
|
this.setBorder(new BottomLineBorder(componentStyle.getStyle().getColor(), componentStyle.getStyle().getBorder())); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public Label getData(){ |
|
|
|
|
return data; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void paintComponent(Graphics g) { |
|
|
|
|
super.paintComponent(g); |
|
|
|
|
Dimension size = getSize(); |
|
|
|
|
Background background = data.getBackground(); |
|
|
|
|
float opacity = data.getBackgroundOpacity(); |
|
|
|
|
if (background != null) { |
|
|
|
|
Utils.paintBackground((Graphics2D) g, background, new Rectangle2D.Double(0, 0, size.getWidth(), size.getHeight()), opacity); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Graphics2D g2d = (Graphics2D) g.create(); |
|
|
|
|
Background inset = data.getInsetImage(); |
|
|
|
|
Image insetImage = inset instanceof ImageBackground ? ((ImageBackground) inset).getImage() : null; |
|
|
|
|