Article View: borland.public.jbuilder.java.swing
Article #7610Re: Customized slider knob imagery
From: Lars Thuring
Date: Sun, 07 Jan 2001 22:40
Date: Sun, 07 Jan 2001 22:40
53 lines
2418 bytes
2418 bytes
Hi Torsten,
Torsten Welches wrote:
> Lars,
>
> please note that the snippet I had posted does not handle L&F changes. Once
> updateUI gets called on your JSlider your new thumb will be lost.
Ouch. Would that also be the case if L&F only can be set at startup? I mean the
slider & it's UI are created at a later stage (at some point in program
execution) so wouldn't the selected UI be overriden anyway?
BTW, I expanded the example by using an Image instead of the red circle. Like
it. ;-)
tsch�ss,
Lars
>
>
> Try adding a button like this and look what happens:
>
> JButton btnSwitchLF = new JButton("switch L&F");
> btnSwitchLF.addActionListener(new ActionListener() {
> public void actionPerformed(ActionEvent e) {
> try {
>
> UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
> SwingUtilities.updateComponentTreeUI(yourFrameOrWhatever);
> //JSlider.updateUI will be called...
> } catch (Exception ex) {
> System.out.println("CrossPlatformLookAndFeel not supported?!
> Shouldn't happen!");
> }
> }
> });
>
> If you'd plan to use it in production code you would probably have to adress
> the L&F issues.
>
> Viel Gr��e aus K�ln,
> Torsten
>
> Lars Thuring schrieb in Nachricht <3A57A5E1.10B75D6B@t-online.de>...
> >Cool!
> >
> >It works nicely (without any changes)! Thank you.
> >
> >Lars
Technical Details
Message-ID:
<3A58F04B.FC74ABE9@t-online.de>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!news.infoave.net!newsfeed.frii.net!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!neel.uni2.net!newssuck.uni2.dk!bornews.borland.com!dnews!62.226.249.28References:
<3A567ADC.25868A32@t-online.de> <3a56f931$1_1@dnews> <3A57A5E1.10B75D6B@t-online.de> <3a5872c8_1@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 111d45,f6e07f74041fb29d X-Google-Attributes: gid111d45,public X-Google-ArrivalTime: 2001-01-07 14:46:50 PST Message-ID: <3A58F04B.FC74ABE9@t-online.de> Date: Sun, 07 Jan 2001 23:40:11 +0100 From: Lars Thuring <thuring@t-online.de> X-Mailer: Mozilla 4.71 [en] (Win98; I) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.swing Subject: Re: Customized slider knob imagery References: <3A567ADC.25868A32@t-online.de> <3a56f931$1_1@dnews> <3A57A5E1.10B75D6B@t-online.de> <3a5872c8_1@dnews> Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit NNTP-Posting-Host: 62.226.249.28 X-Trace: 7 Jan 2001 14:37:05 -0800, 62.226.249.28 Lines: 54 Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!news.infoave.net!newsfeed.frii.net!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!neel.uni2.net!newssuck.uni2.dk!bornews.borland.com!dnews!62.226.249.28