• 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

windows vs Mac look and feel issue

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We are creating some JLabels in rows, and the preferredSize.height value has no effect when we run it under Windoze, but does when we run it on our Macs - the rows get separated more (or less) just like the doctor ordered ...

any tips or tricks?

thanks!

the code:

class NavigationTreeCellRenderer extends DefaultTreeCellRenderer {

// everybody loves magic numbers!
int iconRowHeight = 26;
int defaultHeight = 15;

@Override
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {

Object userObject = ((DefaultMutableTreeNode) value).getUserObject();

JLabel l = (JLabel) super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);

l.setFont(l.getFont().deriveFont(Font.BOLD));

l.setIcon(((NavigationTreeNode) value).getIcon());
Dimension preferredSize = l.getPreferredSize();
preferredSize.height = iconRowHeight;
l.setPreferredSize(preferredSize);

return l;
}
}
 
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Charlie Peet:
The preferredSize.height value has no effect when we run it under Windoze, but does when we run it on our Macs - the rows get separated more (or less) just like the doctor ordered .......



Try not to use variant spellings, it just wastes time while we wait for the bartenders and sherrifs to tell you not to use variant spellings.

Since putting up the reply, I say a page that stated the look and feel had to be set to windows before windows would render the JList correctly.....


[ August 12, 2007: Message edited by: Nicholas Jordan ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic