• 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

Truncated text in Label

 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
i have a probelm :
In windows the text in Jlabel is displayed correctely like

HI Iyappan

while in solaris the text get truncated and displayed like this

HI Iyp. . .

i attach source
. . .
getContentPane().setLayout(null);
l1=new JLabel("HI Iyappan");
getContentPane().add(l1);
getContentPane().add(l2);
l1.setBounds(100,10,40,15);
. . .


urgent pls give solution .
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you've posted this 4 times in 3 forums over 2 days
no replies

perhaps it is a solaris problem, rather than a java/swing problem?
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
getContentPane().setLayout(null);
l1=new JLabel("HI Iyappan");
getContentPane().add(l1);
getContentPane().add(l2);
l1.setBounds(100,10,40,15);


There's your problem - don't use null layout and expect components to be sized correctly.
[ August 23, 2006: Message edited by: Nathan Pruett ]
 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As a follow up to Nathan's post....if you want very explicit control over where your label appears on the screen, use GridBagLayout. Its the more complicated of all layouts, but its the only way you can essentially boss the jvm around and make your components appear where you want them to consistently. IMHO, the only other Layout class that has any value whatsoever is BoxLayout. The rest of them pretty much produce fairly amateur looking screens (again, in my opinion).

To Nathan's point.....NULL layout will work, but only on one screen dimension/resolution/platform. It also will cause issues on repaint, i.e. if the user minimizes and maximizes the screen (because it loses the setbounds property once the "bounds" no longer exist, which they wont on a minimize)
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Even I have come across the same problem and I resolved it by making the frame size bigger and the length between the components is more ie... use gridbag layout and the length between the JLabel and Jtextfield should be more.Then it gets adjusted and the text of the label is displayed fully.
 
iyappan sankaran
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Guys.
reply
    Bookmark Topic Watch Topic
  • New Topic