Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > JButton Icon resize smaller or larger like Cocoa ToolBar button view options

JButton Icon resize smaller or larger like Cocoa ToolBar button view options
Thread Tools
Registered User
Join Date: Feb 2003
Status: Offline
Reply With Quote
Jul 25, 2003, 09:27 AM
 
Hi - I am trying to resize a JButton icon with in a JToolbar. Just like when you select small view Icon in a Cocoa applications for Cocoa ToolBar Icon. I have tried both:

setMinimumSize(new Dimension(10,10));
setBounds(50,50,50,50);
setSize(new Dimension(10,10));

Neither proved successful. What API syntax should I look at to achieve this effect?
(Last edited by depolitic; Jul 25, 2003 at 11:23 PM. )
     
Registered User
Join Date: Feb 2003
Status: Offline
Reply With Quote
Jul 25, 2003, 11:17 PM
 
Hi - I found this is in the JavaDoc:

-------------------------
setSize

public void setSize(float width, float height)

Sets the size of the view. Since Icon doesn't support this functionality, there is nothing we can do._
-------------------------
Does this mean that icon does not work with setSize?
     
Mac Enthusiast
Join Date: Apr 2001
Location: 127.0.0.1
Status: Offline
Reply With Quote
Jul 29, 2003, 06:24 AM
 
Don't give up that easy!

Icon may not provide that functionality out of the box, but you could create your own subclass of Icon which implements the scaling functionality you're looking for. If you're lucky you may even be able to Google a pre-written solution.
     
Registered User
Join Date: Feb 2003
Status: Offline
Reply With Quote
Jul 30, 2003, 12:09 AM
 
Thanks Jolt Guy, I did a goggle search and found it. The funny thing is that it was all the time on the java.sun site. Were I had search using their search tool to no avail, and yet goggle gets it first time. For those interested here is the link.

http://developer.java.sun.com/develo.../tt0220.html#2
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 02:14 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2