Results 1 to 2 of 2
  1. #1
    X-mac is offline Member
    Join Date
    Dec 2010
    Location
    Italy
    Posts
    1
    Rep Power
    0

    Default Launch a Jdialog from menů

    Hi everybody, I'm very very new in Java and I would like to implement some project: Now I'm using NetBeans 7, I had just create a simple project with a Main form and 3 JDialog Form.
    In my Main Form I have an Menů with some MenuItem, every menuItem will be launch a Jdialog.
    By Netbeans I can link an action from menů at form, but when i need write code for those action I can't understend how to do.
    I have see the code for the AboutBox action in the menů, I had try to replicate that code, but don't work.
    Someone can help me?

    The code that for Action to show AboutBox
    @Action
    public void showAboutBox() {
    if (aboutBox == null) {
    JFrame mainFrame = VigiliDelFuocoApp.getApplication().getMainFrame();
    aboutBox = new VigiliDelFuocoAboutBox(mainFrame);
    aboutBox.setLocationRelativeTo(mainFrame);
    }
    VigiliDelFuocoApp.getApplication().show(aboutBox);
    }
    ---this code work---
    but if i try to copy and past with modify:
    @Action
    public void showAboutBox() {

    JFrame mainFrame = VigiliDelFuocoApp.getApplication().getMainFrame();
    AnaBox = new VigiliDelFuocoAnagrafica(mainFrame);
    AnaBox.setLocationRelativeTo(mainFrame);

    VigiliDelFuocoApp.getApplication().show(AnaBox);
    }

    This action don't work

    Tank you for help

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,457
    Rep Power
    20

    Default

    Reading generated code isn't the best, or even a good, way to learn Swing coding. Go through the tutorials instead.
    Trail: Creating a GUI With JFC/Swing (The Java™ Tutorials)

    db

Similar Threads

  1. Launch configuration
    By skittle in forum Eclipse
    Replies: 0
    Last Post: 03-01-2010, 12:57 AM
  2. Launch Error
    By roughjj in forum Eclipse
    Replies: 1
    Last Post: 10-30-2009, 08:59 PM
  3. Fill a menu dynamically when menu is shown
    By Java Tip in forum SWT Tips
    Replies: 0
    Last Post: 07-07-2008, 05:47 PM
  4. React to menu action and checkbox menu
    By Java Tip in forum javax.swing
    Replies: 0
    Last Post: 06-27-2008, 08:50 PM
  5. Replies: 7
    Last Post: 05-09-2008, 08:54 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •