Here's a snip of code that shows how to display an "about" dialog for a GUI.
Code:
public MyGUI()
{
JMenuBar menubar = new JMenuBar(); // create menu bar
...
JMenu help = new JMenu("Help"); // create help menu
JMenuItem about = new JMenuItem("About MyGUI"); // create help menu item
help.add(about); // add that item to the menu
...
menubar.add(help); // add the help menu to the menubar
...
// set the action listener to call the method aboutMyGUI()
about.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
aboutMyGUI();
} });
...
}
/**
* Displays a pop-up dialog with information about my GUI.
*/
private void aboutMyGUI()
{
final String title = "About GUI Tool";
final String message = "Tool Version 1.0\n\n" +
"For support, contact: LinuxQuestions.org";
SwingUtilities.invokeLater(new Runnable()
{
@Override
public void run()
{
JOptionPane.showMessageDialog(null, message, title, JOptionPane.INFORMATION_MESSAGE);
}
});
}
P.S. Why don't you procure a text book that covers the basics of Java Swing Programming? Some of the questions you ask are soooo basic. One book that comes to mind is "Introduction to Java Programming" by Y. Daniel Liang.