Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Editors for JTable cells
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Editors for JTable cells



On Apr 2, 2004, at 8:12 PM, Rib Rdb wrote:

Is there a way to get something like the NSComboBoxCell or
NSButtonCell as editors for a JTable cell instead of using a
JComboBox or JCheckBox that get's clipped because it's too large?

If it's your own cell editor/renderer, provide a different UI delegate for it. Here's the source for a handy one I wrote for NetBeans:

http://openide.netbeans.org/source/browse/openide/src/org/openide/ explorer/propertysheet/CleanComboUI.java?rev=1.4&content-type=text/x- cvsweb-markup

To do it: If you create the editor control, override updateUI() to call setUI() with the above UI delegate ( or something like it), i.e.

public void updateUI () {
setUI ((ComboBoxUI) CleanComboUI.createUI(this);
}

if you don't own the editor control, something like this should work (OTOH, may not be perfect, I'm on my first cup of coffee... you need to subclass the JTable):

public Component prepareRenderer (Component renderer, //rest of the signature) {
if (renderer instanceof JComboBox && (!((JComboBox) renderer).getUI() instanceof CleanComboUI)) {
((JComboBox) renderer).setUI ((ComboBoxUI) CleanComboUI.createUI(renderer);
}
}

ah how I long to be able to write "!instanceof" in java...

Nicer still would be to be able to set a flag (via a client property) to get one of the better fitting combo box appearances that aqua supports but AquaLookAndFeel doesn't :-/

-Tim


__________________________________
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway
http://promotions.yahoo.com/design_giveaway/
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >Editors for JTable cells (From: Rib Rdb <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.