Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #31027

Re: Disabling generated buttons

From Jeff Higgins <jeff@invalid.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Disabling generated buttons
Date 2015-02-02 23:32 -0500
Organization A noiseless patient Spider
Message-ID <mapj7k$dn7$1@dont-email.me> (permalink)
References (3 earlier) <87bnlcyv2h.fsf@Equus.decebal.nl> <map4ub$b3g$1@dont-email.me> <map5ah$c6j$1@dont-email.me> <map98s$nkf$1@dont-email.me> <mapasn$rac$1@dont-email.me>

Show all headers | View raw


On 02/02/2015 09:10 PM, Jeff Higgins wrote:
> On 02/02/2015 08:42 PM, Jeff Higgins wrote:
>> On 02/02/2015 07:35 PM, Jeff Higgins wrote:
>>> On 02/02/2015 07:29 PM, Jeff Higgins wrote:
>>>> On 02/02/2015 02:25 PM, Cecil Westerhof wrote:
>>>>> Op Monday 2 Feb 2015 19:24 CET schreef FredK:
>>>>>>
>>>>>> The above add() saves the buttons, so now you are saving them in two
>>>>>> places. Presumably "this" is some kind of JPanel. The buttons you
>>>>>> added are available by calling this.getComponents()
>>>>>
>>>>> The buttons are on a JFrame, but there are other buttons also on
>>>>> the JFrame and only the Colour buttons should be disabled. That is why
>>>>> I use the array. But I look into a cleaner solution.
>>>>>
>>>> Another shrug.
>>>> Component.getClientProperty(Object key)
>>>> Component.putClientProperty(Object key, Object value)
>>>>
>>> But probably as expensive memory-wise as an array of references.
>>> And certainly more expensive code-complexity-wise.
>>>
>> You could use the button's text as a distinguishing feature,
>> but the way that you've shown:
>> new JButton("" + colour);
>> is guaranteed by the api to be implementation dependent.
>> My implementation sets the button text to
>> "java.awt.Color[r=0,g=0,b=255]".
>> The complexity of a "smart" solution vs the small memory
>> overhead of the "dumb" solution.
>>
> This is what I meant by "MagicButton".
> Perhaps I should have used "SmartButton".

And, after all of this, is there a gate at the other end of
the pipeline you can close? Let your user click as furiously
as he wishes; just don't accept his clicks?

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Disabling generated buttons Cecil Westerhof <Cecil@decebal.nl> - 2015-02-02 13:24 +0100
  Re: Disabling generated buttons Jeff Higgins <jeff@invalid.invalid> - 2015-02-02 07:47 -0500
    Re: Disabling generated buttons Cecil Westerhof <Cecil@decebal.nl> - 2015-02-02 14:03 +0100
      Re: Disabling generated buttons Jeff Higgins <jeff@invalid.invalid> - 2015-02-02 08:26 -0500
        Re: Disabling generated buttons Jeff Higgins <jeff@invalid.invalid> - 2015-02-02 08:48 -0500
          Re: Disabling generated buttons Jeff Higgins <jeff@invalid.invalid> - 2015-02-02 09:06 -0500
        Re: Disabling generated buttons Cecil Westerhof <Cecil@decebal.nl> - 2015-02-02 15:17 +0100
  Re: Disabling generated buttons Cecil Westerhof <Cecil@decebal.nl> - 2015-02-02 15:16 +0100
    Re: Disabling generated buttons FredK <fred.l.kleinschmidt@gmail.com> - 2015-02-02 10:24 -0800
      Re: Disabling generated buttons Cecil Westerhof <Cecil@decebal.nl> - 2015-02-02 20:25 +0100
        Re: Disabling generated buttons Jeff Higgins <jeff@invalid.invalid> - 2015-02-02 19:29 -0500
          Re: Disabling generated buttons Jeff Higgins <jeff@invalid.invalid> - 2015-02-02 19:35 -0500
            Re: Disabling generated buttons Jeff Higgins <jeff@invalid.invalid> - 2015-02-02 20:42 -0500
              Re: Disabling generated buttons Jeff Higgins <jeff@invalid.invalid> - 2015-02-02 21:10 -0500
                Re: Disabling generated buttons Jeff Higgins <jeff@invalid.invalid> - 2015-02-02 23:32 -0500

csiph-web