<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de">
	<id>https://wiki.byte-welt.net/index.php?action=history&amp;feed=atom&amp;title=SwingWorker</id>
	<title>SwingWorker - Versionsgeschichte</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.byte-welt.net/index.php?action=history&amp;feed=atom&amp;title=SwingWorker"/>
	<link rel="alternate" type="text/html" href="https://wiki.byte-welt.net/index.php?title=SwingWorker&amp;action=history"/>
	<updated>2026-08-10T20:04:37Z</updated>
	<subtitle>Versionsgeschichte dieser Seite in Byte-Welt Wiki</subtitle>
	<generator>MediaWiki 1.46.0</generator>
	<entry>
		<id>https://wiki.byte-welt.net/index.php?title=SwingWorker&amp;diff=8732&amp;oldid=prev</id>
		<title>L-ectron-X: /* Beispiel */</title>
		<link rel="alternate" type="text/html" href="https://wiki.byte-welt.net/index.php?title=SwingWorker&amp;diff=8732&amp;oldid=prev"/>
		<updated>2019-03-05T16:31:01Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Beispiel&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw-interface=&quot;&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;de&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Nächstältere Version&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Version vom 5. März 2019, 16:31 Uhr&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-l7&quot;&gt;Zeile 7:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 7:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&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;==Beispiel==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&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;==Beispiel==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&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;Hier ein Beispiel, das ein Verzeichnis kopiert:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&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;Hier ein Beispiel, das ein Verzeichnis kopiert:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&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;&amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code&lt;/del&gt;=java&amp;gt;import java.awt.*;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&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;&amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;syntaxhighlight lang&lt;/ins&gt;=&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&quot;&lt;/ins&gt;java&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&quot;&lt;/ins&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&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;import java.awt.*;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&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;import java.awt.event.*;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&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;import java.awt.event.*;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&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;import javax.swing.*;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&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;import javax.swing.*;&lt;/div&gt;&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-l54&quot;&gt;Zeile 54:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 55:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&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;   }&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&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;   }&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&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;}&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&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;}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&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 style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&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;class Copier extends SwingWorker&amp;lt;Boolean,File&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&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;class Copier extends SwingWorker&amp;lt;Boolean,File&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&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;{&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&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;{&lt;/div&gt;&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-l144&quot;&gt;Zeile 144:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 146:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&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;     }&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&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;     }&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&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;   }&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&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;   }&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&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;}&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code=java&lt;/del&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&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;}&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;syntaxhighlight&lt;/ins&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&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;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&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;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&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;[[Kategorie:Java]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&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;[[Kategorie:Java]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&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;[[Kategorie:Tutorials (Java)]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&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;[[Kategorie:Tutorials (Java)]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&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;[[Kategorie:Swing]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&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;[[Kategorie:Swing]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>L-ectron-X</name></author>
	</entry>
	<entry>
		<id>https://wiki.byte-welt.net/index.php?title=SwingWorker&amp;diff=6597&amp;oldid=prev</id>
		<title>L-ectron-x am 25. September 2014 um 07:53 Uhr</title>
		<link rel="alternate" type="text/html" href="https://wiki.byte-welt.net/index.php?title=SwingWorker&amp;diff=6597&amp;oldid=prev"/>
		<updated>2014-09-25T07:53:42Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw-interface=&quot;&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;de&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Nächstältere Version&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Version vom 25. September 2014, 07:53 Uhr&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;Zeile 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&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;Da [[Swing]] nicht threadsicher ist, kann es Probleme bereiten, wenn man aus anderen [[Thread|Threads]] auf die UI zugreifen will, beispielsweise um einen Fortschrittsbalken zu &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;akzualisieren&lt;/del&gt;. In den Java-Versionen bis 1.5 konnte man sich da nur mit den Methoden invokeLater und invokeAndWait aus den {{JAPI|SwingUtilities}} behelfen. Seit &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Java6 &lt;/del&gt;ist auch in der Standard-API eine weitere Möglichkeit als die SwingUtilities Methoden enthalten, die das ganze ein wenig automatisiert. Mit Hilfe der Klasse &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[http://download.java.net/jdk6/doc/api/javax/swing/&lt;/del&gt;SwingWorker&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;.html SwingWorker] &lt;/del&gt;lassen sich solche &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Gui&lt;/del&gt;-Updates leicht darstellen.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&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;Da [[Swing]] nicht threadsicher ist, kann es Probleme bereiten, wenn man aus anderen [[Thread|Threads]] auf die UI zugreifen will, beispielsweise um einen Fortschrittsbalken zu &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;aktualisieren&lt;/ins&gt;. In den Java-Versionen bis 1.5 konnte man sich da nur mit den Methoden invokeLater&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;() &lt;/ins&gt;und invokeAndWait&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;() &lt;/ins&gt;aus den {{JAPI|SwingUtilities}} behelfen. Seit &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Java 6 &lt;/ins&gt;ist auch in der Standard-API eine weitere Möglichkeit als die SwingUtilities Methoden enthalten, die das ganze ein wenig automatisiert. Mit Hilfe der Klasse &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;{{JAPI|&lt;/ins&gt;SwingWorker&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;}} &lt;/ins&gt;lassen sich solche &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;GUI&lt;/ins&gt;-Updates leicht darstellen.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&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;==Funktionsweise==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&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;==Funktionsweise==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&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;Die Funktionsweise der [[Klasse]] ist folgende: Der startende [[Thread]] erstellt eine Instanz und ruft die execute Methode auf. Diese erstellt einen neuen &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[&lt;/del&gt;Thread&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;]]&lt;/del&gt;, in dem die - abstrakte, vom eigenen Programm überschriebene - Methode doInBackground aufruft. Diese kann der publish Methode Objekte übergeben, die dann der (aus dem Event-Dispatch-Thread aufgerufenen!) Methode process übergeben werden - diese sollte dann auch überschrieben werden, um hier die &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Gui &lt;/del&gt;zu verändern. Außerdem kann sie setProgress aufrufen, dann wird aus dem EDT ein evtl. registrierter {{JAPI|PropertyChangeListener}} benachrichtigt. Wenn doInBackground zurückkehrt, ruft der Event-Dispatch-Thread done() auf, und die get Methode, die bis dahin geblockt hat, gibt den Rückgabewert von doInBackground zurück.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&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;Die Funktionsweise der [[Klasse]] ist folgende: Der startende [[Thread]] erstellt eine &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[&lt;/ins&gt;Instanz&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;]] &lt;/ins&gt;und ruft die execute&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;()-[[&lt;/ins&gt;Methode&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;]] &lt;/ins&gt;auf. Diese erstellt einen neuen Thread, in dem die - abstrakte, vom eigenen Programm überschriebene - Methode doInBackground&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;() &lt;/ins&gt;aufruft. Diese kann der publish&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;()-&lt;/ins&gt;Methode Objekte übergeben, die dann der (aus dem Event-Dispatch-Thread aufgerufenen!) Methode process&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;() &lt;/ins&gt;übergeben werden - diese sollte dann auch überschrieben werden, um hier die &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;GUI &lt;/ins&gt;zu verändern. Außerdem kann sie setProgress&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;() &lt;/ins&gt;aufrufen, dann wird aus dem EDT ein evtl. registrierter {{JAPI|PropertyChangeListener}} benachrichtigt. Wenn doInBackground&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;() &lt;/ins&gt;zurückkehrt, ruft der Event-Dispatch-Thread done() auf, und die get&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;()-&lt;/ins&gt;Methode, die bis dahin geblockt hat, gibt den Rückgabewert von doInBackground&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;() &lt;/ins&gt;zurück.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&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;==Grafische Darstellung==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&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;==Grafische Darstellung==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&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;[[Bild:SwingWorker.gif]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&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;[[Bild:SwingWorker.gif]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>L-ectron-x</name></author>
	</entry>
	<entry>
		<id>https://wiki.byte-welt.net/index.php?title=SwingWorker&amp;diff=6360&amp;oldid=prev</id>
		<title>L-ectron-x am 27. April 2014 um 19:22 Uhr</title>
		<link rel="alternate" type="text/html" href="https://wiki.byte-welt.net/index.php?title=SwingWorker&amp;diff=6360&amp;oldid=prev"/>
		<updated>2014-04-27T19:22:58Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw-interface=&quot;&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;de&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Nächstältere Version&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Version vom 27. April 2014, 19:22 Uhr&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;Zeile 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&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;Da [[Swing]] nicht threadsicher ist, kann es Probleme bereiten, wenn man aus anderen [[Thread|Threads]] auf die UI zugreifen will, beispielsweise um einen Fortschrittsbalken zu akzualisieren. In den Java-Versionen bis 1.5 konnte man sich da nur mit den Methoden invokeLater und invokeAndWait aus den {{&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;API|javax/swing/SwingUtilities&lt;/del&gt;|SwingUtilities}} behelfen. Seit Java6 ist auch in der Standard-API eine weitere Möglichkeit als die SwingUtilities Methoden enthalten, die das ganze ein wenig automatisiert. Mit Hilfe der Klasse [http://download.java.net/jdk6/doc/api/javax/swing/SwingWorker.html SwingWorker] lassen sich solche Gui-Updates leicht darstellen.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&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;Da [[Swing]] nicht threadsicher ist, kann es Probleme bereiten, wenn man aus anderen [[Thread|Threads]] auf die UI zugreifen will, beispielsweise um einen Fortschrittsbalken zu akzualisieren. In den Java-Versionen bis 1.5 konnte man sich da nur mit den Methoden invokeLater und invokeAndWait aus den {{&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;JAPI&lt;/ins&gt;|SwingUtilities}} behelfen. Seit Java6 ist auch in der Standard-API eine weitere Möglichkeit als die SwingUtilities Methoden enthalten, die das ganze ein wenig automatisiert. Mit Hilfe der Klasse [http://download.java.net/jdk6/doc/api/javax/swing/SwingWorker.html SwingWorker] lassen sich solche Gui-Updates leicht darstellen.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&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;==Funktionsweise==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&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;==Funktionsweise==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&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;Die Funktionsweise der [[Klasse]] ist folgende: Der startende [[Thread]] erstellt eine Instanz und ruft die execute Methode auf. Diese erstellt einen neuen [[Thread]], in dem die - abstrakte, vom eigenen Programm überschriebene - Methode doInBackground aufruft. Diese kann der publish Methode Objekte übergeben, die dann der (aus dem Event-Dispatch-Thread aufgerufenen!) Methode process übergeben werden - diese sollte dann auch überschrieben werden, um hier die Gui zu verändern. Außerdem kann sie setProgress aufrufen, dann wird aus dem EDT ein evtl. registrierter PropertyChangeListener benachrichtigt. Wenn doInBackground zurückkehrt, ruft der Event-Dispatch-Thread done() auf, und die get Methode, die bis dahin geblockt hat, gibt den Rückgabewert von doInBackground zurück.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&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;Die Funktionsweise der [[Klasse]] ist folgende: Der startende [[Thread]] erstellt eine Instanz und ruft die execute Methode auf. Diese erstellt einen neuen [[Thread]], in dem die - abstrakte, vom eigenen Programm überschriebene - Methode doInBackground aufruft. Diese kann der publish Methode Objekte übergeben, die dann der (aus dem Event-Dispatch-Thread aufgerufenen!) Methode process übergeben werden - diese sollte dann auch überschrieben werden, um hier die Gui zu verändern. Außerdem kann sie setProgress aufrufen, dann wird aus dem EDT ein evtl. registrierter &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;{{JAPI|&lt;/ins&gt;PropertyChangeListener&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;}} &lt;/ins&gt;benachrichtigt. Wenn doInBackground zurückkehrt, ruft der Event-Dispatch-Thread done() auf, und die get Methode, die bis dahin geblockt hat, gibt den Rückgabewert von doInBackground zurück.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&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;==Grafische Darstellung==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&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;==Grafische Darstellung==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&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;[[Bild:SwingWorker.gif]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&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;[[Bild:SwingWorker.gif]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>L-ectron-x</name></author>
	</entry>
	<entry>
		<id>https://wiki.byte-welt.net/index.php?title=SwingWorker&amp;diff=3593&amp;oldid=prev</id>
		<title>Pcworld: -Leerzeichen nach API, da Bug aufgehoben</title>
		<link rel="alternate" type="text/html" href="https://wiki.byte-welt.net/index.php?title=SwingWorker&amp;diff=3593&amp;oldid=prev"/>
		<updated>2008-10-11T16:00:04Z</updated>

		<summary type="html">&lt;p&gt;-Leerzeichen nach API, da Bug aufgehoben&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw-interface=&quot;&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;de&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Nächstältere Version&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Version vom 11. Oktober 2008, 16:00 Uhr&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;Zeile 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&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;Da [[Swing]] nicht threadsicher ist, kann es Probleme bereiten, wenn man aus anderen [[Thread|Threads]] auf die UI zugreifen will, beispielsweise um einen Fortschrittsbalken zu akzualisieren. In den Java-Versionen bis 1.5 konnte man sich da nur mit den Methoden invokeLater und invokeAndWait aus den {{API|javax/swing/SwingUtilities|SwingUtilities}}behelfen. Seit Java6 ist auch in der Standard-API eine weitere Möglichkeit als die SwingUtilities Methoden enthalten, die das ganze ein wenig automatisiert. Mit Hilfe der Klasse [http://download.java.net/jdk6/doc/api/javax/swing/SwingWorker.html SwingWorker] lassen sich solche Gui-Updates leicht darstellen.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&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;Da [[Swing]] nicht threadsicher ist, kann es Probleme bereiten, wenn man aus anderen [[Thread|Threads]] auf die UI zugreifen will, beispielsweise um einen Fortschrittsbalken zu akzualisieren. In den Java-Versionen bis 1.5 konnte man sich da nur mit den Methoden invokeLater und invokeAndWait aus den {{API|javax/swing/SwingUtilities|SwingUtilities}} behelfen. Seit Java6 ist auch in der Standard-API eine weitere Möglichkeit als die SwingUtilities Methoden enthalten, die das ganze ein wenig automatisiert. Mit Hilfe der Klasse [http://download.java.net/jdk6/doc/api/javax/swing/SwingWorker.html SwingWorker] lassen sich solche Gui-Updates leicht darstellen.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&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;==Funktionsweise==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&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;==Funktionsweise==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&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;Die Funktionsweise der [[Klasse]] ist folgende: Der startende [[Thread]] erstellt eine Instanz und ruft die execute Methode auf. Diese erstellt einen neuen [[Thread]], in dem die - abstrakte, vom eigenen Programm überschriebene - Methode doInBackground aufruft. Diese kann der publish Methode Objekte übergeben, die dann der (aus dem Event-Dispatch-Thread aufgerufenen!) Methode process übergeben werden - diese sollte dann auch überschrieben werden, um hier die Gui zu verändern. Außerdem kann sie setProgress aufrufen, dann wird aus dem EDT ein evtl. registrierter PropertyChangeListener benachrichtigt. Wenn doInBackground zurückkehrt, ruft der Event-Dispatch-Thread done() auf, und die get Methode, die bis dahin geblockt hat, gibt den Rückgabewert von doInBackground zurück.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&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;Die Funktionsweise der [[Klasse]] ist folgende: Der startende [[Thread]] erstellt eine Instanz und ruft die execute Methode auf. Diese erstellt einen neuen [[Thread]], in dem die - abstrakte, vom eigenen Programm überschriebene - Methode doInBackground aufruft. Diese kann der publish Methode Objekte übergeben, die dann der (aus dem Event-Dispatch-Thread aufgerufenen!) Methode process übergeben werden - diese sollte dann auch überschrieben werden, um hier die Gui zu verändern. Außerdem kann sie setProgress aufrufen, dann wird aus dem EDT ein evtl. registrierter PropertyChangeListener benachrichtigt. Wenn doInBackground zurückkehrt, ruft der Event-Dispatch-Thread done() auf, und die get Methode, die bis dahin geblockt hat, gibt den Rückgabewert von doInBackground zurück.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Pcworld</name></author>
	</entry>
	<entry>
		<id>https://wiki.byte-welt.net/index.php?title=SwingWorker&amp;diff=3187&amp;oldid=prev</id>
		<title>AndreUhres: /* Beispiel */</title>
		<link rel="alternate" type="text/html" href="https://wiki.byte-welt.net/index.php?title=SwingWorker&amp;diff=3187&amp;oldid=prev"/>
		<updated>2008-07-26T06:50:19Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Beispiel&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw-interface=&quot;&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;de&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Nächstältere Version&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Version vom 26. Juli 2008, 06:50 Uhr&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-l146&quot;&gt;Zeile 146:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 146:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&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;}&amp;lt;/code=java&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&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;}&amp;lt;/code=java&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&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;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&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;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&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 style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Kategorie:Java]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&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;[[Kategorie:Tutorials (Java)]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&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;[[Kategorie:Tutorials (Java)]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&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;[[Kategorie:Swing]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&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;[[Kategorie:Swing]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&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 style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Kategorie:Java]]&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>AndreUhres</name></author>
	</entry>
	<entry>
		<id>https://wiki.byte-welt.net/index.php?title=SwingWorker&amp;diff=3081&amp;oldid=prev</id>
		<title>AndreUhres am 25. Juli 2008 um 21:26 Uhr</title>
		<link rel="alternate" type="text/html" href="https://wiki.byte-welt.net/index.php?title=SwingWorker&amp;diff=3081&amp;oldid=prev"/>
		<updated>2008-07-25T21:26:16Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw-interface=&quot;&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;de&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Nächstältere Version&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Version vom 25. Juli 2008, 21:26 Uhr&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-l148&quot;&gt;Zeile 148:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 148:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&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;[[Kategorie:Tutorials (Java)]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&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;[[Kategorie:Tutorials (Java)]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&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;[[Kategorie:Swing]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&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;[[Kategorie:Swing]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&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 style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Kategorie:Java]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>AndreUhres</name></author>
	</entry>
	<entry>
		<id>https://wiki.byte-welt.net/index.php?title=SwingWorker&amp;diff=2907&amp;oldid=prev</id>
		<title>AndreUhres am 24. April 2008 um 17:23 Uhr</title>
		<link rel="alternate" type="text/html" href="https://wiki.byte-welt.net/index.php?title=SwingWorker&amp;diff=2907&amp;oldid=prev"/>
		<updated>2008-04-24T17:23:16Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw-interface=&quot;&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;de&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Nächstältere Version&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Version vom 24. April 2008, 17:23 Uhr&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-l147&quot;&gt;Zeile 147:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 147:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&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;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&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;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&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;[[Kategorie:Tutorials (Java)]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&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;[[Kategorie:Tutorials (Java)]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&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 style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Kategorie:Swing]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>AndreUhres</name></author>
	</entry>
	<entry>
		<id>https://wiki.byte-welt.net/index.php?title=SwingWorker&amp;diff=1909&amp;oldid=prev</id>
		<title>Swerflash: 1 Versionen</title>
		<link rel="alternate" type="text/html" href="https://wiki.byte-welt.net/index.php?title=SwingWorker&amp;diff=1909&amp;oldid=prev"/>
		<updated>2007-06-21T14:46:52Z</updated>

		<summary type="html">&lt;p&gt;1 Versionen&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw-interface=&quot;&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;de&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Nächstältere Version&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Version vom 21. Juni 2007, 14:46 Uhr&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;de&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(kein Unterschied)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Swerflash</name></author>
	</entry>
	<entry>
		<id>https://wiki.byte-welt.net/index.php?title=SwingWorker&amp;diff=1908&amp;oldid=prev</id>
		<title>EagleEye am 27. Februar 2007 um 19:33 Uhr</title>
		<link rel="alternate" type="text/html" href="https://wiki.byte-welt.net/index.php?title=SwingWorker&amp;diff=1908&amp;oldid=prev"/>
		<updated>2007-02-27T19:33:45Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Neue Seite&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Da [[Swing]] nicht threadsicher ist, kann es Probleme bereiten, wenn man aus anderen [[Thread|Threads]] auf die UI zugreifen will, beispielsweise um einen Fortschrittsbalken zu akzualisieren. In den Java-Versionen bis 1.5 konnte man sich da nur mit den Methoden invokeLater und invokeAndWait aus den {{API|javax/swing/SwingUtilities|SwingUtilities}}behelfen. Seit Java6 ist auch in der Standard-API eine weitere Möglichkeit als die SwingUtilities Methoden enthalten, die das ganze ein wenig automatisiert. Mit Hilfe der Klasse [http://download.java.net/jdk6/doc/api/javax/swing/SwingWorker.html SwingWorker] lassen sich solche Gui-Updates leicht darstellen.&lt;br /&gt;
==Funktionsweise==&lt;br /&gt;
Die Funktionsweise der [[Klasse]] ist folgende: Der startende [[Thread]] erstellt eine Instanz und ruft die execute Methode auf. Diese erstellt einen neuen [[Thread]], in dem die - abstrakte, vom eigenen Programm überschriebene - Methode doInBackground aufruft. Diese kann der publish Methode Objekte übergeben, die dann der (aus dem Event-Dispatch-Thread aufgerufenen!) Methode process übergeben werden - diese sollte dann auch überschrieben werden, um hier die Gui zu verändern. Außerdem kann sie setProgress aufrufen, dann wird aus dem EDT ein evtl. registrierter PropertyChangeListener benachrichtigt. Wenn doInBackground zurückkehrt, ruft der Event-Dispatch-Thread done() auf, und die get Methode, die bis dahin geblockt hat, gibt den Rückgabewert von doInBackground zurück.&lt;br /&gt;
==Grafische Darstellung==&lt;br /&gt;
[[Bild:SwingWorker.gif]]&lt;br /&gt;
&lt;br /&gt;
==Beispiel==&lt;br /&gt;
Hier ein Beispiel, das ein Verzeichnis kopiert:&lt;br /&gt;
&amp;lt;code=java&amp;gt;import java.awt.*;&lt;br /&gt;
import java.awt.event.*;&lt;br /&gt;
import javax.swing.*;&lt;br /&gt;
import java.io.*;&lt;br /&gt;
import java.beans.*;&lt;br /&gt;
&lt;br /&gt;
public class SwingWorkerExample extends JFrame&lt;br /&gt;
{&lt;br /&gt;
  public SwingWorkerExample(String title, File sourceDir, File destDir)&lt;br /&gt;
  {&lt;br /&gt;
    super(title);&lt;br /&gt;
    setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);&lt;br /&gt;
    setLayout(new BorderLayout());&lt;br /&gt;
    JProgressBar probar = new JProgressBar (0,100);&lt;br /&gt;
    probar.setStringPainted(true);&lt;br /&gt;
    JTextArea fileArea = new JTextArea();&lt;br /&gt;
    add (probar, BorderLayout.NORTH);&lt;br /&gt;
    add (new JScrollPane (fileArea), BorderLayout.CENTER);&lt;br /&gt;
    setSize (512, 384);&lt;br /&gt;
    setLocationByPlatform (true);&lt;br /&gt;
    setVisible(true);&lt;br /&gt;
    Copier c = new Copier(fileArea, sourceDir, destDir);&lt;br /&gt;
    c.addPropertyChangeListener(new ProgressBarChanger(probar));&lt;br /&gt;
    c.execute();&lt;br /&gt;
    try{&lt;br /&gt;
      boolean b = c.get();&lt;br /&gt;
      if (b) System.out.println(&amp;quot;Errors occurred&amp;quot;);&lt;br /&gt;
      else System.out.println(&amp;quot;Everything was fine&amp;quot;);&lt;br /&gt;
    }catch (Exception e){&lt;br /&gt;
      e.printStackTrace (System.console().writer());&lt;br /&gt;
      System.exit (1);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  /*&lt;br /&gt;
   *args[0] = source directory&lt;br /&gt;
   *args[1] = destination directory&lt;br /&gt;
   */&lt;br /&gt;
  public static void main(String[] args)&lt;br /&gt;
  {&lt;br /&gt;
    if (args.length &amp;lt; 2){&lt;br /&gt;
      System.out.println(&amp;quot;Usage: java SwingWorkerExample sourceDirectory destinationDirectory&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    File sourceDir = new File (args[0]);&lt;br /&gt;
    File destDir = new File (args[1]);&lt;br /&gt;
    new SwingWorkerExample(&amp;quot;SwingWorkerExample&amp;quot;, sourceDir, destDir);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
class Copier extends SwingWorker&amp;lt;Boolean,File&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  private JTextArea appendTo;&lt;br /&gt;
  private File srcDir;&lt;br /&gt;
  private File destDir;&lt;br /&gt;
  private float fileNum;&lt;br /&gt;
  private int copied = 0;&lt;br /&gt;
  public Copier (JTextArea appendTo, File srcDir, File destDir)&lt;br /&gt;
  {&lt;br /&gt;
    this.appendTo = appendTo;&lt;br /&gt;
    this.srcDir = srcDir;&lt;br /&gt;
    this.destDir = destDir;&lt;br /&gt;
    fileNum = count (srcDir);&lt;br /&gt;
  }&lt;br /&gt;
  @Override&lt;br /&gt;
  protected Boolean doInBackground()&lt;br /&gt;
  {&lt;br /&gt;
    boolean errorOccurred = copyFile(srcDir, destDir);&lt;br /&gt;
    return Boolean.valueOf(errorOccurred);&lt;br /&gt;
  }&lt;br /&gt;
  @Override&lt;br /&gt;
  protected void process (File... chunks)&lt;br /&gt;
  {&lt;br /&gt;
    for (File f : chunks){&lt;br /&gt;
      appendTo.append (f.getAbsolutePath());&lt;br /&gt;
      appendTo.append (&amp;quot;\n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  private int count(File f)&lt;br /&gt;
  {&lt;br /&gt;
    if (f.isDirectory()){&lt;br /&gt;
      int ret = 0;&lt;br /&gt;
      for (File sf : f.listFiles()){&lt;br /&gt;
        ret += count(sf);&lt;br /&gt;
      }&lt;br /&gt;
      return ret;&lt;br /&gt;
    }else{&lt;br /&gt;
      return 1;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  private boolean copyFile(File src, File dest)&lt;br /&gt;
  {&lt;br /&gt;
    if (src.isDirectory()){&lt;br /&gt;
      dest.mkdirs();&lt;br /&gt;
      boolean ret = false;&lt;br /&gt;
      for (File fil : src.listFiles()){&lt;br /&gt;
        boolean b = copyFile (fil, new File (dest, fil.getName()));&lt;br /&gt;
        if (b) ret = true;&lt;br /&gt;
      }&lt;br /&gt;
      return ret;&lt;br /&gt;
    }else{&lt;br /&gt;
      try{&lt;br /&gt;
         copy (src, dest);&lt;br /&gt;
         return false;&lt;br /&gt;
      }catch(IOException e){&lt;br /&gt;
        e.printStackTrace(System.console().writer());&lt;br /&gt;
        return true;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  private void copy(File src, File dest) throws IOException&lt;br /&gt;
  {&lt;br /&gt;
    InputStream is = new FileInputStream(src);&lt;br /&gt;
    OutputStream os = new FileOutputStream(dest);&lt;br /&gt;
    int len;&lt;br /&gt;
    byte[] buf = new byte[1024];&lt;br /&gt;
    while ((len = is.read(buf)) &amp;gt;= 0){&lt;br /&gt;
      os.write (buf, 0, len);&lt;br /&gt;
    }&lt;br /&gt;
    is.close();&lt;br /&gt;
    os.close();&lt;br /&gt;
    copied++;&lt;br /&gt;
    setProgress((int)(copied / fileNum * 100 + 0.5f));&lt;br /&gt;
    publish (src);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
class ProgressBarChanger implements PropertyChangeListener&lt;br /&gt;
{&lt;br /&gt;
  private JProgressBar jpb;&lt;br /&gt;
  public ProgressBarChanger (JProgressBar myBar)&lt;br /&gt;
  {&lt;br /&gt;
    jpb = myBar;&lt;br /&gt;
  }&lt;br /&gt;
  public void propertyChange(PropertyChangeEvent evt)&lt;br /&gt;
  {&lt;br /&gt;
    if (&amp;quot;progress&amp;quot;.equals(evt.getPropertyName())){&lt;br /&gt;
      jpb.setValue((Integer)evt.getNewValue());&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/code=java&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Kategorie:Tutorials (Java)]]&lt;/div&gt;</summary>
		<author><name>EagleEye</name></author>
	</entry>
</feed>