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.
52 lines
1.4 KiB
52 lines
1.4 KiB
7 months ago
|
package com.fr.widgettheme.theme.panel;
|
||
|
|
||
|
|
||
|
import com.fr.widgettheme.theme.widget.style.ThemedWidgetStyle;
|
||
|
|
||
|
import java.awt.Dimension;
|
||
|
import java.awt.LayoutManager;
|
||
|
import java.awt.Graphics2D;
|
||
|
import java.awt.Graphics;
|
||
|
import java.awt.Color;
|
||
|
|
||
|
/**
|
||
|
* 主题界面预览控件单元格子,单选按钮组被选中的样子
|
||
|
*
|
||
|
* @author John.Ying
|
||
|
* @since 11.0
|
||
|
* Created on 2023/3/18
|
||
|
*/
|
||
|
public class RingControlPreviewCell extends ControlPreviewCell {
|
||
|
/**
|
||
|
* 圆环厚度
|
||
|
*/
|
||
|
private static final int THICK_NESS = 4;
|
||
|
|
||
|
public RingControlPreviewCell() {
|
||
|
this(DEFAULT, DEFAULT_MESSAGE);
|
||
|
}
|
||
|
|
||
|
public RingControlPreviewCell(String value) {
|
||
|
this(DEFAULT, value);
|
||
|
}
|
||
|
|
||
|
public RingControlPreviewCell(LayoutManager layoutManager, String value) {
|
||
|
this.setLayout(layoutManager);
|
||
|
this.setOpaque(false);
|
||
|
this.value = value;
|
||
|
this.setPreferredSize(new Dimension(20, 30));
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void paintComponent(Graphics g) {
|
||
|
super.paintComponent(g);
|
||
|
ThemedWidgetStyle widgetStyle = (ThemedWidgetStyle) reportTheme.getWidgetStyle();
|
||
|
Graphics2D g2d = (Graphics2D) g.create();
|
||
|
g2d.setColor(widgetStyle.getThemeColor());
|
||
|
g2d.fillOval(5, 9, 15, 15);
|
||
|
g2d.setColor(Color.WHITE);
|
||
|
g2d.fillOval(5 + THICK_NESS, 9 + THICK_NESS, 15 - 2 * THICK_NESS, 15 - 2 * THICK_NESS);
|
||
|
}
|
||
|
|
||
|
}
|