|
|
@ -13,6 +13,7 @@ import javax.swing.BorderFactory; |
|
|
|
import javax.swing.ImageIcon; |
|
|
|
import javax.swing.ImageIcon; |
|
|
|
import javax.swing.JComponent; |
|
|
|
import javax.swing.JComponent; |
|
|
|
import javax.swing.JPanel; |
|
|
|
import javax.swing.JPanel; |
|
|
|
|
|
|
|
import javax.swing.JPopupMenu; |
|
|
|
import javax.swing.SwingUtilities; |
|
|
|
import javax.swing.SwingUtilities; |
|
|
|
import java.awt.AWTException; |
|
|
|
import java.awt.AWTException; |
|
|
|
import java.awt.AlphaComposite; |
|
|
|
import java.awt.AlphaComposite; |
|
|
@ -75,13 +76,16 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene { |
|
|
|
if (component instanceof JComponent) { |
|
|
|
if (component instanceof JComponent) { |
|
|
|
JComponent jComponent = (JComponent) component; |
|
|
|
JComponent jComponent = (JComponent) component; |
|
|
|
image = ScreenImage.createImage(jComponent); |
|
|
|
image = ScreenImage.createImage(jComponent); |
|
|
|
|
|
|
|
highlightList.add(getTargetComponentWithImage(image, rectangle, !(component.getParent() instanceof JPopupMenu))); |
|
|
|
} else if (component instanceof Window) { |
|
|
|
} else if (component instanceof Window) { |
|
|
|
image = ScreenImage.createImage(component); |
|
|
|
image = ScreenImage.createImage(component); |
|
|
|
|
|
|
|
highlightList.add(getTargetComponentWithImage(image, rectangle, false)); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
image = captureImage(component); |
|
|
|
image = captureImage(component); |
|
|
|
|
|
|
|
highlightList.add(getTargetComponentWithImage(image, rectangle,true)); |
|
|
|
} |
|
|
|
} |
|
|
|
targetList.add(component); |
|
|
|
targetList.add(component); |
|
|
|
highlightList.add(getTargetComponentWithImage(image, rectangle)); |
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} catch (AWTException e) { |
|
|
|
} catch (AWTException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
e.printStackTrace(); |
|
|
@ -99,7 +103,7 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene { |
|
|
|
try { |
|
|
|
try { |
|
|
|
targetList.add(null); |
|
|
|
targetList.add(null); |
|
|
|
BufferedImage image = captureImage(rectangle); |
|
|
|
BufferedImage image = captureImage(rectangle); |
|
|
|
highlightList.add(getTargetComponentWithImage(image, rectangle)); |
|
|
|
highlightList.add(getTargetComponentWithImage(image, rectangle, true)); |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} catch (AWTException e) { |
|
|
|
} catch (AWTException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
e.printStackTrace(); |
|
|
@ -133,7 +137,7 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene { |
|
|
|
image = ScreenImage.createImage(component).getSubimage(origin.x, origin.y, origin.width, origin.height); |
|
|
|
image = ScreenImage.createImage(component).getSubimage(origin.x, origin.y, origin.width, origin.height); |
|
|
|
} |
|
|
|
} |
|
|
|
targetList.add(component); |
|
|
|
targetList.add(component); |
|
|
|
highlightList.add(getTargetComponentWithImage(image, rectangle)); |
|
|
|
highlightList.add(getTargetComponentWithImage(image, rectangle, true)); |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} catch (AWTException e) { |
|
|
|
} catch (AWTException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
e.printStackTrace(); |
|
|
@ -170,22 +174,29 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene { |
|
|
|
return highlightList; |
|
|
|
return highlightList; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private UILabel getTargetComponentWithImage(BufferedImage image, Rectangle rectangle) { |
|
|
|
private UILabel getTargetComponentWithImage(BufferedImage image, Rectangle rectangle, boolean showBorder) { |
|
|
|
ImageIcon ic = new ImageIcon(image); |
|
|
|
ImageIcon ic = new ImageIcon(image); |
|
|
|
UILabel label = new UILabel(ic){ |
|
|
|
UILabel label; |
|
|
|
@Override |
|
|
|
if (showBorder) { |
|
|
|
public Insets getInsets() { |
|
|
|
label = new UILabel(ic){ |
|
|
|
return DEFAULT_HIGHLIGHT_INSETS; |
|
|
|
@Override |
|
|
|
} |
|
|
|
public Insets getInsets() { |
|
|
|
}; |
|
|
|
return DEFAULT_HIGHLIGHT_INSETS; |
|
|
|
label.setBackground(Color.WHITE); |
|
|
|
} |
|
|
|
label.setOpaque(true); |
|
|
|
}; |
|
|
|
label.setBounds(new Rectangle( |
|
|
|
label.setBackground(Color.WHITE); |
|
|
|
rectangle.x - DEFAULT_HIGHLIGHT_INSETS.left, |
|
|
|
label.setOpaque(true); |
|
|
|
rectangle.y - DEFAULT_HIGHLIGHT_INSETS.top, |
|
|
|
label.setBounds(new Rectangle( |
|
|
|
rectangle.width + DEFAULT_HIGHLIGHT_INSETS.left + DEFAULT_HIGHLIGHT_INSETS.right, |
|
|
|
rectangle.x - DEFAULT_HIGHLIGHT_INSETS.left, |
|
|
|
rectangle.height + DEFAULT_HIGHLIGHT_INSETS.top + DEFAULT_HIGHLIGHT_INSETS.bottom |
|
|
|
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; |
|
|
|
return label; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|