Browse Source

REPORT-62653 【组件可更新提醒】组件复用-组件上“版本不兼容”提示文字不明显

【问题原因】
修改提示文字背景及字体

【改动思路】
同上
feature/x
Starryi 3 years ago
parent
commit
1b42276edf
  1. 10
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetBlock.java

10
designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetBlock.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe.share.ui.block; package com.fr.design.mainframe.share.ui.block;
import com.fr.base.FRContext;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
import com.fr.base.iofile.attr.SharableAttrMark; import com.fr.base.iofile.attr.SharableAttrMark;
import com.fr.design.base.mode.DesignModeContext; import com.fr.design.base.mode.DesignModeContext;
@ -59,6 +60,7 @@ import java.awt.dnd.DnDConstants;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.font.FontRenderContext; import java.awt.font.FontRenderContext;
import java.awt.font.LineMetrics;
import java.awt.geom.Dimension2D; import java.awt.geom.Dimension2D;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.util.UUID; import java.util.UUID;
@ -298,17 +300,17 @@ public class LocalWidgetBlock extends PreviewWidgetBlock<DefaultSharableWidget>
double canvasH = coverDim.getHeight(); double canvasH = coverDim.getHeight();
g2d.setColor(new Color(0.0F, 0.0F, 0.0F, 0.4F)); g2d.setColor(new Color(0.0F, 0.0F, 0.0F, 0.4F));
GraphHelper.fillRect(g2d, canvasX, canvasY, canvasW, canvasH - 16); GraphHelper.fillRect(g2d, canvasX, canvasY, canvasW, canvasH);
g2d.setColor(new Color(0.0F, 0.0F, 0.0F, 0.5F)); g2d.setColor(new Color(0.0F, 0.0F, 0.0F, 0.5F));
GraphHelper.fillRect(g2d, canvasX, canvasH - 16, canvasW, 16); GraphHelper.fillRect(g2d, canvasX, canvasH - 16, canvasW, 16);
String tipText = Toolkit.i18nText("Fine-Design_Share_Incompatible_Version_Tip"); String tipText = Toolkit.i18nText("Fine-Design_Share_Incompatible_Version_Tip");
Font tipFont = FRFont.getInstance().deriveFont(8F); Font tipFont = FRContext.getDefaultValues().getFRFont().deriveFont(8.0F);
FontRenderContext frc = g2d.getFontRenderContext(); FontRenderContext frc = g2d.getFontRenderContext();
double tipTextWidth = GraphHelper.stringWidth(tipText, tipFont, frc); double tipTextWidth = GraphHelper.stringWidth(tipText, tipFont, frc);
Dimension2D dim = GraphHelper.stringDimensionWithRotation(tipText, tipFont, 0, frc); LineMetrics metrics = tipFont.getLineMetrics(tipText, frc);
double tipTextHeight = dim.getHeight(); double tipTextHeight = metrics.getHeight();
g2d.setColor(Color.WHITE); g2d.setColor(Color.WHITE);
g2d.setFont(tipFont); g2d.setFont(tipFont);
GraphHelper.drawString(g2d, tipText, canvasX + (canvasW - tipTextWidth) / 2.0F, canvasY + canvasH - (16 - tipTextHeight) / 2.0F); GraphHelper.drawString(g2d, tipText, canvasX + (canvasW - tipTextWidth) / 2.0F, canvasY + canvasH - (16 - tipTextHeight) / 2.0F);

Loading…
Cancel
Save