Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: opacity bug? or just my code

  1. #1
    Junior Member
    Join Date
    Apr 2013
    Posts
    26
    My Mood
    Aggressive
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default opacity bug? or just my code

    this is my problem:
    1.png

    as we can see, the labels and jbuttons looked like they are opaque but i set:

    lblTime.setOpaque(false);
    b1.setOpaque(false);
    b2.setOpaque(false);
    b3.setOpaque(false);

    i also have this:

    public mainClass(){
            setUndecorated(true);
            setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
     
            pic.setIcon(new javax.swing.ImageIcon(getClass().getResource("/logo.png")));
            pic.setHorizontalAlignment(SwingConstants.CENTER);
            pic.setBackground(new Color(53,53,53));
            pic.setOpaque(true);
            pic.setSize(230, 180);
     
            this.add(pic);
            this.add(hP);
     
            pack();
     
            setLocation(screenSize.width-getSize().width - 25, 25);
     
        }

    hP is the panel, and mainClass is a frame..

    please tell me why the labels and buttons still show background :/
    Attached Images Attached Images
    • File Type: png 1.png (8.4 KB, 1 views)


  2. #2
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: opacity bug? or just my code

    Are you sure your code that sets opacity is being called? Add a printline to make sure...

    If you have verified the code is being called, post more of the code.

Similar Threads

  1. Begginer Java - Bug in my code?
    By rk2010 in forum What's Wrong With My Code?
    Replies: 7
    Last Post: March 7th, 2012, 08:12 AM
  2. What's the bug in this code?
    By r3dApple in forum What's Wrong With My Code?
    Replies: 4
    Last Post: January 11th, 2012, 12:28 AM
  3. Replies: 2
    Last Post: November 9th, 2011, 12:12 AM
  4. KeyListener bug
    By nivangerow in forum AWT / Java Swing
    Replies: 1
    Last Post: September 5th, 2011, 06:10 AM
  5. Apparent bug?
    By 342-173=147 in forum Loops & Control Statements
    Replies: 2
    Last Post: March 4th, 2011, 02:52 PM