Solved

Problems copying a JPanel in NetBeans

Posted on 2009-03-29
5
1,377 Views
Last Modified: 2013-12-14
I'm trying to copy a JPanel that I created in NetBeans to another project in NetBeans.  When I copy the panel and then place it in the other project it looks exactly the same.  I can click on the 'Preview Design' button and everything looks like it should.  The problem is when I run the program none of the labels or buttons appear.  I've looked at the code and it looks correct.  How do I get this to work?  I have 8 panels to copy over so redoing them would be very unpleasant. Please help!
/*
 * welcomePanel.java
 *
 * Created on Mar 29, 2009, 8:24:51 PM
 */
 
package program_b_medical_software;
 
 
public class welcomePanel extends javax.swing.JPanel {
 
    controlPanel controlPanel = null;
    char password[];
 
    /** Creates new form welcomePanel */
    public welcomePanel(controlPanel controlPanel) {
        this.controlPanel = controlPanel;
        initComponents();
    }
 
    /** 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() {
 
        welcomePanel = new javax.swing.JPanel();
        titleLabel = new javax.swing.JLabel();
        welcomeLabel = new javax.swing.JLabel();
        newUserLabel = new javax.swing.JLabel();
        passwordLabel = new javax.swing.JLabel();
        userIDTextField = new javax.swing.JTextField();
        logonButton = new javax.swing.JButton();
        passwordField = new javax.swing.JPasswordField();
 
        setName("Form"); // NOI18N
 
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(program_b_medical_software.Program_B_Medical_SoftwareApp.class).getContext().getResourceMap(welcomePanel.class);
        welcomePanel.setBackground(resourceMap.getColor("welcomePanel.background")); // NOI18N
        welcomePanel.setName("welcomePanel"); // NOI18N
        welcomePanel.setPreferredSize(new java.awt.Dimension(787, 442));
 
        titleLabel.setFont(resourceMap.getFont("titleLabel.font")); // NOI18N
        titleLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        titleLabel.setText(resourceMap.getString("titleLabel.text")); // NOI18N
        titleLabel.setName("titleLabel"); // NOI18N
 
        welcomeLabel.setFont(resourceMap.getFont("welcomeLabel.font")); // NOI18N
        welcomeLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        welcomeLabel.setText(resourceMap.getString("welcomeLabel.text")); // NOI18N
        welcomeLabel.setName("welcomeLabel"); // NOI18N
 
        newUserLabel.setFont(resourceMap.getFont("newUserLabel.font")); // NOI18N
        newUserLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        newUserLabel.setText(resourceMap.getString("newUserLabel.text")); // NOI18N
        newUserLabel.setName("newUserLabel"); // NOI18N
 
        passwordLabel.setFont(resourceMap.getFont("passwordLabel.font")); // NOI18N
        passwordLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        passwordLabel.setText(resourceMap.getString("passwordLabel.text")); // NOI18N
        passwordLabel.setName("passwordLabel"); // NOI18N
 
        userIDTextField.setBackground(resourceMap.getColor("userIDTextField.background")); // NOI18N
        userIDTextField.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        userIDTextField.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.LOWERED));
        userIDTextField.setName("userIDTextField"); // NOI18N
 
        logonButton.setText(resourceMap.getString("logonButton.text")); // NOI18N
        logonButton.setName("logonButton"); // NOI18N
        logonButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                logonButtonMouseClicked(evt);
            }
        });
 
        passwordField.setBackground(resourceMap.getColor("passwordField.background")); // NOI18N
        passwordField.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        passwordField.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
        passwordField.setName("passwordField"); // NOI18N
 
        javax.swing.GroupLayout welcomePanelLayout = new javax.swing.GroupLayout(welcomePanel);
        welcomePanel.setLayout(welcomePanelLayout);
        welcomePanelLayout.setHorizontalGroup(
            welcomePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, welcomePanelLayout.createSequentialGroup()
                .addContainerGap(0, Short.MAX_VALUE)
                .addGroup(welcomePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(welcomePanelLayout.createSequentialGroup()
                        .addGap(227, 227, 227)
                        .addGroup(welcomePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                            .addComponent(titleLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 320, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(welcomeLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(logonButton, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(welcomePanelLayout.createSequentialGroup()
                        .addGap(208, 208, 208)
                        .addGroup(welcomePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(passwordLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(newUserLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(welcomePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(passwordField)
                            .addComponent(userIDTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 150, Short.MAX_VALUE))))
                .addGap(262, 262, 262))
        );
        welcomePanelLayout.setVerticalGroup(
            welcomePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, welcomePanelLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(titleLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(29, 29, 29)
                .addComponent(welcomeLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(83, 83, 83)
                .addGroup(welcomePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(newUserLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(userIDTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(31, 31, 31)
                .addGroup(welcomePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(passwordLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(passwordField, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(60, 60, 60)
                .addComponent(logonButton, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(36, 36, 36))
        );
 
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(welcomePanel, javax.swing.GroupLayout.PREFERRED_SIZE, 809, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(welcomePanel, javax.swing.GroupLayout.PREFERRED_SIZE, 410, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
    }// </editor-fold>
 
    private void logonButtonMouseClicked(java.awt.event.MouseEvent evt) {
        // userIDTextField.setText("Testing");
        String jobTitle;
        int returnCode = 0;
        String Message = " ";
        user user= new user();
        String userID = userIDTextField.getText().toString();
 
        password = passwordField.getPassword();
 
        
        String passwordString = new String(password);
       
        jobTitle = user.checkUser(userID, passwordString);
 
        if (jobTitle.contentEquals("")) {
            //error occurred return
            return;
        } else if (jobTitle.contentEquals("System Administrator")) {
        //    c1.show(mainPanel, "systemAdminPanel");
        } else if (jobTitle.contentEquals("Office Staff")) {
        //    c1.show(mainPanel, "officeStaffPanel");
        } else if (jobTitle.contentEquals("Doctor")) {
            //c1.show(mainPanel, "officeStaffPanel");
        } else if (jobTitle.contentEquals("Physician Assistant")) {
            //c1.show(mainPanel, "officeStaffPanel");
        } else if (jobTitle.contentEquals("Nurse")) {
            //c1.show(mainPanel, "officeStaffPanel");
        } else {
            //Medical Assistant
            //c1.show(mainPanel, "officeStaffPanel");
        }
      
    }
 
 
    // Variables declaration - do not modify
    private javax.swing.JButton logonButton;
    private javax.swing.JLabel newUserLabel;
    private javax.swing.JPasswordField passwordField;
    private javax.swing.JLabel passwordLabel;
    private javax.swing.JLabel titleLabel;
    private javax.swing.JTextField userIDTextField;
    private javax.swing.JLabel welcomeLabel;
    public javax.swing.JPanel welcomePanel;
    // End of variables declaration
 
}

Open in new window

0
Comment
Question by:mtnrunner2001a
  • 2
  • 2
5 Comments
 
LVL 20

Assisted Solution

by:Venabili
Venabili earned 75 total points
ID: 24019702
The elements are there - that's why you see them in preview but noone tells them to show up.
welcomePanel.setVisible(true) at the end of initComponents or something along these lines should fix the issue
You might want to check in the other program how they visualise it.
0
 
LVL 37

Accepted Solution

by:
zzynx earned 175 total points
ID: 24019703
>> I can click on the 'Preview Design' button and everything looks like it should.
Than it's OK.

>> The problem is when I run the program none of the labels or buttons appear.
It will be a problem in your program then.
Could you show us the complete program?
0
 

Author Comment

by:mtnrunner2001a
ID: 24021021
Attached is the rest of my classes.  It's crazy because my textfields show up and sometimes the button is displayed.  All I can do is scratch my head.
package program_b_medical_software;
 
import org.jdesktop.application.Application;
import org.jdesktop.application.SingleFrameApplication;
 
/**
 * The main class of the application.
 */
public class Program_B_Medical_SoftwareApp extends SingleFrameApplication {
 
