<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>Java Programming Forums - The Java Community - AWT / Java Swing</title>
		<link>http://www.javaprogrammingforums.com/</link>
		<description>Graphical User Interface APIs.</description>
		<language>en</language>
		<lastBuildDate>Sat, 25 May 2013 08:53:37 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://www.javaprogrammingforums.com/images/misc/rss.png</url>
			<title>Java Programming Forums - The Java Community - AWT / Java Swing</title>
			<link>http://www.javaprogrammingforums.com/</link>
		</image>
		<item>
			<title>Drawing in JPanel not working as expected</title>
			<link>http://www.javaprogrammingforums.com/awt-java-swing/29615-drawing-jpanel-not-working-expected.html</link>
			<pubDate>Thu, 23 May 2013 09:24:55 GMT</pubDate>
			<description><![CDATA[First of all, I'd like to apologize if this is not in the correct section, this is my first post to the board. If I was wrong to post here, I welcome...]]></description>
			<content:encoded><![CDATA[<div>First of all, I'd like to apologize if this is not in the correct section, this is my first post to the board. If I was wrong to post here, I welcome any criticism so long as you also teach me something ;)<br />
<br />
Anyways, I'm currently working on a practice problem from the textbook &quot;Java - How to Program (9th edition)&quot; at the end of chapter 4. (Fig 4.20)<br />
The problem requires that I use 4 seperate while loops (one for each corner) to drawing 15 lines coming from each corner of the panel in a manner that would resemble a hand fan.<br />
This is a typical case of a problem that should take no more than 5 minutes to complete yet for some reason has become quite an ordeal for me.<br />
<br />
The issue is that while the top corners display in the manner that the book requires, the bottom ones seem to have a bit of an offset and do not end up meeting the top ones (eg: bottom left fan should extend so that each line's endpoint connects with the endpoints of the top right fan, meeting halfway.)<br />
<br />
I've removed the bottom-right fan for the time being, to make it easier to look at.<br />
<br />
Here are my two top corners' while loops:<br />
<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code :</div>
                <hr /><code class="bbcode_code"><div class="" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                int x;
                int y;
                int count;
                int width = getWidth(); // total width
                int height = getHeight(); // total height
&nbsp;
                x = 0;
                y = height;
                count = 1;
                while(count &lt;= 15)
                {
                        g.drawLine(0, 0, x, y);
                        x += width / 15;
                        y -= height / 15;
                        ++count;
                } // end while
&nbsp;
                x = width;
                y = height;
                count = 1;
                while(count &lt;= 15)
                {
                        g.drawLine(width, 0, x, y);
                        x -= width / 15;
                        y -= height / 15;
                        ++count;
                } // end while</pre></div></code><hr />
</div> <br />
<br />
Here is the while loop for the bottom left-corner:<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code :</div>
                <hr /><code class="bbcode_code"><div class="" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                x = 0;
                y = 0;
                count = 1;
                while(count &lt;= 15)
                {
                        g.drawLine(0, height, x, y);
                        x += width / 15;
                        y += height / 15;
                        ++count;
                } // end while</pre></div></code><hr />
</div> <br />
Here is a picture of what currently displays:<br />
<a href="http://www.javaprogrammingforums.com/attachments/awt-java-swing/2097d1369300385-drawing-jpanel-not-working-expected-capture-jpg"  title="Name:  Capture.jpg
Views: 9
Size:  19.3 KB">Capture.jpg</a><br />
<br />
Hopefully I've provided enough information about my problem. Although I'm 99% sure that the problem does not lie elsewhere in my code, 1% is a risk I don't want to take so here are pastebin links to my frame and panel classes (I already had them in pastebin from another board, and am unsure of how clean code snippets appear on this board so I don't want to take chances putting it all up here in case it causes a mess).<br />
Just add these to the end of pastebin(dot)com/<br />
x703CsGv<br />
Yi1cuNZY<br />
<br />
Thank you :)</div>


	<div style="padding:10px">

	

	

	
		<fieldset class="fieldset">
			<legend>Attached Images</legend>
			<ul>
			<li>
	<img class="inlineimg" src="http://www.javaprogrammingforums.com/images/attach/jpg.gif" alt="File Type: jpg" />
	<a href="http://www.javaprogrammingforums.com/attachments/awt-java-swing/2097d1369300385-drawing-jpanel-not-working-expected-capture-jpg">Capture.jpg</a> 
(19.3 KB)
</li>
			</ul>
			</fieldset>
	

	

	</div>
]]></content:encoded>
			<category domain="http://www.javaprogrammingforums.com/awt-java-swing/">AWT / Java Swing</category>
			<dc:creator>brocode</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/awt-java-swing/29615-drawing-jpanel-not-working-expected.html</guid>
		</item>
		<item>
			<title>GUI Freeze D3D Screen Updater thread blocked</title>
			<link>http://www.javaprogrammingforums.com/awt-java-swing/29583-gui-freeze-d3d-screen-updater-thread-blocked.html</link>
			<pubDate>Wed, 22 May 2013 10:44:03 GMT</pubDate>
			<description>Hi All, I have a GUI with a JTable event log that is updating about once a second and the GUI freezes randomly after a period of time. I have only...</description>
			<content:encoded><![CDATA[<div>Hi All, I have a GUI with a JTable event log that is updating about once a second and the GUI freezes randomly after a period of time. I have only recently started running the GUI on a PC using windows 7 running JRE 1.7, previously on XP running JRE 1.6 I did not see this problem.<br />
<br />
Initially it looked like the problem was due to calls to swing operations to scroll the parent JScrollPane to the last event within the event listener method were not being run on the AWT EventThread. So I added the following code to the eventPosted method to force execution of the swing operations on the AWT EventThread:<br />
<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code :</div>
                <hr /><code class="bbcode_code"><div class="" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">SwingUtilities.invokeLater(new Runnable() {
             public void run()
            {
            	try
            	{
                    scrollToBottom();
            	}
            	catch(Exception e)
            	{
            		e.printStackTrace();
            		throw new RuntimeException(e);
            	}
            }
        });
&nbsp;
private void scrollToBottom()
    { 
        Dimension dim = scrollPane.getViewport().getViewSize();
        Point curr = scrollPane.getViewport().getViewPosition();
        curr.translate(0, (int)dim.getHeight());
        scrollPane.getViewport().setViewPosition(curr);
        eventTable.revalidate ();
    }</pre></div></code><hr />
</div> <br />
but I still get the random lockups. After a lock-up here's a snipet of the jstack output from the process:<br />
<br />
D3D Screen Updater&quot; daemon prio=8 tid=0x000000000a848800 nid=0x7e8 waiting for monitor entry [0x000000000b1ff000]<br />
   java.lang.Thread.State: BLOCKED (on object monitor)<br />
        at java.awt.Window.getOpacity(Window.java:3519)<br />
        - waiting to lock &lt;0x00000000c1d2ad80&gt; (a java.awt.Component$AWTTreeLock)<br />
        at sun.awt.SunToolkit.isContainingTopLevelTranslucent  (SunToolkit.java:2018)<br />
        at sun.awt.windows.WComponentPeer.isAccelCapable(WCom  ponentPeer.java:1030)<br />
        at sun.java2d.d3d.D3DSurfaceData$D3DWindowSurfaceData  .restoreSurface(D3DSurfaceData.java:938)<br />
        at sun.java2d.d3d.D3DScreenUpdateManager.validate(D3D  ScreenUpdateManager.java:491)<br />
        at sun.java2d.d3d.D3DScreenUpdateManager.run(D3DScree  nUpdateManager.java:466)<br />
        at java.lang.Thread.run(Thread.java:722)<br />
<br />
&quot;AWT-EventQueue-0&quot; prio=6 tid=0x0000000007c4e000 nid=0x1a5c in Object.wait() [0x000000000a7cd000]<br />
   java.lang.Thread.State: WAITING (on object monitor)<br />
        at java.lang.Object.wait(Native Method)<br />
        - waiting on &lt;0x00000000c1b98c80&gt; (a java.lang.Object)<br />
        at java.lang.Object.wait(Object.java:503)<br />
        at sun.java2d.d3d.D3DScreenUpdateManager.runUpdateNow  (D3DScreenUpdateManager.java:419)<br />
        - locked &lt;0x00000000c1b98c80&gt; (a java.lang.Object)<br />
        at sun.java2d.d3d.D3DBlitLoops.IsoBlit(D3DBlitLoops.j  ava:352)<br />
        at sun.java2d.d3d.D3DRTTSurfaceToSurfaceBlit.Blit(D3D  BlitLoops.java:439)<br />
        at sun.java2d.pipe.DrawImage.blitSurfaceData(DrawImag  e.java:956)<br />
        at sun.java2d.pipe.DrawImage.renderImageCopy(DrawImag  e.java:578)<br />
        at sun.java2d.pipe.DrawImage.copyImage(DrawImage.java  :71)<br />
        at sun.java2d.pipe.DrawImage.copyImage(DrawImage.java  :1011)<br />
        at sun.java2d.pipe.ValidatePipe.copyImage(ValidatePip  e.java:186)<br />
        at sun.java2d.SunGraphics2D.drawImage(SunGraphics2D.j  ava:3062)<br />
        at sun.java2d.SunGraphics2D.drawImage(SunGraphics2D.j  ava:3047)<br />
        at javax.swing.RepaintManager$PaintManager.paintDoubl  eBuffered(RepaintManager.java:1484)<br />
        at javax.swing.RepaintManager$PaintManager.paint(Repa  intManager.java:1413)<br />
        at javax.swing.RepaintManager.paint(RepaintManager.ja  va:1206)<br />
        at javax.swing.JComponent.paintForceDoubleBuffered(JC  omponent.java:1090)<br />
        at javax.swing.JViewport.paintView(JViewport.java:160  9)<br />
        at javax.swing.JViewport.windowBlitPaint(JViewport.ja  va:1540)<br />
        at javax.swing.JViewport.setViewPosition(JViewport.ja  va:1092)<br />
        at javax.swing.ViewportLayout.layoutContainer(Viewpor  tLayout.java:199)<br />
        at java.awt.Container.layout(Container.java:1503)<br />
        at java.awt.Container.doLayout(Container.java:1492)<br />
        at java.awt.Container.validateTree(Container.java:168  8)<br />
        at java.awt.Container.validateTree(Container.java:169  7)<br />
        at java.awt.Container.validate(Container.java:1623)<br />
        - locked &lt;0x00000000c1d2ad80&gt; (a java.awt.Component$AWTTreeLock)<br />
        at javax.swing.RepaintManager.validateInvalidComponen  ts(RepaintManager.java:653)<br />
        at javax.swing.RepaintManager$ProcessingRunnable.run(  RepaintManager.java:1620)<br />
        at java.awt.event.InvocationEvent.dispatch(Invocation  Event.java:251)<br />
        at java.awt.EventQueue.dispatchEventImpl(EventQueue.j  ava:705)<br />
        at java.awt.EventQueue.access$000(EventQueue.java:101  )<br />
        at java.awt.EventQueue$3.run(EventQueue.java:666)<br />
        at java.awt.EventQueue$3.run(EventQueue.java:664)<br />
        at java.security.AccessController.doPrivileged(Native Method)<br />
        at java.security.ProtectionDomain$1.doIntersectionPri  vilege(ProtectionDomain.java:76)<br />
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:  675)<br />
        at java.awt.EventDispatchThread.pumpOneEventForFilter  s(EventDispatchThread.java:211)<br />
        at java.awt.EventDispatchThread.pumpEventsForFilter(E  ventDispatchThread.java:128)<br />
        at java.awt.EventDispatchThread.pumpEventsForHierarch  y(EventDispatchThread.java:117)<br />
        at java.awt.EventDispatchThread.pumpEvents(EventDispa  tchThread.java:113)<br />
        at java.awt.EventDispatchThread.pumpEvents(EventDispa  tchThread.java:105)<br />
        at java.awt.EventDispatchThread.run(EventDispatchThre  ad.java:90)<br />
