Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!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 07:28:51 -0500 Organization: A noiseless patient Spider Lines: 86 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 12:31:29 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="c50a9e5d554cfaba13eda1c71e805135"; logging-data="26020"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18UeSBJ95ZW67Pa8oq8Q9carkVZiKFum7E=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.4.0 In-Reply-To: Cancel-Lock: sha1:SasbJ1LbZKfA91Ew6heqX/CwY/Q= Xref: csiph.com comp.lang.java.programmer:30854 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.