玻璃板绘画模型坏了吗?

Is glassPane painting model broken?

我想,cn1 绘画模型中有什么东西坏了。有人可以查看这是错误还是我做错了什么?

我想存档以下内容:

在窗体上有一个标签,它的文本以 1 秒的间隔用 UITimer 刷新。例如:

为了指示一些 activity 在表单上使用 form.setGlassPane(..) 在表单上方绘制阴影。问题是,标签上的文本更新标签被重新绘制,但玻璃面板没有被重新绘制,即阴影没有被绘制在标签上:

测试代码:

    final Form form = new Form("Welcome", new BoxLayout(BoxLayout.Y_AXIS));
    final Label label = new Label("..");
    Button button = new Button("Show Shade");
    form.addComponent(label);
    form.addComponent(button);

    button.addActionListener((e) -> {
        form.setGlassPane(new Painter() {

            public void paint(Graphics g, Rectangle rect) {
                int wasAlpha = g.getAlpha();
                g.setAlpha(50);
                g.setColor(0x101010);
                g.fillRect(rect.getX(), rect.getY(), rect.getWidth(), rect.getHeight());
                g.setAlpha(wasAlpha);
            }
        });
    });

    new UITimer(() -> {
        label.setText(new Date().toString());
    }).schedule(1000, true, form);
    form.show();

这似乎是由于不久前 issue 1680 的修复。我重新打开了这个问题,我们需要找出失败的原因。