<br />
<br />
It looks like a race condition where the AWT Queue thread has the AWTTreeLock and then has kicked the D3D Screen Updater to update the screen but fails to return because its also waiting on the same component AWTTreeLock. <br />
<br />
Any ideas why I should be seeing this?</div>

]]></content:encoded>
			<category domain="http://www.javaprogrammingforums.com/awt-java-swing/">AWT / Java Swing</category>
			<dc:creator>davef3</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/awt-java-swing/29583-gui-freeze-d3d-screen-updater-thread-blocked.html</guid>
		</item>
		<item>
			<title><![CDATA[Compiled .jar won't run when using .wav-files.]]></title>
			<link>http://www.javaprogrammingforums.com/awt-java-swing/29577-compiled-jar-wont-run-when-using-wav-files.html</link>
			<pubDate>Wed, 22 May 2013 08:50:31 GMT</pubDate>
			<description>I have created a simple GUI that loops a .wav-file when a button is clicked. This works perfectly when run in Eclipse. However, when compiling it in...</description>
			<content:encoded><![CDATA[<div>I have created a simple GUI that loops a .wav-file when a button is clicked. This works perfectly when run in Eclipse. However, when compiling it in a runnable .jar, it does not run. No errors thrown, it just doesn't run. Here is the full code:<br />
<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code :</div>
                <hr /><code class="bbcode_code"><div class="" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">import java.awt.EventQueue;
&nbsp;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.UnsupportedAudioFileException;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.io.File;
import java.io.IOException;
&nbsp;
&nbsp;
public class Lydtest extends JFrame {
&nbsp;
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private JPanel contentPane;
&nbsp;
	/**
	 * Launch the application.
	 */
	public static void main(String&#91;&#93; args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					Lydtest frame = new Lydtest();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}
&nbsp;
	/**
	 * Create the frame.
	 * @throws IOException 
	 * @throws UnsupportedAudioFileException 
	 * @throws LineUnavailableException 
	 */
	public Lydtest() throws UnsupportedAudioFileException, IOException, LineUnavailableException {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 114, 72);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
&nbsp;
		File lydklipp = new File(&quot;pessent.wav&quot;);
		AudioInputStream audioIn = AudioSystem.getAudioInputStream(lydklipp);
		final Clip clip = AudioSystem.getClip();
		clip.open(audioIn);
&nbsp;
&nbsp;
		JButton btnTestLyd = new JButton(&quot;Pezzent!&quot;);
		btnTestLyd.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				clip.loop(getDefaultCloseOperation());
			}
		});
		btnTestLyd.setBounds(10, 11, 91, 23);
		contentPane.add(btnTestLyd);
	}
}</pre></div></code><hr />
</div> </div>

]]></content:encoded>
			<category domain="http://www.javaprogrammingforums.com/awt-java-swing/">AWT / Java Swing</category>
			<dc:creator>EatMyBible</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/awt-java-swing/29577-compiled-jar-wont-run-when-using-wav-files.html</guid>
		</item>
		<item>
			<title>Progress bar</title>
			<link>http://www.javaprogrammingforums.com/awt-java-swing/29544-progress-bar.html</link>
			<pubDate>Mon, 20 May 2013 01:29:45 GMT</pubDate>
			<description>Hi, i have a really simple question.  
