• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JLabel appears as a JButton

 
Gregory Ball
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What ever I try the Jlabel want appeear. Instead it comes up as one of the JButtons.
The code is a little messy, sos.
Any Help would be great
 
Rob Spoor
Sheriff
Pie
Posts: 20369
44
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please Use Code Tags.
 
pete stein
Bartender
Posts: 1561
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that most of your problems will be solved if you avoid using the "null" layout and learn to use the layout managers.

for instance:
 
Gregory Ball
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry for not having my code in quotes. first time on this website.

Cheers for the reply.

I have used layout managers before and they have worked quite well, but time consuming.

I'm still wondering whats wrong with the code. Or does Java hate doing things without a layout scheme?
Should I just forget about it and go a head with what is suggested?

Cheers Greg
 
pete stein
Bartender
Posts: 1561
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gregory Ball wrote:I have used layout managers before and they have worked quite well, but time consuming.

What's more time consuming, trying to set things using absolute positioning, getting it wrong, and having to re-work the code multiple times to get it right, or using nested layouts and just letting the layout managers do the hard work for you? For me the question is a no-brainer.

I'm still wondering whats wrong with the code. Or does Java hate doing things without a layout scheme?

Java neither hates nor loves, but only does what you tell it to do. Your positionings are incorrect. Simple as that.

Should I just forget about it and go a head with what is suggested?

Your call.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic