Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!news.swapon.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Jeff Higgins Newsgroups: comp.lang.java.programmer Subject: Re: Returning to Java - have questions Date: Sun, 25 Jan 2015 10:59:04 -0500 Organization: A noiseless patient Spider Lines: 110 Message-ID: References: <3d67c01a-1dfe-463b-91fe-fa8f2c2c34c4@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 25 Jan 2015 16:01:41 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="c50a9e5d554cfaba13eda1c71e805135"; logging-data="11366"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+y4PReBRIcKeswJcfHSvTz9Rv2RC+ieb4=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.4.0 In-Reply-To: Cancel-Lock: sha1:2Tw9/EsWJzISpWKbiGlAxZbxEVU= Xref: csiph.com comp.lang.java.programmer:30874 On 01/25/2015 10:31 AM, Jerry Stuckle wrote: > On 1/25/2015 7:28 AM, Jeff Higgins wrote: >> On 01/23/2015 08:47 PM, Jerry Stuckle wrote: >>> On 1/23/2015 7:52 PM, Jeff Higgins wrote: >>>> On 01/23/2015 07:27 PM, Jerry Stuckle wrote: >>>>> On 1/23/2015 5:26 PM, FredK wrote: >>>>>> On Friday, January 23, 2015 at 8:49:33 AM UTC-8, Jerry Stuckle wrote: >>>>>>> On 1/23/2015 10:52 AM, Jeff Higgins wrote: >>>>>>>> On 01/23/2015 09:59 AM, Jerry Stuckle wrote: >>>>>>>>> On 1/23/2015 8:08 AM, Jeff Higgins wrote: >>>>>>>>>> On 01/22/2015 09:47 PM, Jerry Stuckle wrote: >>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> Which has nothing to do with the look of a button when it is >>>>>>>>>>> pushed. >>>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> Maybe future iterations will give you public behaviors? >>>>>>>>>> >>>>>>>>> >>>>>>>>> You really don't understand. This has NOTHING to do with >>>>>>>>> skins. In >>>>>>>>> swing it was very easy to set both the pressed and released images >>>>>>>>> via >>>>>>>>> the button's properties. With JavaFX you can only set the pressed >>>>>>>>> image >>>>>>>>> via CSS. >>>>>>>> >>>>>>>> OK, I'm glad you've got it sorted out. >>>>>>>> So, you're now convinced there is one way to accomplish what you >>>>>>>> want. >>>>>>>> That is not the way you want to doit. >>>>>>>> Maybe file a feature request? >>>>>>>> Anyway, happy to help. >>>>>>>> >>>>>>> >>>>>>> No, your updates all along have shown you have no idea what I'm >>>>>>> talking >>>>>>> about. I appreciate your attempts to help, but you haven't >>>>>>> understood a >>>>>>> word I've said. >>>>>>> >>>>>>> But you can prove me wrong. Show me how I can change the pressed >>>>>>> image >>>>>>> if a Button object without using CSS. It has to work wither using >>>>>>> the >>>>>>> mouse or keyboard (including accelerator keys - IOW, every way a >>>>>>> button >>>>>>> may be pressed). >>>>>>> >>>>>>> In Swing, it's as simple as calling JButton.setPressedIcon(), passing >>>>>>> the pressed image (an ImageIcon object). >>>>>>> >>>>>>>>> >>>>>>>>> I see this as a step backwards. >>>>>> >>>>>> Try this: >>>>>> Call button.setOnMousePressed() to register a callback for the press. >>>>>> In that callback method, call button.setGraphic() to set the new >>>>>> image. >>>>>> >>>>> >>>>> Fred, unfortunately, that only works for mouse clicks. It doesn't help >>>>> with keyboard entry (which could be the space bar or an accelerator >>>>> key). >>>>> >>>> InputEvent.ANY >>> >>> And how does that help? How does it indicate whether the input event >>> causes the button to be pressed or not, for instance? >>> >>> How about some code which shows what you're claiming will work? >>> >>> And then let's see you make it as easy as calling >>> JButton.setPressedIcon(). >>> >> >> Looking in the CSS reference I see Node CSS Pseudo-class - pressed. >> I'm assuming this is the pressed that you refer to when you say, >> "It seems with fx the only way you can change the button when >> it's pressed/not pressed is via css." >> >> I'm guessing this Node.pressedProperty is what is changed when >> you refer to pressed in css. >> >> Button.pressedProperty().addListener(new ChangeListener() { >> @Override >> public void changed(ObservableValue observable, >> Boolean oldValue, Boolean newValue) { >> // ... >> } >> }); >> Please correct me if I am wrong. >> > > Did you look at the doc? > > "Whether or not the Node is pressed. Typically this is true when the > primary mouse button is down, though subclasses may define other mouse > button state or key state to cause the node to be "pressed"." > > What is not clear is whether the Button class overrides this to include > keys. > Please provide an example that demonstrates the difference.