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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:02:28+00:00 2026-05-23T19:02:28+00:00

How can i do a initialization for the Frame() while its getting used inside

  • 0

How can i do a initialization for the Frame() while its getting used inside the super()? Like following in a valid way, so that the Frame and all super related has a color RED?

Note: Basically the right red box should not show because Color(r,g,b,ALPHA);

enter image description here

public class 999 extends Window 
{
  private JLabel label;
  private JButton button;
  private static final Canvas canvas = new Canvas();
  private static final Canvas canvas0 = new Canvas();
  private JLayeredPane layers;

  public 999() 
  {
        super(new Frame());
        // Please make this **TRANSPARENT**
        getOwner().setBackground( new Color(255, 0, 0, 0) ); 

        layers = new JLayeredPane();
        button = new JButton("close");

        this.setLayout (new BorderLayout ());     

        button.setBackground(Color.RED);
        button.setSize(200,200);
        button.setLocation(0,20);
        this.add("North", button);

        JPanel p = new JPanel();
        p.setOpaque(false); // transparent
        p.setBackground( new Color(255, 0, 0, 0) ); // transparent

        p.setSize(300, 200);
        p.setLocation(0, 0);
        p.add(new JButton("Test"));
        layers.add(p, new Integer(1));
        layers.setSize(400,300);
        layers.setLocation(400,50);

        layers.setOpaque(false); // transparent
        layers.setBackground( new Color(255, 0, 0, 0) ); // transparent
        this.add("North", layers);

        canvas.setSize(800,800);
        this.add("North",canvas);
        //AWTUtilities.setWindowOpacity(this, 0.2f); // Error in Linux

    }

    public static void main(String[] args) 
    {
      Window j = new 999();
      j.setVisible(true);
        ...
    }

}
  • 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-23T19:02:29+00:00Added an answer on May 23, 2026 at 7:02 pm

    This code is really odd. Create the frame elsewhere and set the values you want before you give it to this object. Or just make this call in your constructor:

     getOwner().setBackground( new Color(255, 0, 0, 255) );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to know a way to actually make the status bar that
I made a subclass of UIView that has a fixed frame. So, can I
Can somebody point me to a resource that explains how to go about having
Can a LINQ enabled app run on a machine that only has the .NET
Can anyone tell me how I can display a status message like 12 seconds
.Hi, I have a nib file that contains an header that will be used
I can't seem to find a way to force an application-scoped managed bean to
I have checked all posts here, but can't find a solution for me so
I need to solve the following question which i can't get to work by
If all tables I want to delete from have the column gamer_id can i

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.