<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="et">
	<id>http://courses.cs.taltech.ee/w/index.php?action=history&amp;feed=atom&amp;title=ITI0011%3Apraktikum_11_N14</id>
	<title>ITI0011:praktikum 11 N14 - Redigeerimiste ajalugu</title>
	<link rel="self" type="application/atom+xml" href="http://courses.cs.taltech.ee/w/index.php?action=history&amp;feed=atom&amp;title=ITI0011%3Apraktikum_11_N14"/>
	<link rel="alternate" type="text/html" href="http://courses.cs.taltech.ee/w/index.php?title=ITI0011:praktikum_11_N14&amp;action=history"/>
	<updated>2026-05-21T20:08:18Z</updated>
	<subtitle>Selle lehekülje redigeerimiste ajalugu</subtitle>
	<generator>MediaWiki 1.35.9</generator>
	<entry>
		<id>http://courses.cs.taltech.ee/w/index.php?title=ITI0011:praktikum_11_N14&amp;diff=1054&amp;oldid=prev</id>
		<title>Ago – 14. november 2014, kell 14:56</title>
		<link rel="alternate" type="text/html" href="http://courses.cs.taltech.ee/w/index.php?title=ITI0011:praktikum_11_N14&amp;diff=1054&amp;oldid=prev"/>
		<updated>2014-11-14T14:56:35Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;et&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←Vanem redaktsioon&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Redaktsioon: 14. november 2014, kell 14:56&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;1. rida:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;1. rida:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Tagai kursuse lehele &lt;/del&gt;[[ITI0011]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Tagasi &lt;/ins&gt;[[ITI0011]] &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;lehele.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Praktikum: 13. 11 kell 14:00&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;== Üldine ==&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Praktikum: 13.11&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;.2014 &lt;/ins&gt;kell 14:00&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Kodutöö põhiosa realiseerimine. Vabakäejoone joonistamine JavaFX-iga.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Kodutöö põhiosa realiseerimine. Vabakäejoone joonistamine JavaFX-iga.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Ago</name></author>
	</entry>
	<entry>
		<id>http://courses.cs.taltech.ee/w/index.php?title=ITI0011:praktikum_11_N14&amp;diff=1053&amp;oldid=prev</id>
		<title>Ago: Uus lehekülg: &#039;Tagai kursuse lehele ITI0011  Praktikum: 13. 11 kell 14:00  Kodutöö põhiosa realiseerimine. Vabakäejoone joonistamine JavaFX-iga.  == Koodinäide ==  &#039;&#039;&#039;Kimp.java&#039;&#039;&#039;  &lt;so...&#039;</title>
		<link rel="alternate" type="text/html" href="http://courses.cs.taltech.ee/w/index.php?title=ITI0011:praktikum_11_N14&amp;diff=1053&amp;oldid=prev"/>
		<updated>2014-11-14T14:56:00Z</updated>

		<summary type="html">&lt;p&gt;Uus lehekülg: &amp;#039;Tagai kursuse lehele &lt;a href=&quot;/pages/ITI0011&quot; class=&quot;mw-redirect&quot; title=&quot;ITI0011&quot;&gt;ITI0011&lt;/a&gt;  Praktikum: 13. 11 kell 14:00  Kodutöö põhiosa realiseerimine. Vabakäejoone joonistamine JavaFX-iga.  == Koodinäide ==  &amp;#039;&amp;#039;&amp;#039;Kimp.java&amp;#039;&amp;#039;&amp;#039;  &amp;lt;so...&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Uus lehekülg&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Tagai kursuse lehele [[ITI0011]]&lt;br /&gt;
&lt;br /&gt;
Praktikum: 13. 11 kell 14:00&lt;br /&gt;
&lt;br /&gt;
Kodutöö põhiosa realiseerimine. Vabakäejoone joonistamine JavaFX-iga.&lt;br /&gt;
&lt;br /&gt;
== Koodinäide ==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Kimp.java&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
import javafx.application.Application;&lt;br /&gt;
import javafx.event.EventHandler;&lt;br /&gt;
import javafx.event.EventType;&lt;br /&gt;
import javafx.scene.Scene;&lt;br /&gt;
import javafx.scene.input.MouseEvent;&lt;br /&gt;
import javafx.scene.layout.BorderPane;&lt;br /&gt;
import javafx.scene.layout.Pane;&lt;br /&gt;
import javafx.scene.paint.Color;&lt;br /&gt;
import javafx.scene.shape.Polyline;&lt;br /&gt;
import javafx.stage.Stage;&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * JavaFX application&lt;br /&gt;
 * @author Ago&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
public class Kimp extends Application {&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Program entry, here we just launch javafx application.&lt;br /&gt;
	 * @param args&lt;br /&gt;
	 */&lt;br /&gt;
	public static void main(String[] args) {&lt;br /&gt;
		launch(args);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	@Override&lt;br /&gt;
	public void start(Stage primaryStage) throws Exception {&lt;br /&gt;
		/*&lt;br /&gt;
		 * First we define main container&lt;br /&gt;
		 * for our scene. We will be using BorderPane&lt;br /&gt;
		 * which allows to set different components&lt;br /&gt;
		 * on different borders or in the center.&lt;br /&gt;
		 * For this example, even plain Pane would work&lt;br /&gt;
		 * as we don&amp;#039;t need anything else besides the main&lt;br /&gt;
		 * area where to draw (we don&amp;#039;t have any buttons etc).&lt;br /&gt;
		 */&lt;br /&gt;
		BorderPane root = new BorderPane();&lt;br /&gt;
		/*&lt;br /&gt;
		 * A new scene with root (BorderPane) set as the &lt;br /&gt;
		 * main container. &lt;br /&gt;
		 */&lt;br /&gt;
		Scene scene = new Scene(root, 500, 500);&lt;br /&gt;
		&lt;br /&gt;
		/*&lt;br /&gt;
		 * As we already have a border pane, &lt;br /&gt;
		 * a separate Pane is set to the center.&lt;br /&gt;
		 * This separated pane is for drawing.&lt;br /&gt;
		 */&lt;br /&gt;
		Pane drawPane = new Pane();&lt;br /&gt;
		root.setCenter(drawPane);&lt;br /&gt;
		&lt;br /&gt;
		primaryStage.setScene(scene);&lt;br /&gt;
		primaryStage.show();&lt;br /&gt;
		//System.exit(1);&lt;br /&gt;
		&lt;br /&gt;
		// we could create new class which implements interface EventHandler&lt;br /&gt;
		&lt;br /&gt;
		// class MyHandler implements EventHandler&amp;lt;MouseEvent&amp;gt; {&lt;br /&gt;
		// handle()&lt;br /&gt;
		// }&lt;br /&gt;
		// EventHandler&amp;lt;MouseEvent&amp;gt; myHandler = new MyHandler();&lt;br /&gt;
		&lt;br /&gt;
		// instead we create the class and instantiate it &amp;quot;on-the-fly&amp;quot;&lt;br /&gt;
		/*&lt;br /&gt;
		 * This handler doesn&amp;#039;t to anything special,&lt;br /&gt;
		 * it only prints out some text. Now your exercise is to&lt;br /&gt;
		 * take the code examples from below (how to draw a line)&lt;br /&gt;
		 * and put it into the handler. There are placeholders (as comments)&lt;br /&gt;
		 * in the handle method.&lt;br /&gt;
		 */&lt;br /&gt;
		EventHandler&amp;lt;MouseEvent&amp;gt; myHandler = new EventHandler&amp;lt;MouseEvent&amp;gt;() {&lt;br /&gt;
&lt;br /&gt;
			@Override&lt;br /&gt;
			public void handle(MouseEvent event) {&lt;br /&gt;
				if (event.getEventType() == MouseEvent.MOUSE_DRAGGED) {&lt;br /&gt;
					System.out.println(&amp;quot;drag:&amp;quot; + event.getX() + &amp;quot;, &amp;quot; + event.getY());&lt;br /&gt;
					// drag, TODO:&lt;br /&gt;
					// get the last line from out app ??&lt;br /&gt;
					// add current point to the line&lt;br /&gt;
				} else if (event.getEventType() == MouseEvent.MOUSE_PRESSED) {&lt;br /&gt;
					System.out.println(&amp;quot;press&amp;quot;);&lt;br /&gt;
					// press, TODO:&lt;br /&gt;
					// create a new line&lt;br /&gt;
					// add current point to the line&lt;br /&gt;
					// add line to our application (into draw pane)&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		};&lt;br /&gt;
		// let&amp;#039;s add event handlers to the drawing pane&lt;br /&gt;
		drawPane.addEventHandler(MouseEvent.MOUSE_DRAGGED, myHandler);&lt;br /&gt;
		drawPane.addEventHandler(MouseEvent.MOUSE_PRESSED, myHandler);&lt;br /&gt;
		&lt;br /&gt;
		// an example of how to use lambda (java 8)&lt;br /&gt;
		/*drawPane.addEventHandler(MouseEvent.MOUSE_DRAGGED, (event) -&amp;gt; {&lt;br /&gt;
			// draw line&lt;br /&gt;
		});*/&lt;br /&gt;
		&lt;br /&gt;
		// an example of how to create a new handler implementation&lt;br /&gt;
		// and pass it to the method all in one place&lt;br /&gt;
		// (previously we had a variable for this handler, here we&lt;br /&gt;
		// don&amp;#039;t need the variable - we just create the object and &lt;br /&gt;
		// pass it to the function)&lt;br /&gt;
		/*drawPane.addEventHandler(MouseEvent.MOUSE_PRESSED, new EventHandler&amp;lt;MouseEvent&amp;gt;() {&lt;br /&gt;
&lt;br /&gt;
			@Override&lt;br /&gt;
			public void handle(MouseEvent arg0) {&lt;br /&gt;
				// TODO Auto-generated method stub&lt;br /&gt;
				&lt;br /&gt;
			}&lt;br /&gt;
		});*/&lt;br /&gt;
		&lt;br /&gt;
		/*&lt;br /&gt;
		 * The following section shows&lt;br /&gt;
		 * how to draw a line (polyline).&lt;br /&gt;
		 * &lt;br /&gt;
		 * All those steps should be put&lt;br /&gt;
		 * into the correct places in the handler (above).&lt;br /&gt;
		 * &lt;br /&gt;
		 */&lt;br /&gt;
		&lt;br /&gt;
		// press:&lt;br /&gt;
		// create a new line&lt;br /&gt;
		Polyline line = new Polyline();&lt;br /&gt;
		// add line to app&lt;br /&gt;
		drawPane.getChildren().add(line);&lt;br /&gt;
		// add a point to the line&lt;br /&gt;
		line.getPoints().add(10.0); // x&lt;br /&gt;
		line.getPoints().add(10.0); // y&lt;br /&gt;
		&lt;br /&gt;
		// drag:&lt;br /&gt;
		// drawPane.getChildren() -&amp;gt; list&lt;br /&gt;
		// line = last line from getChildren()&lt;br /&gt;
		/*&lt;br /&gt;
		 * While dragging, you need to &lt;br /&gt;
		 * add points to the previously created line.&lt;br /&gt;
		 * For that, you need to get the last line&lt;br /&gt;
		 * in the children list.&lt;br /&gt;
		 * getChildren() returns a list. You can&lt;br /&gt;
		 * operate with it as with any regular list.&lt;br /&gt;
		 * So, using .get() and .size(), you can&lt;br /&gt;
		 * get the last line. &lt;br /&gt;
		 */&lt;br /&gt;
		// add another point to the line&lt;br /&gt;
		line.getPoints().add(100.0); // x&lt;br /&gt;
		line.getPoints().add(90.0); // y&lt;br /&gt;
		&lt;br /&gt;
		// create another line&lt;br /&gt;
		line = new Polyline();&lt;br /&gt;
		line.setStroke(Color.RED);&lt;br /&gt;
		drawPane.getChildren().add(line);&lt;br /&gt;
		line.getPoints().add(66.0); // x&lt;br /&gt;
		line.getPoints().add(12.0); // y&lt;br /&gt;
		&lt;br /&gt;
		line.getPoints().add(67.0); // x&lt;br /&gt;
		line.getPoints().add(13.0); // y&lt;br /&gt;
		&lt;br /&gt;
		line.getPoints().add(69.0); // x&lt;br /&gt;
		line.getPoints().add(15.0); // y&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ago</name></author>
	</entry>
</feed>