Can someone tell me where to start when i want to add a progress bar. I have an arraylist of string. when i do...</description>
			<content:encoded><![CDATA[<div>Hi, i have a really simple question. <br />
Can someone tell me where to start when i want to add a progress bar. I have an arraylist of string. when i do a for:each loop, inside the loop i have a method that does something with each object<br />
<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code :</div>
                <hr /><code class="bbcode_code"><div class="" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">for (String ipString : ipAddress.arrListOfIpAddress) { 
&nbsp;
           if (ipAddress.getHostReachable(ipString)) {
              modelIPAddressListModel.addElement(ipString + &quot; is reachable&quot;);                             
           }
}</pre></div></code><hr />
</div> <br />
.How do i put in a progress bar that every time it get's the next item, the progress bar increments by one until it finishes and display's some kind of a message saying finished.</div>

]]></content:encoded>
			<category domain="http://www.javaprogrammingforums.com/awt-java-swing/">AWT / Java Swing</category>
			<dc:creator>tardis_</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/awt-java-swing/29544-progress-bar.html</guid>
		</item>
		<item>
			<title>Layout problems</title>
			<link>http://www.javaprogrammingforums.com/awt-java-swing/29512-layout-problems.html</link>
			<pubDate>Fri, 17 May 2013 16:37:01 GMT</pubDate>
			<description>Hi! 
 
I have often problems with Layouts. How can I set component at exact location.  
I thought I can do 
button.setLocation(20,40) but some...</description>
			<content:encoded><![CDATA[<div>Hi!<br />
<br />
I have often problems with Layouts. How can I set component at exact location. <br />
I thought I can do<br />
button.setLocation(20,40) but some strange things happens all the time. The problem is with this<br />
Layouts (Flow, Grid, Border...). In C# I think there are not these problems.<br />
Can I turn off all these layouts and put things much simpler. At this time I have this code and when I run this<br />
the table is not showed at window?<br />
<br />
public class nothing extends JFrame {<br />
<br />
    private JTable tabpredmet;<br />
<br />
    public nothing () {<br />
        super(&quot;govno&quot;);<br />
        setLayout(null);<br />
        setSize(400, 700);<br />
        setVisible(true);<br />
<br />
        String[][] data = new String[][]{{&quot;Srpski jezik&quot;}, {&quot;Engleski jezik&quot;}, {&quot;Ruski jezik&quot;}};<br />
        String[] col = {&quot;Predmet&quot;};<br />
        tabpredmet = new JTable(data, col);<br />
        tabpredmet.setPreferredScrollableViewportSize(new Dimension(200, 200));<br />
        tabpredmet.setFillsViewportHeight(true);<br />
        // JScrollPane jscrollpane = new JScrollPane(tabpredmet);<br />
        JScrollPane p = new JScrollPane(tabpredmet);<br />
        add(p);<br />
        p.setVisible(true);<br />
        p.setLocation(50, 50);<br />
<br />
    }<br />
<br />
    public static void main(String[] args) {<br />
        nothing a = new nothing ();<br />
        a.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);   <br />
<br />
<br />
<br />
<br />
    }<br />
}</div>

]]></content:encoded>
			<category domain="http://www.javaprogrammingforums.com/awt-java-swing/">AWT / Java Swing</category>
			<dc:creator>lijepdan</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/awt-java-swing/29512-layout-problems.html</guid>
		</item>
		<item>
			<title>Incremental graphics painting in applet</title>
			<link>http://www.javaprogrammingforums.com/awt-java-swing/29444-incremental-graphics-painting-applet.html</link>
			<pubDate>Mon, 13 May 2013 21:05:43 GMT</pubDate>
			<description>I have been doing graphics drawing in Eclipse using Applet abstract class and paint() method. Everything works fine except for one situation. On a...</description>
			<content:encoded><![CDATA[<div>I have been doing graphics drawing in Eclipse using Applet abstract class and paint() method. Everything works fine except for one situation. On a mouse click I draw a graphics object. On a different mouse click I redraw  the same object at a different location via a call to repaint() in mouse click event method. So far, so good. But I can't figure out how to keep each prior painted object on the screen after each new mouse click. It seems repaint() clears the screen. In researching the repaint() method there doesn't seem to be a crisp explanation of how to do incremental painting other than manually keeping track of each drawing object in an array list and then redrawing from that on the call to repaint(). That seems awfully burdensome. I can't believe that's the only way. Any ideas?</div>

]]></content:encoded>
			<category domain="http://www.javaprogrammingforums.com/awt-java-swing/">AWT / Java Swing</category>
			<dc:creator>Hobokenrich</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/awt-java-swing/29444-incremental-graphics-painting-applet.html</guid>
		</item>
		<item>
			<title>how can i make a jbutton to close a jframe??</title>
			<link>http://www.javaprogrammingforums.com/awt-java-swing/29410-how-can-i-make-jbutton-close-jframe.html</link>
			<pubDate>Sun, 12 May 2013 12:48:12 GMT</pubDate>
			<description>y0 guys i have been working on a jframe with background and jbuttons and i fixed everything of it 
