Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Applet Canvas / Panel Problem

Reply
Thread Tools

Applet Canvas / Panel Problem

 
 
lltaylor
Guest
Posts: n/a
 
      05-06-2004
Hello,

I have written a threaded tree control which is displayed in an
applet.
The way it works is that the reusable control is a canvas.
The control is created in an applet and the canvas is drawn onto a
panel.

Things work great when the content is static, however when the tree
structure
is changed - i.e. someone adds a folder or deletes a file problems
creep in.

I have no problem updating the tree (which is the canvas) but after
every change the new canvas needs to be placed on the panel.

I have tried

Panel.remove(tree);
Panel.add("Center", tree);
(there are three panels in total - the other two have scrollbars in
them)

But this does not appear to update when changes are made.

So I have tried

Panel.removeAll();
Panel.add("Center", tree);
Panel.add("South", horizontalScrollbar);
Panel.add("East", verticalScrollbar);

This does the update perfect however I get a flickerwhen the update
occurs.

So basically my question is in two parts?

Can anyone suggest how I can update the panel to avoid it flickering?
Or anyone suggest an alternative way of organising my tree so it
remains a generic control but has a better method of updating?

does that make sense?

Any suggestion greatfully recieved.

Regards

Lloyd
 
Reply With Quote
 
 
 
 
Andrew Thompson
Guest
Posts: n/a
 
      05-06-2004
On 6 May 2004 08:08:50 -0700, lltaylor wrote:

> I have written a threaded tree control which is displayed in an
> applet.


<http://www.physci.org/codes/javafaq.jsp#cljg>

> I have tried...

<code snippets>

> So I have tried

<code snippets>

> This does the update perfect however I get a flickerwhen the update
> occurs.


Those two things seem to contradict.
Or is it just I have been up for 30 hrs??

> So basically my question is in two parts?

...
> does that make sense?


Not much. Though maybe it is just me. (shrugs)

> Any suggestion greatfully recieved.


<http://www.physci.org/codes/sscce.jsp>

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
 
Reply With Quote
 
 
 
 
A. Bolmarcich
Guest
Posts: n/a
 
      05-06-2004
In article <(E-Mail Removed) >, lltaylor wrote:
> Hello,
>
> I have written a threaded tree control which is displayed in an
> applet.
> The way it works is that the reusable control is a canvas.
> The control is created in an applet and the canvas is drawn onto a
> panel.
>
> Things work great when the content is static, however when the tree
> structure
> is changed - i.e. someone adds a folder or deletes a file problems
> creep in.
>
> I have no problem updating the tree (which is the canvas) but after
> every change the new canvas needs to be placed on the panel.
>
> I have tried
>
> Panel.remove(tree);
> Panel.add("Center", tree);
> (there are three panels in total - the other two have scrollbars in
> them)


In your description you wrote that "the new canvas needs to be placed
on the panel", but in the code snippet you add the same component
(named tree) instead of removing the existing component and adding a
new one. Do you have a "new canvas" or not?

> But this does not appear to update when changes are made.


There is no update because nothing has changed about the components that
would cause and update. If the contents of the component has changed,
but it size has not changed, invoke repaint on the component.

> So I have tried
>
> Panel.removeAll();
> Panel.add("Center", tree);
> Panel.add("South", horizontalScrollbar);
> Panel.add("East", verticalScrollbar);
>
> This does the update perfect however I get a flickerwhen the update
> occurs.


If it updates perfectly, chances are there is code outside of this
snippet that is causing the update.

> So basically my question is in two parts?
>
> Can anyone suggest how I can update the panel to avoid it flickering?


Go to you favorite Internet search engine and search for the terms
"double bufferring", "java", and "awt".
 
Reply With Quote
 
lltaylor
Guest
Posts: n/a
 
      05-07-2004
In your description you wrote that "the new canvas needs to be placed
on the panel", but in the code snippet you add the same component
(named tree) instead of removing the existing component and adding a
new one. Do you have a "new canvas" or not?

But this does not appear to update when changes are made.

There is no update because nothing has changed about the components
that
would cause and update. If the contents of the component has changed,
but it size has not changed, invoke repaint on the component.

-----

OK, the way the code works which I didn't make apparent.
The snippet of code is in a method which is called every time a change
is made to the tree. Just above the snippet I provided I create a new
instance of the tree object (which is a canvas).

So what I am trying to do is remove the old one and replace it with
the newly created one.

What I try to initailly is just remove the the panel with the tree on
it and then add the new tree, but this does not update.

However if I remove all the panels on the applet with the remove all
and then
add them all on again - the update occurs - but with flickering.

It is not a double buffering issue because in the class where I
actually draw
the tree onto the canvas - all the double buffering is done there.

I paint the tree onto a canvas - because I am using the tree for
different implementations so I need a generic tree control, and I am
painting it onto a panel becase I need it to be scrollable.

Does anyone know of a way of stopping the flickering when I am
swapping panels, or is there a better way I can architect this?

