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

  • Home
  • SEARCH
  • 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 8066489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T12:00:50+00:00 2026-06-05T12:00:50+00:00

I have a Java application which uses the native LAF like so: UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); This

  • 0

I have a Java application which uses the native LAF like so:

    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

This is working great, however, I am trying to make a button have a red background, but ends up like this:

enter image description here

As you can see, I’m setting background and foreground on the button, but what results is not visually pleasing. Is there a way to have the button draw a red background without subclassing JButton?

  • 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-05T12:00:52+00:00Added an answer on June 5, 2026 at 12:00 pm

    For anybody who comes along the problem I did, here’s the solution I went with:

    I switched to using an image added as a child of the button using ImageIcon:

        BufferedImage stopPicture = null;
        try {
            stopPicture = ImageIO.read(new File("stop.png"));
        } catch (IOException ex) { }
        JLabel picLabel = new JLabel(new ImageIcon( stopPicture ));
        JButton btnStop = new JButton("");
        btnStop.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                SerialTest.getInstance().stopMoving();
            }
        });
        btnStop.add(picLabel);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this android application which uses java-javascript bridge to pick up information from
I am working under java application which uses XSLT transformation. I have a lot
I have an network application which uses a select loop like this: bool shutdown=false;
I have this Java application which uses a MySql Database which I want to
I have a standalone java application, which uses JPA for its persistence. Right now
I have Java application which sends pointer to function (callback) to some native dll
I have a Java application which interacts with native code using JNI. The native
i have created a java application which uses data from its config folder and
In eclipse workset I have an android library and an application which uses this
I have developed a Java Swing application, which uses the SwingWorker class to perform

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.