Page 2 of 2 FirstFirst 12
Results 21 to 23 of 23
  1. #21
    TimHuey is offline Member
    Join Date
    Aug 2009
    Posts
    50
    Rep Power
    0

    Default

    First I would like to say I think NetBeans led me down the wrong path with the code in their skeleton Template for GUI apps that says:

    Java Code:
    /**
         * A convenient static getter for the application instance.
         * @return the instance of GuiPiecesApp
         */
        public static BiditApp getApplication() {
            return Application.getInstance(BiditApp.class);
        }
    If you use that method like I do here:

    Java Code:
    private javax.swing.JRadioButton sort6button;
        private javax.swing.JList sort7Contain;
        private javax.swing.JRadioButton sort7button;
        private javax.swing.JLabel statusAnimationLabel;
        private javax.swing.JLabel statusMessageLabel;
        private javax.swing.JPanel statusPanel;
        private javax.swing.JList trashContain;
        private javax.swing.JRadioButton trashbutton;
        // End of variables declaration                   
        private DefaultListModel bidLinesdlm = new DefaultListModel(); //added per Tim Huey and Netbeans.org
        private DefaultListModel sort1Listdlm = new DefaultListModel();
        private DefaultListModel sort2Listdlm = new DefaultListModel();
        private DefaultListModel sort3Listdlm = new DefaultListModel();
        private DefaultListModel sort4Listdlm = new DefaultListModel();
        private DefaultListModel sort5Listdlm = new DefaultListModel();
        private DefaultListModel sort6Listdlm = new DefaultListModel();
        private DefaultListModel sort7Listdlm = new DefaultListModel();
        private DefaultListModel trashListdlm = new DefaultListModel();
        private DefaultListModel bidListdlm = new DefaultListModel();
        private ListTransferHandler lh;
    
        private DefaultListModel lm = new DefaultListModel(); //added per Tim Huey and Netbeans.org
        private final Timer messageTimer;
        private final Timer busyIconTimer;
        private final Icon idleIcon;
        private final Icon[] busyIcons = new Icon[15];
        private int busyIconIndex = 0;
        private LineObject line;
        private ArrayList lines = new ArrayList(), sequences=new ArrayList();
        private Vector panelist = new Vector();
        private Hashtable seqHashTable = new Hashtable();
        private Hashtable lineHashTable = new Hashtable();
        private String[] seqText = new String[6];
        [B][COLOR="Red"]JFrame mainFrame = BiditApp.getApplication().getMainFrame();[/COLOR][/B]
    The program will not terminate correctly. However, NetBeans uses it in the aboutBox method and it closes correctly. So I investigated what was happening in the aboutbox class and found the word SUPER. I decided to see if that could be used in my program and if it would fix the error. So I did this:

    Java Code:
    private javax.swing.JRadioButton sort6button;
        private javax.swing.JList sort7Contain;
        private javax.swing.JRadioButton sort7button;
        private javax.swing.JLabel statusAnimationLabel;
        private javax.swing.JLabel statusMessageLabel;
        private javax.swing.JPanel statusPanel;
        private javax.swing.JList trashContain;
        private javax.swing.JRadioButton trashbutton;
        // End of variables declaration                   
        private DefaultListModel bidLinesdlm = new DefaultListModel(); //added per Tim Huey and Netbeans.org
        private DefaultListModel sort1Listdlm = new DefaultListModel();
        private DefaultListModel sort2Listdlm = new DefaultListModel();
        private DefaultListModel sort3Listdlm = new DefaultListModel();
        private DefaultListModel sort4Listdlm = new DefaultListModel();
        private DefaultListModel sort5Listdlm = new DefaultListModel();
        private DefaultListModel sort6Listdlm = new DefaultListModel();
        private DefaultListModel sort7Listdlm = new DefaultListModel();
        private DefaultListModel trashListdlm = new DefaultListModel();
        private DefaultListModel bidListdlm = new DefaultListModel();
        private ListTransferHandler lh;
    
        private DefaultListModel lm = new DefaultListModel(); //added per Tim Huey and Netbeans.org
        private final Timer messageTimer;
        private final Timer busyIconTimer;
        private final Icon idleIcon;
        private final Icon[] busyIcons = new Icon[15];
        private int busyIconIndex = 0;
        private LineObject line;
        private ArrayList lines = new ArrayList(), sequences=new ArrayList();
        private Vector panelist = new Vector();
        private Hashtable seqHashTable = new Hashtable();
        private Hashtable lineHashTable = new Hashtable();
        private String[] seqText = new String[6];
        [B][COLOR="Red"]JFrame mainFrame = super.getFrame();[/COLOR][/B]
    
       private JDialog seq1Dialog = new JDialog(mainFrame,"Expanded Sequence 1 View");
        private JDialog seq2Dialog = new JDialog(mainFrame,"Expanded Sequence 2 View");
        private JDialog seq3Dialog = new JDialog(mainFrame,"Expanded Sequence 3 View");
        private JDialog seq4Dialog = new JDialog(mainFrame,"Expanded Sequence 4 View");
    and VOILA it works. And whats more, the whole program works as before and it now shuts down correctly. You may throw praises at me now or flowers or money!!! I probably wasn't using the method of getting the frame correctly in the first place but the directions sure appeared to indicate I could do it that way. Oh well, hope it helps anyone who might be having the same problem. I learned to program using punchcards on a IBM 360 mainframe. OOP is kicking my butt. When I went to college C was a neat idea that MIGHT catch on someday but wasn't a required course.
    Last edited by TimHuey; 09-06-2009 at 05:05 AM.

  2. #22
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Congrats. What you are dealing with is more than just plain Swing here but is with Java's Swing Application Framework. I think it's safe to say that most of us here build GUIs without using NetBean's GUI Builder, and so don't have to deal with this issue.

    Thanks for posting your solution and look forward to seeing you here.

    /Pete

  3. #23
    TimHuey is offline Member
    Join Date
    Aug 2009
    Posts
    50
    Rep Power
    0

    Default

    Quote Originally Posted by Fubarable View Post
    I think it's safe to say that most of us here build GUIs without using NetBean's GUI Builder

    /Pete
    WOW! I would love to do that. Matisse has caused so many headaches for me. But there would be no way I could have done the project without it. So I'm stuck with it.

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Halt applet processes.
    By barusk in forum Java Applets
    Replies: 1
    Last Post: 04-06-2009, 05:11 PM
  2. killing a java process
    By paritoshcg in forum Advanced Java
    Replies: 3
    Last Post: 12-01-2008, 08:16 AM
  3. Killing an Ill-behaved Thread
    By John6715 in forum Threads and Synchronization
    Replies: 6
    Last Post: 10-03-2008, 08:35 AM
  4. Thread killing
    By denis in forum Threads and Synchronization
    Replies: 13
    Last Post: 09-25-2008, 09:28 PM
  5. netbeans processes don´t die
    By karlen in forum NetBeans
    Replies: 0
    Last Post: 06-11-2007, 09:55 PM

Posting Permissions

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