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


Groups > comp.lang.java.programmer > #8079 > unrolled thread

how to bypass this swing limit

Started byPeter Cheung <cmk128@gmail.com>
First post2011-09-16 09:14 -0700
Last post2011-09-19 03:29 -0700
Articles 7 — 4 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  how to bypass this swing limit Peter Cheung <cmk128@gmail.com> - 2011-09-16 09:14 -0700
    Re: how to bypass this swing limit Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2011-09-16 18:31 +0200
      Re: how to bypass this swing limit Peter Cheung <cmk128@gmail.com> - 2011-09-16 09:47 -0700
        Re: how to bypass this swing limit Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2011-09-16 19:07 +0200
        Re: how to bypass this swing limit David Lamb <dalamb@cs.queensu.ca> - 2011-09-16 16:15 -0400
    Re: how to bypass this swing limit Roedy Green <see_website@mindprod.com.invalid> - 2011-09-16 14:48 -0700
      Re: how to bypass this swing limit Peter Cheung <cmk128@gmail.com> - 2011-09-19 03:29 -0700

#8079 — how to bypass this swing limit

FromPeter Cheung <cmk128@gmail.com>
Date2011-09-16 09:14 -0700
Subjecthow to bypass this swing limit
Message-ID<99d5e91e-983c-4b87-ba97-657ccf137521@glegroupsg2000goo.googlegroups.com>
Dear All
   how to by pass this swing limit:
Each GUI component can be contained only once. If a component is already in a container and you try to add it to another container, the component will be removed from the first container and then added to the second.

thanks
from Peter (cmk128@hotmail.com)

[toc] | [next] | [standalone]


#8080

FromDaniele Futtorovic <da.futt.news@laposte-dot-net.invalid>
Date2011-09-16 18:31 +0200
Message-ID<j4vtt8$cnv$1@dont-email.me>
In reply to#8079
On 16/09/2011 18:14, Peter Cheung allegedly wrote:
> Dear All
>    how to by pass this swing limit:
> Each GUI component can be contained only once. If a component is already in a container and you try to add it to another container, the component will be removed from the first container and then added to the second.

Create a new component.

If you want the components to share state, then you ought to put that
state in a model object and make the components share the same model.
State should not be stored in the view anyway.

-- 
DF.
Determinism trumps correctness.

[toc] | [prev] | [next] | [standalone]


#8081

FromPeter Cheung <cmk128@gmail.com>
Date2011-09-16 09:47 -0700
Message-ID<c8ff6fb8-4610-4144-9072-0f5f44be67da@glegroupsg2000goo.googlegroups.com>
In reply to#8080
share the model can make two components display the same data. Except this, i need to create two set of event to handle mouse click, it is quite trouble.

thanks

[toc] | [prev] | [next] | [standalone]


#8082

FromDaniele Futtorovic <da.futt.news@laposte-dot-net.invalid>
Date2011-09-16 19:07 +0200
Message-ID<j50022$std$1@dont-email.me>
In reply to#8081
On 16/09/2011 18:47, Peter Cheung allegedly wrote:
> share the model can make two components display the same data. Except
> this, i need to create two set of event to handle mouse click, it is
> quite trouble.
> 
> thanks

If you have, as you should, written a view/controller class that
initialises its layout, data and listeners, then the net difference
between one and two of those is one instantiation and addition to a
container.

It sounds like the design of your mouse event handler isn't right.

-- 
DF.
Determinism trumps correctness.

[toc] | [prev] | [next] | [standalone]


#8085

FromDavid Lamb <dalamb@cs.queensu.ca>
Date2011-09-16 16:15 -0400
Message-ID<p7Ocq.15569$Ll3.7160@newsfe16.iad>
In reply to#8081
On 16/09/2011 12:47 PM, Peter Cheung wrote:
> share the model can make two components display the same data. Except this, i need to create two set of event to handle mouse click, it is quite trouble.

You originally wanted the same component in two containers.  If the 
container handles mouse clicks, and uses them to update the model state, 
why do you need two sets of events?  Only one of the two components is 
going to get an incoming event at any one time.

[toc] | [prev] | [next] | [standalone]


#8092

FromRoedy Green <see_website@mindprod.com.invalid>
Date2011-09-16 14:48 -0700
Message-ID<30h7771pbjf4inkfp8gk67t5sdcune6e71@4ax.com>
In reply to#8079
On Fri, 16 Sep 2011 09:14:02 -0700 (PDT), Peter Cheung
<cmk128@gmail.com> wrote, quoted or indirectly quoted someone who said
:

>Dear All
>   how to by pass this swing limit:
>Each GUI component can be contained only once.
> If a component is already in a container and you try to add it to another container, 
>the component will be removed from the first container and then added to the second.

The obvious answer is clone the component, and make sure you keep them
up to date with the same state, e.g. by inventing a virtual component
that you update that in turn updates a list of clones for you.

Be careful with this kind of logic you don't create endless
notification loops.

-- 
Roedy Green Canadian Mind Products
http://mindprod.com
Your top priority should be fixing bugs. If you carry on development, 
you are just creating more places you will have to search for them.

[toc] | [prev] | [next] | [standalone]


#8149

FromPeter Cheung <cmk128@gmail.com>
Date2011-09-19 03:29 -0700
Message-ID<30203625.2052.1316428173046.JavaMail.geo-discussion-forums@prgd31>
In reply to#8092
thanks everybody
Peter

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web