Browse Source

REPORT-61299 弹窗类面板高亮区域不加白边

new-design
kuangshuai 3 years ago
parent
commit
4c49a3b475
  1. 46
      designer-base/src/main/java/com/fr/design/mainframe/guide/scene/AbstractGuideScene.java

46
designer-base/src/main/java/com/fr/design/mainframe/guide/scene/AbstractGuideScene.java

@ -75,13 +75,16 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
if (component instanceof JComponent) {
JComponent jComponent = (JComponent) component;
image = ScreenImage.createImage(jComponent);
highlightList.add(getTargetComponentWithImage(image, rectangle, true));
} else if (component instanceof Window) {
image = ScreenImage.createImage(component);
highlightList.add(getTargetComponentWithImage(image, rectangle, false));
} else {
image = captureImage(component);
highlightList.add(getTargetComponentWithImage(image, rectangle,true));
}
targetList.add(component);
highlightList.add(getTargetComponentWithImage(image, rectangle));
return true;
} catch (AWTException e) {
e.printStackTrace();
@ -99,7 +102,7 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
try {
targetList.add(null);
BufferedImage image = captureImage(rectangle);
highlightList.add(getTargetComponentWithImage(image, rectangle));
highlightList.add(getTargetComponentWithImage(image, rectangle, true));
return true;
} catch (AWTException e) {
e.printStackTrace();
@ -133,7 +136,7 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
image = ScreenImage.createImage(component).getSubimage(origin.x, origin.y, origin.width, origin.height);
}
targetList.add(component);
highlightList.add(getTargetComponentWithImage(image, rectangle));
highlightList.add(getTargetComponentWithImage(image, rectangle, true));
return true;
} catch (AWTException e) {
e.printStackTrace();
@ -170,22 +173,29 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
return highlightList;
}
private UILabel getTargetComponentWithImage(BufferedImage image, Rectangle rectangle) {
private UILabel getTargetComponentWithImage(BufferedImage image, Rectangle rectangle, boolean showBorder) {
ImageIcon ic = new ImageIcon(image);
UILabel label = new UILabel(ic){
@Override
public Insets getInsets() {
return DEFAULT_HIGHLIGHT_INSETS;
}
};
label.setBackground(Color.WHITE);
label.setOpaque(true);
label.setBounds(new Rectangle(
rectangle.x - DEFAULT_HIGHLIGHT_INSETS.left,
rectangle.y - DEFAULT_HIGHLIGHT_INSETS.top,
rectangle.width + DEFAULT_HIGHLIGHT_INSETS.left + DEFAULT_HIGHLIGHT_INSETS.right,
rectangle.height + DEFAULT_HIGHLIGHT_INSETS.top + DEFAULT_HIGHLIGHT_INSETS.bottom
));
UILabel label;
if (showBorder) {
label = new UILabel(ic){
@Override
public Insets getInsets() {
return DEFAULT_HIGHLIGHT_INSETS;
}
};
label.setBackground(Color.WHITE);
label.setOpaque(true);
label.setBounds(new Rectangle(
rectangle.x - DEFAULT_HIGHLIGHT_INSETS.left,
rectangle.y - DEFAULT_HIGHLIGHT_INSETS.top,
rectangle.width + DEFAULT_HIGHLIGHT_INSETS.left + DEFAULT_HIGHLIGHT_INSETS.right,
rectangle.height + DEFAULT_HIGHLIGHT_INSETS.top + DEFAULT_HIGHLIGHT_INSETS.bottom
));
} else {
label = new UILabel(ic);
label.setBounds(rectangle);
}
return label;
}

Loading…
Cancel
Save