but the thing that i want to make the exit button...</description>
			<content:encoded><![CDATA[<div>y0 guys i have been working on a jframe with background and jbuttons and i fixed everything of it<br />
but the thing that i want to make the exit button i made to close the jframe when i click on it??<br />
any way how to add that ??<br />
hope somone can help me out!<br />
im a new beginner so.</div>

]]></content:encoded>
			<category domain="http://www.javaprogrammingforums.com/awt-java-swing/">AWT / Java Swing</category>
			<dc:creator>FastFuture</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/awt-java-swing/29410-how-can-i-make-jbutton-close-jframe.html</guid>
		</item>
		<item>
			<title><![CDATA[exchanging 2 Label locations with MouseListener and MouseMotionListen (Drag & Drop)]]></title>
			<link>http://www.javaprogrammingforums.com/awt-java-swing/29373-exchanging-2-label-locations-mouselistener-mousemotionlisten-drag-drop.html</link>
			<pubDate>Thu, 09 May 2013 19:16:52 GMT</pubDate>
			<description>i have tried to make a Drag and Drop for type of Puzzle. Its my school project and im the only one who is stuck with this trouble ... 
 
 
it doesnt...</description>
			<content:encoded><![CDATA[<div>i have tried to make a Drag and Drop for type of Puzzle. Its my school project and im the only one who is stuck with this trouble ...<br />
<br />
<br />
it doesnt exchange me the Location of the Labels .. with MouseListener ...<br />
<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code :</div>
                <hr /><code class="bbcode_code"><div class="" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">package proveproject;
import javax.swing.*;
import java.awt.*;;
import java.io.*;
import java.awt.event.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.util.*;
&nbsp;
public class DPuzzle implements ActionListener{
    JFrame dpFrame;
    JLabel &#91;&#93;lbl;
    JLabel &#91;&#93;eastLbl;
    JButton solve;
    JComponent a,b;
    int X1,Y1,X2,Y2;
&nbsp;
&nbsp;
    DPuzzle(){
        dpFrame = new JFrame(&quot;PUZZLE&quot;);
        dpFrame.setDefaultCloseOperation(dpFrame.EXIT_ON_CLOSE);
        dpFrame.setBounds(50,50,1200,500);
        dpFrame.setLayout(new BorderLayout());
&nbsp;
&nbsp;
        JPanel centerPane = new JPanel();
        centerPane.setLayout(new GridLayout(3,8,3,3));
        JPanel southPane = new JPanel();
&nbsp;
&nbsp;
        //Aggiungo  le immagini
        ImageIcon &#91;&#93;img;
        img = new ImageIcon&#91;9&#93;;
        img&#91;0&#93; = new ImageIcon(&quot;1.jpg&quot;);
        img&#91;1&#93; = new ImageIcon(&quot;2.jpg&quot;);
        img&#91;2&#93; = new ImageIcon(&quot;3.jpg&quot;);
        img&#91;3&#93; = new ImageIcon(&quot;4.jpg&quot;);
        img&#91;4&#93; = new ImageIcon(&quot;5.jpg&quot;);
        img&#91;5&#93; = new ImageIcon(&quot;6.jpg&quot;);
        img&#91;6&#93; = new ImageIcon(&quot;7.jpg&quot;);
        img&#91;7&#93; = new ImageIcon(&quot;8.jpg&quot;);
        img&#91;8&#93; = new ImageIcon(&quot;9.jpg&quot;); 
&nbsp;
&nbsp;
        //metto le immagini nelle label
        lbl = new JLabel&#91;9&#93;;
        for (int i = 0; i &lt; 9; i++) {
            lbl&#91;i&#93;= new JLabel(&quot;&quot;);
            lbl&#91;i&#93;.addMouseMotionListener(new DragMouseAdapter());
            lbl&#91;i&#93;.addMouseListener(new DragMouseAdapter());
        }
&nbsp;
&nbsp;
        lbl&#91;0&#93;.setIcon(img&#91;7&#93;);
        lbl&#91;1&#93;.setIcon(img&#91;4&#93;);
        lbl&#91;2&#93;.setIcon(img&#91;1&#93;);
        lbl&#91;3&#93;.setIcon(img&#91;3&#93;);
        lbl&#91;4&#93;.setIcon(img&#91;6&#93;);
        lbl&#91;5&#93;.setIcon(img&#91;2&#93;);
        lbl&#91;6&#93;.setIcon(img&#91;8&#93;);
        lbl&#91;7&#93;.setIcon(img&#91;5&#93;);
        lbl&#91;8&#93;.setIcon(img&#91;0&#93;);
&nbsp;
&nbsp;
&nbsp;
        //Finisco di mettere le label nel WestPane
&nbsp;
&nbsp;
        //Inizio mettere le immagini nelle Label East 
        ImageIcon whiteImg = new ImageIcon(&quot;whiteImg.jpg&quot;);
        eastLbl = new JLabel&#91;9&#93;;
&nbsp;
&nbsp;
        for (int i = 0; i &lt; 9; i++) {
            eastLbl&#91;i&#93; = new JLabel(&quot;&quot;);
            eastLbl&#91;i&#93;.setIcon(whiteImg);
            eastLbl&#91;i&#93;.addMouseMotionListener(new DragMouseAdapter());
            eastLbl&#91;i&#93;.addMouseListener(new DragMouseAdapter());
        }
&nbsp;
        //Fine Pannello Ovest
&nbsp;
&nbsp;
        //Creare pannello sud 
        solve = new JButton(&quot;Fatto&quot;);
        solve.addActionListener(this);
        southPane.add(solve);
&nbsp;
&nbsp;
&nbsp;
&nbsp;
        centerPane.add(lbl&#91;0&#93;);
        centerPane.add(lbl&#91;1&#93;);
        centerPane.add(lbl&#91;2&#93;);
        centerPane.add(new JLabel(&quot;&quot;));
        centerPane.add(new JLabel(&quot;&quot;));
        centerPane.add(eastLbl&#91;0&#93;);
        centerPane.add(eastLbl&#91;1&#93;);
        centerPane.add(eastLbl&#91;2&#93;);
        centerPane.add(lbl&#91;3&#93;);
        centerPane.add(lbl&#91;4&#93;);
        centerPane.add(lbl&#91;5&#93;);
        centerPane.add(new JLabel(&quot;&quot;));
        centerPane.add(new JLabel(&quot;&quot;));
        centerPane.add(eastLbl&#91;3&#93;);
        centerPane.add(eastLbl&#91;4&#93;);
        centerPane.add(eastLbl&#91;5&#93;);
        centerPane.add(lbl&#91;6&#93;);
        centerPane.add(lbl&#91;7&#93;);
        centerPane.add(lbl&#91;8&#93;);
        centerPane.add(new JLabel(&quot;&quot;));
        centerPane.add(new JLabel(&quot;&quot;));
        centerPane.add(eastLbl&#91;6&#93;);
        centerPane.add(eastLbl&#91;7&#93;);
        centerPane.add(eastLbl&#91;8&#93;);
&nbsp;
&nbsp;
        dpFrame.add(centerPane,BorderLayout.CENTER);
        dpFrame.add(southPane,BorderLayout.SOUTH);
        dpFrame.setVisible(true);
    }
&nbsp;
    @Override
    public void actionPerformed(ActionEvent ae) {
&nbsp;
    }
&nbsp;
    //MouseListener
&nbsp;
&nbsp;
&nbsp;
    //MouseMotionListener
    public class DragMouseAdapter implements MouseMotionListener,MouseListener{
&nbsp;
        @Override
        public void mouseDragged(MouseEvent me) {
            a =(JComponent)me.getSource();
            X1 = a.getX();
            Y1 = a.getY();
        }
&nbsp;
        @Override
        public void mouseMoved(MouseEvent me) {
&nbsp;
        }
&nbsp;
        @Override
        public void mouseClicked(MouseEvent me) {
            a.setLocation(X2, Y2);
            b.setLocation(X1, Y1);
        }
&nbsp;
        @Override
        public void mousePressed(MouseEvent me) {
&nbsp;
        }
        @Override
        public void mouseReleased(MouseEvent me) {
            b = (JComponent)me.getSource();
            X2 = b.getX();
            Y2 = b.getY();
        }
&nbsp;
        @Override
        public void mouseEntered(MouseEvent me) {
            throw new UnsupportedOperationException(&quot;Not supported yet.&quot;);
        }
&nbsp;
        @Override
        public void mouseExited(MouseEvent me) {
            throw new UnsupportedOperationException(&quot;Not supported yet.&quot;);
        }
    }
&nbsp;
&nbsp;
&nbsp;
&nbsp;
    public static void main(String&#91;&#93; args) {
        new DPuzzle();
    }
&nbsp;
}</pre></div></code><hr />
</div> <br />
<br />
<br />
Is there anybody who can help me doing the exchange of the JLabels Location???</div>

]]></content:encoded>
			<category domain="http://www.javaprogrammingforums.com/awt-java-swing/">AWT / Java Swing</category>
			<dc:creator>haiderali</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/awt-java-swing/29373-exchanging-2-label-locations-mouselistener-mousemotionlisten-drag-drop.html</guid>
		</item>
		<item>
			<title>Add MouseClickEvent for a X/Y-Coordinate (JFrame)</title>
			<link>http://www.javaprogrammingforums.com/awt-java-swing/29364-add-mouseclickevent-x-y-coordinate-jframe.html</link>
			<pubDate>Thu, 09 May 2013 13:10:36 GMT</pubDate>
			<description><![CDATA[Hello Everyone 
 
I Google'd for a solution to my problem, but I couldnt find anything :( 
 
I want to add a MouseClickEvent for my GUI, but only for...]]></description>
			<content:encoded><![CDATA[<div>Hello Everyone<br />
<br />
I Google'd for a solution to my problem, but I couldnt find anything :(<br />
<br />
I want to add a MouseClickEvent for my GUI, but only for a small part of my JFrame.<br />
<br />
I made it work with a Invisible Button, but for several reasons I'd like to add the Event in the JFrame.<br />
<br />
Is there a Method with which I can define a range from the X/Y-Coordinates of the JFrame?<br />
<br />
Sorry for my imperfect english :)<br />
<br />
Thx<br />
Student_27</div>

]]></content:encoded>
			<category domain="http://www.javaprogrammingforums.com/awt-java-swing/">AWT / Java Swing</category>
			<dc:creator>Student_27</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/awt-java-swing/29364-add-mouseclickevent-x-y-coordinate-jframe.html</guid>
		</item>
		<item>
			<title>Jradiobutton problem</title>
			<link>http://www.javaprogrammingforums.com/awt-java-swing/29208-jradiobutton-problem.html</link>
			<pubDate>Tue, 07 May 2013 06:58:17 GMT</pubDate>
			<description><![CDATA[I can't seem to get my radio buttons to work. My program basically is a menu. My problem is when i select a burger from my radio buttons and then...]]></description>
			<content:encoded><![CDATA[<div>I can't seem to get my radio buttons to work. My program basically is a menu. My problem is when i select a burger from my radio buttons and then click calcuate it says my subtotal is 200(which I set as default). But since i clicked a button it should be 4.95,5.95,or 6.95. What should I do? Any help is appreciated.<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code :</div>
                <hr /><code class="bbcode_code"><div class="" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
&nbsp;
import javax.swing.JRadioButton;
import javax.swing.ButtonGroup;
&nbsp;
&nbsp;
public class DisplayMenu extends JFrame {
	private static JPanel panel;
	private static JPanel panel2;
	private static JPanel panel3;
	private static JPanel orderPanel;
	private static JPanel buttonPanel;
	private JLabel message1;
	private JLabel message2;
	private JLabel message3;
	private JTextField text1;
	private JTextField text2;
	private JTextField text3;
	private JButton calcButton;
	private JButton exitButton;
	private JRadioButton jrb1;
	private JRadioButton jrb2;
	private JRadioButton jrb3;
	private JCheckBox Jchk;
	private JCheckBox Jchk2;
	private JCheckBox Jchk3;
	private JCheckBox Jchk4;
	private JCheckBox Jchk5;
	double BurgerTotal;
	double cond1;
	double cond2;
	double cond3;
	double cond4;
	double cond5;
	double cond6;
	double Subtotal;
	public static void main(String&#91;&#93; args) {
		// TODO Auto-generated method stub
&nbsp;
		 DisplayMenu  frame = new DisplayMenu();
			frame.setTitle (&quot;Hamburger Hamlet Order&quot;);
			frame.setSize (400, 400);
			frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
			frame.buildPanel();
			frame.add(panel3);
			frame.setVisible(true);
&nbsp;
	}
&nbsp;
	private void buildPanel()
	{
&nbsp;
	panel = new JPanel();
	 jrb1 = new JRadioButton (&quot;burger1(4.95)&quot;);
	  jrb2 = new JRadioButton (&quot;burger2(5.95)&quot;);
	  jrb3 = new JRadioButton (&quot;burger3(6.95)&quot;);
	  Jchk = new JCheckBox(&quot;lettuce&quot;);
	  Jchk2 = new JCheckBox(&quot;onion&quot;);
	  Jchk3 = new JCheckBox(&quot;tomatoes&quot;);
	  Jchk4 = new JCheckBox(&quot;nug&quot;);
	  Jchk5 = new JCheckBox(&quot;byug&quot;);
	ButtonGroup group = new ButtonGroup();
	group.add(jrb1);
	group.add(jrb2);
	group.add(jrb3);
&nbsp;
&nbsp;
if (Jchk.isSelected()){
	cond1 = .25;
}
else{
	cond1= 0;
}
&nbsp;
if (Jchk2.isSelected()){
	cond2 = .25;
}
else{
	cond2 = 0;
}
if (Jchk3.isSelected()){
	cond3 = .25;
}
else{
	cond3= 0;
}
&nbsp;
if (Jchk4.isSelected()){
	cond4 = .25;
}
else{
	cond4 = 0;
}	
if (Jchk5.isSelected()){
	cond5 = .25;
}
else{
	cond5 = 0;
}	
&nbsp;
	add(panel, BorderLayout.WEST); //add the left panel to the border layout
	panel.setLayout (new BoxLayout (panel, BoxLayout.Y_AXIS)); //set the layout of left to box layout
	  //display the buttons on the panel
	calcButton = new JButton (&quot;calculate&quot;);
	exitButton = new JButton (&quot;Exit&quot;);
	panel.add (jrb1);
	panel.add (jrb2);
	panel.add (jrb3);
	if (jrb1.isSelected()){
		BurgerTotal = 4.95;
	}
	else if (jrb2.isSelected()){
		BurgerTotal = 5.95;
	}
	else if (jrb3.isSelected()){
		BurgerTotal = 6.95;
	}
	else{
		BurgerTotal =200;
	}
	calcButton.addActionListener(new CalcButtonListener());
&nbsp;
	exitButton.addActionListener(new ExitButtonListener());
	panel2  = new JPanel();
	panel2.setLayout(new GridLayout(3,2));
	panel2.add (Jchk);
	panel2.add (Jchk2);
	panel2.add (Jchk3);
	panel2.add (Jchk4);
	panel2.add (Jchk5);
	add(panel2, BorderLayout.WEST); //add the left panel to the border layout
	  panel2.setLayout (new BoxLayout (panel2, BoxLayout.Y_AXIS)); //set the layout of left to box layout
	orderPanel = new JPanel();
	orderPanel.setLayout(new GridLayout(3,2));
	message3 = new JLabel (&quot;Subtotal: &quot;);
	orderPanel.add(message3);
	text3 = new JTextField(10);
	text3.setEditable(false);
	orderPanel.add(text3);
	message2 = new JLabel (&quot;Tax(7.85%): &quot;);
	orderPanel.add(message2);
	text2 = new JTextField(10);
	text2.setEditable(false);
	orderPanel.add(text2);
	message1 = new JLabel (&quot;Total due: &quot;);
	text1 = new JTextField(10);
	text1.setEditable(false);
	orderPanel.add(message1);
	orderPanel.add(text1);
	buttonPanel = new JPanel();
	buttonPanel.setLayout(new GridLayout(3,1));
	buttonPanel.add(calcButton);
	buttonPanel.add(exitButton);
	panel3 = new JPanel();
	panel3.setLayout(new GridLayout(2,2));
	panel3.add(panel);
	panel3.add(panel2);
	panel3.add(orderPanel);
	panel3.add(buttonPanel);
&nbsp;
&nbsp;
	}
&nbsp;
	private class CalcButtonListener implements ActionListener
	{
		public void actionPerformed(ActionEvent e)
		{
&nbsp;
			double subtotal;
&nbsp;
			subtotal = BurgerTotal;
			text3.setText(Double.toString(subtotal));	
		}
&nbsp;
	}
	//exits when you click exit
	private class ExitButtonListener implements ActionListener
	{
		public void actionPerformed(ActionEvent e)
		{
			System.exit(ABORT);
		}
&nbsp;
	}
&nbsp;
	}</pre></div></code><hr />
</div> <font color="Silver"><br />
<br />
--- Update ---<br />
<br />
</font>ok i figured that part out I just moved my if statements to the actionlistener</div>

]]></content:encoded>
			<category domain="http://www.javaprogrammingforums.com/awt-java-swing/">AWT / Java Swing</category>
			<dc:creator>wetwater</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/awt-java-swing/29208-jradiobutton-problem.html</guid>
		</item>
		<item>
			<title>How do you change tab stop index in Swing?</title>
			<link>http://www.javaprogrammingforums.com/awt-java-swing/29201-how-do-you-change-tab-stop-index-swing.html</link>
			<pubDate>Tue, 07 May 2013 03:45:33 GMT</pubDate>
			<description>I am sorry for a very simple question, but I am really at loss about this. I am very new with Java, learning it with Murach Java Programming at the...</description>
			<content:encoded><![CDATA[<div>I am sorry for a very simple question, but I am really at loss about this. I am very new with Java, learning it with Murach Java Programming at the moment, with Java 7. What I want to know is, how can I change the order of the focus change when we press the tab key in keyboard? In Visual Basic .NET it is called Tab Index, what is it called in Java? I would love to use Java lingo, but mine is very limited currently.<br />
<br />
Thank you so much.</div>

]]></content:encoded>
			<category domain="http://www.javaprogrammingforums.com/awt-java-swing/">AWT / Java Swing</category>
			<dc:creator>IndraG</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/awt-java-swing/29201-how-do-you-change-tab-stop-index-swing.html</guid>
		</item>
		<item>
			<title>jTextfields and JTables</title>
			<link>http://www.javaprogrammingforums.com/awt-java-swing/29200-jtextfields-jtables.html</link>
			<pubDate>Tue, 07 May 2013 02:21:25 GMT</pubDate>
			<description>Is it possible to populate a J Table when text is entered into a textfield? Reason I ask is I want the data entered in the text fields to be added...</description>
			<content:encoded><![CDATA[<div>Is it possible to populate a J Table when text is entered into a textfield? Reason I ask is I want the data entered in the text fields to be added into the J Table in the same fashion as it is entered. Also I have a combo box that has five titles for my application that I want to be displayed along with the rest if data</div>

]]></content:encoded>
			<category domain="http://www.javaprogrammingforums.com/awt-java-swing/">AWT / Java Swing</category>
			<dc:creator>JoeSmo</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/awt-java-swing/29200-jtextfields-jtables.html</guid>
		</item>
		<item>
			<title>problems with event handlers</title>
			<link>http://www.javaprogrammingforums.com/awt-java-swing/29155-problems-event-handlers.html</link>
			<pubDate>Sat, 04 May 2013 22:07:19 GMT</pubDate>
			<description><![CDATA[I have a GUI project, but the instructions I'm given on what is supposed to happen in each event handler is uncleared. 
For one of them, it is...]]></description>
			<content:encoded><![CDATA[<div>I have a GUI project, but the instructions I'm given on what is supposed to happen in each event handler is uncleared.<br />
For one of them, it is supposed to delete a file made in another event handler. However, I do not know how to delete the file. Can someone help me with this?<br />
For a different event handler, it is supposed to check to make sure all fields are filled in, but I do not know how to write the code to check this. I'm also supposed to store 4 pieces of data to a file on a separate line. However, i don't know how to do this. I have another method, but I don't think I can put a method into a event handler. Can someone help me with this too?</div>

]]></content:encoded>
			<category domain="http://www.javaprogrammingforums.com/awt-java-swing/">AWT / Java Swing</category>
			<dc:creator>my21</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/awt-java-swing/29155-problems-event-handlers.html</guid>
		</item>
		<item>
			<title>Tic Tac Toe Program</title>
			<link>http://www.javaprogrammingforums.com/awt-java-swing/29001-tic-tac-toe-program.html</link>
			<pubDate>Thu, 02 May 2013 00:47:29 GMT</pubDate>
			<description>Alright, so I have run into a bit of an error and I am not sure where I have gone wrong. I have two sets of code that should work together. The...</description>
			<content:encoded><![CDATA[<div>Alright, so I have run into a bit of an error and I am not sure where I have gone wrong. I have two sets of code that should work together. The problem seems to be in the second file TicTacEvent on line 5. I read something about associating the file, but I do not fully understand what the means or how I am supposed to go about doing that.<br />
<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code :</div>
                <hr /><code class="bbcode_code"><div class="" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  void b2()
  {
    clicks = clicks + 1;
    if ((clicks%2)==1)
    {
      gui.boxes&#91;0&#93;&#91;1&#93;.setIcon(a);
      check&#91;0&#93;&#91;1&#93; = 1; 
    }
    else
    {
      gui.boxes&#91;0&#93;&#91;1&#93;.setIcon(b);
      check&#91;0&#93;&#91;1&#93; = 2;
    }
  }</pre></div></code><hr />
</div> <br />
<div class="bbcode_container">
                <div class="bbcode_description">Code :</div>
                <hr /><code class="bbcode_code"><div class="" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
&nbsp;
public class TicTacEvent implements ItemListener, ActionListener, Runnable
{
  TicTac gui;
  Thread playing;
  ImageIcon a = new ImageIcon(&quot;x.jpg&quot;);
  ImageIcon b = new ImageIcon(&quot;o.jpg&quot;);
  int clicks = 0;
  int win = 0;
  int&#91;&#93;&#91;&#93; check = new int&#91;3&#93;&#91;3&#93;;
&nbsp;
  public TicTacEvent (TicTac in)
  {
    gui = in;
    for (int row=0; row&lt;=2; row++)
    {
      for (int col=0; col&lt;=2; col++)
      {
        check&#91;row&#93;&#91;col&#93;=0;
      }
    }
  }
&nbsp;
  public void actionPerformed (ActionEvent event)
  {
    String command = event.getActionCommand();
&nbsp;
    if (command.equals(&quot;Play&quot;)) 
    {
      startPlaying();
    }
    if (command.equals(&quot;1&quot;)) 
    {
      b1();
    }
    if (command.equals(&quot;2&quot;)) 
    {
      b2();
    }
    if (command.equals(&quot;3&quot;)) 
    {
      b3();
    }
    if (command.equals(&quot;4&quot;)) 
    {
      b4();
    }
    if (command.equals(&quot;5&quot;)) 
    {
      b5();
    }
    if (command.equals(&quot;6&quot;)) 
    {
      b6();
    }
    if (command.equals(&quot;7&quot;)) 
    {
      b7();
    }
    if (command.equals(&quot;8&quot;)) 
    {
      b8();
    }
    if (command.equals(&quot;9&quot;)) 
    {
      b9();
    }
  }
&nbsp;
  void b1()
  {
    clicks = clicks + 1;
    if ((clicks%2)==1)
    {
      gui.boxes&#91;0&#93;&#91;0&#93;.setIcon(a);
      check&#91;0&#93;&#91;0&#93; = 1;
    }
    else
    {
      gui.boxes&#91;0&#93;&#91;0&#93;.setIcon(b);
      check&#91;0&#93;&#91;0&#93; = 2;
    }
  }
&nbsp;
  void b2()
  {
    clicks = clicks + 1;
    if ((clicks%2)==1)
    {
      gui.boxes&#91;0&#93;&#91;1&#93;.setIcon(a);
      check&#91;0&#93;&#91;1&#93; = 1; 
    }
    else
    {
      gui.boxes&#91;0&#93;&#91;1&#93;.setIcon(b);
      check&#91;0&#93;&#91;1&#93; = 2;
    }
  }
&nbsp;
  void b3()
  {
    clicks = clicks + 1;
    if ((clicks%2)==1)
    {
      gui.boxes&#91;0&#93;&#91;2&#93;.setIcon(a);
      check&#91;0&#93;&#91;2&#93; = 1; 
    }
    else
    {
      gui.boxes&#91;0&#93;&#91;2&#93;.setIcon(b);
      check&#91;0&#93;&#91;2&#93; = 2;
    }
  }
&nbsp;
  void b4()
  {
    clicks = clicks + 1;
    if ((clicks%2)==1)
    {
      gui.boxes&#91;1&#93;&#91;0&#93;.setIcon(a);
      check&#91;1&#93;&#91;0&#93; = 1; 
    }
    else
    {
      gui.boxes&#91;1&#93;&#91;0&#93;.setIcon(b);
      check&#91;1&#93;&#91;0&#93; = 2;
    }
  }
&nbsp;
  void b5()
  {
    clicks = clicks + 1;
    if ((clicks%2)==1)
    {
      gui.boxes&#91;1&#93;&#91;1&#93;.setIcon(a);
      check&#91;1&#93;&#91;1&#93; = 1; 
    }
    else
    {
      gui.boxes&#91;1&#93;&#91;1&#93;.setIcon(b);
      check&#91;1&#93;&#91;1&#93; = 2;
    }
  }
&nbsp;
  void b6()
  {
    clicks = clicks + 1;
    if ((clicks%2)==1)
    {
      gui.boxes&#91;1&#93;&#91;2&#93;.setIcon(a);
      check&#91;1&#93;&#91;2&#93; = 1; 
    }
    else
    {
      gui.boxes&#91;1&#93;&#91;2&#93;.setIcon(b);
      check&#91;1&#93;&#91;2&#93; = 2;
    }
  }
&nbsp;
  void b7()
  {
    clicks = clicks + 1;
    if ((clicks%2)==1)
    {
      gui.boxes&#91;2&#93;&#91;0&#93;.setIcon(a);
      check&#91;2&#93;&#91;0&#93; = 1; 
    }
    else
    {
      gui.boxes&#91;2&#93;&#91;0&#93;.setIcon(b);
      check&#91;2&#93;&#91;0&#93; = 2;
    }
  }
&nbsp;
  void b8()
  {
    clicks = clicks + 1;
    if ((clicks%2)==1)
    {
      gui.boxes&#91;2&#93;&#91;1&#93;.setIcon(a);
      check&#91;2&#93;&#91;1&#93; = 1; 
    }
    else
    {
      gui.boxes&#91;2&#93;&#91;1&#93;.setIcon(b);
      check&#91;2&#93;&#91;1&#93; = 2;
    }
  }
&nbsp;
  void b9()
  {
    clicks = clicks + 1;
    if ((clicks%2)==1)
    {
      gui.boxes&#91;2&#93;&#91;2&#93;.setIcon(a);
      check&#91;2&#93;&#91;2&#93; = 1; 
    }
    else
    {
      gui.boxes&#91;2&#93;&#91;2&#93;.setIcon(b);
      check&#91;2&#93;&#91;2&#93; = 2;
    }
  }
&nbsp;
  void startPlaying()
  {
    playing = new Thread(this);
    playing.start();
    gui.play.setEnabled(false);
  }
}</pre></div></code><hr />
</div> </div>

]]></content:encoded>
			<category domain="http://www.javaprogrammingforums.com/awt-java-swing/">AWT / Java Swing</category>
			<dc:creator>shodai</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/awt-java-swing/29001-tic-tac-toe-program.html</guid>
		</item>
		<item>
			<title>Can Anyone Point me in the right direction?</title>
			<link>http://www.javaprogrammingforums.com/awt-java-swing/28995-can-anyone-point-me-right-direction.html</link>
			<pubDate>Wed, 01 May 2013 20:59:02 GMT</pubDate>
			<description>Doing an assignment for my university course based on an applet guessing game, using random shapes and shapes that are golden. Am i right to use a...</description>
			<content:encoded><![CDATA[<div>Doing an assignment for my university course based on an applet guessing game, using random shapes and shapes that are golden. Am i right to use a case/switch statement for this? I.E. Different cases for random shape and golden ratio shape?</div>

]]></content:encoded>
			<category domain="http://www.javaprogrammingforums.com/awt-java-swing/">AWT / Java Swing</category>
			<dc:creator>ImyMTD</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/awt-java-swing/28995-can-anyone-point-me-right-direction.html</guid>
		</item>
	</channel>
</rss>
