SwingWrapper.java 文件源码

java
阅读 17 收藏 0 点赞 0 评论 0

项目:Device-Mod-Apps 作者:
public void render(int x, int y, int mouseX, int mouseY) {
    rc = txt.getDynamicTextureLocation(c.toString(), new DynamicTexture(img));
    if (!frame.isVisible()) frame.setVisible(true);

    if (rc != null) {
        mc.getRenderManager().renderEngine.bindTexture(rc);
        drawRectWithFullTexture(x, y, width, height);
        txt.deleteTexture(rc);
    }
    if (mouseX >= x && mouseY >= y && mouseX < x + this.width && mouseY < y + this.height) {
        if (mouseX != lastMouseX && mouseY != lastMouseY) {
            if (c instanceof BrowserView) {
                Point p = new Point(Math.round(SwingUtils.map(mouseX - x, 0, width, 0, c.getWidth())), Math.round(SwingUtils.map(mouseY - y, 0, height, 0, c.getHeight())));

                Point globalP = p.getLocation();
                SwingUtilities.convertPointToScreen(globalP, c);

                BrowserView view = (BrowserView) c;

                SwingUtils.forwardMouseMoveEvent(view.getBrowser(), p.x, p.y, globalP.x, globalP.y);
            }
        }
    }
    lastMouseX = mouseX;
    lastMouseY = mouseY;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号