• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JLabel appears as a JButton

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 22784
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please Use Code Tags.
 
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
I got this tall by not having enough crisco in my diet as a kid. This ad looks like it had plenty of shortening:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic