This campaign is about Human beings, Democracy, UNHCR, Refugees, The Iraqis,
Islam, Kurds, Human rights, Respect, Money, Donations, Angelina Jolie,
Pavarotti, Giorgio Armani, Donors, Peace, History, Campaigns and about you if
you care about these words.
Hi there,
I am SAM, an Iraqi refugee living in Lebanon at the moment; I have spent the
last 10 years of my life as a refugee registered with the UNHCR in Beirut. The
last 4 years, I have spent as an activist for peace and human rights (especially
refugees and asylum seekers) on the Internet; I'm also books author and ebooks
publisher. I have launched many campaigns to improve our situation as refugees
in Lebanon and hopefully bring more understanding to our problems worldwide. I
helped make many changes and improvements at the UNHCR office in Beirut; I used
the Internet as the field for my activities (you can read more about that in my
free ebook 'MY CAMPAIGNS'). All my ebooks are free and could be download from my
sites.
This is my newest campaign, it's about the illegal and humiliating actions of
the UNHCR, who using photos of refugees as banners and human-buttons to collect
money. This is an abuse of the dignity and humanity of the refugees and must
stop immediately and a clear public apology present by The United Nations High
Commissioner for Refugees. My friends, I am talking about the pictures you can
see here: http://unhcrlebanon.createdollz.com/human-buttons.htm
Also you can read my new campaign 'Urgent, we need smile' here:
http://unhcrlebanon.topcities.com/smile.html
For more info about UNHCR and life of refugees you can read my free ebooks. I
invite you as fellow humans and members of the world community to support my
campaign by reading my article on my site and see the human-buttons. The
campaign is to support and improve the UNHCR http://www.unhcr.org especially
after the last scandals in the UN and UNHCR, just for example:
http://www.mizzima.com/archives/news-in-2005/news-in-april/12-April05-22.htm
"We make demonstration and fast because the UNHCR office in Cairo did nothing
for our problem..." http://news.bbc.co.uk/2/hi/africa/4440730.stm
Together we will build better world.
You could reach me fast via this form:
http://lebanon.dreamstation.com/email_me.htm
and if you like to know more about me, you can google for my name 'osam
altaee'.
Thanks
THE TRUTH WARRIOR
http://lebanon.angelcities.comhttp://www.unhcr.us
John,
You guys are definitely treading in uncharted waters. Jurtle wasn't
really designed with the idea of non-Turtle threads using the Turtle
API calls. I do see what is going on though. When the Stop button
is clicked, a "needsToStop" flag is set in the Turtle indicating a
Stop has been requested. Each Turtle drawing method checks this
flag, and if it is set it throws a StopException. The main Turtle
thread catches this exception and cleans up after itself. However if
the Turtle method is being called from a non-Turtle thread, the
exception is not caught and it appears in the console. The running
thread is finally killed however. That explains what you are seeing.
Although fun, I would not recommend this to your students as an
acceptable way of programming.
Bill
On Sep 12, 2005, at 7:12 PM, John Kirkilis wrote:
> Bill,
>
> Well, this isn't the behavior we're seeing. If we press the blue
> button
> 4 times, it takes 5 presses of the STOP button ( 1 for each spawned
> thread and 1 for the Turtle I presume). The pattern holds true for any
> number of blueBtnHandler threads that are spawned. The
> BlueBtnHandler is
> an inner class of the outer Turtle class, so is each press of Jurtle's
> STOP button finding and killing off these "child" threads?
>
> I also assume that since these drawing threads are being spawned from
> the same Turtle instance that they share and overwrite the same
> attributes of that Turtle such as penWidth, penColor, penWidth,
> penPosition, etc. The display is quite entertaining actually and
> we had
> a blast in class today as a result.
>
> Here's the output from the Console...
>
> With curious glee,
>
> John
>
> ----------------------- Begin Console Output ------------------------
>
> Execution started...
>
> Red button clicked
> Green button clicked
> Blue button clicked
> Blue button clicked
> Blue button clicked
> Blue button clicked
> com.otherwise.jurtle.Turtle$StopException
> at com.otherwise.jurtle.Turtle.checkForStop(Turtle.java:132)
> at com.otherwise.jurtle.Turtle.setPosition(Turtle.java:650)
> at com.otherwise.jurtle.Turtle.forward(Turtle.java:170)
> at GUIDisplayReloaded$HandleBlueBtn.run(GUIDisplayReloaded.java:
> 107)
> com.otherwise.jurtle.Turtle$StopException
> at com.otherwise.jurtle.Turtle.checkForStop(Turtle.java:132)
> at com.otherwise.jurtle.Turtle.setPosition(Turtle.java:650)
> at com.otherwise.jurtle.Turtle.forward(Turtle.java:170)
> at GUIDisplayReloaded$HandleBlueBtn.run(GUIDisplayReloaded.java:
> 107)
> com.otherwise.jurtle.Turtle$StopException
> at com.otherwise.jurtle.Turtle.checkForStop(Turtle.java:132)
> at com.otherwise.jurtle.Turtle.setPosition(Turtle.java:650)
> at com.otherwise.jurtle.Turtle.forward(Turtle.java:170)
> at GUIDisplayReloaded$HandleBlueBtn.run(GUIDisplayReloaded.java:
> 107)
> com.otherwise.jurtle.Turtle$StopException
> at com.otherwise.jurtle.Turtle.checkForStop(Turtle.java:132)
> at com.otherwise.jurtle.Turtle.setPosition(Turtle.java:650)
> at GUIDisplayReloaded$HandleBlueBtn.run(GUIDisplayReloaded.java:
> 105)
--
Bill Tschumy
Otherwise -- Austin, TX
http://www.otherwise.com
Bill,
Well, this isn't the behavior we're seeing. If we press the blue button
4 times, it takes 5 presses of the STOP button ( 1 for each spawned
thread and 1 for the Turtle I presume). The pattern holds true for any
number of blueBtnHandler threads that are spawned. The BlueBtnHandler is
an inner class of the outer Turtle class, so is each press of Jurtle's
STOP button finding and killing off these "child" threads?
I also assume that since these drawing threads are being spawned from
the same Turtle instance that they share and overwrite the same
attributes of that Turtle such as penWidth, penColor, penWidth,
penPosition, etc. The display is quite entertaining actually and we had
a blast in class today as a result.
Here's the output from the Console...
With curious glee,
John
----------------------- Begin Console Output ------------------------
Execution started...
Red button clicked
Green button clicked
Blue button clicked
Blue button clicked
Blue button clicked
Blue button clicked
com.otherwise.jurtle.Turtle$StopException
at com.otherwise.jurtle.Turtle.checkForStop(Turtle.java:132)
at com.otherwise.jurtle.Turtle.setPosition(Turtle.java:650)
at com.otherwise.jurtle.Turtle.forward(Turtle.java:170)
at GUIDisplayReloaded$HandleBlueBtn.run(GUIDisplayReloaded.java:107)
com.otherwise.jurtle.Turtle$StopException
at com.otherwise.jurtle.Turtle.checkForStop(Turtle.java:132)
at com.otherwise.jurtle.Turtle.setPosition(Turtle.java:650)
at com.otherwise.jurtle.Turtle.forward(Turtle.java:170)
at GUIDisplayReloaded$HandleBlueBtn.run(GUIDisplayReloaded.java:107)
com.otherwise.jurtle.Turtle$StopException
at com.otherwise.jurtle.Turtle.checkForStop(Turtle.java:132)
at com.otherwise.jurtle.Turtle.setPosition(Turtle.java:650)
at com.otherwise.jurtle.Turtle.forward(Turtle.java:170)
at GUIDisplayReloaded$HandleBlueBtn.run(GUIDisplayReloaded.java:107)
com.otherwise.jurtle.Turtle$StopException
at com.otherwise.jurtle.Turtle.checkForStop(Turtle.java:132)
at com.otherwise.jurtle.Turtle.setPosition(Turtle.java:650)
at GUIDisplayReloaded$HandleBlueBtn.run(GUIDisplayReloaded.java:105)
Bill Tschumy wrote:
> The Stop button will only stop the Turtle thread. Any other threads
> that you may start are unknown to Jurtle and must terminate on their
> own (the normal case) or you have to have code yourself that deals
> with stopping them.
>
>
> On Sep 10, 2005, at 4:28 PM, John Kirkilis wrote:
>
> > Hi Bill,
> >
> > With the changes you suggested to create a separate drawing thread, my
> > students found that if they changed the number of iterations in the
> > ColorWheel code from 360 to something like 3600 which goes around 10
> > times and pressed the Blue button several times in succession, they
> > could get several drawing threads all updating the screen at the same
> > time which is entertaining. They also discovered that if hitting the
> > STOP button in Jurtle appears to kill off one of the threads while
> > leaving the remaining ones running. If you've got a lot of drawing
> > threads, then it takes a lot of clicks to terminate the program. It
> > also
> > appears that the CPU stays pegged even though control has returned to
> > Jurtle. Is this the intended behavior or should the STOP button
> > stop all
> > active user threads?
> >
> > - John
> >
> > p.s. Now my students want to have separate threads drawing in
> > different
> > areas of the display. We've created a monster!
> >
> > Here's the code:
> >
> > /**
> > * The GUIDisplay turtle displays the same basic user interface as
> > GUI,
> > but it does
> > * it within the Display. This shows how to get the display panel and
> > add graphical
> > * elements to it.
> > *
> > * Note the use of waitForStop() at the end of the runTurtle() method.
> > This causes
> > * the turtle to not finish until the Stop button has been clicked or
> > the stopTurtle()
> > * method has been called.
> > */
> >
> > import java.awt.*;
> > import java.awt.event.*;
> > import javax.swing.*;
> > import com.otherwise.jurtle.*;
> >
> > public class GUIDisplayReloaded extends Turtle
> > {
> >
> > JButton redBtn;
> > JButton greenBtn;
> > JButton blueBtn;
> > Container displayContainer;
> >
> > /**
> > * Main entry point to the code. Creates the GUI within the
> > Display
> > * area calls waitForStop to wait until the Stop button is
> > clicked.
> > */
> >
> > public void runTurtle()
> > {
> > displayContainer = getDisplayContainer();
> > JPanel controlsPanel = new JPanel();
> > controlsPanel.setLayout( new FlowLayout() );
> >
> > displayContainer.setLayout( new BorderLayout() );
> > displayContainer.add( controlsPanel, BorderLayout.NORTH );
> > displayContainer.add( getDisplay(), BorderLayout.CENTER );
> >
> > redBtn = new JButton( "Red" );
> > redBtn.addActionListener( new BtnHandler() );
> > controlsPanel.add( redBtn );
> >
> > greenBtn = new JButton( "Green" );
> > greenBtn.addActionListener( new BtnHandler() );
> > controlsPanel.add( greenBtn );
> >
> > blueBtn = new JButton( "Blue" );
> > blueBtn.addActionListener( new BtnHandler() );
> > controlsPanel.add( blueBtn );
> >
> > displayContainer.validate();
> > waitForStop();
> > }
> >
> > /**
> > * The BtnHandler class is responsible for responding to mouse
> > * clicks on the buttons.
> > */
> >
> > private class BtnHandler implements ActionListener
> > {
> > public void actionPerformed( ActionEvent evt )
> > {
> > Object src = evt.getSource();
> > if ( src == redBtn )
> > {
> > setDisplayColor( Color.red );
> > Console.println( "Red button clicked" );
> > }
> > else if ( src == greenBtn )
> > {
> > setDisplayColor( Color.green );
> > Console.println( "Green button clicked" );
> > }
> > else if ( src == blueBtn )
> > {
> > new HandleBlueBtn().start();
> > }
> >
> > }
> > }
> >
> > private class HandleBlueBtn extends Thread
> > {
> > public void run()
> > {
> > setDisplayColor( Color.blue );
> > Console.println( "Blue button clicked" );
> >
> > // insert code from ColorWheel class
> >
> > setPenWidth( 5 );
> > setAutoUpdate( false );
> > hideTurtle();
> >
> > for ( int i = 0; i < 36000; i = i + 1 )
> > {
> > setPenColor( Color.getHSBColor( i / 360.0f, 1.0f,
> > 1.0f ) );
> > center();
> > forward( 200 );
> > right( 1 );
> >
> > // Only update the display every 10th line drawn.
> > This
> > decreases time to draw the entire wheel.
> >
> > if ( ( i % 10 ) == 0 )
> > updateDisplay();
> > }
> > updateDisplay();
> > }
> > }
> > }
> >
> >
> >
> > ------------------------ Yahoo! Groups Sponsor --------------------
> > ~-->
> > Get Bzzzy! (real tools to help you find a job). Welcome to the
> > Sweet Life.
> > http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/5cFolB/TM
> > --------------------------------------------------------------------
> > ~->
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
> >
>
> --
> Bill Tschumy
> Otherwise -- Austin, TX
> http://www.otherwise.com
>
>
>
>
> SPONSORED LINKS
> Basic programming language
>
<http://groups.yahoo.com/gads?t=ms&k=Basic+programming+language&w1=Basic+program\
ming+language&w2=C+programming+language&w3=Computer+programming+languages&w4=The\
+c+programming+language&w5=C+++programming+language&w6=List+of+programming+langu\
ages&c=6&s=193&.sig=aLlETYEcZKW67uFZnuZPPw>
> C programming language
>
<http://groups.yahoo.com/gads?t=ms&k=C+programming+language&w1=Basic+programming\
+language&w2=C+programming+language&w3=Computer+programming+languages&w4=The+c+p\
rogramming+language&w5=C+++programming+language&w6=List+of+programming+languages\
&c=6&s=193&.sig=n4wEVXDpIBKogo8e_G77cw>
> Computer programming languages
>
<http://groups.yahoo.com/gads?t=ms&k=Computer+programming+languages&w1=Basic+pro\
gramming+language&w2=C+programming+language&w3=Computer+programming+languages&w4\
=The+c+programming+language&w5=C+++programming+language&w6=List+of+programming+l\
anguages&c=6&s=193&.sig=KFl1CeQi7jrKmsK4WD6ygQ>
>
> The c programming language
>
<http://groups.yahoo.com/gads?t=ms&k=The+c+programming+language&w1=Basic+program\
ming+language&w2=C+programming+language&w3=Computer+programming+languages&w4=The\
+c+programming+language&w5=C+++programming+language&w6=List+of+programming+langu\
ages&c=6&s=193&.sig=lU9w7-4UlGPB4LjDy84c2Q>
> C programming language
>
<http://groups.yahoo.com/gads?t=ms&k=C+++programming+language&w1=Basic+programmi\
ng+language&w2=C+programming+language&w3=Computer+programming+languages&w4=The+c\
+programming+language&w5=C+++programming+language&w6=List+of+programming+languag\
es&c=6&s=193&.sig=dtKotXT1Ne2N9AO_aEbPFQ>
> List of programming languages
>
<http://groups.yahoo.com/gads?t=ms&k=List+of+programming+languages&w1=Basic+prog\
ramming+language&w2=C+programming+language&w3=Computer+programming+languages&w4=\
The+c+programming+language&w5=C+++programming+language&w6=List+of+programming+la\
nguages&c=6&s=193&.sig=0shmxLBHwrZWcSjC3QvZAA>
>
>
>
> ------------------------------------------------------------------------
> YAHOO! GROUPS LINKS
>
> * Visit your group "jurtle-users
> <http://groups.yahoo.com/group/jurtle-users>" on the web.
>
> * To unsubscribe from this group, send an email to:
> jurtle-users-unsubscribe@yahoogroups.com
> <mailto:jurtle-users-unsubscribe@yahoogroups.com?subject=Unsubscribe>
>
> * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service <http://docs.yahoo.com/info/terms/>.
>
>
> ------------------------------------------------------------------------
>
The Stop button will only stop the Turtle thread. Any other threads
that you may start are unknown to Jurtle and must terminate on their
own (the normal case) or you have to have code yourself that deals
with stopping them.
On Sep 10, 2005, at 4:28 PM, John Kirkilis wrote:
> Hi Bill,
>
> With the changes you suggested to create a separate drawing thread, my
> students found that if they changed the number of iterations in the
> ColorWheel code from 360 to something like 3600 which goes around 10
> times and pressed the Blue button several times in succession, they
> could get several drawing threads all updating the screen at the same
> time which is entertaining. They also discovered that if hitting the
> STOP button in Jurtle appears to kill off one of the threads while
> leaving the remaining ones running. If you've got a lot of drawing
> threads, then it takes a lot of clicks to terminate the program. It
> also
> appears that the CPU stays pegged even though control has returned to
> Jurtle. Is this the intended behavior or should the STOP button
> stop all
> active user threads?
>
> - John
>
> p.s. Now my students want to have separate threads drawing in
> different
> areas of the display. We've created a monster!
>
> Here's the code:
>
> /**
> * The GUIDisplay turtle displays the same basic user interface as
> GUI,
> but it does
> * it within the Display. This shows how to get the display panel and
> add graphical
> * elements to it.
> *
> * Note the use of waitForStop() at the end of the runTurtle() method.
> This causes
> * the turtle to not finish until the Stop button has been clicked or
> the stopTurtle()
> * method has been called.
> */
>
> import java.awt.*;
> import java.awt.event.*;
> import javax.swing.*;
> import com.otherwise.jurtle.*;
>
> public class GUIDisplayReloaded extends Turtle
> {
>
> JButton redBtn;
> JButton greenBtn;
> JButton blueBtn;
> Container displayContainer;
>
> /**
> * Main entry point to the code. Creates the GUI within the
> Display
> * area calls waitForStop to wait until the Stop button is
> clicked.
> */
>
> public void runTurtle()
> {
> displayContainer = getDisplayContainer();
> JPanel controlsPanel = new JPanel();
> controlsPanel.setLayout( new FlowLayout() );
>
> displayContainer.setLayout( new BorderLayout() );
> displayContainer.add( controlsPanel, BorderLayout.NORTH );
> displayContainer.add( getDisplay(), BorderLayout.CENTER );
>
> redBtn = new JButton( "Red" );
> redBtn.addActionListener( new BtnHandler() );
> controlsPanel.add( redBtn );
>
> greenBtn = new JButton( "Green" );
> greenBtn.addActionListener( new BtnHandler() );
> controlsPanel.add( greenBtn );
>
> blueBtn = new JButton( "Blue" );
> blueBtn.addActionListener( new BtnHandler() );
> controlsPanel.add( blueBtn );
>
> displayContainer.validate();
> waitForStop();
> }
>
> /**
> * The BtnHandler class is responsible for responding to mouse
> * clicks on the buttons.
> */
>
> private class BtnHandler implements ActionListener
> {
> public void actionPerformed( ActionEvent evt )
> {
> Object src = evt.getSource();
> if ( src == redBtn )
> {
> setDisplayColor( Color.red );
> Console.println( "Red button clicked" );
> }
> else if ( src == greenBtn )
> {
> setDisplayColor( Color.green );
> Console.println( "Green button clicked" );
> }
> else if ( src == blueBtn )
> {
> new HandleBlueBtn().start();
> }
>
> }
> }
>
> private class HandleBlueBtn extends Thread
> {
> public void run()
> {
> setDisplayColor( Color.blue );
> Console.println( "Blue button clicked" );
>
> // insert code from ColorWheel class
>
> setPenWidth( 5 );
> setAutoUpdate( false );
> hideTurtle();
>
> for ( int i = 0; i < 36000; i = i + 1 )
> {
> setPenColor( Color.getHSBColor( i / 360.0f, 1.0f,
> 1.0f ) );
> center();
> forward( 200 );
> right( 1 );
>
> // Only update the display every 10th line drawn.
> This
> decreases time to draw the entire wheel.
>
> if ( ( i % 10 ) == 0 )
> updateDisplay();
> }
> updateDisplay();
> }
> }
> }
>
>
>
> ------------------------ Yahoo! Groups Sponsor --------------------
> ~-->
> Get Bzzzy! (real tools to help you find a job). Welcome to the
> Sweet Life.
> http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/5cFolB/TM
> --------------------------------------------------------------------
> ~->
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
--
Bill Tschumy
Otherwise -- Austin, TX
http://www.otherwise.com
Hi Bill,
With the changes you suggested to create a separate drawing thread, my
students found that if they changed the number of iterations in the
ColorWheel code from 360 to something like 3600 which goes around 10
times and pressed the Blue button several times in succession, they
could get several drawing threads all updating the screen at the same
time which is entertaining. They also discovered that if hitting the
STOP button in Jurtle appears to kill off one of the threads while
leaving the remaining ones running. If you've got a lot of drawing
threads, then it takes a lot of clicks to terminate the program. It also
appears that the CPU stays pegged even though control has returned to
Jurtle. Is this the intended behavior or should the STOP button stop all
active user threads?
- John
p.s. Now my students want to have separate threads drawing in different
areas of the display. We've created a monster!
Here's the code:
/**
* The GUIDisplay turtle displays the same basic user interface as GUI,
but it does
* it within the Display. This shows how to get the display panel and
add graphical
* elements to it.
*
* Note the use of waitForStop() at the end of the runTurtle() method.
This causes
* the turtle to not finish until the Stop button has been clicked or
the stopTurtle()
* method has been called.
*/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import com.otherwise.jurtle.*;
public class GUIDisplayReloaded extends Turtle
{
JButton redBtn;
JButton greenBtn;
JButton blueBtn;
Container displayContainer;
/**
* Main entry point to the code. Creates the GUI within the Display
* area calls waitForStop to wait until the Stop button is clicked.
*/
public void runTurtle()
{
displayContainer = getDisplayContainer();
JPanel controlsPanel = new JPanel();
controlsPanel.setLayout( new FlowLayout() );
displayContainer.setLayout( new BorderLayout() );
displayContainer.add( controlsPanel, BorderLayout.NORTH );
displayContainer.add( getDisplay(), BorderLayout.CENTER );
redBtn = new JButton( "Red" );
redBtn.addActionListener( new BtnHandler() );
controlsPanel.add( redBtn );
greenBtn = new JButton( "Green" );
greenBtn.addActionListener( new BtnHandler() );
controlsPanel.add( greenBtn );
blueBtn = new JButton( "Blue" );
blueBtn.addActionListener( new BtnHandler() );
controlsPanel.add( blueBtn );
displayContainer.validate();
waitForStop();
}
/**
* The BtnHandler class is responsible for responding to mouse
* clicks on the buttons.
*/
private class BtnHandler implements ActionListener
{
public void actionPerformed( ActionEvent evt )
{
Object src = evt.getSource();
if ( src == redBtn )
{
setDisplayColor( Color.red );
Console.println( "Red button clicked" );
}
else if ( src == greenBtn )
{
setDisplayColor( Color.green );
Console.println( "Green button clicked" );
}
else if ( src == blueBtn )
{
new HandleBlueBtn().start();
}
}
}
private class HandleBlueBtn extends Thread
{
public void run()
{
setDisplayColor( Color.blue );
Console.println( "Blue button clicked" );
// insert code from ColorWheel class
setPenWidth( 5 );
setAutoUpdate( false );
hideTurtle();
for ( int i = 0; i < 36000; i = i + 1 )
{
setPenColor( Color.getHSBColor( i / 360.0f, 1.0f, 1.0f ) );
center();
forward( 200 );
right( 1 );
// Only update the display every 10th line drawn. This
decreases time to draw the entire wheel.
if ( ( i % 10 ) == 0 )
updateDisplay();
}
updateDisplay();
}
}
}
On Sep 8, 2005, at 7:37 PM, John Kirkilis wrote:
> Bill,
>
> I was afraid you were going to say that, but since you've provided me
> with a working example, I'm glad. I've talked about multi-threading to
> my students and the event listener model, so we'll just get to dive
> into
> in a few weeks earlier.
>
> I'm still not quite sure why your PolySpiral example with the JSlider
> works just fine without needing to spawn a drawing thread. Is it
> because
> a complete spiral is drawn in response to a slider action with no
> intermediate updates being requested?
Yes, that's it exactly. If you don't need to see the intermediate
drawing there is no need for a separate thread. Once you return from
the slider's event the (complete) drawing can be processed the next
time through the event loop.
>
> Thanks again for all of your help.
>
> - John
>
--
Bill Tschumy
Otherwise -- Austin, TX
http://www.otherwise.com
Bill,
I was afraid you were going to say that, but since you've provided me
with a working example, I'm glad. I've talked about multi-threading to
my students and the event listener model, so we'll just get to dive into
in a few weeks earlier.
I'm still not quite sure why your PolySpiral example with the JSlider
works just fine without needing to spawn a drawing thread. Is it because
a complete spiral is drawn in response to a slider action with no
intermediate updates being requested?
Thanks again for all of your help.
- John
Bill Tschumy wrote:
> John,
>
> This is normal when executing code on the Event Thread. Because the
> event thread is used for both events and drawing updates, it is
> somewhat tricky to get intermediate drawing to happen during a method
> that is running on this thread. The standard way would be to let the
> event thread method start another thread that does the drawing,
> calling updateDisplay as needed. Because this is not happening on
> the event thread, it is now freed up to process the update events.
>
> Here is some modified code that demonstrates this. Welcome to the
> (somewhat confusing) world of multi-threaded programming.
>
> /**
> * The GUIDisplay turtle displays the same basic user interface as
> GUI, but it does
> * it within the Display. This shows how to get the display panel
> and add graphical
> * elements to it.
> *
> * Note the use of waitForStop() at the end of the runTurtle()
> method. This causes
> * the turtle to not finish until the Stop button has been clicked or
> the stopTurtle()
> * method has been called.
> */
>
> import java.awt.*;
> import java.awt.event.*;
> import javax.swing.*;
> import com.otherwise.jurtle.*;
>
> public class GUIDisplay extends Turtle
> {
>
> JButton redBtn;
> JButton greenBtn;
> JButton blueBtn;
> Container displayContainer;
>
> /**
> * Main entry point to the code. Creates the GUI within the
> Display
> * area calls waitForStop to wait until the Stop button is
> clicked.
> */
> public void runTurtle()
> {
> displayContainer = getDisplayContainer();
> JPanel controlsPanel = new JPanel();
> controlsPanel.setLayout( new FlowLayout() );
>
> displayContainer.setLayout( new BorderLayout() );
> displayContainer.add( controlsPanel, BorderLayout.NORTH );
> displayContainer.add( getDisplay(), BorderLayout.CENTER );
>
> redBtn = new JButton( "Red" );
> redBtn.addActionListener( new BtnHandler() );
> controlsPanel.add( redBtn );
>
> greenBtn = new JButton( "Green" );
> greenBtn.addActionListener( new BtnHandler() );
> controlsPanel.add( greenBtn );
>
> blueBtn = new JButton( "Blue" );
> blueBtn.addActionListener( new BtnHandler() );
> controlsPanel.add( blueBtn );
>
> displayContainer.validate();
> waitForStop();
> }
>
> /**
> * The BtnHandler class is responsible for responding to mouse
> * clicks on the buttons.
> */
> private class BtnHandler implements ActionListener
> {
> public void actionPerformed( ActionEvent evt )
> {
> Object src = evt.getSource();
> if ( src == redBtn )
> {
> setDisplayColor( Color.red );
> Console.println( "Red button clicked" );
> }
> else if ( src == greenBtn )
> {
> setDisplayColor( Color.green );
> Console.println( "Green button clicked" );
> }
> else if ( src == blueBtn )
> {
> (new HandleBlueBtn()).start();
> }
>
> }
> }
>
> private class HandleBlueBtn extends Thread
> {
> public void run()
> {
> setDisplayColor( Color.blue );
> Console.println( "Blue button clicked" );
>
> // insert code from ColorWheel class
>
> setPenWidth( 5 );
> setAutoUpdate( false );
> hideTurtle();
>
> for ( int i = 0; i < 360; i = i + 1 )
> {
> setPenColor( Color.getHSBColor( i / 360.0f, 1.0f,
> 1.0f ) );
> center();
> forward( 200 );
> right( 1 );
>
> // Only update the display every 10th line drawn.
> This decreases
> // time to draw the wheel
> if ( ( i % 10 ) == 0 )
> updateDisplay();
> }
> updateDisplay();
> }
> }
>
>
> }
>
>
> Bill
>
> On Sep 7, 2005, at 11:43 PM, John Kirkilis wrote:
>
> > Howdy Bill,
> >
> > For the past few classes, I've been going over GUI interface
> > programming
> > with my students. I started them off with the slider example
> > (PolySpiral), but then retreated back to the "GUIDisplay" example as a
> > better starting point. GUIDisplay uses a named inner class for the
> > button handling while the PolySpiral uses an anonymous class to handle
> > the events.
> >
> > My students started adding their own buttons and then invoking some of
> > the drawing code from other Jurtle examples in the handler methods. In
> > every case, the display area did not update until the execution of the
> > handler completed even though some of the code explicitly asked for
> > updates to occur as certain intervals. I'm suspicious that there's
> > some
> > event and/or thread management issue that is not allowing any of the
> > interim updates, or perhaps the updateDisplay() method is not updating
> > the drawing container for some other reason.
> >
> > In the attached file, I took the GUIDisplay example and then inserted
> > the ColorWheel example's drawing code into the handler for the Blue
> > Button and as my students experienced, only one display update
> > occurred
> > at the very end.
> >
> > What am I not seeing or understanding?
> >
> > Thanks,
> >
> > John
> >
> >
> >
> > ------------------------ Yahoo! Groups Sponsor --------------------
> > ~-->
> > Get Bzzzy! (real tools to help you find a job). Welcome to the
> > Sweet Life.
> > http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/5cFolB/TM
> > --------------------------------------------------------------------
> > ~->
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
>
> --
> Bill Tschumy
> Otherwise -- Austin, TX
> http://www.otherwise.com
>
>
>
> ------------------------------------------------------------------------
> YAHOO! GROUPS LINKS
>
> * Visit your group "jurtle-users
> <http://groups.yahoo.com/group/jurtle-users>" on the web.
>
> * To unsubscribe from this group, send an email to:
> jurtle-users-unsubscribe@yahoogroups.com
> <mailto:jurtle-users-unsubscribe@yahoogroups.com?subject=Unsubscribe>
>
> * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service <http://docs.yahoo.com/info/terms/>.
>
>
> ------------------------------------------------------------------------
>
John,
This is normal when executing code on the Event Thread. Because the
event thread is used for both events and drawing updates, it is
somewhat tricky to get intermediate drawing to happen during a method
that is running on this thread. The standard way would be to let the
event thread method start another thread that does the drawing,
calling updateDisplay as needed. Because this is not happening on
the event thread, it is now freed up to process the update events.
Here is some modified code that demonstrates this. Welcome to the
(somewhat confusing) world of multi-threaded programming.
/**
* The GUIDisplay turtle displays the same basic user interface as
GUI, but it does
* it within the Display. This shows how to get the display panel
and add graphical
* elements to it.
*
* Note the use of waitForStop() at the end of the runTurtle()
method. This causes
* the turtle to not finish until the Stop button has been clicked or
the stopTurtle()
* method has been called.
*/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import com.otherwise.jurtle.*;
public class GUIDisplay extends Turtle
{
JButton redBtn;
JButton greenBtn;
JButton blueBtn;
Container displayContainer;
/**
* Main entry point to the code. Creates the GUI within the
Display
* area calls waitForStop to wait until the Stop button is
clicked.
*/
public void runTurtle()
{
displayContainer = getDisplayContainer();
JPanel controlsPanel = new JPanel();
controlsPanel.setLayout( new FlowLayout() );
displayContainer.setLayout( new BorderLayout() );
displayContainer.add( controlsPanel, BorderLayout.NORTH );
displayContainer.add( getDisplay(), BorderLayout.CENTER );
redBtn = new JButton( "Red" );
redBtn.addActionListener( new BtnHandler() );
controlsPanel.add( redBtn );
greenBtn = new JButton( "Green" );
greenBtn.addActionListener( new BtnHandler() );
controlsPanel.add( greenBtn );
blueBtn = new JButton( "Blue" );
blueBtn.addActionListener( new BtnHandler() );
controlsPanel.add( blueBtn );
displayContainer.validate();
waitForStop();
}
/**
* The BtnHandler class is responsible for responding to mouse
* clicks on the buttons.
*/
private class BtnHandler implements ActionListener
{
public void actionPerformed( ActionEvent evt )
{
Object src = evt.getSource();
if ( src == redBtn )
{
setDisplayColor( Color.red );
Console.println( "Red button clicked" );
}
else if ( src == greenBtn )
{
setDisplayColor( Color.green );
Console.println( "Green button clicked" );
}
else if ( src == blueBtn )
{
(new HandleBlueBtn()).start();
}
}
}
private class HandleBlueBtn extends Thread
{
public void run()
{
setDisplayColor( Color.blue );
Console.println( "Blue button clicked" );
// insert code from ColorWheel class
setPenWidth( 5 );
setAutoUpdate( false );
hideTurtle();
for ( int i = 0; i < 360; i = i + 1 )
{
setPenColor( Color.getHSBColor( i / 360.0f, 1.0f,
1.0f ) );
center();
forward( 200 );
right( 1 );
// Only update the display every 10th line drawn.
This decreases
// time to draw the wheel
if ( ( i % 10 ) == 0 )
updateDisplay();
}
updateDisplay();
}
}
}
Bill
On Sep 7, 2005, at 11:43 PM, John Kirkilis wrote:
> Howdy Bill,
>
> For the past few classes, I've been going over GUI interface
> programming
> with my students. I started them off with the slider example
> (PolySpiral), but then retreated back to the "GUIDisplay" example as a
> better starting point. GUIDisplay uses a named inner class for the
> button handling while the PolySpiral uses an anonymous class to handle
> the events.
>
> My students started adding their own buttons and then invoking some of
> the drawing code from other Jurtle examples in the handler methods. In
> every case, the display area did not update until the execution of the
> handler completed even though some of the code explicitly asked for
> updates to occur as certain intervals. I'm suspicious that there's
> some
> event and/or thread management issue that is not allowing any of the
> interim updates, or perhaps the updateDisplay() method is not updating
> the drawing container for some other reason.
>
> In the attached file, I took the GUIDisplay example and then inserted
> the ColorWheel example's drawing code into the handler for the Blue
> Button and as my students experienced, only one display update
> occurred
> at the very end.
>
> What am I not seeing or understanding?
>
> Thanks,
>
> John
>
>
>
> ------------------------ Yahoo! Groups Sponsor --------------------
> ~-->
> Get Bzzzy! (real tools to help you find a job). Welcome to the
> Sweet Life.
> http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/5cFolB/TM
> --------------------------------------------------------------------
> ~->
>
>
> Yahoo! Groups Links
>
>
>
>
--
Bill Tschumy
Otherwise -- Austin, TX
http://www.otherwise.com
Howdy Bill,
For the past few classes, I've been going over GUI interface programming
with my students. I started them off with the slider example
(PolySpiral), but then retreated back to the "GUIDisplay" example as a
better starting point. GUIDisplay uses a named inner class for the
button handling while the PolySpiral uses an anonymous class to handle
the events.
My students started adding their own buttons and then invoking some of
the drawing code from other Jurtle examples in the handler methods. In
every case, the display area did not update until the execution of the
handler completed even though some of the code explicitly asked for
updates to occur as certain intervals. I'm suspicious that there's some
event and/or thread management issue that is not allowing any of the
interim updates, or perhaps the updateDisplay() method is not updating
the drawing container for some other reason.
In the attached file, I took the GUIDisplay example and then inserted
the ColorWheel example's drawing code into the handler for the Blue
Button and as my students experienced, only one display update occurred
at the very end.
What am I not seeing or understanding?
Thanks,
John
No, there is no way to show just the Display pane without the rest of
the interface being visible. It seems you are really stretching
Jurtle outside of its intended purpose.
Bill
On Sep 7, 2005, at 12:52 PM, chander2010 wrote:
> Is there any way to hide the java programme? basically I want open
> Display window directly when Jurtle editor was opened, this is for
> presenataion.
>
> so I want hide the programme to outside people. or I want to lock the
> edit window?
>
> thanks in advance
>
>
>
>
> ------------------------ Yahoo! Groups Sponsor --------------------
> ~-->
> Most low income households are not online. Help bridge the digital
> divide today!
> http://us.click.yahoo.com/cd_AJB/QnQLAA/TtwFAA/5cFolB/TM
> --------------------------------------------------------------------
> ~->
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
--
Bill Tschumy
Otherwise -- Austin, TX
http://www.otherwise.com
Is there any way to hide the java programme? basically I want open
Display window directly when Jurtle editor was opened, this is for
presenataion.
so I want hide the programme to outside people. or I want to lock the
edit window?
thanks in advance
You cannot run any of the Turtle subclasses outside of Jurtle.
Jurtle sets up the appropriate display area that Turtles require.
In theory I could extract the necessary classes for Turtles and
package them in a standalone jar. Then running a Turtle would open a
JFrame with just the Display area. However, this change is not high
on my priority list. If others request it, I will consider doing it
in a future release.
On Jul 13, 2005, at 12:19 PM, chander2010 wrote:
> Is there a way to run the BouncingBalls example from the command
> line? When I try to run the example and include the Jurtle.jar file
> in the classpath I get a NullPointerException. I would like to
> reapply this concept to launch my own graphic program. Is there some
> kind of Graphics or Component layouts that I need to setup before
> instantiating the BouncingBalls object?
>
> Exception in thread "main" java.lang.NullPointerException
> at com.otherwise.jurtle.Turtle.<init>(SourceFile:77)
> at BouncingBalls.<init>(BouncingBalls.java:22)
> at BouncingBalls.main(BouncingBalls.java:70)
--
Bill Tschumy
Otherwise -- Austin, TX
http://www.otherwise.com
Is there a way to run the BouncingBalls example from the command
line? When I try to run the example and include the Jurtle.jar file
in the classpath I get a NullPointerException. I would like to
reapply this concept to launch my own graphic program. Is there some
kind of Graphics or Component layouts that I need to setup before
instantiating the BouncingBalls object?
Exception in thread "main" java.lang.NullPointerException
at com.otherwise.jurtle.Turtle.<init>(SourceFile:77)
at BouncingBalls.<init>(BouncingBalls.java:22)
at BouncingBalls.main(BouncingBalls.java:70)
On Jul 8, 2005, at 10:58 AM, chander2010 wrote:
> Hi jhon
>
> I am taking about display area should go beyond the present display
> in the Jurtle even after minimize the left side file content list
> and bottom consol area, I mean can I extend the display area should
> go out of the monitor display area, to use scroll bars to vertical
> and horizontal. like setSeize(1500, 1500) or more.
>
> thanks
> Chander
>
There is no way to do this. The Jurtle display area is controlled by
the physical size of the window. There is no virtual display. Sorry.
--
Bill Tschumy
Otherwise -- Austin, TX
http://www.otherwise.com
Hi jhon
I am taking about display area should go beyond the present display
in the Jurtle even after minimize the left side file content list
and bottom consol area, I mean can I extend the display area should
go out of the monitor display area, to use scroll bars to vertical
and horizontal. like setSeize(1500, 1500) or more.
thanks
Chander
--- In jurtle-users@yahoogroups.com, John Kirkilis <john@a...> wrote:
> Chander,
>
> I'm not sure I understand your question. You can hide the panel on
the
> left which lists the contents of your current folder by dragging
the
> panel boundary to the left and you can drag the boundry between
the
> display and console areas down to maximize the size of the display
area
> within Jurtle. Obviously, you should maximize the Jurtle window to
take
> up your full screen.
>
> Is this what you need?
>
> John
>
> chander2010 wrote:
>
> > Hi All
> >
> > I need to increase the display seize in the Jurtle, I need to
draw
> > multiple flowers so that extends height of the editor so what is
max
> > limit for the dispaly seize in Jurtle, plase help me.
> >
> > thanks in advance
> > Chander
> >
> >
> >
> > -----------------------------------------------------------------
-------
> > YAHOO! GROUPS LINKS
> >
> > * Visit your group "jurtle-users
> > <http://groups.yahoo.com/group/jurtle-users>" on the web.
> >
> > * To unsubscribe from this group, send an email to:
> > jurtle-users-unsubscribe@yahoogroups.com
> > <mailto:jurtle-users-unsubscribe@yahoogroups.com?
subject=Unsubscribe>
> >
> > * Your use of Yahoo! Groups is subject to the Yahoo! Terms
of
> > Service <http://docs.yahoo.com/info/terms/>.
> >
> >
> > -----------------------------------------------------------------
-------
> >
Chander,
I'm not sure I understand your question. You can hide the panel on the
left which lists the contents of your current folder by dragging the
panel boundary to the left and you can drag the boundry between the
display and console areas down to maximize the size of the display area
within Jurtle. Obviously, you should maximize the Jurtle window to take
up your full screen.
Is this what you need?
John
chander2010 wrote:
> Hi All
>
> I need to increase the display seize in the Jurtle, I need to draw
> multiple flowers so that extends height of the editor so what is max
> limit for the dispaly seize in Jurtle, plase help me.
>
> thanks in advance
> Chander
>
>
>
> ------------------------------------------------------------------------
> YAHOO! GROUPS LINKS
>
> * Visit your group "jurtle-users
> <http://groups.yahoo.com/group/jurtle-users>" on the web.
>
> * To unsubscribe from this group, send an email to:
> jurtle-users-unsubscribe@yahoogroups.com
> <mailto:jurtle-users-unsubscribe@yahoogroups.com?subject=Unsubscribe>
>
> * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service <http://docs.yahoo.com/info/terms/>.
>
>
> ------------------------------------------------------------------------
>
Hi All
I need to increase the display seize in the Jurtle, I need to draw
multiple flowers so that extends height of the editor so what is max
limit for the dispaly seize in Jurtle, plase help me.
thanks in advance
Chander
Hi all
at last fixed my self, to fill the different colors to petals in
Flower.java, just I replaced petal method with this code.
private void petal( double radius, double degrees ){
for ( double i = radius; i > 0 ; i-- ) {
setPenWidth( (int)(degrees /100) );
arcRight( i, degrees );
right( 180 - degrees );
arcRight( i, degrees );
right( 180 - degrees );
}
}
chander
--- In jurtle-users@yahoogroups.com, Bill Tschumy <bill@o...> wrote:
> Chander,
>
> I gave you bad advice on using fillArc. This method doesn't do
what
> I thought. It will draw a pie shaped wedge rather than a 1/2 a
petal
> like I assumed.
>
> The requirement to fill the petals really makes this problem
harder.
> Are you sure it is necessary?
>
> If you need to fill it, I see your choices as:
>
> 1. use fillPolygon(), but you will need to calculate a list of
points
> defining the polygon of each petal.
> 2. use fillOval(), but you will need to rotate and translate the
> coordinate system to get each petal oriented correctly.
> 3. use drawImage() to draw a generic image of the petal, but you
will
> need to rotate and translate the coordinate system as in #2.
>
> I think you need to discuss this with your instructor and get
> guidance from him. I don't think I can help you further.
>
>
> Bill
>
> On Jun 30, 2005, at 9:12 AM, chander2010 wrote:
>
> > Jhon
> >
> > I used this fillArc method in arcRight() or arcLeft() , this
works,
> > but the problem is it over rides each petal at same positions of
X,
> > Y. I need it should fill the petal as side by side in a circle.
> > g.fillArc(pt.x, pt.y, (int)radius, (int)degrees, 180, 360);
> >
> > thanks
> > Chander
> >
> >
> > --- In jurtle-users@yahoogroups.com, John Kirkilis <john@a...>
wrote:
> >
> >> Chander,
> >>
> >> I haven't done much of any graphics programming outside of
> >>
> > Jurtle's
> >
> >> Turtle methods, but you can get the coordinates of the current
> >>
> > Turtle's
> >
> >> position in the graphic's context by calling the getPosition
> >>
> > method
> >
> >> which returns an object of type Dimension if memory serves me
> >>
> > correctly.
> >
> >> I would hope that the Java2D or AWT arcRight / arcLeft methods
use
> >>
> > the
> >
> >> same coordinate system, but perhaps not.
> >>
> >> Bill will be able to give you a more definite answer, but I
> >>
> > thought I'd
> >
> >> throw in my 2 cents anyway.
> >>
> >> Good luck,
> >>
> >> John
> >>
> >> chander2010 wrote:
> >>
> >>
> >>> I tried to do same way in arcRight() or arcLeft() but I
couldnot
> >>> able to find the X, Y positions and width & height, can you
help
> >>>
> > me
> >
> >>> how to figure out the positions to fill the colors.
> >>>
> >>> this is very urgent, please help me.
> >>>
> >>> thanks
> >>> Chander
> >>>
> >>>
> >>> --- In jurtle-users@yahoogroups.com, Bill Tschumy <bill@o...>
> >>>
> > wrote:
> >
> >>>> That's going to be a bit tricky to do. Turtle Graphics is
> >>>>
> >>> designed
> >>>
> >>>> mainly for line drawing, not for filing areas. You would
> >>>>
> > probably
> >
> >>> be
> >>>
> >>>> better off replacing the arcRight and arcLeft methods in
Flower
> >>>>
> >>> with
> >>>
> >>>> the fillArc method of java.awt.Graphics. You can get the
> >>>>
> >>> Graphics
> >>>
> >>>> object using the Turtle method getGraphics().
> >>>>
> >>>>
> >>>> On Jun 28, 2005, at 12:44 PM, chander2010 wrote:
> >>>>
> >>>>
> >>>>> Hi All
> >>>>>
> >>>>> I need to fill in each petal with different colors in
> >>>>>
> > Flower.java
> >
> >>>>> example. i can draw each petal with different colors, but I
> >>>>>
> >>> couldn't
> >>>
> >>>>> able to fill colors. any body can help me.
> >>>>>
> >>>>> thanks in advance
> >>>>> chander
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>> Yahoo! Groups Links
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>
> >>>> --
> >>>> Bill Tschumy
> >>>> Otherwise -- Austin, TX
> >>>> http://www.otherwise.com
> >>>>
> >>>
> >>>
> >>>
> >>> ---------------------------------------------------------------
--
> >>>
> > -------
> >
> >>> YAHOO! GROUPS LINKS
> >>>
> >>> * Visit your group "jurtle-users
> >>> <http://groups.yahoo.com/group/jurtle-users>" on the web.
> >>>
> >>> * To unsubscribe from this group, send an email to:
> >>> jurtle-users-unsubscribe@yahoogroups.com
> >>> <mailto:jurtle-users-unsubscribe@yahoogroups.com?
> >>>
> > subject=Unsubscribe>
> >
> >>>
> >>> * Your use of Yahoo! Groups is subject to the Yahoo! Terms
> >>>
> > of
> >
> >>> Service <http://docs.yahoo.com/info/terms/>.
> >>>
> >>>
> >>> ---------------------------------------------------------------
--
> >>>
> > -------
> >
> >>>
> >>>
> >
> >
> >
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
>
> --
> Bill Tschumy
> Otherwise -- Austin, TX
> http://www.otherwise.com
Chander,
I gave you bad advice on using fillArc. This method doesn't do what
I thought. It will draw a pie shaped wedge rather than a 1/2 a petal
like I assumed.
The requirement to fill the petals really makes this problem harder.
Are you sure it is necessary?
If you need to fill it, I see your choices as:
1. use fillPolygon(), but you will need to calculate a list of points
defining the polygon of each petal.
2. use fillOval(), but you will need to rotate and translate the
coordinate system to get each petal oriented correctly.
3. use drawImage() to draw a generic image of the petal, but you will
need to rotate and translate the coordinate system as in #2.
I think you need to discuss this with your instructor and get
guidance from him. I don't think I can help you further.
Bill
On Jun 30, 2005, at 9:12 AM, chander2010 wrote:
> Jhon
>
> I used this fillArc method in arcRight() or arcLeft() , this works,
> but the problem is it over rides each petal at same positions of X,
> Y. I need it should fill the petal as side by side in a circle.
> g.fillArc(pt.x, pt.y, (int)radius, (int)degrees, 180, 360);
>
> thanks
> Chander
>
>
> --- In jurtle-users@yahoogroups.com, John Kirkilis <john@a...> wrote:
>
>> Chander,
>>
>> I haven't done much of any graphics programming outside of
>>
> Jurtle's
>
>> Turtle methods, but you can get the coordinates of the current
>>
> Turtle's
>
>> position in the graphic's context by calling the getPosition
>>
> method
>
>> which returns an object of type Dimension if memory serves me
>>
> correctly.
>
>> I would hope that the Java2D or AWT arcRight / arcLeft methods use
>>
> the
>
>> same coordinate system, but perhaps not.
>>
>> Bill will be able to give you a more definite answer, but I
>>
> thought I'd
>
>> throw in my 2 cents anyway.
>>
>> Good luck,
>>
>> John
>>
>> chander2010 wrote:
>>
>>
>>> I tried to do same way in arcRight() or arcLeft() but I couldnot
>>> able to find the X, Y positions and width & height, can you help
>>>
> me
>
>>> how to figure out the positions to fill the colors.
>>>
>>> this is very urgent, please help me.
>>>
>>> thanks
>>> Chander
>>>
>>>
>>> --- In jurtle-users@yahoogroups.com, Bill Tschumy <bill@o...>
>>>
> wrote:
>
>>>> That's going to be a bit tricky to do. Turtle Graphics is
>>>>
>>> designed
>>>
>>>> mainly for line drawing, not for filing areas. You would
>>>>
> probably
>
>>> be
>>>
>>>> better off replacing the arcRight and arcLeft methods in Flower
>>>>
>>> with
>>>
>>>> the fillArc method of java.awt.Graphics. You can get the
>>>>
>>> Graphics
>>>
>>>> object using the Turtle method getGraphics().
>>>>
>>>>
>>>> On Jun 28, 2005, at 12:44 PM, chander2010 wrote:
>>>>
>>>>
>>>>> Hi All
>>>>>
>>>>> I need to fill in each petal with different colors in
>>>>>
> Flower.java
>
>>>>> example. i can draw each petal with different colors, but I
>>>>>
>>> couldn't
>>>
>>>>> able to fill colors. any body can help me.
>>>>>
>>>>> thanks in advance
>>>>> chander
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Yahoo! Groups Links
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> Bill Tschumy
>>>> Otherwise -- Austin, TX
>>>> http://www.otherwise.com
>>>>
>>>
>>>
>>>
>>> -----------------------------------------------------------------
>>>
> -------
>
>>> YAHOO! GROUPS LINKS
>>>
>>> * Visit your group "jurtle-users
>>> <http://groups.yahoo.com/group/jurtle-users>" on the web.
>>>
>>> * To unsubscribe from this group, send an email to:
>>> jurtle-users-unsubscribe@yahoogroups.com
>>> <mailto:jurtle-users-unsubscribe@yahoogroups.com?
>>>
> subject=Unsubscribe>
>
>>>
>>> * Your use of Yahoo! Groups is subject to the Yahoo! Terms
>>>
> of
>
>>> Service <http://docs.yahoo.com/info/terms/>.
>>>
>>>
>>> -----------------------------------------------------------------
>>>
> -------
>
>>>
>>>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
--
Bill Tschumy
Otherwise -- Austin, TX
http://www.otherwise.com
Jhon
I used this fillArc method in arcRight() or arcLeft() , this works,
but the problem is it over rides each petal at same positions of X,
Y. I need it should fill the petal as side by side in a circle.
g.fillArc(pt.x, pt.y, (int)radius, (int)degrees, 180, 360);
thanks
Chander
--- In jurtle-users@yahoogroups.com, John Kirkilis <john@a...> wrote:
> Chander,
>
> I haven't done much of any graphics programming outside of
Jurtle's
> Turtle methods, but you can get the coordinates of the current
Turtle's
> position in the graphic's context by calling the getPosition
method
> which returns an object of type Dimension if memory serves me
correctly.
> I would hope that the Java2D or AWT arcRight / arcLeft methods use
the
> same coordinate system, but perhaps not.
>
> Bill will be able to give you a more definite answer, but I
thought I'd
> throw in my 2 cents anyway.
>
> Good luck,
>
> John
>
> chander2010 wrote:
>
> > I tried to do same way in arcRight() or arcLeft() but I couldnot
> > able to find the X, Y positions and width & height, can you help
me
> > how to figure out the positions to fill the colors.
> >
> > this is very urgent, please help me.
> >
> > thanks
> > Chander
> >
> >
> > --- In jurtle-users@yahoogroups.com, Bill Tschumy <bill@o...>
wrote:
> > > That's going to be a bit tricky to do. Turtle Graphics is
> > designed
> > > mainly for line drawing, not for filing areas. You would
probably
> > be
> > > better off replacing the arcRight and arcLeft methods in Flower
> > with
> > > the fillArc method of java.awt.Graphics. You can get the
> > Graphics
> > > object using the Turtle method getGraphics().
> > >
> > >
> > > On Jun 28, 2005, at 12:44 PM, chander2010 wrote:
> > >
> > > > Hi All
> > > >
> > > > I need to fill in each petal with different colors in
Flower.java
> > > > example. i can draw each petal with different colors, but I
> > couldn't
> > > > able to fill colors. any body can help me.
> > > >
> > > > thanks in advance
> > > > chander
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > Yahoo! Groups Links
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > > --
> > > Bill Tschumy
> > > Otherwise -- Austin, TX
> > > http://www.otherwise.com
> >
> >
> >
> > -----------------------------------------------------------------
-------
> > YAHOO! GROUPS LINKS
> >
> > * Visit your group "jurtle-users
> > <http://groups.yahoo.com/group/jurtle-users>" on the web.
> >
> > * To unsubscribe from this group, send an email to:
> > jurtle-users-unsubscribe@yahoogroups.com
> > <mailto:jurtle-users-unsubscribe@yahoogroups.com?
subject=Unsubscribe>
> >
> > * Your use of Yahoo! Groups is subject to the Yahoo! Terms
of
> > Service <http://docs.yahoo.com/info/terms/>.
> >
> >
> > -----------------------------------------------------------------
-------
> >
Chander,
I haven't done much of any graphics programming outside of Jurtle's
Turtle methods, but you can get the coordinates of the current Turtle's
position in the graphic's context by calling the getPosition method
which returns an object of type Dimension if memory serves me correctly.
I would hope that the Java2D or AWT arcRight / arcLeft methods use the
same coordinate system, but perhaps not.
Bill will be able to give you a more definite answer, but I thought I'd
throw in my 2 cents anyway.
Good luck,
John
chander2010 wrote:
> I tried to do same way in arcRight() or arcLeft() but I couldnot
> able to find the X, Y positions and width & height, can you help me
> how to figure out the positions to fill the colors.
>
> this is very urgent, please help me.
>
> thanks
> Chander
>
>
> --- In jurtle-users@yahoogroups.com, Bill Tschumy <bill@o...> wrote:
> > That's going to be a bit tricky to do. Turtle Graphics is
> designed
> > mainly for line drawing, not for filing areas. You would probably
> be
> > better off replacing the arcRight and arcLeft methods in Flower
> with
> > the fillArc method of java.awt.Graphics. You can get the
> Graphics
> > object using the Turtle method getGraphics().
> >
> >
> > On Jun 28, 2005, at 12:44 PM, chander2010 wrote:
> >
> > > Hi All
> > >
> > > I need to fill in each petal with different colors in Flower.java
> > > example. i can draw each petal with different colors, but I
> couldn't
> > > able to fill colors. any body can help me.
> > >
> > > thanks in advance
> > > chander
> > >
> > >
> > >
> > >
> > >
> > > Yahoo! Groups Links
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
> > --
> > Bill Tschumy
> > Otherwise -- Austin, TX
> > http://www.otherwise.com
>
>
>
> ------------------------------------------------------------------------
> YAHOO! GROUPS LINKS
>
> * Visit your group "jurtle-users
> <http://groups.yahoo.com/group/jurtle-users>" on the web.
>
> * To unsubscribe from this group, send an email to:
> jurtle-users-unsubscribe@yahoogroups.com
> <mailto:jurtle-users-unsubscribe@yahoogroups.com?subject=Unsubscribe>
>
> * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service <http://docs.yahoo.com/info/terms/>.
>
>
> ------------------------------------------------------------------------
>
I tried to do same way in arcRight() or arcLeft() but I couldnot
able to find the X, Y positions and width & height, can you help me
how to figure out the positions to fill the colors.
this is very urgent, please help me.
thanks
Chander
--- In jurtle-users@yahoogroups.com, Bill Tschumy <bill@o...> wrote:
> That's going to be a bit tricky to do. Turtle Graphics is
designed
> mainly for line drawing, not for filing areas. You would probably
be
> better off replacing the arcRight and arcLeft methods in Flower
with
> the fillArc method of java.awt.Graphics. You can get the
Graphics
> object using the Turtle method getGraphics().
>
>
> On Jun 28, 2005, at 12:44 PM, chander2010 wrote:
>
> > Hi All
> >
> > I need to fill in each petal with different colors in Flower.java
> > example. i can draw each petal with different colors, but I
couldn't
> > able to fill colors. any body can help me.
> >
> > thanks in advance
> > chander
> >
> >
> >
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
>
> --
> Bill Tschumy
> Otherwise -- Austin, TX
> http://www.otherwise.com
That's going to be a bit tricky to do. Turtle Graphics is designed
mainly for line drawing, not for filing areas. You would probably be
better off replacing the arcRight and arcLeft methods in Flower with
the fillArc method of java.awt.Graphics. You can get the Graphics
object using the Turtle method getGraphics().
On Jun 28, 2005, at 12:44 PM, chander2010 wrote:
> Hi All
>
> I need to fill in each petal with different colors in Flower.java
> example. i can draw each petal with different colors, but I couldn't
> able to fill colors. any body can help me.
>
> thanks in advance
> chander
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
--
Bill Tschumy
Otherwise -- Austin, TX
http://www.otherwise.com
Hi All
I need to fill in each petal with different colors in Flower.java
example. i can draw each petal with different colors, but I couldn't
able to fill colors. any body can help me.
thanks in advance
chander
Hi Bill
thanks for the responce, I got the Flower.java, but I
couldn't able to convert that programme into java
Applet or java application.
and the flower shape should looks like, tha center
should have small circle and each petal interact with
circle and I need the postion of X, Y cordinates.
thanks again
Chander
--- Bill Tschumy <bill@...> wrote:
> Chander,
>
> This sounds like a school assignment. What have you
> tried so far?
> We can help, but can't do your assignment for you.
> Jurtle has a
> "Flower.java" example that might give you some
> ideas, but it does use
> Jurtle's turtle graphics library.
>
> Bill
>
>
> On Jun 22, 2005, at 3:14 PM, chander2010 wrote:
>
> > Hi
> >
> > I need to draw a flower or something, which looks
> like beauty.
> > with different radius and degrees in Applet,
> >
> > the no of petals varies, so each petal shouldnot
> overlap on other
> > petal.
> >
> > please help me.
> >
> > thanks in advance
> > Chander
>
> --
> Bill Tschumy
> Otherwise -- Austin, TX
> http://www.otherwise.com
>
>
>
____________________________________________________
Yahoo! Sports
Rekindle the Rivalries. Sign up for Fantasy Football
http://football.fantasysports.yahoo.com
Chander,
This sounds like a school assignment. What have you tried so far?
We can help, but can't do your assignment for you. Jurtle has a
"Flower.java" example that might give you some ideas, but it does use
Jurtle's turtle graphics library.
Bill
On Jun 22, 2005, at 3:14 PM, chander2010 wrote:
> Hi
>
> I need to draw a flower or something, which looks like beauty.
> with different radius and degrees in Applet,
>
> the no of petals varies, so each petal shouldnot overlap on other
> petal.
>
> please help me.
>
> thanks in advance
> Chander
--
Bill Tschumy
Otherwise -- Austin, TX
http://www.otherwise.com