    /**
     * At startup create and show the main frame of the application.
     */
    @Override protected void startup() {
        show(new Program_B_Medical_SoftwareView(this));
    }
 
    /**
     * This method is to initialize the specified window by injecting resources.
     * Windows shown in our application come fully initialized from the GUI
     * builder, so this additional configuration is not needed.
     */
    @Override protected void configureWindow(java.awt.Window root) {
    }
 
    /**
     * A convenient static getter for the application instance.
     * @return the instance of Program_B_Medical_SoftwareApp
     */
    public static Program_B_Medical_SoftwareApp getApplication() {
        return Application.getInstance(Program_B_Medical_SoftwareApp.class);
    }
 
    /**
     * Main method launching the application.
     */
    public static void main(String[] args) {
        launch(Program_B_Medical_SoftwareApp.class, args);
    }
}
 
package program_b_medical_software;
 
import org.jdesktop.application.Action;
import org.jdesktop.application.ResourceMap;
import org.jdesktop.application.SingleFrameApplication;
import org.jdesktop.application.FrameView;
import org.jdesktop.application.TaskMonitor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Timer;
import javax.swing.Icon;
import javax.swing.JDialog;
import javax.swing.JFrame;
 
/**
 * The application's main frame.
 */
public class Program_B_Medical_SoftwareView extends FrameView {
 
    controlPanel controlPanel = new controlPanel();
 
    public Program_B_Medical_SoftwareView(SingleFrameApplication app) {
        super(app);
 
        initComponents();
 
        setComponent(controlPanel);
        controlPanel.displayImage("welcomeScreen");
 
        // status bar initialization - message timeout, idle icon and busy animation, etc
        ResourceMap resourceMap = getResourceMap();
        int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout");
        messageTimer = new Timer(messageTimeout, new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                statusMessageLabel.setText("");
            }
        });
        messageTimer.setRepeats(false);
        int busyAnimationRate = resourceMap.getInteger("StatusBar.busyAnimationRate");
        for (int i = 0; i < busyIcons.length; i++) {
            busyIcons[i] = resourceMap.getIcon("StatusBar.busyIcons[" + i + "]");
        }
        busyIconTimer = new Timer(busyAnimationRate, new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                busyIconIndex = (busyIconIndex + 1) % busyIcons.length;
                statusAnimationLabel.setIcon(busyIcons[busyIconIndex]);
            }
        });
        idleIcon = resourceMap.getIcon("StatusBar.idleIcon");
        statusAnimationLabel.setIcon(idleIcon);
        progressBar.setVisible(false);
 
        // connecting action tasks to status bar via TaskMonitor
        TaskMonitor taskMonitor = new TaskMonitor(getApplication().getContext());
        taskMonitor.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                String propertyName = evt.getPropertyName();
                if ("started".equals(propertyName)) {
                    if (!busyIconTimer.isRunning()) {
                        statusAnimationLabel.setIcon(busyIcons[0]);
                        busyIconIndex = 0;
                        busyIconTimer.start();
                    }
                    progressBar.setVisible(true);
                    progressBar.setIndeterminate(true);
                } else if ("done".equals(propertyName)) {
                    busyIconTimer.stop();
                    statusAnimationLabel.setIcon(idleIcon);
                    progressBar.setVisible(false);
                    progressBar.setValue(0);
                } else if ("message".equals(propertyName)) {
                    String text = (String)(evt.getNewValue());
                    statusMessageLabel.setText((text == null) ? "" : text);
                    messageTimer.restart();
                } else if ("progress".equals(propertyName)) {
                    int value = (Integer)(evt.getNewValue());
                    progressBar.setVisible(true);
                    progressBar.setIndeterminate(false);
                    progressBar.setValue(value);
                }
            }
        });
    }
 
    @Action
    public void showAboutBox() {
        if (aboutBox == null) {
            JFrame mainFrame = Program_B_Medical_SoftwareApp.getApplication().getMainFrame();
            aboutBox = new Program_B_Medical_SoftwareAboutBox(mainFrame);
            aboutBox.setLocationRelativeTo(mainFrame);
        }
        Program_B_Medical_SoftwareApp.getApplication().show(aboutBox);
    }
 
    /** 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() {
 
        mainPanel = new javax.swing.JPanel();
        menuBar = new javax.swing.JMenuBar();
        javax.swing.JMenu fileMenu = new javax.swing.JMenu();
        javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem();
        javax.swing.JMenu helpMenu = new javax.swing.JMenu();
        javax.swing.JMenuItem aboutMenuItem = new javax.swing.JMenuItem();
        statusPanel = new javax.swing.JPanel();
        javax.swing.JSeparator statusPanelSeparator = new javax.swing.JSeparator();
        statusMessageLabel = new javax.swing.JLabel();
        statusAnimationLabel = new javax.swing.JLabel();
        progressBar = new javax.swing.JProgressBar();
 
        mainPanel.setName("mainPanel"); // NOI18N
 
        javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
        mainPanel.setLayout(mainPanelLayout);
        mainPanelLayout.setHorizontalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );
        mainPanelLayout.setVerticalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 252, Short.MAX_VALUE)
        );
 
        menuBar.setName("menuBar"); // NOI18N
 
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(program_b_medical_software.Program_B_Medical_SoftwareApp.class).getContext().getResourceMap(Program_B_Medical_SoftwareView.class);
        fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N
        fileMenu.setName("fileMenu"); // NOI18N
 
        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(program_b_medical_software.Program_B_Medical_SoftwareApp.class).getContext().getActionMap(Program_B_Medical_SoftwareView.class, this);
        exitMenuItem.setAction(actionMap.get("quit")); // NOI18N
        exitMenuItem.setName("exitMenuItem"); // NOI18N
        fileMenu.add(exitMenuItem);
 
        menuBar.add(fileMenu);
 
        helpMenu.setText(resourceMap.getString("helpMenu.text")); // NOI18N
        helpMenu.setName("helpMenu"); // NOI18N
 
        aboutMenuItem.setAction(actionMap.get("showAboutBox")); // NOI18N
        aboutMenuItem.setName("aboutMenuItem"); // NOI18N
        helpMenu.add(aboutMenuItem);
 
        menuBar.add(helpMenu);
 
        statusPanel.setName("statusPanel"); // NOI18N
 
        statusPanelSeparator.setName("statusPanelSeparator"); // NOI18N
 
        statusMessageLabel.setName("statusMessageLabel"); // NOI18N
 
        statusAnimationLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        statusAnimationLabel.setName("statusAnimationLabel"); // NOI18N
 
        progressBar.setName("progressBar"); // NOI18N
 
        javax.swing.GroupLayout statusPanelLayout = new javax.swing.GroupLayout(statusPanel);
        statusPanel.setLayout(statusPanelLayout);
        statusPanelLayout.setHorizontalGroup(
            statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(statusPanelSeparator, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
            .addGroup(statusPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(statusMessageLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 226, Short.MAX_VALUE)
                .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(statusAnimationLabel)
                .addContainerGap())
        );
        statusPanelLayout.setVerticalGroup(
            statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(statusPanelLayout.createSequentialGroup()
                .addComponent(statusPanelSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(statusMessageLabel)
                    .addComponent(statusAnimationLabel)
                    .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(3, 3, 3))
        );
 
        setComponent(mainPanel);
        setMenuBar(menuBar);
        setStatusBar(statusPanel);
    }// </editor-fold>                        
 
    // Variables declaration - do not modify                     
    private javax.swing.JPanel mainPanel;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JProgressBar progressBar;
    private javax.swing.JLabel statusAnimationLabel;
    private javax.swing.JLabel statusMessageLabel;
    private javax.swing.JPanel statusPanel;
    // End of variables declaration                   
 
    private final Timer messageTimer;
    private final Timer busyIconTimer;
    private final Icon idleIcon;
    private final Icon[] busyIcons = new Icon[15];
    private int busyIconIndex = 0;
 
    private JDialog aboutBox;
}
 
package program_b_medical_software;
 
import java.awt.*;
import java.awt.event.*;
 
/**
 *
 * @author Brigette
 */
