Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: Java Error JInternalFrame on the next showing

  1. #1
    Junior Member
    Join Date
    May 2013
    Location
    Indonesia
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Java Error JInternalFrame on the next showing

    I have problem with showing jInternalFrame from another jInternalFrame to JDesktopane, i'm use Netbeans IDE. First show no problem appears but when the jInternalFrame close with dispose() and want to show again error appears.

    This is the error message :
    Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: illegal component position
    	at java.awt.Container.addImpl(Container.java:1093)
    	at javax.swing.JLayeredPane.addImpl(JLayeredPane.java:230)
    	at javax.swing.JDesktopPane.addImpl(JDesktopPane.java:474)
    	at java.awt.Container.add(Container.java:410)
    	at InternalTes.FrameMaster.menuTambahActionPerformed(FrameMaster.java:83)
    	at InternalTes.FrameMaster.access$000(FrameMaster.java:13)
    	at InternalTes.FrameMaster$1.actionPerformed(FrameMaster.java:49)
    	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
    	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
    	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
    	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
    	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
    	at java.awt.Component.processMouseEvent(Component.java:6505)
    	at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
    	at java.awt.Component.processEvent(Component.java:6270)
    	at java.awt.Container.processEvent(Container.java:2229)
    	at java.awt.Component.dispatchEventImpl(Component.java:4861)
    	at java.awt.Container.dispatchEventImpl(Container.java:2287)
    	at java.awt.Component.dispatchEvent(Component.java:4687)
    	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
    	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
    	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
    	at java.awt.Container.dispatchEventImpl(Container.java:2273)
    	at java.awt.Window.dispatchEventImpl(Window.java:2719)
    	at java.awt.Component.dispatchEvent(Component.java:4687)
    	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735)
    	at java.awt.EventQueue.access$200(EventQueue.java:103)
    	at java.awt.EventQueue$3.run(EventQueue.java:694)
    	at java.awt.EventQueue$3.run(EventQueue.java:692)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
    	at java.awt.EventQueue$4.run(EventQueue.java:708)
    	at java.awt.EventQueue$4.run(EventQueue.java:706)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    	at java.awt.EventQueue.dispatchEvent(EventQueue.java:705)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
    	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
    	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
    	at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)

    This is FrameMaster(JInternalFrame) Code :
    package InternalTes;
     
    /**
     *
     * @author Vikar
     */
    public class FrameMaster extends javax.swing.JInternalFrame {
     
        /**
         * Creates new form FrameMaster
         */
        public FrameMaster() {
            initComponents();
        }
     
        private static FrameMaster instance;
        public static FrameMaster getInstance() {
            if(instance == null){
                instance = new FrameMaster();
            }
            return instance;
        }
     
        /**
         * This method is called from within the constructor to initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is always
         * regenerated by the Form Editor.
         */
        @SuppressWarnings("unchecked")
        // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
        private void initComponents() {
     
            btnShowChild = new javax.swing.JButton();
     
            btnShowChild.setText("Show");
            btnShowChild.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    btnShowChildActionPerformed(evt);
                }
            });
     
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(btnShowChild)
                    .addContainerGap(336, Short.MAX_VALUE))
            );
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(238, 238, 238)
                    .addComponent(btnShowChild)
                    .addContainerGap(17, Short.MAX_VALUE))
            );
     
            pack();
        }// </editor-fold>                        
     
        private void btnShowChildActionPerformed(java.awt.event.ActionEvent evt) {                                             
            // TODO add your handling code here:
            FrameChild wd = FrameChild.getInstance();
            if(wd.isVisible()){
               wd.toFront();
            }else {
                Window.jDesktopPane1.add(wd);
                wd.setVisible(true);
            }
        }                                            
     
     
        // Variables declaration - do not modify                     
        private javax.swing.JButton btnShowChild;
        // End of variables declaration                   
    }

    This is FrameChild(JInternalFrame) Code :
    package InternalTes;
     
    /**
     *
     * @author Vikar
     */
    public class FrameChild extends javax.swing.JInternalFrame {
     
        /**
         * Creates new form input
         */
        public FrameChild() {
            initComponents();
        }
     
        private static FrameChild myInstance;
        public static FrameChild getInstance() {
            if(myInstance == null){
                myInstance = new FrameChild();
            }
            return myInstance;
        }
     
        /**
         * This method is called from within the constructor to initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is always
         * regenerated by the Form Editor.
         */
        @SuppressWarnings("unchecked")
        // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
        private void initComponents() {
     
            btnClose = new javax.swing.JButton();
     
            btnClose.setText("jButton1");
            btnClose.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    btnCloseActionPerformed(evt);
                }
            });
     
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addContainerGap(311, Short.MAX_VALUE)
                    .addComponent(btnClose)
                    .addContainerGap())
            );
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addContainerGap(244, Short.MAX_VALUE)
                    .addComponent(btnClose)
                    .addContainerGap())
            );
     
            pack();
        }// </editor-fold>                        
     
        private void btnCloseActionPerformed(java.awt.event.ActionEvent evt) {                                         
            // TODO add your handling code here:
            dispose();
        }                                        
     
     
        // Variables declaration - do not modify                     
        private javax.swing.JButton btnClose;
        // End of variables declaration                   
    }

    For Window(JFrame), I did not include it here because the code just usual JFrame & JDesktoPane inside. Please Master of java programming here please it's support, this problem make me crazy for a half years. My System Information Project stuck only because of this problem, i have no problem for using unbranched JInternalFrame.

    Thanks, Best & Regrads.


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Java Error JInternalFrame on the next showing

    This is your second topic on this same problem. The previous thread was reportedly solved. Why are we visiting this again, and what has changed since your original thread?

    As I asked in the orignal thread, post code - as short as possible - with instructions to reliably repeat the problem so that we can run and see the problem ourselves. There's not much we can do with the info you've given so far.

    The code you've posted also has the fingerprints of being crafted (I use the term generously) by the Netbeans GUIBuilder. If that's the case, you may have trouble finding help here, because the code produced by the GUIBuilder isn't meant to be fiddled with (understood, maintained, etc.). You may need to look for help with the GUIBuilder rather than with Java, because therein lies the root cause of the problem.

  3. #3
    Junior Member
    Join Date
    May 2013
    Location
    Indonesia
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Java Error JInternalFrame on the next showing

    sorry if it makes you confused, this is a new problem, because JDialog is a Top Container and can not replace JInternalFrame function. I tried comparing other programming languages ​​such as Power Builder. Looks like InternalFrame It can not be called from InternalFrame, do you agree with me?

  4. #4
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Java Error JInternalFrame on the next showing

    I don't understand the problem you're trying to solve. A short, runnable example would help.

  5. #5
    Junior Member
    Join Date
    May 2013
    Location
    Indonesia
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Java Error JInternalFrame on the next showing

    Quote Originally Posted by GregBrannon View Post
    I don't understand the problem you're trying to solve. A short, runnable example would help.
    Can I send you the Netbeans Project file that contain the problem?
    Thanks

Similar Threads

  1. Y is this showing a error???
    By harshilshah in forum What's Wrong With My Code?
    Replies: 4
    Last Post: May 22nd, 2013, 08:45 AM
  2. Replies: 3
    Last Post: March 6th, 2012, 03:50 AM
  3. Why it is showing error??
    By Sreejith63 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: January 12th, 2012, 12:16 AM
  4. Replies: 1
    Last Post: September 26th, 2011, 07:23 AM
  5. Showing JPanel error
    By Fermen in forum What's Wrong With My Code?
    Replies: 5
    Last Post: June 20th, 2011, 12:12 PM

Tags for this Thread