Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Can't change placement of JLabel

800965Jul 15 2011 — edited Jul 15 2011
I want to place a JLabel at a fixed x, y position on the ContentPane, with no effect. I have a JFrame, with a JPanel with a custom background picture as the content pane. And I'm adding the JLabel to the content pane. It appear at a fixed position at the top of the frame. That I want to change. I tried setBounds and setLocation with no effect. Any ideas?

This is the code to setup the JLabel:
        congratulations = new JLabel();
        //congratulations.setLocation(50, 260);
        congratulations.setBounds(50, 260, 200, 30);
        congratulations.setFont(new Font("Optima", 0, 24));
        getContentPane().add(congratulations);
Thanks,
PR.
This post has been answered by 801313 on Jul 15 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 12 2011
Added on Jul 15 2011
7 comments
400 views