1

我希望在 GlassPane 前面显示一个 InternalFrame。在我的程序中,用户应该能够点击 FILE -> Settings 并且应该显示一个 InternalFrame。背景中的所有内容都应该用 GlassPane 覆盖。有人有想法吗?

m21.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
        Settings settings = new Settings();

        //get the InternalFrame
        settings.getFrame().setBounds(100,100,getWidth()-200, getHeight()-200);
        settings.getFrame().toFront();

        setGlassPane(new Glass());
        getGlassPane().setVisible(true);

        //get the InternalFrame
        getLayeredPane().add(settings.getFrame(), BorderLayout.NORTH);
        getLayeredPane().moveToFront(settings.getFrame());

        repaint();
    }
});

玻璃板

4

1 回答 1

0

玻璃窗格的重点是在其他一切之前:

玻璃板

但是,您可以将任何组件设置为玻璃窗格。我的建议是您将设置框架的内容推送为玻璃窗格。

于 2020-12-21T07:43:05.577 回答