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 8841245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:39:57+00:00 2026-06-14T10:39:57+00:00

Here is the JPanel class that is having the issue: public class EntryDialog extends

  • 0

Here is the JPanel class that is having the issue:

public class EntryDialog extends JPanel{

private static final long serialVersionUID = 1L;

MainWindow         mainWindow;
Image              background;
JButton            continueresume;
JButton            newresume;
JButton            settings;
JButton            exit;

public EntryDialog(MainWindow mainWindow){

    continueresume            = new JButton("Continue resume");
    newresume                 = new JButton("New resume");
    settings                  = new JButton("Settings");
    exit                      = new JButton("Exit");
    this.mainWindow           = mainWindow;
    this.background           = Utilities.getImage("images\\entryDialogBackground.jpg", true);

    this.setLayout(null);

    //continueresume button
    continueresume.setBounds(Utilities.getScaledWidth(1150), 
            Utilities.getScaledHeight(150), 
            Utilities.getScaledWidth(500), 
            Utilities.getScaledHeight(50));

    //newresume button
    newresume.setBounds(Utilities.getScaledWidth(1150), 
            Utilities.getScaledHeight(220), 
            Utilities.getScaledWidth(500), 
            Utilities.getScaledHeight(50));

    //settings button
    settings.setBounds(Utilities.getScaledWidth(1150), 
            Utilities.getScaledHeight(290), 
            Utilities.getScaledWidth(500), 
            Utilities.getScaledHeight(50));
    //exit button
    exit.setBounds(Utilities.getScaledWidth(1150), 
            Utilities.getScaledHeight(360), 
            Utilities.getScaledWidth(500), 
            Utilities.getScaledHeight(50));

    this.add(continueresume);
    this.add(newresume);
    this.add(settings);
    this.add(exit);

}

@Override
public void paintComponent(Graphics g){
    super.paintComponent(g);
    Graphics2D g2d = (Graphics2D) g;
    if(background != null){
        g2d.drawImage(background, 0, 0, this);
    }
    g2d.dispose();
}

This JPanel is being painted to a main frame in another class. What is happening is “background” is being painted just fine, but the buttons are not. The buttons appear once I hover over them with my mouse but until then they are invisible. I have searched for hours and not come to a solution so any help would be appreciated. Thanks!

  • 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-06-14T10:39:58+00:00Added an answer on June 14, 2026 at 10:39 am

    I’d have to guess it’s happening in your paintComponent method. You’re calling super.paintComponent() will draw everything like usual including the buttons. Then you’re drawing over it with g2d.drawImage(). You should draw the background first.

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

Sidebar

Related Questions

I have a class whitch extends JPanel: public class ButtonPanel extends JPanel { private
i simply implemented class that inherits JPanel like below public class Orpanel extends JPanel
Here is my code... import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; public class
Here's the view: @if (stream.StreamSourceId == 1) { <img class=source src=@Url.Content(~/Public/assets/images/own3dlogo.png) alt= /> }
I have created a class that extends JLabel to use as my object moving
I am attempting to write a pretty short class that ties a JPanel to
I need to pass a JPanel extending class to the main class. Here is
I have class main extends jframe , it has a button that calls /shows
I am using NetBeans, and I have a class that extends to JDialog, inside
Recently I asked here how to add a new JPanel to JFrame . The

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.