Regards

Lloyd


http://www.velocityreviews.com/forums/(E-Mail Removed)9.net (A. Bolmarcich) wrote in message news:<(E-Mail Removed)9.net>...
> In article <(E-Mail Removed) >, lltaylor wrote:
> > Hello,
> >
> > I have written a threaded tree control which is displayed in an
> > applet.
> > The way it works is that the reusable control is a canvas.
> > The control is created in an applet and the canvas is drawn onto a
> > panel.
> >
> > Things work great when the content is static, however when the tree
> > structure
> > is changed - i.e. someone adds a folder or deletes a file problems
> > creep in.
> >
> > I have no problem updating the tree (which is the canvas) but after
> > every change the new canvas needs to be placed on the panel.
> >
> > I have tried
> >
> > Panel.remove(tree);
> > Panel.add("Center", tree);
> > (there are three panels in total - the other two have scrollbars in
> > them)

>
> In your description you wrote that "the new canvas needs to be placed
> on the panel", but in the code snippet you add the same component
> (named tree) instead of removing the existing component and adding a
> new one. Do you have a "new canvas" or not?
>
> > But this does not appear to update when changes are made.

>
> There is no update because nothing has changed about the components that
> would cause and update. If the contents of the component has changed,
> but it size has not changed, invoke repaint on the component.
>
> > So I have tried
> >
> > Panel.removeAll();
> > Panel.add("Center", tree);
> > Panel.add("South", horizontalScrollbar);
> > Panel.add("East", verticalScrollbar);
> >
> > This does the update perfect however I get a flickerwhen the update
> > occurs.

>
> If it updates perfectly, chances are there is code outside of this
> snippet that is causing the update.
>
> > So basically my question is in two parts?
> >
> > Can anyone suggest how I can update the panel to avoid it flickering?

>
> Go to you favorite Internet search engine and search for the terms
> "double bufferring", "java", and "awt".

 
Reply With Quote
 
Andrew Thompson
Guest
Posts: n/a
 
      05-07-2004
On 7 May 2004 02:25:26 -0700, lltaylor wrote:

> OK, the way the code works which I didn't make apparent.

(snip more vague descriptions)

You will find that vague descriptions, top-posted..
<http://www.physci.org/codes/javafaq.jsp#netiquette>
...to 100 line (non trimmed) replies (4th and 5th paragraph)..
<http://www.physci.org/codes/javafaq.jsp#netiquette>
...are less effective at explaining than, say..
<http://www.physci.org/codes/sscce.jsp>
as I mentioned..
<http://google.com/groups?th=3ee994846e9c1d10#link2>

You might be getting better answers at..
<http://www.physci.org/codes/javafaq.jsp#cljh>

HTH

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
 
Reply With Quote
 
lltaylor
Guest
Posts: n/a
 
      05-07-2004
Andrew, Get over yourself.

I don't see the point in replying if all it is about is to boast
how great you are, and that you have a web site - wow.


Andrew Thompson <(E-Mail Removed)> wrote in message news:<ynl3w6xj81vh$.m56zuz1awo0e$(E-Mail Removed)>. ..
> On 7 May 2004 02:25:26 -0700, lltaylor wrote:
>
> > OK, the way the code works which I didn't make apparent.

> (snip more vague descriptions)
>
> You will find that vague descriptions, top-posted..
> <http://www.physci.org/codes/javafaq.jsp#netiquette>
> ..to 100 line (non trimmed) replies (4th and 5th paragraph)..
> <http://www.physci.org/codes/javafaq.jsp#netiquette>
> ..are less effective at explaining than, say..
> <http://www.physci.org/codes/sscce.jsp>
> as I mentioned..
> <http://google.com/groups?th=3ee994846e9c1d10#link2>
>
> You might be getting better answers at..
> <http://www.physci.org/codes/javafaq.jsp#cljh>
>
> HTH

 
Reply With Quote
 
Andrew Thompson
Guest
Posts: n/a
 
      05-07-2004
On 7 May 2004 07:04:59 -0700, lltaylor wrote:

> I don't see the point in replying if all it is about is to boast
> how great you are,


I don't see the point in replying at all if
you do not attentively read the responses
you receive, and formulate reasoned responses.

>..and that you have a web site - wow.


...and you have broken code - wow.

F'Ups set to c.l.j.help.

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to couper contenier of a canvas in an outer canvas??? olsr.kamal@gmail.com Python 10 03-15-2013 08:46 PM
Re: Applet ( canvas ) Lew Java 2 03-20-2009 03:10 AM
Canvas with scrollbars - how to get correct canvas coordinate when the scroll bars have moved? PhilC Python 2 10-25-2004 11:57 AM
Canvas scrolling - scrollBar become "disabled" on change in canvas Askari Python 2 08-30-2004 02:56 PM
applet vs. canvas in applet Rob Love Java 1 07-07-2003 10:07 PM



Advertisments