I am programmi an application for mac and I would like to have an about window to show to the user some infos, like the one of Finder.
Actually I am using this code:
System.setProperty("apple.laf.useScreenMenuBar", "true");
// SET NAME IN THE MACMENUBAR
System.setProperty("com.apple.mrj.application.apple.menu.about.name", Constants.APP_NAME);
Application application = Application.getApplication();
Image image = Toolkit.getDefaultToolkit().getImage("res/logo.png");
application.setDockIconImage(image);
application.setAboutHandler(new AboutHandler() {
public void handleAbout(AboutEvent arg0) {
JOptionPane.showMessageDialog(null, "Some infos.");
}
});;
but the thing that I obtain is not what I want, because is a dialog box with the “logo.png” image on the left and the text on the right. And also a big awful “OK” button that you must press to close the window.
How can I make a simple about window like Finder’s ?
Can you help me? I found many tutorial on the net, but all are using deprecated methods in Application class.
(sorry for my bad english, I am italian)
You have at least two options:
Create a
JPanel(possibly your own subclass) and layout the components in it as you want. Then show it withJOptionPane.showMessageDialog()by passing it as the first argument, rather than passingnullas you have.Create a
JDialogand layout the components yourself. Again, you may want to create a subclass ofJDialogto do this.