Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

Resizing Label

Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my applet, I have two components. One of them goes in the centre and the other is a Label component being placed at the NORTH edge of the applet.
I know that the applet has a BorderLayout, so the width of the label is determined by the width of the applet.
The question is, can I set the height of the label, or will it only ever be displayed within the applet at the label's preferred height. If I can set it, then how, since everything I have tried does not seem to work.
Best Regards
Matt Gaunt
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've tried lots of things, and here's the only thing that I've found that works... creating a subclass of Label that sets it's size itself... you might want to expand upon this idea and make the size changes dynamic ( i.e. add methods so you can set height and width without hard coding it in... )

I don't like that guy. The tiny ad agrees with me.
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic