JWebBrowser を使用できるように、DJ Native Swing API を使用しています。
public class GUI extends JPanel {
    Robot robot;
    JComponent glassPane;
    public GUI(final Bot bot) {
        super(new BorderLayout());
        try {
            robot = new Robot();
        } catch (AWTException e) {
            e.printStackTrace();
        }
        JPanel webBrowserPanel = new JPanel(new BorderLayout());
        JWebBrowser webBrowser = new JWebBrowser(JWebBrowser.constrainVisibility());
        webBrowser.setBarsVisible(false);
        webBrowser.setButtonBarVisible(false);
        webBrowser.setMenuBarVisible(false);
        webBrowser.navigate("http://google.com");
        webBrowserPanel.add(webBrowser, BorderLayout.CENTER);
        add(webBrowserPanel, BorderLayout.CENTER);
        JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 4, 4));
        final JButton button = new JButton("Start");
        button.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                if (bot.isRunning()) {
                    button.setText("Start");
                } else {
                    button.setText("Stop");
                }
                bot.setRunning(!bot.isRunning());
            }
        });
        buttonPanel.add(button, BorderLayout.WEST);
        add(buttonPanel, BorderLayout.NORTH);
        JFrame mainFrame = new JFrame("Bot");
        mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        mainFrame.getContentPane().add(this, BorderLayout.CENTER);
        glassPane = new JComponent()
        {
            public void paintComponent(Graphics g)
            {
                g.setColor(new Color(1, 0, 0, 0.5f));
                g.fillRect(10, 10, 815, 775);
            }
        };
        glassPane.setSize(815,775);
        glassPane.setOpaque(false);
       mainFrame.setGlassPane(glassPane);
        glassPane.setVisible(true);
        mainFrame.setSize(815, 775);
        mainFrame.setLocationRelativeTo(null);
        mainFrame.setVisible(true);
    }
}
これを実行すると、GUI 全体に赤い四角形が表示されるはずです。これは起こりません。これは私が見ているものです(申し訳ありませんが、直接画像を投稿することはできません): http://i.stack.imgur.com/ZAe51.png
JWebBrowser がガラス ペインの上に表示されるのはなぜですか? Glass Paneはすべてを超えるべきだと思いました。
JWebBrowser は JPanel を拡張します。ドキュメントは次のとおりです: Javadoc
このガラス ペインの私の目標は、ユーザーが GUI を使用しているときにマウスの位置を取得できるようにすることです。何らかの理由で、webBrowser.getMousePosition() または webBrowserPanel.getMousePosition() を使用して、マウスの位置が null を返します (コンポーネント上にあっても)。

