Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

windows vs Mac look and feel issue  RSS feed

 
Charlie Peet
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • 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;
}
}
 
Nicholas Jordan
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
  • 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 ]
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!