forked from fanruan/design
Browse Source
* commit '24af5d34cd0e21fbb9e9f1b5e3fe5cb995513253': REPORT-54604 参数面板放置默认不可见的预定义控件后,修改控件属性,控件在参数面板丢失显示 CHART-19708 图表块图表标题背景修改 REPORT-54122 设计器组件悬停/选中/编辑状态优化research/10.0
superman
3 years ago
20 changed files with 366 additions and 59 deletions
After Width: | Height: | Size: 304 B |
After Width: | Height: | Size: 281 B |
@ -0,0 +1,47 @@ |
|||||||
|
package com.fr.design.designer.creator; |
||||||
|
|
||||||
|
import com.fr.design.form.util.XCreatorConstants; |
||||||
|
import com.fr.general.IOUtils; |
||||||
|
import java.awt.AlphaComposite; |
||||||
|
import java.awt.Color; |
||||||
|
import java.awt.Graphics; |
||||||
|
import java.awt.Graphics2D; |
||||||
|
import java.awt.Image; |
||||||
|
import java.awt.Rectangle; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author hades |
||||||
|
* @version 10.0 |
||||||
|
* Created by hades on 2021/06/30 |
||||||
|
*/ |
||||||
|
public class SelectedBorderIcon { |
||||||
|
|
||||||
|
private static final Image EDIT_ICON = IOUtils.readImage("/com/fr/design/images/control/show_edit.png"); |
||||||
|
private static final Image SETTING_ICON = IOUtils.readImage("/com/fr/design/images/control/show_setting.png"); |
||||||
|
private static final float ALPHA = 0.7F; |
||||||
|
private static final int TIP_WIDTH = 20; |
||||||
|
private static final int TIP_HEIGHT = 40; |
||||||
|
private static final int ARC_VALUE = 4; |
||||||
|
// 组件到整个提示之间的空隙
|
||||||
|
private static final int CREATOR_TO_TIP_GAP = 5; |
||||||
|
// icon在整个提示背景下缩进
|
||||||
|
private static final int TIP_ICON_GAP = 2; |
||||||
|
|
||||||
|
/** |
||||||
|
* 在bounds范围的右上角绘制特定图标 |
||||||
|
* |
||||||
|
* @param g |
||||||
|
* @param bounds |
||||||
|
*/ |
||||||
|
public void paint(Graphics g, Rectangle bounds) { |
||||||
|
Graphics2D g2d = (Graphics2D) g; |
||||||
|
AlphaComposite alphaComposite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, ALPHA); |
||||||
|
g2d.setColor(XCreatorConstants.EDIT_COLOR); |
||||||
|
g2d.setComposite(alphaComposite); |
||||||
|
g2d.fillRoundRect(bounds.x + bounds.width + CREATOR_TO_TIP_GAP, bounds.y, TIP_WIDTH, TIP_HEIGHT, ARC_VALUE, ARC_VALUE); |
||||||
|
g2d.drawImage(EDIT_ICON, bounds.x + bounds.width + CREATOR_TO_TIP_GAP + TIP_ICON_GAP, bounds.y + TIP_ICON_GAP, EDIT_ICON.getWidth(null), EDIT_ICON.getHeight(null), null); |
||||||
|
g2d.drawImage(SETTING_ICON, bounds.x + bounds.width + CREATOR_TO_TIP_GAP + TIP_ICON_GAP, bounds.y + CREATOR_TO_TIP_GAP + EDIT_ICON.getHeight(null), SETTING_ICON.getWidth(null), SETTING_ICON.getHeight(null), null); |
||||||
|
g2d.setColor(Color.WHITE); |
||||||
|
g2d.drawLine(bounds.x + bounds.width + CREATOR_TO_TIP_GAP + TIP_ICON_GAP, bounds.y + TIP_WIDTH, bounds.x + bounds.width + CREATOR_TO_TIP_GAP + TIP_ICON_GAP + EDIT_ICON.getWidth(null), bounds.y + TIP_WIDTH); |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue