Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 753233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T14:52:25+00:00 2026-05-14T14:52:25+00:00

in Netbeans, I am using Jlabels to display images and text within a JFrame.

  • 0

in Netbeans, I am using Jlabels to display images and text within a JFrame. The Jlabels display correctly in the IDE, but when I run or build the project, some of the Jlabels don’t show up(Labels that are added later on after the first few). To fix this problem I have to start all over again and add the images all at once. This sucks cause I went from 4 to 8 and now I need to add 20 more images. I really don’t want to start all over again.

 private void initComponents() {

    mainPanel = new javax.swing.JPanel();
    javax.swing.JSeparator statusPanelSeparator = new javax.swing.JSeparator();
    jButton2 = new javax.swing.JButton();
    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();
    statusMessageLabel = new javax.swing.JLabel();
    statusAnimationLabel = new javax.swing.JLabel();
    progressBar = new javax.swing.JProgressBar();
    jLabel1 = new javax.swing.JLabel();
    jFrame1 = new javax.swing.JFrame();
    jLayeredPane2 = new javax.swing.JLayeredPane();
    jLabel2 = new javax.swing.JLabel();
    PC = new javax.swing.JLabel();
    ALU = new javax.swing.JLabel();
    BC = new javax.swing.JLabel();
    DR = new javax.swing.JLabel();
    MUXB = new javax.swing.JLabel();
    MUXD = new javax.swing.JLabel();
    RF = new javax.swing.JLabel();
    IR = new javax.swing.JLabel();
    ID = new javax.swing.JLabel();
    bg = new javax.swing.JLabel();

    mainPanel.setMaximumSize(new java.awt.Dimension(1000, 1000));
    mainPanel.setMinimumSize(new java.awt.Dimension(800, 800));
    mainPanel.setName("mainPanel"); // NOI18N
    mainPanel.setPreferredSize(new java.awt.Dimension(900, 900));

    statusPanelSeparator.setName("statusPanelSeparator"); // NOI18N

    org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(honors231.Honors231App.class).getContext().getResourceMap(Honors231View.class);
    jButton2.setText(resourceMap.getString("jButton2.text")); // NOI18N
    jButton2.setName("jButton2"); // NOI18N
    jButton2.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton2ActionPerformed(evt);
        }
    });

    javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
    mainPanel.setLayout(mainPanelLayout);
    mainPanelLayout.setHorizontalGroup(
        mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(mainPanelLayout.createSequentialGroup()
            .addGap(3055, 3055, 3055)
            .addComponent(statusPanelSeparator, javax.swing.GroupLayout.DEFAULT_SIZE, 1, Short.MAX_VALUE))
        .addGroup(mainPanelLayout.createSequentialGroup()
            .addGap(305, 305, 305)
            .addComponent(jButton2)
            .addContainerGap(2678, Short.MAX_VALUE))
    );
    mainPanelLayout.setVerticalGroup(
        mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(mainPanelLayout.createSequentialGroup()
            .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(statusPanelSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addGap(1470, 1470, 1470))
        .addGroup(mainPanelLayout.createSequentialGroup()
            .addGap(11, 11, 11)
            .addComponent(jButton2)
            .addContainerGap(866, Short.MAX_VALUE))
    );

    menuBar.setMaximumSize(new java.awt.Dimension(60, 1000));
    menuBar.setName("menuBar"); // NOI18N

    fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N
    fileMenu.setName("fileMenu"); // NOI18N

    javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(honors231.Honors231App.class).getContext().getActionMap(Honors231View.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.setMaximumSize(new java.awt.Dimension(1000, 1000));
    statusPanel.setMinimumSize(new java.awt.Dimension(800, 800));
    statusPanel.setName("statusPanel"); // NOI18N
    statusPanel.setPreferredSize(new java.awt.Dimension(1000, 28));

    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)
        .addGroup(statusPanelLayout.createSequentialGroup()
            .addContainerGap()
            .addComponent(statusMessageLabel)
            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 830, 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(javax.swing.GroupLayout.Alignment.TRAILING, statusPanelLayout.createSequentialGroup()
            .addContainerGap(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))
    );

    jLabel1.setIcon(new javax.swing.ImageIcon("C:\\Users\\Davis\\Desktop\\cs231\\button0.png")); // NOI18N
    jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
    jLabel1.setName("jLabel1"); // NOI18N

    jFrame1.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
    jFrame1.setMinimumSize(new java.awt.Dimension(1600, 1000));
    jFrame1.setName("jFrame1"); // NOI18N
    jFrame1.setResizable(false);

    jLayeredPane2.setBackground(resourceMap.getColor("jLayeredPane2.background")); // NOI18N
    jLayeredPane2.setDoubleBuffered(true);
    jLayeredPane2.setName("jLayeredPane2"); // NOI18N

    jLabel2.setIcon(resourceMap.getIcon("jLabel2.icon")); // NOI18N
    jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
    jLabel2.setName("jLabel2"); // NOI18N
    jLabel2.setBounds(160, 330, 380, 280);
    jLayeredPane2.add(jLabel2, javax.swing.JLayeredPane.DEFAULT_LAYER);

    PC.setIcon(resourceMap.getIcon("PC.icon")); // NOI18N
    PC.setText(resourceMap.getString("PC.text")); // NOI18N
    PC.setName("PC"); // NOI18N
    PC.setBounds(360, 40, 257, 227);
    jLayeredPane2.add(PC, javax.swing.JLayeredPane.DEFAULT_LAYER);

    ALU.setIcon(resourceMap.getIcon("ALU.icon")); // NOI18N
    ALU.setText(resourceMap.getString("ALU.text")); // NOI18N
    ALU.setName("ALU"); // NOI18N
    ALU.setBounds(800, 490, 304, 300);
    jLayeredPane2.add(ALU, javax.swing.JLayeredPane.DEFAULT_LAYER);

    BC.setIcon(resourceMap.getIcon("BC.icon")); // NOI18N
    BC.setText(resourceMap.getString("BC.text")); // NOI18N
    BC.setName("BC"); // NOI18N
    BC.setBounds(40, 40, 257, 227);
    jLayeredPane2.add(BC, javax.swing.JLayeredPane.DEFAULT_LAYER);

    DR.setIcon(resourceMap.getIcon("DR.icon")); // NOI18N
    DR.setText(resourceMap.getString("DR.text")); // NOI18N
    DR.setName("DR"); // NOI18N
    DR.setBounds(1150, 570, 425, 320);
    jLayeredPane2.add(DR, javax.swing.JLayeredPane.DEFAULT_LAYER);

    MUXB.setIcon(resourceMap.getIcon("MUXB.icon")); // NOI18N
    MUXB.setText(resourceMap.getString("MUXB.text")); // NOI18N
    MUXB.setName("MUXB"); // NOI18N
    MUXB.setBounds(1210, 350, 246, 186);
    jLayeredPane2.add(MUXB, javax.swing.JLayeredPane.DEFAULT_LAYER);

    MUXD.setIcon(resourceMap.getIcon("MUXD.icon")); // NOI18N
    MUXD.setText(resourceMap.getString("MUXD.text")); // NOI18N
    MUXD.setName("MUXD"); // NOI18N
    MUXD.setBounds(710, 780, 246, 186);
    jLayeredPane2.add(MUXD, javax.swing.JLayeredPane.DEFAULT_LAYER);

    RF.setIcon(resourceMap.getIcon("RF.icon")); // NOI18N
    RF.setText(resourceMap.getString("RF.text")); // NOI18N
    RF.setName("RF"); // NOI18N
    RF.setBounds(930, 0, 450, 330);
    jLayeredPane2.add(RF, javax.swing.JLayeredPane.DEFAULT_LAYER);

    IR.setIcon(resourceMap.getIcon("IR.icon")); // NOI18N
    IR.setText(resourceMap.getString("IR.text")); // NOI18N
    IR.setName("IR"); // NOI18N
    IR.setBounds(460, 340, 300, 330);
    jLayeredPane2.add(IR, javax.swing.JLayeredPane.DEFAULT_LAYER);

    ID.setIcon(resourceMap.getIcon("ID.icon")); // NOI18N
    ID.setText(resourceMap.getString("ID.text")); // NOI18N
    ID.setName("ID"); // NOI18N
    ID.setBounds(100, 670, 500, 227);
    jLayeredPane2.add(ID, javax.swing.JLayeredPane.DEFAULT_LAYER);

    bg.setIcon(resourceMap.getIcon("bg.icon")); // NOI18N
    bg.setText(resourceMap.getString("bg.text")); // NOI18N
    bg.setName("bg"); // NOI18N
    bg.setBounds(0, 0, 1600, 1000);
    jLayeredPane2.add(bg, javax.swing.JLayeredPane.DEFAULT_LAYER);

    javax.swing.GroupLayout jFrame1Layout = new javax.swing.GroupLayout(jFrame1.getContentPane());
    jFrame1.getContentPane().setLayout(jFrame1Layout);
    jFrame1Layout.setHorizontalGroup(
        jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(jFrame1Layout.createSequentialGroup()
            .addComponent(jLayeredPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 1600, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addContainerGap(1714, Short.MAX_VALUE))
    );
    jFrame1Layout.setVerticalGroup(
        jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(jFrame1Layout.createSequentialGroup()
            .addComponent(jLayeredPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 1002, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addContainerGap(869, Short.MAX_VALUE))
    );

    setComponent(mainPanel);
    setMenuBar(menuBar);
    setStatusBar(statusPanel);
}// </editor-fold>                        
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T14:52:25+00:00Added an answer on May 14, 2026 at 2:52 pm

    Try running a clean and build (Run > Clean and Build Main Project). The NetBeans ant scripts do not track the fact that your class file has a dependency on the resource files, so when the class is compiled, it is copied to build/classes (and from there to the jar), but the resources are not.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using netbeans to develop some BPEL but can't figure out how to add
I am using NetBeans IDE and have created a new project. The new project
Using NetBeans IDE and Glassfish Server. For some reason I can't get a DataSource
I'm having trouble with debugging a PHP project through NetBeans using XDebug, and was
im using netbeans with svn. i've checked out a project and then i used
im using netbeans for svn. i open a project in netbeans and then i
I'm using NetBeans to develop some simple applications to solve puzzles . Upon launching
I am using NetBeans and JSF to do my project. Recently I encountered a
I am using Netbeans . I did some things with bindings and now whenever
I am using Netbeans and am trying to find a way for the IDE

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.