Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JToolBar JButtons and L&F  RSS feed

 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is what I am experiencing. I am coding an application using Swing. I am using a JDesktopPane, JFrame, JInternalFrames, etc. I have a JToolBar with JButtons on it and am using gifs for the JButton Icons.
My problem is when I use the Metal L&F the JButtons auto-fit to the size of the ImageIcon, which is what I want. Except that I want to use the Windows L&F and when I do this, the JButtons are larger than the ImageIcon.
I know that I can set my Layout Manager to null and setBounds on all the components in the JToolBar, but I don't want to do that. Is there a way to make the JButtons fit the ImageIcon with the Windows L&F??

------------------
Happy Coding,
Gregg Bolinger
 
Renee Zhang
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please check that if you can use ToolBarLayout. I haven't done this before, but I hope maybe that will solve your problem.
Good luck!
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What class does that belong to? It doesn't seem to register for me.

------------------
Happy Coding,
Gregg Bolinger
 
Renee Zhang
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually ToolBarLayout is in the package com.borland.dbswing.ToolBarLayout. So you may use it only if you use jBuilder. ToolBarLayout is a hybrid layout manager that combines the behaviors of the AWT FlowLayout and GridLayout layout managers. I didn't find it is very helpful. Sorry about the misleading.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!