public class controlPanel extends javax.swing.JPanel {
 
   //systemAdminPanel systemAdminPanel = new systemAdminPanel(this);
 
   //createUserPanel newUserPanel = new createUserPanel(this);
 
    welcomePanel welcomePanel = new welcomePanel(this);
 
   private CardLayout cards = new CardLayout();
 
    /** Creates new form controlPanel */
    public controlPanel() {
        initComponents();
 
        setLayout(cards);
        
       // add(systemAdminPanel, "systemAdminWelcome");
       // add(newUserPanel, "newUserForm");
        add(welcomePanel, "welcomeScreen");
    }
 
    /** 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() {
 
        jPanel1 = new javax.swing.JPanel();
 
        setName("Form"); // NOI18N
 
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(program_b_medical_software.Program_B_Medical_SoftwareApp.class).getContext().getResourceMap(controlPanel.class);
        jPanel1.setBackground(resourceMap.getColor("jPanel1.background")); // NOI18N
        jPanel1.setName("jPanel1"); // NOI18N
        jPanel1.setPreferredSize(new java.awt.Dimension(787, 442));
        jPanel1.setRequestFocusEnabled(false);
        jPanel1.setLayout(new java.awt.CardLayout());
 
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(0, 0, Short.MAX_VALUE)
                    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 400, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 0, Short.MAX_VALUE)))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 300, Short.MAX_VALUE)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(0, 0, Short.MAX_VALUE)
                    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 0, Short.MAX_VALUE)))
        );
    }// </editor-fold>                        
 
 
    // Variables declaration - do not modify                     
    private javax.swing.JPanel jPanel1;
    // End of variables declaration                   
 
    public void displayImage(String passedChoice) {
 
		System.out.println("passed choice = " + passedChoice);
 
		cards.show(this, passedChoice);
 
	}
 
}

Open in new window

0
 

Author Comment

by:mtnrunner2001a
ID: 24024479
Turns out I had an extra JPanel in my controlPanel which was screwing things up.  Once that was deleted everything worked. Thanks!
0
 
LVL 37

Expert Comment

by:zzynx
ID: 24026270
Good to hear you found the problem.
Thanx 4 axxepting
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question