user3759750
user3759750

Reputation: 153

getPopup() of PopupFactory not called on Mac

I have extended javax.swing.PopupFactory class and override getPopup(). Also I have set as shared instance for PopupFactory. I have put logs in getPopup() method.

On Windows I can see the logs of getPopup(). But on Mac the logs are not showing. It seems like on Mac, the getPopup() method is not called.

Can anyone help me why the method is not called on Mac? How can I override the getPopup() on Mac?

Here is my custom PopupFactory and the class in which I pack a combo box in frame.

 public class PopupExample {

    public static void main(String args[]) {
        PopupFactory.setSharedInstance(new PopupFactory() {

            public Popup getPopup(Component owner, Component contents, int x, int y)
                    throws IllegalArgumentException {
                System.out.println("getPopup called...");
                return super.getPopup(owner, contents, x, y);
            }
        });
        JFrame f = new JFrame();
        f.getContentPane().add(new JComboBox(new String[]{"a","b","c"}));
        f.pack();
        f.setVisible(true);
    }
}

On Windows I can see the message "getPopup called..." in the console when I click on combobox to open. But on Mac it didn't show the message.

Upvotes: 0

Views: 187

Answers (0)

Related Questions