Paul Kiddie

Creating a MessageBox in Java

January 05, 2010

I wanted to see if there was a Java equivalent of .NET’s MessageBox class. Turns out there is but it’s a little more hidden away as a static method on JOptionPane, so I’ve pasted the code here for referring to it in the future:

JOptionPane.showMessageDialog(null,"message","title"));

This creates and shows a message dialog with no parent with message “message and the title “title”.


👋 I'm Paul Kiddie, a software engineer working in London. I'm currently working as a Principal Engineer at trainline.