Re: Creating a type of toggle with two labels..

2013-12-04 Thread Jonathan Giles
ing > custom controls for use in general application code? > > Thanks, > John > > -Original Message- > From: openjfx-dev-boun...@openjdk.java.net > [mailto:openjfx-dev-boun...@openjdk.java.net] On Behalf Of Jonathan Giles > Sent: Wednesday, December 04, 2013 5:

RE: Creating a type of toggle with two labels..

2013-12-04 Thread John Smith
penjfx-dev-boun...@openjdk.java.net [mailto:openjfx-dev-boun...@openjdk.java.net] On Behalf Of Jonathan Giles Sent: Wednesday, December 04, 2013 5:12 PM To: Pedro Duque Vieira Cc: OpenJFX Mailing List Subject: Re: Creating a type of toggle with two labels.. It's a toss-up between minimising duplicat

Re: Creating a type of toggle with two labels..

2013-12-04 Thread Jonathan Giles
It's a toss-up between minimising duplicated code or having to bend API and implementation to your will (and end up with API you don't necessarily want in the process). Very rarely would I suggest extending a control - only when the API matches perfectly with what you're doing, and then that reall

Re: Creating a type of toggle with two labels..

2013-12-04 Thread Pedro Duque Vieira
Thanks Jasper.. On Thu, Dec 5, 2013 at 12:33 AM, Jasper Potts wrote: > I did a couple examples using just CSS and Checkbox control for my JavaOne > session. See below. > > Hoep that helps, > > Jasper > > > > *Modena Style* > > /* Slider Button Styled Checkbox */ > .switch.check-box > .box > .mar

Re: Creating a type of toggle with two labels..

2013-12-04 Thread Pedro Duque Vieira
Thanks for the help guys! I'll follow Jonathan's advice since I want this to be a control that will be used by other developers so I don't want to have inherited public methods that don't make any sense on this control. Regards, On Wed, Dec 4, 2013 at 11:52 PM, David Grieve wrote: > It could b

Re: Creating a type of toggle with two labels..

2013-12-04 Thread David Grieve
It could be just about any type of button…with the right css styles! On Dec 4, 2013, at 5:57 PM, Leif Samuelsson wrote: > On 2013-12-04 14:54, Leif Samuelsson wrote: >> It seems to me that you could do this with a small class extending >> ToggleButton. >> Add a couple of String properties and u

Re: Creating a type of toggle with two labels..

2013-12-04 Thread Leif Samuelsson
On 2013-12-04 14:54, Leif Samuelsson wrote: It seems to me that you could do this with a small class extending ToggleButton. Add a couple of String properties and use a selection listener to switch the main text value. You wouldn't need to write any skin or behavior classes, Just define the look

Re: Creating a type of toggle with two labels..

2013-12-04 Thread Leif Samuelsson
It seems to me that you could do this with a small class extending ToggleButton. Add a couple of String properties and use a selection listener to switch the main text value. You wouldn't need to write any skin or behavior classes, Just define the look in CSS and use -fx-label-padding to place th

Re: Creating a type of toggle with two labels..

2013-12-04 Thread David Grieve
You might want to look at what Gerrit has done here: http://harmoniccode.blogspot.com/2013/10/friday-fun-xviii.html On Dec 4, 2013, at 5:05 PM, Pedro Duque Vieira wrote: > OK, sounds reasonable. Too bad about the code duplication that will need to > take place. > > Thanks Jonathan and thanks

Re: Creating a type of toggle with two labels..

2013-12-04 Thread Pedro Duque Vieira
OK, sounds reasonable. Too bad about the code duplication that will need to take place. Thanks Jonathan and thanks for the link. Regards, On Wed, Dec 4, 2013 at 9:39 PM, Jonathan Giles wrote: > It is likely significantly easier to simply roll your own control and > not try to coerce ButtonBase

Re: Creating a type of toggle with two labels..

2013-12-04 Thread Jonathan Giles
It is likely significantly easier to simply roll your own control and not try to coerce ButtonBase to support two labels. For what it is worth, Paru and I talked about precisely this control at JavaOne 2012, which you can watch on YouTube here: http://www.youtube.com/watch?v=ryUTSrGGnvo&list=PLKCk

Creating a type of toggle with two labels..

2013-12-04 Thread Pedro Duque Vieira
Hi, I'm trying to create a new control to be used by other developers. It is know as "Toggle Switch". You can see this control in android: http://ankri.de/switch-button-for-android-2-3-gingerbread/ in iOS: http://iosguides.net/ios-menus-comparison/ (search for "Toggle Switch") and on Windows 8: ht