LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-15-2012, 07:52 PM   #1
mia_tech
Member
 
Registered: Dec 2007
Location: FL, USA
Distribution: CentOS 5.3, Ubuntu 9.04
Posts: 245

Rep: Reputation: 16
how to implement an about box in java gui


guys, I have a gui designed in netbeans, and I want to implement an about dialog box underneath the help menu. How could I do that?

Thanks
 
Old 07-17-2012, 05:26 AM   #2
dwhitney67
Senior Member
 
Registered: Jun 2006
Location: Maryland
Distribution: Kubuntu, Fedora, RHEL
Posts: 1,541

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
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.
 
Old 07-21-2012, 12:50 AM   #3
mia_tech
Member
 
Registered: Dec 2007
Location: FL, USA
Distribution: CentOS 5.3, Ubuntu 9.04
Posts: 245

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by dwhitney67 View Post
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.
yeah, this is fine and all, but I remember doing this from the gui(dragging the menus) sometime ago, and that's what I was looking for
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] A bit confused trying to implement jgoodies LOOKS - java - Fedora 14 rmknox Programming 2 06-20-2011 06:45 PM
How to implement a web GUI front-end? RogueWarrior65 Linux - Embedded & Single-board computer 6 02-23-2011 10:23 AM
how to setup a network using 1 cpu i.e how to implement linux multiuer one box concep zigmos Linux - Newbie 1 09-16-2009 12:32 PM
how to implement ddclient on Red Hat Enterprise 4.0 Box ? joszy Linux - Server 1 03-01-2008 02:57 AM
LXer: Implement a relaxed immutability model in Java LXer Syndicated Linux News 0 02-27-2007 08:01 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:24 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration