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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T12:54:37+00:00 2026-06-02T12:54:37+00:00

I am using netbeans to create a desktop application, and I am trying to

  • 0

I am using netbeans to create a desktop application, and I am trying to change the background color of a JButton, btn1 using the code

btn1.setBackground(Color.Red)

But this does not work. Instead of changing the fill color of the button, only the border color is changed. How can I change the background fill?

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-02T12:54:39+00:00Added an answer on June 2, 2026 at 12:54 pm

    See this related question and answer.

    In particular, you can use setForeground() to change the color of a button’s text, but the corresponding setBackground() doesn’t read well on some platforms. Using a Border is one alternative; a colored panel, shown below, is another.

    You can also try calling setOpaque(true) on your button.

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

Sidebar

Related Questions

I tried to create a new Swing GUI desktop application template using NetBean 7.0
I'm using NetBeans, trying to change the familiar Java coffee cup icon to a
I'm programming a desktop application in Java using NetBeans . My question is this:
I am working on a desktop application which uses JavaDB. I am using NetBeans
i am using Netbeans to create a Web Service and the code is written
I am using Jboss and Netbeans to create Spring MVC web application on windows.
I am using Netbeans 6.9 and Glassfish 3.1 to create my web application. Now,
I'm trying to create a java desktop application that holds desktop icons. The app
I am using NetBeans to create my first Ruby on Rails application. Is there
I'm using Netbeans to develop a Java application and I want to create a

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.