Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Problem with callin components in jpanel

874712Jul 11 2011 — edited Jul 12 2011
I created a function to change panels in jPanel1 of my application. This code worked for a while, but as I added a panel it stopped working. Now it is not working for any of the panels, it was working with before.
The change panel function is as follows:
public void changePanel(JPanel panelchange)
    {
    System.out.println("entered in changePanel function phase1"); // just for debugging purpose
    //panelchange  = new EditMemberPanel();
    panelchange.setVisible(true);
        jPanel1.removeAll();
        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(this.jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(panelchange, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        System.out.println("entered in changePanel function phase2"); // just for debugging purpose
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(panelchange, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())

        );
        System.out.println("exiting changePanel function"); // just for debugging purpose
        
}
when I call this fuction all the debugging phrases are coming in the command line, even the size of the panel is changing as the size of the panel passed, but the components are'nt visible. Any help will be highly appreciated. thnx

Edited by: 871709 on 12-Jul-2011 02:21

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Aug 9 2011
Added on Jul 11 2011
4 comments
877 views