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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:53:46+00:00 2026-06-07T22:53:46+00:00

In my problem I have an opaque JPanel and another JPanel that is translucent(semi-transparent)

  • 0

In my problem I have an opaque JPanel and another JPanel that is translucent(semi-transparent) which sits on the first JPanel. When I have added radio buttons onto the top JPanel. The problem is every time I enter mouse over the area of the label of each radio button(and every time I move mouse away from the label), it gets darker and darker.

package trial;

import java.awt.Color;
import javax.swing.ButtonGroup;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JRadioButton;

public class Test {

public static void main(String arg[]){
    JFrame rootframe = new JFrame("Test panel");
    rootframe.setSize(800, 550);
    rootframe.setExtendedState(JFrame.MAXIMIZED_BOTH);

    JPanel basePanel = new JPanel(); //fills rootFrame
    basePanel.setOpaque(true);
    basePanel.setBackground(Color.yellow );     

    JPanel panelContainingRadioButtons = new JPanel();//wraps radio buttons
    panelContainingRadioButtons.setOpaque(true);
    panelContainingRadioButtons.setBackground(new Color(0,0,0,100) );

    ButtonGroup buttonGroup1 = new ButtonGroup();

    JRadioButton jRadioButton1 = new JRadioButton();
    jRadioButton1.setText("Text A...............................");
    jRadioButton1.setOpaque(false);
    jRadioButton1.setForeground( Color.white);
    buttonGroup1.add(jRadioButton1);

    JRadioButton jRadioButton2 = new JRadioButton();
    jRadioButton2.setOpaque(false);
    jRadioButton2.setForeground( Color.white);
    buttonGroup1.add(jRadioButton2);
    jRadioButton2.setText("Text B.......................");

    JRadioButton jRadioButton3 = new JRadioButton();
    jRadioButton3.setOpaque(false);
    jRadioButton3.setForeground( Color.white);
    buttonGroup1.add(jRadioButton3);
    jRadioButton3.setText("Text C................................");

    panelContainingRadioButtons.add(jRadioButton1);
    panelContainingRadioButtons.add(jRadioButton2);
    panelContainingRadioButtons.add(jRadioButton3);

    basePanel.add(panelContainingRadioButtons);

    rootframe.add(basePanel);
    rootframe.setVisible(true);

}
}

I believe this is not a problem with radio buttons because, in another occasion I have observed that under same conditions, if I added a JLabel to the top JPanel, and add listeners to the top Panel so that the color of the text of jLabel will change when the mouse is hovered over, and reset to orginal color when the mouse exits, the text gets redrawn in different places as in the image below:-

http://s13.postimage.org/6yn3cw48n/Untitled.png

If necessary I will post that code too. I think it is the same problem that is there in both cases.

  • 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-07T22:53:48+00:00Added an answer on June 7, 2026 at 10:53 pm

    You get these painting artifacts probably because of transparent color that is used for a background. JComponents do not support transparent colors as background colors. Here is a good article by @camickr that explains in details the issue and also provides an alternative solution.

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

Sidebar

Related Questions

i'm studying iOS programming. but i have a problem, which is opaque. now assume.
I have a Sprite that contains opaque objects surrounded by transparent pixels. I also
I want to have a div that is semi opaque filled with text that
Problem: Have made a small mail program which works perfectly on my developer pc
I've seen that a few instances of this problem have been raised already. However,
Problem: I have a table that prints out vertical but I would like it
Problem: I have a value that is set in $record, for instance 1.69. Then
Problem: I have a string that looks like this: [1=>2,3,4][5=>6,7,8][9=>10,11,12][13=>14,15][16=>17,18] Question: How can you
Problem I have computed a probability density function that depends on two variables. I
Problem I have a UDPlistener application that I need to write a unit test

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.