<?xml version="1.0" encoding="utf-8"?>

<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>DaniWeb IT Discussion Community - Java</title>
		<link>http://www.daniweb.com/forums/</link>
		<description><![CDATA[Our Java forum is the place for Q&A-style discussions related to this popular OOP-based language. Note there is also a JSP forum within our Web Development category.]]></description>
		<language>en-US</language>
		<lastBuildDate>Sat, 07 Nov 2009 19:45:20 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://www.daniweb.com/alphaimages/misc/rss.jpg</url>
			<title>DaniWeb IT Discussion Community - Java</title>
			<link>http://www.daniweb.com/forums/</link>
		</image>
		<item>
			<title>how to redirect speech received by Skype? //and Skype vs Fring</title>
			<link>http://www.daniweb.com/forums/thread236850.html</link>
			<pubDate>Sat, 07 Nov 2009 19:33:56 GMT</pubDate>
			<description><![CDATA[Hello :-)! 
 
I'd like to create application for mobile phone (maximum price of phone would be about 220USD, it is for Central Europe; I will be testing the application on Sony Ericsson k750i and maybe on Motorola V500). The application must recognize speech and properly react for recognized...]]></description>
			<content:encoded><![CDATA[<div>Hello :-)!<br />
<br />
I'd like to create application for mobile phone (maximum price of phone would be about 220USD, it is for Central Europe; I will be testing the application on Sony Ericsson k750i and maybe on Motorola V500). The application must recognize speech and properly react for recognized numbers (calculate control sum and respond). I'd like to use CMU Sphinx, but I still need to decide whether it would be [1] or [2]. Solution [1] is as follows: speech recognition on mobile phone (PocketSpinx) and sending results to server (post, httpconnection; I also tried Wireless Messaging API but it didn't work properly). Aprroach no. [2]: redirecting of speech from mobile phone to server (I thought about Digium + Asterisk but Digium cards are rather expensive) and speech recognition on server (Sphinx4).<br />
<br />
I think I will choose the [2]-nd option, however I thought about different way of connecting to internet, because those Digium cards are expensive. I thought about GSM/3G or CDMA but I'm not sure whether those would be good enough to ensure real time speech between user on mobile phone and program on server.<br />
<br />
Somebody suggested me that mobile phone with Skype would be cheap and good option. I will be using this application in the place where they've got office with access to cable internet and fax, and mobile phone would be several kilometers from the office. From my point of view, creating wireless network with some kilometers of range would be too expensive and there may be too many distortions of signal. And here I've got question for you. Let's assume I've got mobile phone. On this phone I installed Skype and the phone has access to internet (GSM/3G or CDMA). I also have got Skype and Sphinx4 on server. How should I configure it so that Skype on server can automatically receive the call from mobile phone and redirect it to Sphinx4, and server can answer from time to time to Skype? In other words: a) how to allow Skype to receive automatically call from mobile phone?, b) how to redirect speech from Skype to other application? (I also thought about Fring, which may be alternative for Skype).<br />
<br />
Thanks very much for your answer in advance :-)!<br />
Greetings :-)!</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>johnyjj2</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236850.html</guid>
		</item>
		<item>
			<title>problem with date class</title>
			<link>http://www.daniweb.com/forums/thread236842.html</link>
			<pubDate>Sat, 07 Nov 2009 18:51:13 GMT</pubDate>
			<description>please if someone can help me i have probleams in the constructor of the class, how can i pass parameters to date constructor.....</description>
			<content:encoded><![CDATA[<div>please if someone can help me i have probleams in the constructor of the class, how can i pass parameters to date constructor.....</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>jaque322</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236842.html</guid>
		</item>
		<item>
			<title>Threads in an instant messaging program</title>
			<link>http://www.daniweb.com/forums/thread236838.html</link>
			<pubDate>Sat, 07 Nov 2009 18:42:08 GMT</pubDate>
			<description><![CDATA[I'm trying to write an instant messaging program in Java. What I have coded so far, goes like this: Each client connects to a thread created by the server, to which he/she sends the message. My doubt is, how can I kill all the threads that have been created by the main program when the...]]></description>
			<content:encoded><![CDATA[<div>I'm trying to write an instant messaging program in Java. What I have coded so far, goes like this: Each client connects to a thread created by the server, to which he/she sends the message. My doubt is, how can I kill all the threads that have been created by the main program when the administrator presses de 'q' in the keyboard. I made a class for a thread whose only function is to read the 'q' from the keyboard, but, how can I notify to the main program  that it must kill all the threads?<br />
<br />
This is the Server (it is not complete):<br />
 <pre style="margin:20px; line-height:13px">public class Server {<br />
&nbsp; &nbsp; public static void main(String[] args) throws IOException {<br />
&nbsp; &nbsp; &nbsp; &nbsp; ServerSocket serverSocket = null;<br />
&nbsp; &nbsp; &nbsp; &nbsp; boolean listening = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; new StdinReaderThread();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; try {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; serverSocket = new ServerSocket(4444);<br />
&nbsp; &nbsp; &nbsp; &nbsp; } catch (IOException e) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.err.println(&quot;Could not create socket&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.exit(-1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; while (listening){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; new ServerThread(serverSocket.accept()).start();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; serverSocket.close();<br />
&nbsp; &nbsp; }<br />
}</pre><br />
This is the thread which reads 'q' from keyboard:<br />
<br />
 <pre style="margin:20px; line-height:13px">public class StdinReaderThread implements Runnable{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; BufferedReader stdin;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public StdinReaderThread(){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Thread subpr = new Thread(this,&quot;x&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stdin = new BufferedReader( new InputStreamReader(System.in));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; subpr.start();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void run(){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while (true){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  try{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String stdinline = stdin.readLine();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if( stdinline.startsWith(&quot;q&quot;)){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;end&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if( stdinline.startsWith(&quot;m&quot;))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;send message&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if( stdinline.startsWith(&quot;l&quot;))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;send login&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if( stdinline.startsWith(&quot;u&quot;))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;list users&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } catch (Exception e){}<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>eleal</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236838.html</guid>
		</item>
		<item>
			<title>Code Snippet Bacteria Growth</title>
			<link>http://www.daniweb.com/code/snippet236834.html</link>
			<pubDate>Sat, 07 Nov 2009 18:24:50 GMT</pubDate>
			<description>Having trouble with this one: 
 
The formula y = nekt  can be used for estimating growth where 
 
n is the initial amount 
k is a constant 
t is the time 
y is the final amount 
 
This formula will be used for estimating the bacteria growth in a lab experiment. The output should look similar to:</description>
			<content:encoded><![CDATA[<div>Having trouble with this one:<br />
<br />
The formula y = nekt  can be used for estimating growth where<br />
<br />
n is the initial amount<br />
k is a constant<br />
t is the time<br />
y is the final amount<br />
<br />
This formula will be used for estimating the bacteria growth in a lab experiment. The output should look similar to:<br />
<br />
Enter intial bacteria amount:<br />
5.0<br />
Enter a constant value for k:<br />
0.8<br />
<br />
Time(hours)     Bacteria<br />
<br />
1                      11.13<br />
2                      24.77<br />
3                      55.12<br />
4                    122.66<br />
5                    272.99<br />
6                    607.55<br />
7                  1352.13<br />
8                  3009.23<br />
<br />
<br />
In the class Mymath , write two different methods:<br />
<br />
a. Prompts the user initial bacteria and the constant k in the method.<br />
<br />
b. Get the user initial bacteria and the constant k from the main method.<br />
<br />
Write a main method to test the two methods above.<br />
<br />
My coding:</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>kulrik</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236834.html</guid>
		</item>
		<item>
			<title>mean and standard deviation confused</title>
			<link>http://www.daniweb.com/forums/thread236833.html</link>
			<pubDate>Sat, 07 Nov 2009 18:17:54 GMT</pubDate>
			<description>I am really confused by this problem. PLEASE HELP 
 
Write a program that reads a set of floating point data values from the input. When the user indicates the end of the input, print out  the count if the values, the average, and the standard deviation. The average of a data set is x1,......,xn is...</description>
			<content:encoded><![CDATA[<div>I am really confused by this problem. PLEASE HELP<br />
<br />
Write a program that reads a set of floating point data values from the input. When the user indicates the end of the input, print out  the count if the values, the average, and the standard deviation. The average of a data set is x1,......,xn is <br />
<br />
t = Σxi/n<br />
<br />
where Σx1 = x1+...+xn is the sum of the input values. The standard deviation is:<br />
<br />
s=Math.sqrt(Σxi^2 - (1/n)*(Σxi)^2/n-1)<br />
<br />
my professor asks me to Create a method in the class Mymath to print out the count of values, the average, and the standard deviation. Use the numerically less stable formula to find the standard deviation.<br />
<br />
and this is what the output should be:<br />
<br />
1<br />
2<br />
3<br />
4<br />
5<br />
6<br />
-1<br />
<br />
Count of values: 6<br />
Average: 3.50<br />
Standard Deviation: 1.87</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>kulrik</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236833.html</guid>
		</item>
		<item>
			<title>Threads en servidor de mensajes instantáneos.</title>
			<link>http://www.daniweb.com/forums/thread236798.html</link>
			<pubDate>Sat, 07 Nov 2009 15:07:53 GMT</pubDate>
			<description>Hola a todos, 
 
Estoy tratando de escribir un servidor de mensajería entre clientes, en Java. El problema que tengo es cuando quiero terminar el servidor. El servidor que he pensado funciona así: Cada cliente se conecta a un hilo que crea el servidor y allí envía los mensajes. El problema está en...</description>
			<content:encoded><![CDATA[<div>Hola a todos,<br />
<br />
Estoy tratando de escribir un servidor de mensajería entre clientes, en Java. El problema que tengo es cuando quiero terminar el servidor. El servidor que he pensado funciona así: Cada cliente se conecta a un hilo que crea el servidor y allí envía los mensajes. El problema está en cómo hacer que cuando administrador del servidor desee terminar el programa (presionando 'q' en el teclado), éste acabe con todos los hilos que ha creado y cierre. Para ello había pensado lo siguiente: Que el programa servidor prinicipal, antes de crear cualquier thread para atender a los usuarios, cree un hilo especial dedicado a leer de la entrada por teclado, pero ¿cómo le avisa éste al proceso principal que debe terminar y que por tanto el proceso principal debe decir a todos los demás hilos que ha creado que terminen?<br />
<br />
El código que llevo es:<br />
<br />
Servidor:<br />
 <pre style="margin:20px; line-height:13px">public class Servidor {<br />
&nbsp; &nbsp; public static void main(String[] args) throws IOException {<br />
&nbsp; &nbsp; &nbsp; &nbsp; ServerSocket serverSocket = null;<br />
&nbsp; &nbsp; &nbsp; &nbsp; boolean listening = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; new StdinReaderThread();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; try {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; serverSocket = new ServerSocket(4444);<br />
&nbsp; &nbsp; &nbsp; &nbsp; } catch (IOException e) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.err.println(&quot;No pudo crearse el socket&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.exit(-1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; while (listening){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; new HiloServidor(serverSocket.accept()).start();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; serverSocket.close();<br />
&nbsp; &nbsp; }<br />
}</pre><br />
y el hilo que lee del teclado:<br />
 <pre style="margin:20px; line-height:13px">public class StdinReaderThread implements Runnable{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; BufferedReader stdin;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public StdinReaderThread(){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Thread subpr = new Thread(this,&quot;x&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stdin = new BufferedReader( new InputStreamReader(System.in));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; subpr.start();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void run(){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while (true){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  try{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String stdinline = stdin.readLine();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if( stdinline.startsWith(&quot;q&quot;)){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;salir&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if( stdinline.startsWith(&quot;m&quot;))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;enviar mensaje&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if( stdinline.startsWith(&quot;l&quot;))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;enviar login&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if( stdinline.startsWith(&quot;u&quot;))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;lista usuarios&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } catch (Exception e){}<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}</pre><br />
Saludos,</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>eleal</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236798.html</guid>
		</item>
		<item>
			<title>Help with Assignment</title>
			<link>http://www.daniweb.com/forums/thread236790.html</link>
			<pubDate>Sat, 07 Nov 2009 13:41:14 GMT</pubDate>
			<description>Hi,  
 
I ap posting my Assignment subject here, and hope to get some helps with each Classes, I am not asking that you do all my home works but to give me hints as I want to learn something and as  I am new to Java I am block some times. 
 
this is the Subject...</description>
			<content:encoded><![CDATA[<div>Hi, <br />
<br />
I ap posting my Assignment subject here, and hope to get some helps with each Classes, I am not asking that you do all my home works but to give me hints as I want to learn something and as  I am new to Java I am block some times.<br />
<br />
this is the Subject<br />
****************************************************<br />
The program allows customers to list the videos available and to borrow them (ignore returning videos). It<br />
records whether a video is on the shelf or on loan, and if it is on loan, the date it is due to be returned.<br />
Customers can borrow up to two videos for 3 days. Build the program according to the following recipe:<br />
1. There should be classes describing customers and videos and also a class called VideoStore that<br />
contains ArrayLists of customers and videos. There should also be a small public class VideoTest<br />
that contains the main() method.<br />
<br />
2. The Video class has instance fields for the video title, whether it is on loan and the date it is due to be<br />
returned. There are get and set methods for some of these fields and a toString() method.<br />
<br />
3. The Customer class has instance fields for the customer name and for the number of videos he is<br />
borrowing. A method borrowvideo(Video v) checks that the video is available and that the<br />
customer is not borrowing more than 2 videos, it then sets the duedate and onloan fields in the Video<br />
class. The due date is printed on screen. There is a get method for the customer name.<br />
<br />
4. The constructor for the VideoStore class initialises a small number (less than 10) of Customer and<br />
Video objects and stores them in two separate ArrayLists that are the instance fields for the class. It<br />
provides a method (listallvideos()) for listing all the videos in the store and a method called<br />
borrow(String,String) described below.<br />
<br />
5. The main method in VideoTest creates a VideoStore, then enters a loop that implements a menu:<br />
&quot;Menu: L-List, B-Borrow, Q-Quit&quot;. A Scanner picks up the letter entered and causes the desired<br />
response. List, lists the titles of all the videos along with whether they are on the shelf or the due date<br />
if they are on loan. Quit, drops out of the loop and exits the application. Borrow, asks first the<br />
Customer's name, and then the title of the video he wishes to borrow and picks up responses with a<br />
Scanner. These are then passed to the VideoStore borrow method as borrow(name,title).<br />
<br />
6. The VideoStore borrow method checks that the name and title match entries in the VideoStore arrays,<br />
and identifies the Customer and Video objects they correspond to. The Customer<br />
borrowvideo(Video v) method can then be called.<br />
<br />
*****************************************************<br />
<br />
this is my VideoTest Class<br />
*****************************************************<br />
<br />
/*<br />
 * To change this template, choose Tools | Templates<br />
 * and open the template in the editor.<br />
 */<br />
<br />
package assignement;<br />
import java.util.*;<br />
/**<br />
 *<br />
 * @author Harris<br />
 */<br />
public class VideotTest {<br />
<br />
    public static void main(String[] args)<br />
   {<br />
           VideoStore vs = new VideoStore();<br />
<br />
	   Scanner sc = new Scanner(System.in);<br />
	   String menuResponse;<br />
       do<br />
	   {<br />
          <br />
		   System.out.println(&quot;Menu: L-list, B-borrow, Q-quit&quot;);<br />
		   menuResponse = sc.nextLine();<br />
<br />
	       if(menuResponse.equals(&quot;L&quot;))<br />
		       vs.listallvideos();<br />
	       else if (menuResponse.equals(&quot;B&quot;))<br />
		   {<br />
			   System.out.println(&quot;What is your name?&quot;);<br />
			   String nameResponse = sc.nextLine();<br />
                          <br />
                     	   System.out.println(&quot;What is the title of the video you want to borrow?&quot;);<br />
			   String videoResponse = sc.nextLine();<br />
		      // vs.borrow(nameResponse,videoResponse);<br />
		   }<br />
	   } while(!menuResponse.equalsIgnoreCase(&quot;Q&quot;));<br />
   }<br />
}<br />
<br />
*****************************************************<br />
this is my VideoStore Class<br />
*****************************************************<br />
/*<br />
 * To change this template, choose Tools | Templates<br />
 * and open the template in the editor.<br />
 */<br />
<br />
package assignement;<br />
import java.util.*;<br />
/**<br />
 *<br />
 * @author Harris<br />
 */<br />
public class VideoStore {<br />
<br />
    private String VideoName;<br />
    private String CustomersName;<br />
    private ArrayList&lt;String&gt; Videos = new ArrayList&lt;String&gt;();<br />
    private ArrayList&lt;String&gt; CustomersListe = new ArrayList&lt;String&gt;();<br />
  <br />
<br />
    public VideoStore(){<br />
        VideoName = null;<br />
        CustomersName = null;<br />
        <br />
<br />
    }<br />
<br />
<br />
    public VideoStore(String VidName, String CustName){<br />
<br />
        VideoName = VidName;<br />
        CustName = CustomersName;<br />
       <br />
<br />
        Videos.add(&quot;Brave Heart&quot;);<br />
        Videos.add(&quot;Troy&quot;);<br />
        Videos.add(&quot;Shakspear In Love&quot;);<br />
        Videos.add(&quot;Green Mile&quot;);<br />
        Videos.add(&quot;Ice Age&quot;);<br />
<br />
        CustomersListe.add(&quot;Harris&quot;);<br />
        CustomersListe.add(&quot;John&quot;);<br />
        CustomersListe.add(&quot;Ricky&quot;);<br />
        CustomersListe.add(&quot;Mike&quot;);<br />
        CustomersListe.add(&quot;Robin&quot;);<br />
    }<br />
<br />
    public String getVideoName(){<br />
        return VideoName;<br />
    }<br />
    public String getCustomersName(){<br />
        return CustomersName;<br />
    }<br />
<br />
<br />
<br />
    public void listallvideos(){<br />
       <br />
        for (int i = 0; i &lt; Videos.size(); i++)<br />
        System.out.println(Videos.get(i));<br />
    }<br />
<br />
}<br />
<br />
***********************************************<br />
<br />
the problem which I get is when I run VideoTest which is my main class by chosing L it dosnt not list my Videos list which is an Array list it goes back to the menu.<br />
Anyone Can Help?<br />
<br />
Thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>Harris68</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236790.html</guid>
		</item>
		<item>
			<title><![CDATA[Phone Emulator Doesn't Appear]]></title>
			<link>http://www.daniweb.com/forums/thread236769.html</link>
			<pubDate>Sat, 07 Nov 2009 12:08:35 GMT</pubDate>
			<description><![CDATA[Hi, i'm working with Netbeans IDE 6.7.1 on Vista Home Premium. I have run my program with no errors, but the phone won't show up. I have turned off my firewall and even tried reinstalling Netbeans with no success. Thx in advance! :icon_smile:]]></description>
			<content:encoded><![CDATA[<div>Hi, i'm working with Netbeans IDE 6.7.1 on Vista Home Premium. I have run my program with no errors, but the phone won't show up. I have turned off my firewall and even tried reinstalling Netbeans with no success. Thx in advance! :icon_smile:</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>ITfav</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236769.html</guid>
		</item>
		<item>
			<title>Help with Code</title>
			<link>http://www.daniweb.com/forums/thread236724.html</link>
			<pubDate>Sat, 07 Nov 2009 07:45:37 GMT</pubDate>
			<description><![CDATA[Hello, 
 
I am an online student in an intro to Java programming course and am a little stuck on my current program. The program is supposed to prompt for the name of files until the user enters "stop" to quit and includes the following methods in addition to the main method: 
 
1. countLines(),...]]></description>
			<content:encoded><![CDATA[<div>Hello,<br />
<br />
I am an online student in an intro to Java programming course and am a little stuck on my current program. The program is supposed to prompt for the name of files until the user enters &quot;stop&quot; to quit and includes the following methods in addition to the main method:<br />
<br />
1. countLines(), which takes a File object, and returns the number of lines of text in the file<br />
<br />
2. countLettersInLines(), which takes a File object, and returns an array of integers. In this array of integers, the first entry is the number of letters in the first line of the file, the second entry is the number of letters in the second line of the file, etc.<br />
<br />
3. countLetters(), which takes a File object, and returns the number of letters in the file<br />
<br />
4. countOneLetter() takes a File object and a letter, and returns the number of occurrences of the specified letter in the file (in uppercase or lowercase). This method and countLetters() can be used to determine the frequency of each letter in a text file.<br />
<br />
5. countAllLetters() takes a File object, and returns an array of 26 integers, such that the entries in the array contain the number of occurrences of each letter of the alphabet in the file, disregarding case. The first entry in the array will be the number of a's in the file (regardless of case), the second entry is the number of b's (regardless of case), and so on. This method should use countOneLetter().<br />
<br />
6. countIntegers() takes a File object, and returns the number of integers in the file<br />
<br />
An example to this program would be:<br />
Please enter the file name, or &quot;stop&quot; to end: short.txt<br />
<br />
Number of lines: 2<br />
Line with maximum number of letters: 1<br />
Line 1: 13 letters<br />
Line 2: 5 letters<br />
<br />
Number of letters: 18<br />
Frequency of a: 5.555555555555555<br />
Frequency of b: 0.0<br />
Frequency of c: 0.0<br />
Frequency of d: 0.0<br />
Frequency of e: 16.666666666666668<br />
Frequency of f: 0.0<br />
Frequency of g: 0.0<br />
Frequency of h: 5.555555555555555<br />
Frequency of i: 11.11111111111111<br />
Frequency of j: 0.0<br />
Frequency of k: 0.0<br />
Frequency of l: 16.666666666666668<br />
Frequency of m: 11.11111111111111<br />
Frequency of n: 5.555555555555555<br />
Frequency of o: 5.555555555555555<br />
Frequency of q: 0.0<br />
Frequency of r: 0.0<br />
Frequency of s: 11.11111111111111<br />
Frequency of t: 0.0<br />
Frequency of u: 0.0<br />
Frequency of v: 5.555555555555555<br />
Frequency of w: 0.0<br />
Frequency of x: 0.0<br />
Frequency of y: 5.555555555555555<br />
Frequency of z: 0.0<br />
<br />
Integers in the file: 2<br />
<br />
Please enter the file name, or &quot;stop&quot; to end: stop<br />
<br />
<br />
Thank you any help will be much appreciated.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>hedwards09</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236724.html</guid>
		</item>
		<item>
			<title>Help with Code</title>
			<link>http://www.daniweb.com/forums/thread236723.html</link>
			<pubDate>Sat, 07 Nov 2009 07:26:58 GMT</pubDate>
			<description><![CDATA[Hello, 
 
I am an online student in an intro to Java programming course and am a little stuck on my current program.  The program is supposed to prompt for the name of files until the user enters "stop" to quit and includes the following methods in addition to the main method: 
 
1. countLines(),...]]></description>
			<content:encoded><![CDATA[<div>Hello,<br />
<br />
I am an online student in an intro to Java programming course and am a little stuck on my current program.  The program is supposed to prompt for the name of files until the user enters &quot;stop&quot; to quit and includes the following methods in addition to the main method:<br />
<br />
1. countLines(), which takes a File object, and returns the number of lines of text in the file<br />
<br />
2. countLettersInLines(), which takes a File object, and returns an array of integers. In this array of integers, the first entry is the number of letters in the first line of the file, the second entry is the number of letters in the second line of the file, etc.<br />
<br />
3. countLetters(), which takes a File object, and returns the number of letters in the file<br />
<br />
4. countOneLetter() takes a File object and a letter, and returns the number of occurrences of the specified letter in the file (in uppercase or lowercase). This method and countLetters() can be used to determine the frequency of each letter in a text file.<br />
<br />
5.  countAllLetters() takes a File object, and returns an array of 26 integers, such that the entries in the array contain the number of occurrences of each letter of the alphabet in the file, disregarding case. The first entry in the array will be the number of a's in the file (regardless of case), the second entry is the number of b's (regardless of case), and so on. This method should use countOneLetter().<br />
<br />
6. countIntegers() takes a File object, and returns the number of integers in the file<br />
<br />
An example to this program would be:<br />
Please enter the file name, or &quot;stop&quot; to end: short.txt<br />
<br />
Number of lines: 2<br />
    Line with maximum number of letters: 1<br />
    Line 1: 13 letters<br />
    Line 2: 5 letters<br />
<br />
Number of letters: 18<br />
    Frequency of a: 5.555555555555555<br />
    Frequency of b: 0.0<br />
    Frequency of c: 0.0<br />
    Frequency of d: 0.0<br />
    Frequency of e: 16.666666666666668<br />
    Frequency of f: 0.0<br />
    Frequency of g: 0.0<br />
    Frequency of h: 5.555555555555555<br />
    Frequency of i: 11.11111111111111<br />
    Frequency of j: 0.0<br />
    Frequency of k: 0.0<br />
    Frequency of l: 16.666666666666668<br />
    Frequency of m: 11.11111111111111<br />
    Frequency of n: 5.555555555555555<br />
    Frequency of o: 5.555555555555555<br />
    Frequency of q: 0.0<br />
    Frequency of r: 0.0<br />
    Frequency of s: 11.11111111111111<br />
    Frequency of t: 0.0<br />
    Frequency of u: 0.0<br />
    Frequency of v: 5.555555555555555<br />
    Frequency of w: 0.0<br />
    Frequency of x: 0.0<br />
    Frequency of y: 5.555555555555555<br />
    Frequency of z: 0.0<br />
<br />
Integers in the file: 2<br />
<br />
Please enter the file name, or &quot;stop&quot; to end: stop<br />
<br />
<br />
Thank you any help will be much appreciated.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>hedwards09</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236723.html</guid>
		</item>
		<item>
			<title>Blank JFrame</title>
			<link>http://www.daniweb.com/forums/thread236704.html</link>
			<pubDate>Sat, 07 Nov 2009 04:38:58 GMT</pubDate>
			<description><![CDATA[Hi guys, 
The following program works the way I want it to but there's one small problem; when it loads, it doesn't give a blank frame. It want it to show the output after I click on the blank area. Help me please. 
  <div class="codeblock"> <div class="spaced"> <div style="float:right;...]]></description>
			<content:encoded><![CDATA[<div>Hi guys,<br />
The following program works the way I want it to but there's one small problem; when it loads, it doesn't give a blank frame. It want it to show the output after I click on the blank area. Help me please.<br />
 <pre style="margin:20px; line-height:13px">import java.awt.*;<br />
import javax.swing.*;<br />
import java.awt.event.MouseAdapter;<br />
import java.awt.event.MouseEvent;<br />
<br />
public class TrackMouseMovementTest{<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; public static void main(String[] args){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; EventQueue.invokeLater(new Runnable(){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void run(){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MouseFrame frame = new MouseFrame();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; frame.setVisible(true);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; });<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}<br />
<br />
class MouseFrame extends JFrame<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; public MouseFrame(){<br />
&nbsp; &nbsp; &nbsp; &nbsp; setTitle(&quot;Mouse Movement Tracker&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; MouseComponent component = new MouseComponent();<br />
&nbsp; &nbsp; &nbsp; &nbsp; add(component);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; public static final int DEFAULT_WIDTH = 500;<br />
&nbsp; &nbsp; &nbsp; &nbsp; public static final int DEFAULT_HEIGHT = 500;<br />
}<br />
<br />
class MouseComponent extends JComponent{<br />
&nbsp; &nbsp; &nbsp; &nbsp; public MouseComponent(){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; addMouseListener(new MouseHandler());<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; private class MouseHandler extends MouseAdapter{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void mousePressed(MouseEvent event){&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; x = event.getX();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; y = event.getY();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; repaint();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void paintComponent(Graphics g){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; g.drawString(&quot;X: &quot; + x + &quot;,Y: &quot; + y + &quot;&quot;,x,y);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; g.drawString(&quot;Click #: &quot; + counter ++ ,x , y + 16);<br />
&nbsp; &nbsp; } <br />
&nbsp; &nbsp; &nbsp; &nbsp; int x;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int y;&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; private static int counter=-1;<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>babylonlion</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236704.html</guid>
		</item>
		<item>
			<title>Is calling Win32 API from Java possible??</title>
			<link>http://www.daniweb.com/forums/thread236683.html</link>
			<pubDate>Sat, 07 Nov 2009 02:32:04 GMT</pubDate>
			<description><![CDATA[Is there any other way besides Jawin to call Win32 API methods from within Java? I have the option of using C++ as im going to be using the API a fair amount however i'm also doing GUI stuff and i would prefer the Java GUI features over C++. 
 
If i can find a way to call the windows API from Java...]]></description>
			<content:encoded><![CDATA[<div>Is there any other way besides Jawin to call Win32 API methods from within Java? I have the option of using C++ as im going to be using the API a fair amount however i'm also doing GUI stuff and i would prefer the Java GUI features over C++.<br />
<br />
If i can find a way to call the windows API from Java then i can stick to Java.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>futureaussiecto</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236683.html</guid>
		</item>
		<item>
			<title>Unable to expand window</title>
			<link>http://www.daniweb.com/forums/thread236660.html</link>
			<pubDate>Fri, 06 Nov 2009 23:22:41 GMT</pubDate>
			<description>I have a GUI window with a JFrame. On this JFrame, I have a JPanel that completely covers the JFrame. I then have another JPanel within this first JPanel that contains a text box and 3 buttons.  Within an event handler, I want to expand the JFrame and 2 JPanels by a height of 20 px. I then want to ...</description>
			<content:encoded><![CDATA[<div>I have a GUI window with a JFrame. On this JFrame, I have a JPanel that completely covers the JFrame. I then have another JPanel within this first JPanel that contains a text box and 3 buttons.  Within an event handler, I want to expand the JFrame and 2 JPanels by a height of 20 px. I then want to  move down the text box and 3 buttons, 20 px.<br />
<br />
I can expand the JFrame and the first JPanel with the following code snip. But, it doesn't work on the second panel nor does it work to move the button  down.<br />
<br />
Appreciate your help. Thanks..<br />
<br />
 <pre style="margin:20px; line-height:13px">// Make room for an additional text box<br />
&nbsp; &nbsp; &nbsp; &nbsp; int heightInc = 20;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; Dimension frameSize = new Dimension();<br />
&nbsp; &nbsp; &nbsp; &nbsp; Rectangle rectangle = new Rectangle();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; //&nbsp; Adjust JFrame size (This Works)<br />
&nbsp; &nbsp; &nbsp; &nbsp; frameSize = this.getSize();<br />
&nbsp; &nbsp; &nbsp; &nbsp; frameSize.height += heightInc;<br />
&nbsp; &nbsp; &nbsp; &nbsp; this.setSize(frameSize);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; //&nbsp; Adjust the bounding JPanel size (This Works)<br />
&nbsp; &nbsp; &nbsp; &nbsp; frameSize = jplFrame.getSize();<br />
&nbsp; &nbsp; &nbsp; &nbsp; frameSize.height += heightInc;<br />
&nbsp; &nbsp; &nbsp; &nbsp; jplFrame.setPreferredSize(frameSize);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; //&nbsp; Adjust the AddSubtitle JPanel size&nbsp; (This doesn't work)<br />
&nbsp; &nbsp; &nbsp; &nbsp; frameSize = jplAddSubtitle.getSize();<br />
&nbsp; &nbsp; &nbsp; &nbsp; frameSize.height += heightInc;<br />
&nbsp; &nbsp; &nbsp; &nbsp; jplAddSubtitle.setPreferredSize(frameSize);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; //&nbsp; Move the &quot;Add Another&quot; button down (This doesn't work)<br />
&nbsp; &nbsp; &nbsp; &nbsp; rectangle = btnAddAnother.getBounds();<br />
&nbsp; &nbsp; &nbsp; &nbsp; rectangle.y += heightInc;<br />
&nbsp; &nbsp; &nbsp; &nbsp; btnAddAnother.setBounds(rectangle);</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>bruceaj</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236660.html</guid>
		</item>
		<item>
			<title>Incompatible types found (HELP!)</title>
			<link>http://www.daniweb.com/forums/thread236649.html</link>
			<pubDate>Fri, 06 Nov 2009 21:52:29 GMT</pubDate>
			<description><![CDATA[<div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox" title="Help with Code Tags" target="_blank">Help with Code Tags</a> </div> <div> <strong>Java Syntax</strong> (<a...]]></description>
			<content:encoded><![CDATA[<div> <pre style="margin:20px; line-height:13px">/*<br />
&nbsp;* CensusCalculator.java<br />
&nbsp;* <br />
&nbsp;* Computer Science 111, Boston University<br />
&nbsp;*<br />
&nbsp;* This program performs various computations on census data stored in a text file.<br />
&nbsp;* It uses arrays in several ways, including for storage of the results of<br />
&nbsp;* the computations.<br />
&nbsp;* <br />
&nbsp;* modified by: [Daniel Sutton (dan13@bu.edu)]<br />
&nbsp;*&nbsp; &nbsp; &nbsp; &nbsp; date: 11/4/09<br />
&nbsp;*/<br />
<br />
import java.util.*;<br />
import java.io.*;<br />
<br />
<br />
public class CensusCalculator {<br />
&nbsp;  <br />
&nbsp;  public static final String DATA_FILE_NAME = &quot;census.txt&quot;;<br />
&nbsp;  <br />
&nbsp;  /* The number of population counts for each county.<br />
&nbsp; &nbsp; * Changing the value of this constant should be all that is needed<br />
&nbsp; &nbsp; * to allow your program to handle a data file with a different<br />
&nbsp; &nbsp; * number of counts.<br />
&nbsp; &nbsp; */<br />
&nbsp;  public static final int NUM_POPULATION_COUNTS = 2;&nbsp; &nbsp; <br />
&nbsp;  <br />
&nbsp;  /* A class-constant array of Strings containing the names of the states<br />
&nbsp; &nbsp; * in the data file.<br />
&nbsp; &nbsp; * <br />
&nbsp; &nbsp; * The index of a given state name in the array is the<br />
&nbsp; &nbsp; * same as the numeric code of the state in the data file.<br />
&nbsp; &nbsp; * For example, Alaska has a state code of 1 in the data file, <br />
&nbsp; &nbsp; * so its name is at position 1 in this array.<br />
&nbsp; &nbsp; */<br />
&nbsp;  public static final String[] STATE_NAMES = {&quot;Alabama&quot;, &quot;Alaska&quot;,<br />
&nbsp; &nbsp; &nbsp; &quot;Arizona&quot;, &quot;Arkansas&quot;, &quot;California&quot;, &quot;Colorado&quot;, &quot;Connecticut&quot;,<br />
&nbsp; &nbsp; &nbsp; &quot;Delaware&quot;, &quot;Florida&quot;, &quot;Georgia&quot;, &quot;Hawaii&quot;, &quot;Idaho&quot;, &quot;Illinois&quot;,<br />
&nbsp; &nbsp; &nbsp; &quot;Indiana&quot;, &quot;Iowa&quot;, &quot;Kansas&quot;, &quot;Kentucky&quot;, &quot;Louisiana&quot;, &quot;Maine&quot;,<br />
&nbsp; &nbsp; &nbsp; &quot;Maryland&quot;, &quot;Massachusetts&quot;, &quot;Michigan&quot;, &quot;Minnesota&quot;,<br />
&nbsp; &nbsp; &nbsp; &quot;Mississippi&quot;, &quot;Missouri&quot;, &quot;Montana&quot;, &quot;Nebraska&quot;, &quot;Nevada&quot;,<br />
&nbsp; &nbsp; &nbsp; &quot;New Hampshire&quot;, &quot;New Jersey&quot;, &quot;New Mexico&quot;, &quot;New York&quot;,<br />
&nbsp; &nbsp; &nbsp; &quot;North Carolina&quot;, &quot;North Dakota&quot;, &quot;Ohio&quot;, &quot;Oklahoma&quot;, &quot;Oregon&quot;, <br />
&nbsp; &nbsp; &nbsp; &quot;Pennsylvania&quot;, &quot;Rhode Island&quot;, &quot;South Carolina&quot;, &quot;South Dakota&quot;,<br />
&nbsp; &nbsp; &nbsp; &quot;Tennessee&quot;, &quot;Texas&quot;, &quot;Utah&quot;, &quot;Vermont&quot;, &quot;Virginia&quot;, &quot;Washington&quot;,<br />
&nbsp; &nbsp; &nbsp; &quot;West Virginia&quot;, &quot;Wisconsin&quot;, &quot;Wyoming&quot;, &quot;District of Columbia&quot;};<br />
&nbsp;  <br />
&nbsp;  /* <br />
&nbsp; &nbsp; * A class-constant array of Strings containing the names of <br />
&nbsp; &nbsp; * the nine divisions used by the Census Bureau.<br />
&nbsp; &nbsp; * <br />
&nbsp; &nbsp; * The Census Bureau also numbers the divisions, and we have<br />
&nbsp; &nbsp; * used a division's number as its index in this array.<br />
&nbsp; &nbsp; * For example, New England is Division 1, so its name is at<br />
&nbsp; &nbsp; * position 1 in this array.<br />
&nbsp; &nbsp; * <br />
&nbsp; &nbsp; * Note that there is no division 0, so we have put the name<br />
&nbsp; &nbsp; * &quot;none&quot; in position 0 of the array.<br />
&nbsp; &nbsp; */<br />
&nbsp;  public static final String[] DIVISION_NAMES = {<br />
&nbsp; &nbsp; &nbsp; &quot;none&quot;,<br />
&nbsp; &nbsp; &nbsp; &quot;New England (CT,ME,MA,NH,RI,VT)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;, <br />
&nbsp; &nbsp; &nbsp; &quot;Mid-Atlantic (NJ,NY,PA)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;, <br />
&nbsp; &nbsp; &nbsp; &quot;East North Central (IL,IN,MI,OH,WI)&nbsp; &nbsp; &nbsp; &nbsp; &quot;,<br />
&nbsp; &nbsp; &nbsp; &quot;West North Central (IA,KS,MN,MO,NE,ND,SD)&nbsp; &quot;, <br />
&nbsp; &nbsp; &nbsp; &quot;South Atlantic (DE,FL,GA,MD,NC,SC,VA,WV,DC)&quot;, <br />
&nbsp; &nbsp; &nbsp; &quot;East South Central (AL,KY,MS,TN)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &quot;,<br />
&nbsp; &nbsp; &nbsp; &quot;West South Central (AR,LA,OK,TX)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &quot;, <br />
&nbsp; &nbsp; &nbsp; &quot;Mountain (AZ,CO,ID,MT,NV,NM,UT,WY)&nbsp; &nbsp; &nbsp; &nbsp;  &quot;, <br />
&nbsp; &nbsp; &nbsp; &quot;Pacific (AK,CA,HI,OR,WA)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &quot;};&nbsp; <br />
&nbsp;  <br />
&nbsp;  /*<br />
&nbsp; &nbsp; * A class-constant array of integers that allows you to<br />
&nbsp; &nbsp; * determine the number of the division to which each<br />
&nbsp; &nbsp; * state belongs.<br />
&nbsp; &nbsp; * <br />
&nbsp; &nbsp; * For example, Alaska has a state code of 1.<br />
&nbsp; &nbsp; * Element 1 of this array is the integer 9, which indicates<br />
&nbsp; &nbsp; * that Alaska is in division 9 (Pacific).<br />
&nbsp; &nbsp; */<br />
&nbsp;  public static final int[] DIVISION_FOR_STATE = {6, 9,<br />
&nbsp; &nbsp; &nbsp; 8, 7, 9, 8, 1, 5, 5, 5, 9, 8, 3, 3, 4, 4, 6, 7, 1, 5, <br />
&nbsp; &nbsp; &nbsp; 1, 3, 4, 6, 4, 8, 4, 8, 1, 2, 8, 2, 5, 4, 3, 7, 9, 2,<br />
&nbsp; &nbsp; &nbsp; 1, 5, 4, 6, 7, 8, 1, 5, 9, 5, 3, 8, 5};<br />
&nbsp;  <br />
&nbsp;  /*<br />
&nbsp; &nbsp; * printOneDivision - prints the counts for a single division with the<br />
&nbsp; &nbsp; * specified name, old population (oldPop), and new population (newPop).<br />
&nbsp; &nbsp; * It computes the percent change for you. It displays the results so that<br />
&nbsp; &nbsp; * the full list of division results will be lined up in columns, and<br />
&nbsp; &nbsp; * it adds commas and rounds the percents to one place after the decimal.<br />
&nbsp; &nbsp; */<br />
&nbsp;  <br />
&nbsp;  public static void main(String[] args) throws FileNotFoundException {<br />
&nbsp; &nbsp; &nbsp; Scanner console = new Scanner(System.in);<br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; System.out.println(&quot;MENU: &quot;);<br />
&nbsp; &nbsp; &nbsp; System.out.println(&quot;\t1. compute state totals&quot;);<br />
&nbsp; &nbsp; &nbsp; System.out.println(&quot;\t2. compute division totals&quot;);<br />
&nbsp; &nbsp; &nbsp; System.out.println(&quot;\t3. quit&quot;);<br />
&nbsp; &nbsp; &nbsp; System.out.print(&quot;Enter the number of your choice: &quot;);<br />
&nbsp; &nbsp; &nbsp; int choice = console.nextInt();<br />
&nbsp; &nbsp; &nbsp; console.nextLine();<br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; if (choice == 1) {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp;  System.out.print(&quot;state name: &quot;);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  String stateName = console.nextLine();<br />
&nbsp; &nbsp; &nbsp; &nbsp;  getStateCode(stateName);<br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; if (choice == 2) {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; if (choice == 3) {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  boolean end = true;<br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; if (choice &lt; 1 || choice &gt; 3) {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  System.out.println(&quot;Not a valid choice.&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp;  System.out.print(&quot;Enter the number of your choice: &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp;  choice = console.nextInt();<br />
&nbsp; &nbsp; &nbsp; &nbsp;  console.nextLine();<br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp;  }<br />
&nbsp;  public static void printOneDivision(String name, int oldPop, int newPop) {<br />
&nbsp; &nbsp; &nbsp; double percChange = (newPop - oldPop) * 100.0 / oldPop;<br />
&nbsp; &nbsp; &nbsp; System.out.printf(&quot;%43s\t&nbsp; %,d\t&nbsp; %,d\t&nbsp; %4.1f%%\n&quot;, name, oldPop, newPop, percChange);<br />
&nbsp;  }<br />
&nbsp;  <br />
&nbsp;  /*<br />
&nbsp; &nbsp; * getStateCode - finds and returns the state code for<br />
&nbsp; &nbsp; * the specified state name, and -1 if the specified<br />
&nbsp; &nbsp; * state name is not found.<br />
&nbsp; &nbsp; * <br />
&nbsp; &nbsp; * You will complete this method so that it searches <br />
&nbsp; &nbsp; * through the STATE_NAMES array and returns the index<br />
&nbsp; &nbsp; * of stateName in that array, or -1 is stateName<br />
&nbsp; &nbsp; * is not found in that array.<br />
&nbsp; &nbsp; */<br />
&nbsp;  <br />
&nbsp;  public static int getStateCode(String stateName) {<br />
&nbsp; &nbsp; &nbsp; int stateCode = 0;<br />
&nbsp; &nbsp; &nbsp; for (int i = 0; i &lt; STATE_NAMES.length; i++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  if (stateName.equals(STATE_NAMES[i])) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i = stateCode;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; return stateCode;<br />
&nbsp;  }<br />
&nbsp;  <br />
&nbsp;  public static int getStateInfo (int[] stateCode, int[] oldPop, int[] newPop) <br />
&nbsp; &nbsp; &nbsp; throws FileNotFoundException {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp;  Scanner input = new Scanner(new File(DATA_FILE_NAME));&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  input.useDelimiter(&quot;\t|\r\n|\n|\r&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp;  boolean found = false;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  int count=0;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  while (input.hasNextLine()) {<br />
<span style="color:Red">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  stateCode = input.nextInt();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  oldPop = input.nextInt();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  newPop = input.nextInt();</span>&nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:Red"> return stateCode;</span><br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp;  <br />
<br />
&nbsp;  }</pre><br />
When I try to compile this code (I am not finished with it yet) I get 4 error messages that all say incompatible types<br />
found   : int<br />
required: int[]<br />
<br />
directed toward the highlighted lines in the code. I feel like i've tried everything, but nothing is working. Any help would be greatly appreciated!</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>DanieL34749</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236649.html</guid>
		</item>
		<item>
			<title>I really need help,please</title>
			<link>http://www.daniweb.com/forums/thread236641.html</link>
			<pubDate>Fri, 06 Nov 2009 21:18:38 GMT</pubDate>
			<description><![CDATA[heey all ,,  
I'v a question about the pow ,, but when I run the programe it didn't work =S  
I really need help because tomorrow I shloud give it to my teacher,,  
  
     ******************************************** 
import java.lang.Math; 
public class ques3 
{ 
public static void...]]></description>
			<content:encoded><![CDATA[<div>heey all ,, <br />
I'v a question about the pow ,, but when I run the programe it didn't work =S <br />
I really need help because tomorrow I shloud give it to my teacher,, <br />
 <br />
     ********************************************<br />
import java.lang.Math;<br />
public class ques3<br />
{<br />
public static void main(String[]args)<br />
{<br />
static Scanner console =  new Scanner(System.in);<br />
float a,b,c;<br />
System.out.println(&quot;Enter a &quot;);<br />
a=console.nextFloat();<br />
System.out.println(&quot;Enter b &quot;);<br />
b=console.nextFloat();<br />
System.out.println(&quot;Enter c &quot;);<br />
c=console.nextFloat();<br />
sum=Math.Pow((double)b*b-4*a*c,0.5);</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>somewhere</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236641.html</guid>
		</item>
		<item>
			<title>Group with both Jcheckbox and Jbutton</title>
			<link>http://www.daniweb.com/forums/thread236615.html</link>
			<pubDate>Fri, 06 Nov 2009 18:05:51 GMT</pubDate>
			<description>Hi, 
 
I am trying to create a button group which can give me both Jcheckboxes as well as Jbuttons. The problem is that I am creating a button group and not able to fit the checkbox criteria into it. Actually I want to create 2 radiobuttons followed by one checkbox 
 
I mean something like like:- 
...</description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
I am trying to create a button group which can give me both Jcheckboxes as well as Jbuttons. The problem is that I am creating a button group and not able to fit the checkbox criteria into it. Actually I want to create 2 radiobuttons followed by one checkbox<br />
<br />
I mean something like like:-<br />
 <pre style="margin:20px; line-height:13px">No&nbsp; &nbsp; &nbsp;  Buttons<br />
1&nbsp; &nbsp; &nbsp; &nbsp;  jbutton1&nbsp; &nbsp; &nbsp; jbutton2&nbsp;  jcheckbox1&nbsp; &nbsp; <br />
2&nbsp; &nbsp; &nbsp; &nbsp;  jbutton1&nbsp; &nbsp; &nbsp; jbutton2&nbsp;  jcheckbox1&nbsp; &nbsp; <br />
3&nbsp; &nbsp; &nbsp; &nbsp;  jbutton1&nbsp; &nbsp; &nbsp; jbutton2&nbsp;  jcheckbox1</pre><br />
Here is how I am creating my button group:-<br />
<br />
 <pre style="margin:20px; line-height:13px">&nbsp; &nbsp; &nbsp; &nbsp; private JCheckBox[] buttons;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; private JRadioButton noSelectionButton;<br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RadioButtonPanel(String[] str) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setLayout(new BoxLayout(this, BoxLayout.X_AXIS));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; buttons = new JCheckBox[str.length];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ButtonGroup group = new ButtonGroup();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; noSelectionButton = new JRadioButton();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; group.add(noSelectionButton);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int i = 0; i &lt; buttons.length; i++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; buttons[i] = new JCheckBox(str[i]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; buttons[i].setFocusPainted(false);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; add(buttons[i]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; group.add(buttons[i]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre><br />
I was trying to follow this example to fit my requirement but in this case I need to use CheckboxGroup whereas I am using ButtonGroup and since I am filling my buttongroup like this <br />
 <pre style="margin:20px; line-height:13px">group.add(buttons[i])</pre><br />
<br />
It is creating me problems when I declare CheckboxGroup instead of ButtonGroup.<br />
<br />
Here is the example I am talking about :-<br />
<a rel="nofollow" class="t" href="http://www.apl.jhu.edu/~hall/CWP-Chapter13/CWP-Chapter13.5.html" target="_blank">http://www.apl.jhu.edu/~hall/CWP-Cha...apter13.5.html</a><br />
<br />
Here is my full code <br />
 <pre style="margin:20px; line-height:13px">import java.awt.*;<br />
import java.awt.event.*;<br />
import javax.swing.*;<br />
import javax.swing.table.*;<br />
import javax.swing.JRadioButton;<br />
import javax.swing.JButton;<br />
&nbsp;<br />
public class MixedButtons extends javax.swing.JFrame {<br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; public MixedButtons() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; super(&quot;JRadioButtonTable Example&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DefaultTableModel dm = new DefaultTableModel(new Object[][]{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {new String(&quot;one&quot;)},<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {new String(&quot;two&quot;)},<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {new String(&quot;three&quot;)},<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {new String(&quot;four&quot;)},<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {new String(&quot;five&quot;)}},<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; new Object[]{&quot;Question&quot;, &quot;Answer&quot;});<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JTable table = new JTable(dm);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String[] answer = {&quot;A&quot;, &quot;B&quot;, &quot;C&quot;};<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; table.getColumn(&quot;Answer&quot;).setCellRenderer(new RadioButtonRenderer(answer));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; table.getColumn(&quot;Answer&quot;).setCellEditor(new RadioButtonEditor(new RadioButtonPanel(answer)));<br />
&nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setContentPane(new JScrollPane(table));<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; // Cell base<br />
&nbsp; &nbsp; &nbsp; &nbsp; class RadioButtonPanel extends JPanel {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; private JCheckBox[] buttons;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; private JRadioButton noSelectionButton;<br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RadioButtonPanel(String[] str) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setLayout(new BoxLayout(this, BoxLayout.X_AXIS));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; buttons = new JCheckBox[str.length];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ButtonGroup group = new ButtonGroup();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; noSelectionButton = new JRadioButton();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; group.add(noSelectionButton);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int i = 0; i &lt; buttons.length; i++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; buttons[i] = new JCheckBox(str[i]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; buttons[i].setFocusPainted(false);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; add(buttons[i]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; group.add(buttons[i]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void addActionListener(ActionListener anActionListener) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int i = 0; i &lt; buttons.length; i++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; buttons[i].addActionListener(anActionListener);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void removeActionListener(ActionListener anActionListener) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int i = 0; i &lt; buttons.length; i++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; buttons[i].removeActionListener(anActionListener);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void setSelectedIndex(int index) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (index &lt; 0 || index &gt;= buttons.length) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; noSelectionButton.setSelected(true);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int i = 0; i &lt; buttons.length; i++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (i == index) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; buttons[i].setSelected(true);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public int getSelectedIndex() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int i = 0; i &lt; buttons.length; i++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (buttons[i].isSelected()) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return i;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return -1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public JCheckBox[] getButtons() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return buttons;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; class RadioButtonRenderer extends RadioButtonPanel implements TableCellRenderer {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RadioButtonRenderer(String[] strs) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; super(strs);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public Component getTableCellRendererComponent(JTable table,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Object value, boolean isSelected, boolean hasFocus, int row,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int column) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (value instanceof Integer) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setSelectedIndex(((Integer)value).intValue());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return this;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; class RadioButtonEditor extends AbstractCellEditor implements TableCellEditor, ActionListener {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; private RadioButtonPanel theRadioButtonPanel;<br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public RadioButtonEditor(RadioButtonPanel aRadioButtonPanel) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; theRadioButtonPanel = aRadioButtonPanel;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; theRadioButtonPanel.addActionListener(this);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public Component getTableCellEditorComponent(JTable table,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Object value, boolean isSelected, int row, int column) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (value instanceof Integer) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; theRadioButtonPanel.setSelectedIndex(((Integer) value).intValue());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return theRadioButtonPanel;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public Object getCellEditorValue() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return new Integer(theRadioButtonPanel.getSelectedIndex());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void actionPerformed(ActionEvent e) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fireEditingStopped();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; public static void main(String[] args) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MixedButtons frame = new MixedButtons();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; frame.addWindowListener(new WindowAdapter() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void windowClosing(WindowEvent e) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.exit(0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; });<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; frame.setSize(230, 140);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; frame.setVisible(true);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}</pre><br />
Thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>Web_Sailor</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236615.html</guid>
		</item>
		<item>
			<title>Boolean class</title>
			<link>http://www.daniweb.com/forums/thread236609.html</link>
			<pubDate>Fri, 06 Nov 2009 17:10:52 GMT</pubDate>
			<description>Public final static Boolean FALSE=new Boolean(false); 
Public final static Boolean TRUE=new Boolean(true); 
what is the meaning of above two statements?</description>
			<content:encoded><![CDATA[<div>Public final static Boolean FALSE=new Boolean(false);<br />
Public final static Boolean TRUE=new Boolean(true);<br />
what is the meaning of above two statements?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>sridhar123</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236609.html</guid>
		</item>
		<item>
			<title>How to implement a sample saas application</title>
			<link>http://www.daniweb.com/forums/thread236556.html</link>
			<pubDate>Fri, 06 Nov 2009 12:34:42 GMT</pubDate>
			<description>hi friends 
 
I am trying to implement a SAAS based sample application in my final year project. But I do not know where to start and what is needed to build it. 
Kindly if anyone knows about it please help me 
 
Thanks</description>
			<content:encoded><![CDATA[<div>hi friends<br />
<br />
I am trying to implement a SAAS based sample application in my final year project. But I do not know where to start and what is needed to build it.<br />
Kindly if anyone knows about it please help me<br />
<br />
Thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>gshockneo</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236556.html</guid>
		</item>
		<item>
			<title><![CDATA[location of the 'outfile']]></title>
			<link>http://www.daniweb.com/forums/thread236550.html</link>
			<pubDate>Fri, 06 Nov 2009 11:36:02 GMT</pubDate>
			<description><![CDATA[I want to create a data file(.txt) with the data in a mysql table. (of course i did that) 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox" title="Help with...]]></description>
			<content:encoded><![CDATA[<div>I want to create a data file(.txt) with the data in a mysql table. (of course i did that)<br />
<br />
 <pre style="margin:20px; line-height:13px"><br />
&nbsp;try {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Create the statement<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //Export the data<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String filename = &quot;test.xls&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String tablename = &quot;test&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; c.getData(&quot;SELECT * INTO OUTFILE '&quot;+ filename + &quot;' FROM &quot; + tablename);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(filename);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } catch (Exception e) {}</pre>This create the test.xls file in the folder that the java class in.<br />
<br />
I want to make that file created in a specific folder rather than the folder that the java class is in. <br />
<br />
**getdata() method is OK.<br />
<br />
How can I do that?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>jrosh</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236550.html</guid>
		</item>
		<item>
			<title>Voice Over IP (VoIP) Help needed</title>
			<link>http://www.daniweb.com/forums/thread236547.html</link>
			<pubDate>Fri, 06 Nov 2009 11:03:16 GMT</pubDate>
			<description>hi, 
i need to build a VOIP client using Java technology...so do i need to code the server as well or is there any free VOID servers available?please give any suggestions 
 
regards, 
don</description>
			<content:encoded><![CDATA[<div>hi,<br />
i need to build a VOIP client using Java technology...so do i need to code the server as well or is there any free VOID servers available?please give any suggestions<br />
<br />
regards,<br />
don</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>duminda1986</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236547.html</guid>
		</item>
		<item>
			<title>Can Java handle this much data?</title>
			<link>http://www.daniweb.com/forums/thread236520.html</link>
			<pubDate>Fri, 06 Nov 2009 09:21:09 GMT</pubDate>
			<description><![CDATA[To keep things simple I have a spreadsheet that lists x and y values.  I'm not sure how many of these data points there are but 13.5 million is a safe lower bound.  Anyway, I wrote a program to parse this file and plot the points in jfreechart and the program ran out of memory. 
 
I tried messing...]]></description>
			<content:encoded><![CDATA[<div>To keep things simple I have a spreadsheet that lists x and y values.  I'm not sure how many of these data points there are but 13.5 million is a safe lower bound.  Anyway, I wrote a program to parse this file and plot the points in jfreechart and the program ran out of memory.<br />
<br />
I tried messing with the heap size, I have 4GB of RAM so I tried passing -Xms1024m -Xms2048m to java and was told it couldn't allocate that much space, I then halved those values and the program ran, didn't run out of memory, but the chart kind of just showed it's window border and I got that weird effect were the chart moved but didn't erase it's old position when I moved it(basically the program broke).<br />
<br />
I could do all this fine in C so I'm wondering if I should just go back to it.  Another thing is that I'd like to let less computer savvy people use this program and I doubt that they would want to mess with Heap Sizes, or use the command line.  So can I adjust the heap from within the program(set the heap at the start of the main method or let the user set the heap through a dialog box)?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>OffbeatPatriot</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236520.html</guid>
		</item>
		<item>
			<title>Polynomial</title>
			<link>http://www.daniweb.com/forums/thread236501.html</link>
			<pubDate>Fri, 06 Nov 2009 07:21:37 GMT</pubDate>
			<description><![CDATA[Ok, before everyone gets mad at me for not looking around the board for these topics, I have, but they weren't my problem. My problem I am having is calling the Polynomial class. I know how to call classes in a different class, but this is a bit different. I also realize that this is a homework...]]></description>
			<content:encoded><![CDATA[<div>Ok, before everyone gets mad at me for not looking around the board for these topics, I have, but they weren't my problem. My problem I am having is calling the Polynomial class. I know how to call classes in a different class, but this is a bit different. I also realize that this is a homework assignment, and I don't want anyone to do my assignment for me. This is just a step that I am confused about.  In addition, I can't just call the Polynomial class because I need to add two polynomials, then in another case subtract, and the other math-type stuff. <br />
Thank you for looking at my thread, if you helped, thanks a lot, if not, thank you for your time to look. <br />
<br />
This is my driver class, which all it does so far is basically the menu system.<br />
 <pre style="margin:20px; line-height:13px">//Driver<br />
import java.io.*;<br />
import java.util.*;<br />
public class Project6<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; private static Scanner console = new Scanner(System.in);<br />
&nbsp; &nbsp; &nbsp; &nbsp; public static void main(String[] args)<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //3 instances of the class Polynomial<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Polynomial polyAdd = new Polynomial();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Polynomial polySub = new Polynomial();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Polynomial polyMul = new Polynomial();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Call to menu<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; menu();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; public static void menu()<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Decalre Variable to record the user's number entered to navigate menu<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int choice;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String polynomial1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String polynomial2;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Menu print<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;1. Create a Polynomial from the keyboard.&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;2. Add two Polynomials and Display Result.&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;3. Subtract two Polynomials and Display Result.&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;4. Multiply two Polynomials and Display Result.&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;5. Terminate the program&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;&quot;);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Take in choice variable to navigate the menu<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; choice = console.nextInt();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;&quot;);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Switch controlling the menu system<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; switch (choice)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Take in two polynomails<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 1:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Enter the first polynomial.&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; polynomial1 = console.next();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Enter the second polynomial.&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; polynomial2 = console.next();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Add two Polynomials and Display result<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 2:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Subtract two Polynomials and Display result<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 3:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Multiply two Polynomials and Display result<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 4:<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Terminate the program<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 5:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.exit(0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Default<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; default:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; choice = console.nextInt();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; console.nextLine();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; menu();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
}</pre>This is a worker class, and I am trying to call it.<br />
 <pre style="margin:20px; line-height:13px">import java.util.*;<br />
<br />
public class Polynomial extends UnorderedArrayList&lt;Double&gt;<br />
{<br />
&nbsp; &nbsp; &nbsp;  //Default constructor<br />
&nbsp; &nbsp; &nbsp;  //Postcondition: An array of the size 100, and<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  length and maxSize are set to 100<br />
&nbsp; &nbsp; public Polynomial()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  super();<br />
&nbsp; &nbsp; &nbsp; &nbsp;  length = 100;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; //Constructor with a parameter<br />
&nbsp; &nbsp; &nbsp; //Postcondition: An array of the size specified by<br />
&nbsp; &nbsp; &nbsp; //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  the parameter size is created, length<br />
&nbsp; &nbsp; &nbsp; //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  and maxSize are initialized to size<br />
&nbsp; &nbsp; public Polynomial(int size)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  super(size);<br />
&nbsp; &nbsp; &nbsp; &nbsp;  length = size;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp;  //Method to evaluate a polynomial at a given value<br />
&nbsp; &nbsp; &nbsp;  //Postcondition: The polynomial is evaluated at x and<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  the value is returned<br />
&nbsp; &nbsp; public double evaluate(Double x)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; double value = 0.0;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; Double coeff;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; for (int i = 0; i &lt; length; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; coeff = retrieveAt(i);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (coeff != 0.0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  value = value + coeff * Math.pow(x, i);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; return value;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp;  //Method to add two polynomials<br />
&nbsp; &nbsp; &nbsp;  //Postcondition: This polynomial is added with the polynomial<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  specified by the parameter right. A<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  reference of the result is returned.<br />
&nbsp; &nbsp; public Polynomial add(Polynomial right)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; int size = max(length, right.length);<br />
&nbsp; &nbsp; &nbsp; &nbsp; int i;<br />
&nbsp; &nbsp; &nbsp; &nbsp; Double sumCoeff;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; Double coeffP;<br />
&nbsp; &nbsp; &nbsp; &nbsp; Double coeffQ;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; Polynomial temp = new Polynomial(size);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; for (i = 0; i &lt; min(length, right.length); i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; coeffP = retrieveAt(i);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; coeffQ = right.retrieveAt(i);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sumCoeff = coeffP + coeffQ;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp.replaceAt(i, sumCoeff);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (size == length)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (i = min(length, right.length); i &lt; length; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp.replaceAt(i, retrieveAt(i));<br />
&nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (i = min(length, right.length);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i &lt; right.length; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp.replaceAt(i, right.retrieveAt(i));<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; return temp;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp;  //Method to subtract two polynomials<br />
&nbsp; &nbsp; &nbsp;  //Postcondition: The polynomial specified by the<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  parameter right is subtracted from this<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  polynomial. A reference of the result<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  is returned.<br />
&nbsp; &nbsp; public Polynomial subtract(Polynomial right)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; int size = max(length, right.length);<br />
&nbsp; &nbsp; &nbsp; &nbsp; int i;<br />
&nbsp; &nbsp; &nbsp; &nbsp; Double diffCoeff;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; Double coeffP;<br />
&nbsp; &nbsp; &nbsp; &nbsp; Double coeffQ;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; Polynomial temp = new Polynomial(size);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; for (i = 0; i &lt; min(length, right.length); i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; coeffP = retrieveAt(i);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; coeffQ = right.retrieveAt(i);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; diffCoeff = coeffP - coeffQ;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp.replaceAt(i, diffCoeff);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (size == length)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  for (i = min(length, right.length); i &lt; length; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  temp.replaceAt(i, retrieveAt(i));<br />
&nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  for (i = min(length, right.length);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i &lt; right.length; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Double coeff;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  coeff = right.retrieveAt(i);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  coeff = -coeff;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  temp.replaceAt(i, coeff);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; return temp;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp;  //Method to multiply two polynomials<br />
&nbsp; &nbsp; &nbsp;  //Postcondition: This polynomial is multiplied with the<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  polynomial specified by the parameter right.<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  A reference of the result is returned.<br />
&nbsp; &nbsp; public Polynomial multiply(Polynomial right)<br />
&nbsp; &nbsp; {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; Polynomial temp = new Polynomial();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;See Programming Exercise 5 at &quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  + &quot;the end of the chapter.&quot;);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; return temp;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp;  //Method to read the coefficients of a polynomial<br />
&nbsp; &nbsp; public void read()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; Scanner console = new Scanner(System.in);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; Double x;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;The degree of this polynomial is: &quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  + (length - 1));<br />
&nbsp; &nbsp; &nbsp; &nbsp; for (int i = 0; i &lt; length; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.print(&quot;Enter the coefficient of x^&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  + i + &quot;: &quot;);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; x = console.nextDouble();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; replaceAt(i, x);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp;  //Method to return the string containing the polynomial<br />
&nbsp; &nbsp; public String toString()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; int i;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int firstNonzeroCoeff = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; Double coeff = 0.0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; String str = &quot;&quot;;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; for (i = 0; i &lt; length; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; coeff = retrieveAt(i);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (coeff != 0.0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  firstNonzeroCoeff = i;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (firstNonzeroCoeff &lt; length)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if (firstNonzeroCoeff == 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; str = retrieveAt(firstNonzeroCoeff) + &quot; &quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; str = retrieveAt(firstNonzeroCoeff) + &quot;x^&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  + firstNonzeroCoeff + &quot; &quot;;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  for (i = firstNonzeroCoeff + 1; i &lt; length; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  coeff = retrieveAt(i);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if (coeff != 0.0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (coeff &gt; 0.0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  str += &quot;+ &quot; + coeff + &quot;x^&quot; + i + &quot; &quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  str += &quot;- &quot; + (-coeff) + &quot;x^&quot; + i + &quot; &quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; return str;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp;  //Method to determine the smaller of x and y<br />
&nbsp; &nbsp; &nbsp;  //Postcondition: The smaller of x and y is returned<br />
&nbsp; &nbsp; public int min(int x, int y)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (x &lt;= y)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  return x;<br />
&nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  return y;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp;  //Method to determine the larger of x and y<br />
&nbsp; &nbsp; &nbsp;  //Postcondition: The larger of x and y is returned<br />
&nbsp; &nbsp; public int max(int x, int y)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (x &gt;= y)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return x;<br />
&nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return y;<br />
&nbsp; &nbsp; }<br />
}</pre>I included the next class because it was extended in my Polynomial worker class.<br />
 <pre style="margin:20px; line-height:13px">public class UnorderedArrayList&lt;T&gt; extends ArrayListClass&lt;T&gt;<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //Default constructor<br />
&nbsp; &nbsp; public UnorderedArrayList()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; super();<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp;  //Constructor with a parameter<br />
&nbsp; &nbsp; public UnorderedArrayList(int size)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; super(size);<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp;  //Method to determine whether searchItem is in the list.<br />
&nbsp; &nbsp; &nbsp;  //Postcondition: If searchItem is found, returns the<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  location in the array where searchItem<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  is found; otherwise, returns -1.<br />
&nbsp; &nbsp; public int seqSearch(T searchItem)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; int loc;<br />
&nbsp; &nbsp; &nbsp; &nbsp; boolean found = false;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; for (loc = 0; loc &lt; length; loc++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (list[loc].equals(searchItem))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; found = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (found)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return loc;<br />
&nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return -1;<br />
&nbsp; &nbsp; } //end seqSearch<br />
<br />
&nbsp; &nbsp; &nbsp;  //Method to insert insertItem in the list at the position<br />
&nbsp; &nbsp; &nbsp;  //specified by location.<br />
&nbsp; &nbsp; &nbsp;  //Postcondition: Starting at location, the elements of<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  the list are shifted to make room for<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  insertItem, list[location] = insertItem;,<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  and length++;<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  If the list is full or location is out<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  of range, an appropriate message is<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  output.<br />
&nbsp; &nbsp; public void insertAt(int location, T insertItem)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (location &lt; 0 || location &gt;= maxSize)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.err.println(&quot;The position of the item to &quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  + &quot;be inserted is out of range.&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (length &gt;= maxSize)&nbsp; //list is full<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.err.println(&quot;Cannot insert in a full &quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  + &quot;list.&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int i = length; i &gt; location; i--)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; list[i] = list[i - 1];&nbsp; //move the<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //elements down<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; list[location] = insertItem;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; length++;&nbsp;  //increment the length<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; } //end insertAt<br />
<br />
&nbsp; &nbsp; &nbsp;  //Method to insert insertItem at the end of the list.<br />
&nbsp; &nbsp; &nbsp;  //Postcondition: list[length] = insertItem; and length++;<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  If the list is full, an appropriate<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  message is output.<br />
&nbsp; &nbsp; public void insertEnd(T insertItem)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (length &gt;= maxSize)&nbsp; //the list is full<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.err.println(&quot;Cannot insert in a full list.&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; list[length] = insertItem;&nbsp; //insert the<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //item at the end<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; length++; //increment the length<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; } //end insertEnd<br />
<br />
<br />
&nbsp; &nbsp; &nbsp;  //Method to replace the element in the list at<br />
&nbsp; &nbsp; &nbsp;  //the position specified by location with repItem.<br />
&nbsp; &nbsp; &nbsp;  //Postcondition: list[location] = repItem<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  If location is out of range, an<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  appropriate message is output.<br />
&nbsp; &nbsp; public void replaceAt(int location, T repItem)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (location &lt; 0 || location &gt;= length)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.err.println(&quot;The location of the item to &quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  + &quot;be replaced is out of range.&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; list[location] = repItem;<br />
&nbsp; &nbsp; } //end replaceAt<br />
<br />
&nbsp; &nbsp; &nbsp;  //Method to remove an item from the list.<br />
&nbsp; &nbsp; &nbsp;  //The parameter removeItem specifies the item to<br />
&nbsp; &nbsp; &nbsp;  //be removed.<br />
&nbsp; &nbsp; &nbsp;  //Postcondition: If removeItem is found in the list, it<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  is removed from the list and length is<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  decremented by one.<br />
&nbsp; &nbsp; public void remove(T removeItem)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; int loc;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (length == 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.err.println(&quot;Cannot delete from an &quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  + &quot;empty list.&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; loc = seqSearch(removeItem);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (loc != -1)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; removeAt(loc);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;The item to be deleted &quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  + &quot;is not in the list.&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; } //end remove<br />
}</pre>I included this class because it was extended in my UnorderedArrayList class.<br />
 <pre style="margin:20px; line-height:13px">public abstract class ArrayListClass&lt;T&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; implements ArrayListADT&lt;T&gt;, Cloneable<br />
{<br />
&nbsp; &nbsp; protected int length;&nbsp; //to store the length of the list<br />
&nbsp; &nbsp; protected int maxSize; //to store the maximum size of<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //the list<br />
&nbsp; &nbsp; protected T[] list;&nbsp; &nbsp; //array to hold the list elements<br />
<br />
<br />
&nbsp; &nbsp; &nbsp;  //Default constructor<br />
&nbsp; &nbsp; &nbsp;  //Creates an array of size 100<br />
&nbsp; &nbsp; &nbsp;  //Postcondition: list points to the array, length = 0,<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  and maxSize = 100<br />
&nbsp; &nbsp; public ArrayListClass()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; maxSize = 100;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; length = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; list = (T[]) new Object[maxSize];<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp;  //Constructor with a parameter<br />
&nbsp; &nbsp; &nbsp;  //Creates an array of the size specified by the<br />
&nbsp; &nbsp; &nbsp;  //parameter size.<br />
&nbsp; &nbsp; &nbsp;  //Postcondition: list points to the array, length = 0,<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  and maxSize = size<br />
&nbsp; &nbsp; public ArrayListClass(int size)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (size &lt;= 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.err.println(&quot;The array size must be positive. &quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  + &quot;Creating an array of size 100. &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  maxSize = 100;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; maxSize = size;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; length = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; list = (T[]) new Object[maxSize];<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp;  //Method to determine whether the list is empty.<br />
&nbsp; &nbsp; &nbsp;  //Postcondition: Returns true if the list is empty;<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  otherwise, returns false.<br />
&nbsp; &nbsp; public boolean isEmpty()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; return (length == 0);<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp;  //Method to determine whether the list is full.<br />
&nbsp; &nbsp; &nbsp;  //Postcondition: Returns true if the list is full;<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  otherwise, returns false.<br />
&nbsp; &nbsp; public boolean isFull()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; return (length == maxSize);<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp;  //Method to return the number of elements in the list.<br />
&nbsp; &nbsp; &nbsp;  //Postcondition: Returns the value of length.<br />
&nbsp; &nbsp; public int listSize()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; return length;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp;  //Method to return the maximum size of the list.<br />
&nbsp; &nbsp; &nbsp;  //Postcondition: Returns the value of maxSize.<br />
&nbsp; &nbsp; public int maxListSize()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; return maxSize;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp;  //Method to output the elements of the list.<br />
&nbsp; &nbsp; &nbsp;  //Postcondition: Elements of the list are output on the<br />
&nbsp; &nbsp; &nbsp;  //standard output device.<br />
&nbsp; &nbsp; public void print()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; for (int i = 0; i &lt; length; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(list[i]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println();<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp;  //Returns a copy of objects data in store.<br />
&nbsp; &nbsp; &nbsp;  //This method clones only the references stored in<br />
&nbsp; &nbsp; &nbsp;  //the array. The objects that the array references<br />
&nbsp; &nbsp; &nbsp;  //point to are not cloned.<br />
&nbsp; &nbsp; public Object clone()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; ArrayListClass&lt;T&gt; copy = null;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; try<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; copy = (ArrayListClass&lt;T&gt;) super.clone();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; catch (CloneNotSupportedException e)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return null;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; copy.list = (T[]) list.clone();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; return copy;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp;  //Method to determine whether item is the same as the item<br />
&nbsp; &nbsp; &nbsp;  //in the list at the position specified by location.<br />
&nbsp; &nbsp; &nbsp;  //Postcondition: Returns true if list[location] is the<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  same as item; otherwise, returns false.<br />
&nbsp; &nbsp; public boolean isItemAtEqual(int location, T item)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (location &lt; 0 || location &gt;= length)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.err.println(&quot;The location of the item to &quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  + &quot;be compared is out of range.&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return false;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; return (list[location].equals(item));<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp;  //Method to remove all the elements from the list.<br />
&nbsp; &nbsp; &nbsp;  //Postcondition: length = 0<br />
&nbsp; &nbsp; public void clearList()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; for (int i = 0; i &lt; length; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; list[i] = null;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; length = 0;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.gc();&nbsp;  //invoke garbage collector<br />
&nbsp; &nbsp; } //end clearList<br />
<br />
&nbsp; &nbsp; &nbsp;  //Method to remove the item from the list at the position<br />
&nbsp; &nbsp; &nbsp;  //specified by location.<br />
&nbsp; &nbsp; &nbsp;  //Postcondition: The list element at list[location] is<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  removed and length is decremented by 1.<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  If location is out of range, an<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  appropriate message is output.<br />
&nbsp; &nbsp; public void removeAt(int location)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (location &lt; 0 || location &gt;= length)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.err.println(&quot;The location of the item to &quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  + &quot;be removed is out of range.&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int i = location; i &lt; length - 1; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; list[i] = list[i + 1];<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; list[length - 1] = null;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; length--;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; } //end removeAt<br />
<br />
&nbsp; &nbsp; &nbsp;  //Method to retrieve the element from the list at the<br />
&nbsp; &nbsp; &nbsp;  //position specified by location.<br />
&nbsp; &nbsp; &nbsp;  //Postcondition: A reference of the element at the<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  position specified by location is<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  returned. If location is out of range,<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  an appropriate message is output and<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  null is returned.<br />
&nbsp; &nbsp; public T retrieveAt(int location)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (location &lt; 0 || location &gt;= length)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.err.println(&quot;The location of the item to be &quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  + &quot;retrieved is out of range.&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return null;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return list[location];<br />
&nbsp; &nbsp; } //end retrieveAt<br />
<br />
<br />
&nbsp; &nbsp; &nbsp;  //Method to insert insertItem in the list at the position<br />
&nbsp; &nbsp; &nbsp;  //specified by location.<br />
&nbsp; &nbsp; &nbsp;  //Postcondition: Starting at location, the elements of<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  the list are shifted to make room for<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  insertItem, list[location] = insertItem;,<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  and length++;<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  If the list is full or location is out<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  of range, an appropriate message is<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  output.<br />
&nbsp; &nbsp; public abstract void insertAt(int location, T insertItem);<br />
<br />
&nbsp; &nbsp; &nbsp;  //Method to insert insertItem at the end of the list.<br />
&nbsp; &nbsp; &nbsp;  //Postcondition: list[length] = insertItem; and length++;<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  If the list is full, an appropriate<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  message is output.<br />
&nbsp; &nbsp; public abstract void insertEnd(T insertItem);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; //Method to replace the element in the list at<br />
&nbsp; &nbsp; &nbsp; &nbsp; //the position specified by location with repItem.<br />
&nbsp; &nbsp; &nbsp; &nbsp; //Postcondition: list[location] = repItem<br />
&nbsp; &nbsp; &nbsp; &nbsp; //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  If location is out of range, an<br />
&nbsp; &nbsp; &nbsp; &nbsp; //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  appropriate message is output.<br />
&nbsp; &nbsp; public abstract void replaceAt(int location, T repItem);<br />
<br />
&nbsp; &nbsp; &nbsp;  //Method to determine whether searchItem is in the list.<br />
&nbsp; &nbsp; &nbsp;  //Postcondition: If searchItem is found, returns the<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  location in the array where searchItem<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  is found; otherwise, returns -1.<br />
&nbsp; &nbsp; public abstract int seqSearch(T searchItem);<br />
<br />
&nbsp; &nbsp; &nbsp;  //Method to remove an item from the list.<br />
&nbsp; &nbsp; &nbsp;  //The parameter removeItem specifies the item to<br />
&nbsp; &nbsp; &nbsp;  //be removed.<br />
&nbsp; &nbsp; &nbsp;  //Postcondition: If removeItem is found in the list, it<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  is removed from the list and length is<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  decremented by one.<br />
&nbsp; &nbsp; public abstract void remove(T removeItem);<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>Hanyouslayer</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236501.html</guid>
		</item>
		<item>
			<title>Fetch and display online images.</title>
			<link>http://www.daniweb.com/forums/thread236483.html</link>
			<pubDate>Fri, 06 Nov 2009 05:19:11 GMT</pubDate>
			<description><![CDATA[I'm trying to fetch and display an online image in a GUI. The method will "target" an online image (like http://www.site.com/picture.jpg)  and put it in the GUI. Also, I will need to be able to replace the image with another when the need arises. Any ideas?]]></description>
			<content:encoded><![CDATA[<div>I'm trying to fetch and display an online image in a GUI. The method will &quot;target&quot; an online image (like <a rel="nofollow" class="t" href="http://www.site.com/picture.jpg" target="_blank">http://www.site.com/picture.jpg</a>)  and put it in the GUI. Also, I will need to be able to replace the image with another when the need arises. Any ideas?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>Tactical Fart</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236483.html</guid>
		</item>
		<item>
			<title>playing PIG</title>
			<link>http://www.daniweb.com/forums/thread236478.html</link>
			<pubDate>Fri, 06 Nov 2009 05:05:45 GMT</pubDate>
			<description><![CDATA[This program is a game which allows the user to play against a computer in a dice game called ``Pig''. 
Rules are: 
    * Players alternate turns and try to be the first to reach 100 points. 
    * A turn consists of rolling a die repeatedly until either a 1 is rolled or the player chooses to quit...]]></description>
			<content:encoded><![CDATA[<div>This program is a game which allows the user to play against a computer in a dice game called ``Pig''.<br />
Rules are:<br />
    * Players alternate turns and try to be the first to reach 100 points.<br />
    * A turn consists of rolling a die repeatedly until either a 1 is rolled or the player chooses to quit rolling.<br />
    * If a turn ends with the roll of a 1 then 0 points are earned on that turn.<br />
    * If a turn ends by the player choosing to hold then the number of points earned is the sum of the rolls for that turn.<br />
    * The points earned in a turn are added to a player's total score for the game.<br />
<br />
my problem: How do i get the total score for the round to add up and each time it passes thru the methods? <br />
<br />
 <pre style="margin:20px; line-height:13px">import java.util.Scanner;<br />
<br />
public class PlayPig<br />
{<br />
&nbsp; public static void main(String [] args)<br />
&nbsp; {<br />
&nbsp; int usertotal, comptotal;<br />
&nbsp; <br />
&nbsp; do<br />
&nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; usertotal=userTurn();<br />
&nbsp; &nbsp; &nbsp; &nbsp; comptotal=compTurn();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }while(usertotal&lt;100 || comptotal&lt;100);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public static int userTurn()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Scanner scan= new Scanner(System.in);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int random, current, usertotal;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String ans=&quot;n&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; current=0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; do<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; random= (int) (Math.random()*6.0)+1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Your roll is &quot;+random);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (random==1)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; current = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Your score is: &quot;+current);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if (random !=1 &amp;&amp; random&lt;=6)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; current= current+random;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Your current score is: &quot;+current);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Do you want to roll again? [Y/N]&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ans=scan.nextLine();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }while(ans.equals(&quot;Y&quot;)&amp;&amp; random!= 1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Your total score is: &quot;+current);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; usertotal=current;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return usertotal;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; public static int compTurn()<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Scanner scan= new Scanner(System.in);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int times, random, current, comptotal=0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; current=0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; times= (int) (Math.random()*5.0)+1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for(int i=0; i&lt; times; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; random= (int) (Math.random()*6.0)+1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Comp roll is &quot;+random);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(random == 1)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; current=0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i= times;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Comp score is: &quot;+current);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if(random !=1 &amp;&amp; random&lt;=6)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; current= current+random;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; comptotal =current;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Comp total score is: &quot;+comptotal);&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return comptotal;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>estefania</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236478.html</guid>
		</item>
		<item>
			<title>Help with hw...</title>
			<link>http://www.daniweb.com/forums/thread236475.html</link>
			<pubDate>Fri, 06 Nov 2009 04:43:18 GMT</pubDate>
			<description><![CDATA[AHHH so i've been writing this code with my teachers help. IT will now be able to get 1 coordinate, but i want it to get teh same number of coordinates, i set my shipsize to.. waht can i do...my teacher said I could do a loop... but.... i couldnt get it to work....( this is jsut part of the code)...]]></description>
			<content:encoded><![CDATA[<div>AHHH so i've been writing this code with my teachers help. IT will now be able to get 1 coordinate, but i want it to get teh same number of coordinates, i set my shipsize to.. waht can i do...my teacher said I could do a loop... but.... i couldnt get it to work....( this is jsut part of the code) you dotn the otehrs...<br />
<br />
 <pre style="margin:20px; line-height:13px">import java.util.ArrayList;<br />
<br />
public class GameBoard<br />
{<br />
&nbsp; &nbsp; private boolean&#91;&#93;&#91;&#93; i = new boolean&#91;10&#93;&#91;10&#93;;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; boolean spotIsTaken = true;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; public ArrayList&lt;String&gt; placeShip(int shipSize)<br />
&nbsp; &nbsp; {&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(shipSize);<br />
&nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; String&#91;&#93; letters = {&quot;a&quot;, &quot;b&quot;, &quot;c&quot;, &quot;d&quot;, &quot;e&quot;, &quot;f&quot;, &quot;g&quot;, &quot;h&quot;, &quot;i&quot;, &quot;j&quot;};<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int row =(int)(Math.random()*10);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int column =(int)(Math.random()*10);<br />
&nbsp; <br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while(spotIsTaken)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(i&#91;row&#93;&#91;column&#93;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; row =(int)(Math.random()*10);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; column =(int)(Math.random()*10);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; spotIsTaken = false;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp;  for (int i = )<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; ArrayList&lt;String&gt; points = new ArrayList&lt;String&gt;();<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; points.add(letters&#91;row&#93; + (column + 1));<br />
&nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(letters&#91;row&#93;+ (column + 1));<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; return points;&nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; <br />
}<br />
&nbsp; <br />
<br />
&nbsp; // Returns an ArrayList of coordinates<br />
&nbsp; // where a ship of shipSize can be placed<br />
&nbsp; // Example: placeShip(3)<br />
&nbsp; // could return { b3, b4, b5 }</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>icreamed</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236475.html</guid>
		</item>
		<item>
			<title><![CDATA[Is there something with my "insert" method for my binary search tree?]]></title>
			<link>http://www.daniweb.com/forums/thread236474.html</link>
			<pubDate>Fri, 06 Nov 2009 04:39:57 GMT</pubDate>
			<description><![CDATA[So my binary search tree doesn't seem to be traversing through all the nodes. each node has references to other nodes. So I'm traversing through right or left (depending on value) until I hit null, which means I can insert. After insertion, I reset root to first so it can reiterate through the top...]]></description>
			<content:encoded><![CDATA[<div>So my binary search tree doesn't seem to be traversing through all the nodes. each node has references to other nodes. So I'm traversing through right or left (depending on value) until I hit null, which means I can insert. After insertion, I reset root to first so it can reiterate through the top of the search tree when I call it next. But instead, it's not working as it should, seems like it only moves through the first node.<br />
<br />
My constructor for the BST:<br />
 <pre style="margin:20px; line-height:13px">&nbsp; public BST() {<br />
&nbsp; <br />
&nbsp; &nbsp; root = null;<br />
&nbsp; &nbsp; first = null;<br />
&nbsp; &nbsp; size = 0;<br />
&nbsp; &nbsp; <br />
&nbsp; }</pre><br />
Constructor for node:<br />
 <pre style="margin:20px; line-height:13px">&nbsp; &nbsp; protected Node(K key, V value) {<br />
<br />
&nbsp; &nbsp; &nbsp; if ((key == null) || (value == null)) {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; throw new NullPointerException();<br />
<br />
&nbsp; &nbsp; &nbsp; } else {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; this.key = key;<br />
&nbsp; &nbsp; &nbsp; &nbsp; this.value = value;<br />
&nbsp; &nbsp; &nbsp; &nbsp; left = null;<br />
&nbsp; &nbsp; &nbsp; &nbsp; right = null;<br />
&nbsp; &nbsp; &nbsp; &nbsp; parent = null;<br />
&nbsp; &nbsp; &nbsp; &nbsp; predecessor = null;<br />
&nbsp; &nbsp; &nbsp; &nbsp; successor = null;<br />
&nbsp; &nbsp; &nbsp; };</pre><br />
This is the method for insert:<br />
 <pre style="margin:20px; line-height:13px">public V put (K key, V value) {<br />
&nbsp; &nbsp; &nbsp; if (root == null) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; root = new Node(key, value);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (size == 0) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Setting first root!&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; first = root;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; size++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Inserted &quot; + root.key);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; root = first;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(size);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return root.value;<br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; else {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int compareKeyToNode = key.compareTo(root.key);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Compares key to root's key, returns -1 if less than, 1 if greater than, 0 if keys are equal<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (compareKeyToNode &gt; 0) {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Moved right of &quot; + root.key);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; root = root.right;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (compareKeyToNode &lt; 0) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Moved left of &quot; + root.key);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; root = root.left;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; return (put(key, value));<br />
&nbsp; }</pre><br />
Say for input of 15, 12, 14, 8<br />
<br />
It should print:<br />
<br />
Inserting 15<br />
Moving left of 15<br />
Inserting 12<br />
Moving left of 15<br />
Moving right of 12<br />
Inserting 14<br />
Moving left of 15<br />
Moving left of 12<br />
Inserting 8<br />
<br />
Instead, it outputs:<br />
<br />
Inserting 15<br />
Moving left of 15<br />
Inserting 12<br />
Moving left of 15<br />
Inserting 14<br />
Moving left of 15<br />
Inserting 8<br />
<br />
So it only seems to be traversing through the top node and inserts right away even though it shouldn't be null. Can anyone spot a logic error in my code?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>iamsmooth</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236474.html</guid>
		</item>
		<item>
			<title>linked list polynomial help with add Term?</title>
			<link>http://www.daniweb.com/forums/thread236473.html</link>
			<pubDate>Fri, 06 Nov 2009 04:29:18 GMT</pubDate>
			<description>I am currently building a Polynomial linked list.  
 
Classes 
 
*Node*, that has a Term and a Node next. 
http://www.boomica.com/Node.java 
 
*Term* with a coefficient and exponent. 
http://www.boomica.com/Term.java</description>
			<content:encoded><![CDATA[<div>I am currently building a Polynomial linked list. <br />
<br />
Classes<br />
<br />
<span style="font-weight:bold">Node</span>, that has a Term and a Node next.<br />
<a rel="nofollow" class="t" href="http://www.boomica.com/Node.java" target="_blank">http://www.boomica.com/Node.java</a><br />
<br />
<span style="font-weight:bold">Term</span> with a coefficient and exponent.<br />
<a rel="nofollow" class="t" href="http://www.boomica.com/Term.java" target="_blank">http://www.boomica.com/Term.java</a><br />
<br />
<span style="font-weight:bold">Polynomial</span><br />
<br />
<a rel="nofollow" class="t" href="http://www.boomica.com/Polynomial.java" target="_blank">http://www.boomica.com/Polynomial.java</a><br />
<br />
 <pre style="margin:20px; line-height:13px">public void addTerm(Term nomial)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Node temp = first;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Node&nbsp; toAdd;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(isEmpty() || (temp.getTerm().compareTo(nomial) &lt;= 0))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Node newFirst = new Node(nomial, first);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; first = newFirst;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while((temp.getTerm().compareTo(nomial) &gt;= 0) &amp;&amp; temp.getNext() != null)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp = temp.getNext();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(temp.getNext() == null)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; toAdd = new Node(nomial, null);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp.setNext(toAdd);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; toAdd = new Node(nomial, temp.getNext());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp.setNext(toAdd);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }</pre><br />
My Driver:<br />
<br />
 <pre style="margin:20px; line-height:13px">package dsa.exam;<br />
<br />
public class PolynomialDriver <br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; public static void main (String args[])<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Polynomial nomial = new Polynomial();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nomial.addTerm(new Term(3));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nomial.addTerm(new Term(2,7));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nomial.addTerm(new Term(3,6));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nomial.addTerm(new Term(3, 1));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nomial.addTerm(new Term(3, 8));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //nomial.addTerm(new Term(3,2));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //nomial.addTerm(new Term(3,5));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //double answer = one.evaluate(2) + two.evaluate(2) + three.evaluate(2) + four.evaluate(2) + five.evaluate(2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String s = nomial.printPolynomial();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(s);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
}</pre><br />
It's seems its messing up when I try to switch 3 + 3x(or 3x^1), it wont sort after.<br />
<br />
I went through step by step with the Eclipse Debugger and couldnt find it.<br />
<br />
Could anyone help me out, and tell me why it isnt sorting correctly and to share opinions on my Add method as do you think it is efficient?<br />
<br />
Help is greatly appreciated! =)</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>.11</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236473.html</guid>
		</item>
		<item>
			<title>Java Minimum essentials</title>
			<link>http://www.daniweb.com/forums/thread236462.html</link>
			<pubDate>Fri, 06 Nov 2009 03:51:51 GMT</pubDate>
			<description><![CDATA[Hi all, 
I'm just starting Java and have read some tutorials and reading also thinking in Java and I see it is a good language. I have a question though, what are MINIMUM requirement of ANY Java program for it to run?]]></description>
			<content:encoded><![CDATA[<div>Hi all,<br />
I'm just starting Java and have read some tutorials and reading also thinking in Java and I see it is a good language. I have a question though, what are MINIMUM requirement of ANY Java program for it to run?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>evstevemd</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236462.html</guid>
		</item>
		<item>
			<title>Merge file program compiles but not run.</title>
			<link>http://www.daniweb.com/forums/thread236456.html</link>
			<pubDate>Fri, 06 Nov 2009 03:38:26 GMT</pubDate>
			<description>This program is suppose to merge the two files by taking one element at a time from each, and the third file should contain the numbers from both file from lowest to highest.  
 
Data1: 11 25 36 45 56 78 90 
Data2: 1 3 5 7 54 32 78 99  
 
Then the third data should output:  
 
data3: 1 3 5 7 11 25...</description>
			<content:encoded><![CDATA[<div>This program is suppose to merge the two files by taking one element at a time from each, and the third file should contain the numbers from both file from lowest to highest. <br />
<br />
Data1: 11 25 36 45 56 78 90<br />
Data2: 1 3 5 7 54 32 78 99 <br />
<br />
Then the third data should output: <br />
<br />
data3: 1 3 5 7 11 25 32 36 45 54 56 ..... so on (from low to high) <br />
<br />
<br />
<br />
The program compiles but when I run it, it gives me this error..... how do i fix this, so that it outputs.<br />
<br />
&gt; java MergeFiles<br />
Static Error: No static method in MergeFiles with name 'main' accepts arguments (String[])<br />
&gt;<br />
<br />
<br />
 <pre style="margin:20px; line-height:13px">import java.io.*;<br />
import java.util.ArrayList;<br />
import java.util.Scanner;<br />
import java.util.Collections;<br />
<br />
<br />
public class MergeFiles {<br />
&nbsp; &nbsp; public static void MergeFiles (String[] args) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; try {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FileReader file1=new FileReader(&quot;File1.txt&quot;);&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Scanner scan = new Scanner(new File(&quot;File1.txt&quot;));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ArrayList&lt;Integer&gt; values = new ArrayList&lt;Integer&gt;(); <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Collections.sort(values);&nbsp; &nbsp; &nbsp;  //sorting the values <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while(scan.hasNextInt()) values.add(scan.nextInt());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FileReader file2=new FileReader(&quot;File2.txt&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; scan = new Scanner(new File(&quot;File2.txt&quot;)); <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; values = new ArrayList&lt;Integer&gt;();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Collections.sort(values);&nbsp; &nbsp; &nbsp; &nbsp; //sorting the values. <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while(scan.hasNextInt()) values.add(scan.nextInt());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; BufferedReader br1 = new BufferedReader (file1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; BufferedReader br2 = new BufferedReader(file2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String temp1 = &quot;&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String temp2 = &quot;&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while(br1.readLine() !=null)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp1=br1.readLine()+temp1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while(br2.readLine()!=null)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp2=br2.readLine()+temp2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String temp = temp1 + temp2; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Merging the numbers from low to high into a third file. <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FileWriter fw=new FileWriter(&quot;File3.txt&quot;);&nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; char buffer[]=new char[temp.length()];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp.getChars(0,temp.length(),buffer,0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fw.write(buffer);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; file1.close();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; file2.close();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fw.close();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; } catch (IOException e) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; e.printStackTrace();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>StarZ</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236456.html</guid>
		</item>
		<item>
			<title>HELP!!!!!</title>
			<link>http://www.daniweb.com/forums/thread236444.html</link>
			<pubDate>Fri, 06 Nov 2009 01:58:38 GMT</pubDate>
			<description><![CDATA[I am making a tic-tac-toe game and I am scanning in the players name and piece in the viewer. How am I able to access that in the component class? I am not able to put a method in my viewer, so I can't say getPlayer of getPiece, but there has to be some way to pass that variable into a different...]]></description>
			<content:encoded><![CDATA[<div>I am making a tic-tac-toe game and I am scanning in the players name and piece in the viewer. How am I able to access that in the component class? I am not able to put a method in my viewer, so I can't say getPlayer of getPiece, but there has to be some way to pass that variable into a different class. Thank you!</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>kjavaapclass</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236444.html</guid>
		</item>
		<item>
			<title>java class question</title>
			<link>http://www.daniweb.com/forums/thread236428.html</link>
			<pubDate>Fri, 06 Nov 2009 00:14:04 GMT</pubDate>
			<description><![CDATA[Given this client 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox" title="Help with Code Tags" target="_blank">Help with Code Tags</a> </div> <div> <strong>Java...]]></description>
			<content:encoded><![CDATA[<div>Given this client<br />
 <pre style="margin:20px; line-height:13px">/* Test of<br />
&nbsp;*&nbsp; &nbsp; Constructor with 2 arguments<br />
&nbsp;*&nbsp; &nbsp; drawLine<br />
&nbsp;*&nbsp; &nbsp; setSize<br />
&nbsp;*/<br />
<br />
public class BoxesClient5<br />
{<br />
&nbsp;  public static void main(String[] args)<br />
&nbsp;  {<br />
&nbsp; &nbsp; &nbsp; Boxes alphaBox;<br />
&nbsp; &nbsp; &nbsp; int i;<br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; System.out.println(&quot;Result of various calls to drawLine:&quot;);<br />
<br />
&nbsp; &nbsp; &nbsp; alphaBox = new Boxes(7, 'a');<br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; for ( i = 0; i &lt; 5; i++ ) {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  alphaBox.setSize( alphaBox.getSize() + 1 );<br />
&nbsp; &nbsp; &nbsp; &nbsp;  alphaBox.drawLine();<br />
&nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; for ( i = 0; i &lt; 5; i++ ) {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  alphaBox.setSize( alphaBox.getSize() - 1 );<br />
&nbsp; &nbsp; &nbsp; &nbsp;  alphaBox.drawLine();<br />
&nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp;  } // end of method main<br />
} // end of class BoxesClient5</pre><br />
I need to write a class file to make it print something along the lines<br />
+-----+ the number of dash's depends on the length that is used. <br />
<br />
I have this so far:<br />
 <pre style="margin:20px; line-height:13px">public class Boxes{<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; // instance variables<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; private int size;<br />
&nbsp; &nbsp; &nbsp; &nbsp; private char symbol;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; // constructor<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; public Boxes(int length, char FillChar){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; size = length;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; symbol = FillChar;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; public Boxes(){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; size = 5;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; symbol = 'z';<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; public boolean equals(Boxes obj){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(size == obj.size &amp;&amp; symbol == obj.symbol){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return false;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; // getter<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; public char getFillChar(){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return symbol;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; public int getSize(){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return size;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; // setter<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; public void setSize(int setSize){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; size = setSize;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; public void setFillChar(char setFillChar){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; symbol = setFillChar;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; // toString<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; public String drawLine(){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String line = &quot;&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for(int h = size; h&gt;0; h--){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; line = line + &quot;-&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return '+' + line + '+';<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; public String toString(){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return &quot;&quot; + size <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  + &quot;\n&quot; + symbol;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }</pre><br />
When I try to print the line, it just prints a blank space. Could you please tell me what I can change to fix this? I have to do this for an upward triangle, downward triangle and box as well, but I think I should be able to get those as long as I can get this one to print.<br />
<br />
Thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>ninjaelves</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236428.html</guid>
		</item>
		<item>
			<title>need help with some coding</title>
			<link>http://www.daniweb.com/forums/thread236419.html</link>
			<pubDate>Thu, 05 Nov 2009 23:43:03 GMT</pubDate>
			<description>public boolean addEvent(int year, int month, int day, int hour, int minute, int duration, String what);  
This will return true if the event was added and false otherwise. Only valid events will be added to the list.  
 
i kind of understand what im suppose to do but i just cant figure out the...</description>
			<content:encoded><![CDATA[<div>public boolean addEvent(int year, int month, int day, int hour, int minute, int duration, String what); <br />
This will return true if the event was added and false otherwise. Only valid events will be added to the list. <br />
<br />
i kind of understand what im suppose to do but i just cant figure out the coding. calenderEvent is being declared in another class. i just need help with these directions turning them into coding<br />
<br />
 <pre style="margin:20px; line-height:13px">public boolean addEvent(int year, int month, int day, <br />
&nbsp; &nbsp; &nbsp; &nbsp; int hour, int minute, int duration, String what){<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; if(CalenderEvent != addEvent)<br />
&nbsp; &nbsp; &nbsp; &nbsp; return true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; else if (CalenderEvent != addEvent)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return false;</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>bkafroboy69</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236419.html</guid>
		</item>
		<item>
			<title>Trouble converting int to float</title>
			<link>http://www.daniweb.com/forums/thread236416.html</link>
			<pubDate>Thu, 05 Nov 2009 23:33:26 GMT</pubDate>
			<description><![CDATA[I am trying to write a method that accepts two integer parameters and returns their average as a float, but for some reason it is only returning a double. I am quite sure that there needs to be "f" after the resulting value, but it's not showing up. Can someone please help me fix this? 
 
  <div...]]></description>
			<content:encoded><![CDATA[<div>I am trying to write a method that accepts two integer parameters and returns their average as a float, but for some reason it is only returning a double. I am quite sure that there needs to be &quot;f&quot; after the resulting value, but it's not showing up. Can someone please help me fix this?<br />
<br />
 <pre style="margin:20px; line-height:13px">public static float average(int x, int y)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return (x + y)/2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }</pre><br />
 <pre style="margin:20px; line-height:13px">&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;average(\&quot;7, 5\&quot;) = &quot; + Lab7.average(7, 5));</pre><br />
RESTULTS:<br />
average(&quot;7, 5&quot;) = 6.0</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>Bluesilver</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236416.html</guid>
		</item>
		<item>
			<title>simple question about my code</title>
			<link>http://www.daniweb.com/forums/thread236403.html</link>
			<pubDate>Thu, 05 Nov 2009 22:48:01 GMT</pubDate>
			<description><![CDATA[Hello everyone. I am required to write a simple code that reads 10 numbers and displays the largest and last number entered. I thought i would be able to do this easily but for some reason the numbers wont get assigned to the variables like i thought. 
 
  <div class="codeblock"> <div...]]></description>
			<content:encoded><![CDATA[<div>Hello everyone. I am required to write a simple code that reads 10 numbers and displays the largest and last number entered. I thought i would be able to do this easily but for some reason the numbers wont get assigned to the variables like i thought.<br />
<br />
 <pre style="margin:20px; line-height:13px">import java.util.Scanner;<br />
public class LargestNumber {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; public static void main(String[] args) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int largest=0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int number=0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int counter=1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Scanner input=new Scanner (System.in);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Please enter a number: &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; number=input.nextInt();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; number=largest;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; counter++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while (counter &lt;= 10){&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Enter another number: &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; number=input.nextInt();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (number&gt;largest)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; number=largest;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; counter++;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Last number entered was: &quot;+ number+&quot;.&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;The largest number entered was: &quot;+ largest+&quot;.&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
}</pre><br />
thats what i made, which i thought would work fine...but then the output says the largest and number variables are equal to 0. I set them to 0 at the top, but how come they arnt assigned the new numbers when the while loop executes?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>shroomiin</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236403.html</guid>
		</item>
		<item>
			<title>Drwaing Circles?</title>
			<link>http://www.daniweb.com/forums/thread236396.html</link>
			<pubDate>Thu, 05 Nov 2009 22:24:03 GMT</pubDate>
			<description>hi, i want to be able to draw two eyes with are exactly the same in radius and colour etc next to eachother. So when i open the window the pair of eyes are there in the centre. I have managed to get one eye but i dnt have a clue to how to get one beside it, i am not sure hw to.. here is my code for...</description>
			<content:encoded><![CDATA[<div>hi, i want to be able to draw two eyes with are exactly the same in radius and colour etc next to eachother. So when i open the window the pair of eyes are there in the centre. I have managed to get one eye but i dnt have a clue to how to get one beside it, i am not sure hw to.. here is my code for the first eye and function should be calling the drawCircle six times.<br />
please help<br />
 <pre style="margin:20px; line-height:13px">from graphics import *<br />
import math<br />
def drawCircle(win, centre, radius, colour):<br />
circle = Circle(centre, radius)<br />
circle.setFill(colour)<br />
circle.setWidth(2)<br />
circle.draw(win)<br />
<br />
def drawTarget():<br />
win = GraphWin()<br />
centre = Point(100,100)<br />
drawCircle(win, centre, 40, &quot;white&quot;)<br />
drawCircle(win, centre, 20, &quot;blue&quot;)<br />
drawCircle(win, centre, 10, &quot;black&quot;)</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>jaison2</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236396.html</guid>
		</item>
		<item>
			<title>Java word guessing game - problem</title>
			<link>http://www.daniweb.com/forums/thread236379.html</link>
			<pubDate>Thu, 05 Nov 2009 21:02:50 GMT</pubDate>
			<description><![CDATA[Hi all, I've been working on a Java guessing game, similar to hangman which rewards you with a picture using the Gogga class (developed by the people who wrote my IT textbook for Grade 10, also I removed gogga for this website, since I doubt you'd be able to find it). 
Just a word of warning... it...]]></description>
			<content:encoded><![CDATA[<div>Hi all, I've been working on a Java guessing game, similar to hangman which rewards you with a picture using the Gogga class (developed by the people who wrote my IT textbook for Grade 10, also I removed gogga for this website, since I doubt you'd be able to find it).<br />
Just a word of warning... it could be simplified to a lot less lines of code, but since I may not use for complex things such as arrays, do while, etc. The problem I'm having is at the word guessing part of the program, it asks for the next character and displays the words and picture within the if statements, regardless of whether the input character was incorrect of not (so it carries out the code regardless if the conditions of the &quot;if&quot; is met). I hope you guys know what I'm talking about.  Also I seem to not be able to have &quot;else&quot; after the big bunch of if statements. Just for reference, the program is not yet 100% complete since I first wanted to sort out this bug.<br />
<br />
 <pre style="margin:20px; line-height:13px">/* PAT Assignment --- Word Guessing + Number pattern game<br />
&nbsp; &nbsp;  Charl Potgieter 10Pn<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; October / November 2009<br />
*/<br />
<br />
&nbsp;  <br />
&nbsp;  import javax.swing.*;&nbsp;  <br />
&nbsp;  import java.util.*; // for random<br />
&nbsp; &nbsp; public class GuessingGame1<br />
&nbsp;  {<br />
&nbsp; &nbsp; &nbsp;  public static void main (String [] args)<br />
&nbsp; &nbsp; &nbsp; { <br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp;  JOptionPane.showMessageDialog(null, &quot;Welcome to the Guessing Game!&quot;);<br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp;  for ( int j = 1; ; j = j ++ )<br />
&nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String menu, undscore1, undscore2, undscore3, undscore4, undscore5; //have underscores<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Random ran = new Random();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; char char1, char2, char3, char4, char5, inpChar;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String[] options = {&quot;Word Guessing&quot;,&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;Patterns Game &quot;, <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;Exit&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; };&nbsp; &nbsp; // Used to make options to select in the menu<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; menu = (String) JOptionPane.showInputDialog (null, &quot;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MENU&quot;, &quot;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Guessing Game&quot;, JOptionPane.PLAIN_MESSAGE, null, options, &quot; &quot;);&nbsp; //Starting menu<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (menu.equals (options [0]))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  String word = JOptionPane.showInputDialog(&quot;Player 1: Please input a word (to a maximum of 5 characters), for single player type: 'random' &quot;); //Ask for input, whether the user wants to make a word, or a random one<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  int rndChoice = (int)(Math.random()*14); // rndChoice is made for the switch to be able to randomly choose a word<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Code for user word<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if (!word.equals(&quot;random&quot;))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /* undscore1 = &quot;_&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; undscore2 = &quot;_&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; undscore3 = &quot;_&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; undscore4 = &quot;_&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; undscore5 = &quot;_&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; */<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String inpWord;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inpWord = JOptionPane.showInputDialog(&quot;Please input a character that you want to guess&quot;);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inpChar = inpWord.charAt(0);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; char1 = word.charAt(0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; char2 = word.charAt(1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; char3 = word.charAt(2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; char4 = word.charAt(3);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; char5 = word.charAt(4);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (inpChar == char1)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  System.out.println(&quot;The word is: &quot;+char1+&quot;____ &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inpWord = JOptionPane.showInputDialog(&quot;Please input a character that you want to guess&quot;);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inpChar = inpWord.charAt(0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(inpChar == char2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  System.out.println(&quot;The word is: &quot;+char1+char2+&quot;___&quot; );<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inpWord = JOptionPane.showInputDialog(&quot;Please input a character that you want to guess&quot;);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inpChar = inpWord.charAt(0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(inpChar == char3);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  System.out.println(&quot;The word is: &quot;+char1+char2+char3+&quot;__&quot; );<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inpWord = JOptionPane.showInputDialog(&quot;Please input a character that you want to guess&quot;);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inpChar = inpWord.charAt(0);&nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(inpChar == char4);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  System.out.println(&quot;The word is: &quot;+char1+char2+char3+char4+&quot;_&quot; );<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inpWord = JOptionPane.showInputDialog(&quot;Please input a character that you want to guess&quot;);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inpChar = inpWord.charAt(0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(inpChar == char5);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  System.out.println(&quot;The word is: &quot;+char1+char2+char3+char4+char5 );<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, &quot;Congratulations, you have won! \n Returning to menu&quot;);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Code for random word<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if (word.equals(&quot;random&quot;))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; switch (rndChoice)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  case 0:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; word = &quot;hello&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  case 1:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; word = &quot;kevin&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  case 2:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; word = &quot;charl&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  case 3:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; word = &quot;county&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  case 4:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; word = &quot;sweety&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  case 5:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; word = &quot;motor&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  case 6:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; word = &quot;edges&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  case 7:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; word = &quot;works&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  case 8:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; word = &quot;place&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  case 9:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; word = &quot;right&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  case 10:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; word = &quot;dudes&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  case 11:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; word = &quot;lucky&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  case 12:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; word = &quot;homes&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; undscore1 = &quot;_&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; undscore2 = &quot;_&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; undscore3 = &quot;_&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; undscore4 = &quot;_&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; undscore5 = &quot;_&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String inpWord;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for ( int count = 1; ; count = count ++ )<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  inpWord = JOptionPane.showInputDialog(&quot;Please input a character that you want to guess&quot;); <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  inpChar = inpWord.charAt(0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  char1 = word.charAt(0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  char2 = word.charAt(1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  char3 = word.charAt(2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  char4 = word.charAt(3);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  char5 = word.charAt(4);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if (inpChar == char1)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;The word is: &quot;+char1+&quot;____ &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  inpWord = JOptionPane.showInputDialog(&quot;Please input a character that you want to guess&quot;);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  inpChar = inpWord.charAt(0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if(inpChar == char2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;The word is: &quot;+char1+char2+&quot;___&quot; );<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  inpWord = JOptionPane.showInputDialog(&quot;Please input a character that you want to guess&quot;);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  inpChar = inpWord.charAt(0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if(inpChar == char3);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;The word is: &quot;+char1+char2+char3+&quot;__&quot; );<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  } <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  inpWord = JOptionPane.showInputDialog(&quot;Please input a character that you want to guess&quot;);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  inpChar = inpWord.charAt(0);&nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if(inpChar == char4);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;The word is: &quot;+char1+char2+char3+char4+&quot;_&quot; );<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  inpWord = JOptionPane.showInputDialog(&quot;Please input a character that you want to guess&quot;);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  inpChar = inpWord.charAt(0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if(inpChar == char5);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;The word is: &quot;+char1+char2+char3+char4+char5 );<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  JOptionPane.showMessageDialog(null, &quot;Congratulations, you have won! \n Returning to menu&quot;);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (menu.equals (options [1]))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  JOptionPane.showMessageDialog(null, &quot;In this game you will be given 10 sequences of numbers that you will have to complete, you only have one try, its that easy!&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  int patrn;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  int rndNoChoice = (int)(Math.random()*14); // rndNoChoice is made for the switch to be able to randomly choose a pattern<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  switch (rndNoChoice)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 0:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  patrn = Integer.parseInt(JOptionPane.showInputDialog(&quot;What is the next number: \n 15 ; 30 ; 45 ....&quot;));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if (patrn == 60)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, &quot;Correct!&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, &quot;Incorrect!&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /////////////////<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 1:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  patrn = Integer.parseInt(JOptionPane.showInputDialog(&quot;What is the next number: \n 10 ; 20 ; 30 ....&quot;));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if (patrn == 40)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, &quot;Correct!&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, &quot;Incorrect!&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //////////////////<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 2:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  patrn = Integer.parseInt(JOptionPane.showInputDialog(&quot;What is the next number: \n 1 ; 2 ; 3 ....&quot;));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if (patrn == 4)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, &quot;Correct!&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, &quot;Incorrect!&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //////////////////<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 3:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  patrn = Integer.parseInt(JOptionPane.showInputDialog(&quot;What is the next number: \n 7 ; 14 ; 21 ....&quot;));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if (patrn == 28)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, &quot;Correct!&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, &quot;Incorrect!&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /////////////////<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 4:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  patrn = Integer.parseInt(JOptionPane.showInputDialog(&quot;What is the next number: \n 8 ; 16 ; 24 ....&quot;));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if (patrn == 32)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, &quot;Correct!&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, &quot;Incorrect!&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /////////////////<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 5:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  patrn = Integer.parseInt(JOptionPane.showInputDialog(&quot;What is the next number: \n 2 ; 4 ; 6 ....&quot;));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if (patrn == 8)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, &quot;Correct!&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, &quot;Incorrect!&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //////////////////<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 6:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  patrn = Integer.parseInt(JOptionPane.showInputDialog(&quot;What is the next number: \n 12 ; 24 ; 36 ....&quot;));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if (patrn == 48)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, &quot;Correct!&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, &quot;Incorrect!&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //////////////////<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 7:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  patrn = Integer.parseInt(JOptionPane.showInputDialog(&quot;What is the next number: \n 1000 ; 750 ; 500 ....&quot;));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if (patrn == 250)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, &quot;Correct!&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, &quot;Incorrect!&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //////////////////<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 8:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  patrn = Integer.parseInt(JOptionPane.showInputDialog(&quot;What is the next number: \n 4 ; 8 ; 12 ....&quot;));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if (patrn == 16)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, &quot;Correct!&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, &quot;Incorrect!&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //////////////////<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 9:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  patrn = Integer.parseInt(JOptionPane.showInputDialog(&quot;What is the next number: \n 1000 ; 2000 ; 3000 ....&quot;));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if (patrn == 4000)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, &quot;Correct!&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, &quot;Incorrect!&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //////////////////<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 10:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  patrn = Integer.parseInt(JOptionPane.showInputDialog(&quot;What is the next number: \n 9 ; 18 ; 27 ....&quot;));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if (patrn == 36)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, &quot;Correct!&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, &quot;Incorrect!&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /////////////////<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 11:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  patrn = Integer.parseInt(JOptionPane.showInputDialog(&quot;What is the next number: \n 3 ; 6 ; 9 ....&quot;));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if (patrn == 12)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, &quot;Correct!&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, &quot;Incorrect!&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /////////////////<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 12:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  patrn = Integer.parseInt(JOptionPane.showInputDialog(&quot;What is the next number: \n 23 ; 46 ; 69 ....&quot;));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if (patrn == 92)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, &quot;Correct!&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, &quot;Incorrect!&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //////////////////<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (menu.equals (options [2]))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  JOptionPane.showMessageDialog(null,&quot;Thank you for playing!! \n Credits: \t Charl Potgieter&quot;);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp;  }</pre><br />
Thank you for your time and patience,<br />
 - Charl aka Potty391</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>Potty391</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236379.html</guid>
		</item>
		<item>
			<title>catch without try</title>
			<link>http://www.daniweb.com/forums/thread236369.html</link>
			<pubDate>Thu, 05 Nov 2009 20:36:51 GMT</pubDate>
			<description><![CDATA[Can anyone shed some light on these errors? 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox" title="Help with Code Tags" target="_blank">Help with Code Tags</a>...]]></description>
			<content:encoded><![CDATA[<div>Can anyone shed some light on these errors?<br />
 <pre style="margin:20px; line-height:13px">public void FaultHandler () {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int faultCount = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  while ( faultCount &lt; 4 ) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DatagramPacket request =<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; new DatagramPacket(requestArray, requestArray.length, aHost, proxyPort);&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; aSocket.send(request);&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp;  try {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; aSocket.setSoTimeout(4000);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; aSocket.receive(reply);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp;  catch ( SocketTimeoutException e ) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; faultCount++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; continue; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp;  catch ( IOException e ){}<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp;  catch ( IOException e ) {}&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //----it doesn't like this line!<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ( faultCount &gt;= 3 )<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.exit(0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }</pre><br />
I keep getting these errors: <br />
<br />
 'catch' without 'try'<br />
	 catch ( IOException e ) {}	<br />
	 ^<br />
Ex2Client.java:18: ')' expected<br />
	 catch ( IOException e ) {}	<br />
	                    ^<br />
Ex2Client.java:18: not a statement<br />
	 catch ( IOException e ) {}	<br />
	       ^<br />
Ex2Client.java:18: ';' expected<br />
	 catch ( IOException e ) {}</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>nonshatter</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236369.html</guid>
		</item>
		<item>
			<title>how can i show a wap site in J2ME application ???</title>
			<link>http://www.daniweb.com/forums/thread236366.html</link>
			<pubDate>Thu, 05 Nov 2009 20:25:37 GMT</pubDate>
			<description>Hi  
i want to show a wap website on Java ME application but i dont know how !!! 
please help me to do it  
thanks</description>
			<content:encoded><![CDATA[<div>Hi <br />
i want to show a wap website on Java ME application but i dont know how !!!<br />
please help me to do it <br />
thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>mahdi68</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236366.html</guid>
		</item>
		<item>
			<title>Java html reading</title>
			<link>http://www.daniweb.com/forums/thread236349.html</link>
			<pubDate>Thu, 05 Nov 2009 18:51:04 GMT</pubDate>
			<description><![CDATA[I haven't ever messed with any webpages through java and I'm kind of curious as to how it would work. I have a specific question that perhaps someone will be able to answer. 
 
How would one go about pulling certain information from a forum? To better understand what I am asking, I'll give an...]]></description>
			<content:encoded><![CDATA[<div>I haven't ever messed with any webpages through java and I'm kind of curious as to how it would work. I have a specific question that perhaps someone will be able to answer.<br />
<br />
How would one go about pulling certain information from a forum? To better understand what I am asking, I'll give an example:<br />
<br />
Lets say I am surfing this forum and am currently at: <div style="margin:20px; margin-top:5px; "> <div class="smallfont" style="margin-bottom:2px">Quote:</div> <table cellpadding="5" cellspacing="0" border="0" width="100%"> <tr> <td class="alt2"> <hr />  <a rel="nofollow" class="t" href="http://www.daniweb.com/forums/forum9.html" target="_blank">http://www.daniweb.com/forums/forum9.html</a>  <hr /> </td> </tr> </table> </div>Then I click view source, this gives me the source of the current page opened. <br />
<br />
Now lets say I want to pull out every title in there. Ex. <span style="font-weight:bold">title=&quot;&quot;</span><br />
<br />
After pulling out each title I would want to add it to a text file or something of the sort so I can refer to it later. For the mean time I would probably add it to an arraylist of some sort because the next thing I would want it to do is click next page and do it to the following page.<br />
<br />
Can anyone shed some light on how to do such a thing? Or perhaps let me know what I need to read up on to get where I'm wanting to go.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>KirkPatrick</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236349.html</guid>
		</item>
		<item>
			<title>Crisis with co2 footprint program</title>
			<link>http://www.daniweb.com/forums/thread236343.html</link>
			<pubDate>Thu, 05 Nov 2009 18:34:50 GMT</pubDate>
			<description>what i am trying to do is take alot of information and use it to calculate a persons carbon footprint based on a list of things that are in the second class of my program. im trying to make everything very easy to read program wise. im doing this assignment and i got in over my head trying to get...</description>
			<content:encoded><![CDATA[<div>what i am trying to do is take alot of information and use it to calculate a persons carbon footprint based on a list of things that are in the second class of my program. im trying to make everything very easy to read program wise. im doing this assignment and i got in over my head trying to get it done. im trying to work down from bigger problems to specific questions, but at this point i would greatly appreciate it if you guys could point out some of my errors that i am not catching. if anyone can help it is most def appreciated. im super lost and i have to get this done.<br />
<br />
 <pre style="margin:20px; line-height:13px">public class CO2Footprint<br />
{<br />
&nbsp; &nbsp; &nbsp;  CO2Footprint()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; public void calculateGasEmissions(int [] gas){<br />
&nbsp; &nbsp; &nbsp; &nbsp; double[] gasFootprint = new double[5];<br />
&nbsp; &nbsp; &nbsp; &nbsp; for(int counter = 0; counter &lt;= 5; counter++){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gasFootprint[counter] = 19.3565 * gas[counter];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; public void calculateElectricityEmissions(int [] averageElectricBill, int [] averageElecPrice){<br />
&nbsp; &nbsp; &nbsp; &nbsp; double[] electricityEmissions = new double[5];<br />
&nbsp; &nbsp; &nbsp; &nbsp; for(int counter = 0; counter &lt;= 5; counter++){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  electricityEmissions[counter] = (averageElectricBill[counter]/averageElecPrice[counter]) * 1.37 * 12;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
<br />
&nbsp; &nbsp; public void calcWasteReduction(int [] lightsTotal){<br />
&nbsp; &nbsp; &nbsp; &nbsp; double[] emissionReductions = new double[5];<br />
&nbsp; &nbsp; &nbsp; &nbsp; for(int counter = 0; counter &lt;=5; counter++){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; emissionReductions[counter] = lightsTotal[counter] * 1.37 * 73;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp;  public void calcGrossWasteEmission(int [] numberOfPeople) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double[] grossWasteEmission = new double[5];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for(int counter = 0; counter &lt;=5; counter++){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; grossWasteEmission[counter] = numberOfPeople[counter] * 1018;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
}<br />
<br />
&nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; public void calcNetWasteReduction(boolean [] cans,boolean [] plastic,boolean [] glass,boolean [] paper, double[] grossWasteEmission,int [] numberOfPeople, int[] emissionReductions) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  for (int counter = 0; counter&lt;=5; counter++){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if (cans[counter]){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  double canReductions = 165.8;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  grossWasteEmission[counter] -= (canReductions * numberOfPeople[counter]) - emissionReductions[counter];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int counter = 0; counter&lt;=5; counter++){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if(glass[counter]){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  double glassReductions = 46.6 ;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  grossWasteEmission[counter] -= (glassReductions * numberOfPeople[counter]) - emissionReductions[counter];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  for (int counter = 0; counter&lt;=5; counter++){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(plastic[counter]){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  double plasticReductions = 25.6;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; grossWasteEmission[counter] -= (plasticReductions * numberOfPeople[counter]) - emissionReductions[counter];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int counter = 0; counter&lt;=5; counter++){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if(paper[counter]){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  double paperReductions = 184.0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  grossWasteEmission[counter] -= (paperReductions * numberOfPeople[counter]) - emissionReductions[counter];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
}</pre><br />
<br />
 <pre style="margin:20px; line-height:13px">public class CO2FootPrintTester<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; public static void main(String[] args){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; //declaration of variables <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp;  int [] numberOfPeople =&nbsp; new int[5];<br />
&nbsp; &nbsp; &nbsp;  numberOfPeople[0] = 3;<br />
&nbsp; &nbsp; &nbsp;  numberOfPeople[1] = 6;<br />
&nbsp; &nbsp; &nbsp;  numberOfPeople[2] = 2;<br />
&nbsp; &nbsp; &nbsp;  numberOfPeople[3] = 10;<br />
&nbsp; &nbsp; &nbsp;  numberOfPeople[4] = 1;<br />
&nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp;  double [] avgElecBill = new double[5];<br />
&nbsp; &nbsp; &nbsp;  avgElecBill[0] = 227.29;<br />
&nbsp; &nbsp; &nbsp;  avgElecBill[1] = 213.28;<br />
&nbsp; &nbsp; &nbsp;  avgElecBill[2] = 234.78;<br />
&nbsp; &nbsp; &nbsp;  avgElecBill[3] = 256.04;<br />
&nbsp; &nbsp; &nbsp;  avgElecBill[4] = 221.96;<br />
&nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp;  for (int counter = 0; counter &lt;=5; counter++){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  int totalAverageElectricBill = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  totalAverageElectricBill += avgElecBill [counter];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  int&nbsp; averageElectricBill&nbsp; = totalAverageElectricBill / 5;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp;  boolean [] cans = new boolean[5];<br />
&nbsp; &nbsp; &nbsp;  cans[0] = true;<br />
&nbsp; &nbsp; &nbsp;  cans[1] = false;<br />
&nbsp; &nbsp; &nbsp;  cans[2] = true;<br />
&nbsp; &nbsp; &nbsp;  cans[3] = false;<br />
&nbsp; &nbsp; &nbsp;  cans[4] = true;<br />
&nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp;  boolean [] glass = new boolean[5];<br />
&nbsp; &nbsp; &nbsp;  glass[0] = true;<br />
&nbsp; &nbsp; &nbsp;  glass[1] = false;<br />
&nbsp; &nbsp; &nbsp;  glass[2] = true;<br />
&nbsp; &nbsp; &nbsp;  glass[3] = false;<br />
&nbsp; &nbsp; &nbsp;  glass[4] = true;<br />
&nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp;  boolean [] plastic = new boolean[5];<br />
&nbsp; &nbsp; &nbsp;  plastic[0] = true;<br />
&nbsp; &nbsp; &nbsp;  plastic[1] = true;<br />
&nbsp; &nbsp; &nbsp;  plastic[2] = false;<br />
&nbsp; &nbsp; &nbsp;  plastic[3] = false;<br />
&nbsp; &nbsp; &nbsp;  plastic[4] = true;<br />
&nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp;  boolean [] paper&nbsp; = new boolean[5];<br />
&nbsp; &nbsp; &nbsp;  paper[0] = true;<br />
&nbsp; &nbsp; &nbsp;  paper[1] = false;<br />
&nbsp; &nbsp; &nbsp;  paper[2] = true;<br />
&nbsp; &nbsp; &nbsp;  paper[3] = false;<br />
&nbsp; &nbsp; &nbsp;  paper[4] = true;<br />
&nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp;  int [] numLights = new int[5];<br />
&nbsp; &nbsp; &nbsp;  numLights[0] = 9;<br />
&nbsp; &nbsp; &nbsp;  numLights[1] = 3;<br />
&nbsp; &nbsp; &nbsp;  numLights[2] = 5;<br />
&nbsp; &nbsp; &nbsp;  numLights[3] = 1;<br />
&nbsp; &nbsp; &nbsp;  numLights[4] = 8;<br />
&nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp;  for (int counter = 0; counter&lt;=5; counter++){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  int []&nbsp; lightsTotal;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  lightsTotal[counter] += numLights[counter];<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp;  int [] gas = new int[5];<br />
&nbsp; &nbsp; &nbsp;  gas[0] = 2604;<br />
&nbsp; &nbsp; &nbsp;  gas[1] = 3029;<br />
&nbsp; &nbsp; &nbsp;  gas[2] = 1745;<br />
&nbsp; &nbsp; &nbsp;  gas[3] = 3590; <br />
&nbsp; &nbsp; &nbsp;  gas[4] = 1362;<br />
&nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp;  for (int counter = 0; counter&lt;=5; counter++){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  int gasTotal = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  gasTotal += gas[counter];<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp;  double [] avgElecPrice = new double[5];<br />
&nbsp; &nbsp; &nbsp;  avgElecPrice[0] =&nbsp; .084;<br />
&nbsp; &nbsp; &nbsp;  avgElecPrice[1] = .081;<br />
&nbsp; &nbsp; &nbsp;  avgElecPrice[2] = .085;<br />
&nbsp; &nbsp; &nbsp;  avgElecPrice[3] = .084; <br />
&nbsp; &nbsp; &nbsp;  avgElecPrice[4] = .086; <br />
&nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp;  for (int counter = 0; counter &lt;=5; counter++){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  int totalAverageElectricPrice = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  totalAverageElectricPrice += avgElecPrice[counter];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  int averageElecPrice = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  averageElecPrice = totalAverageElectricPrice / 5;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; //call methods<br />
&nbsp; &nbsp; &nbsp; &nbsp; for (int counter = 0; counter &lt;=4; counter ++){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; gasFootprint[counter] = CO2Footprint.calculateGasEmissions(gas);<br />
&nbsp; &nbsp; &nbsp; &nbsp; electricityEmissions[counter] = CO2Footprint.calculateElectricityEmissions(averageElectricBill, averageElecPrice);<br />
&nbsp; &nbsp; &nbsp; &nbsp; emissionReductions[counter] =&nbsp; CO2Footprint.calcNetWasteReduction(cans,plastic,glass,paper, grossWasteEmission,numberOfPeople);<br />
&nbsp; &nbsp; &nbsp; &nbsp; grossWasteEmission[counter] = CO2Footprint.calcGrossWasteEmission(numberOfPeople);<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; //print results<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Pounds of CO2&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  |&nbsp; &nbsp; &nbsp; Pounds of CO2&nbsp; &nbsp; &nbsp; &nbsp;  |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  |&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Emmited from&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |&nbsp; &nbsp; &nbsp; Reduced from&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  |&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;|&nbsp;  Gas&nbsp;  |&nbsp; &nbsp; &nbsp; Electricity&nbsp; |&nbsp;  Waste&nbsp;  |&nbsp;  Recycling&nbsp; |&nbsp; New Bulbs&nbsp; |&nbsp; &nbsp; CO2 Footprint&nbsp; &nbsp; &nbsp; |&quot;);<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; }<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>gibson.nathan</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236343.html</guid>
		</item>
		<item>
			<title>working with Java GUI</title>
			<link>http://www.daniweb.com/forums/thread236334.html</link>
			<pubDate>Thu, 05 Nov 2009 17:46:17 GMT</pubDate>
			<description><![CDATA[This project is similar to, but not exactly like, my phonetic project.  I am having to construct a GUI and have done so. I have been able to get everything except one part. 
 
What I need it to do is: 
1) User inputs a string   (this part works) 
2) When user clicks button "Code It" it needs to...]]></description>
			<content:encoded><![CDATA[<div>This project is similar to, but not exactly like, my phonetic project.  I am having to construct a GUI and have done so. I have been able to get everything except one part.<br />
<br />
What I need it to do is:<br />
1) User inputs a string   (this part works)<br />
2) When user clicks button &quot;Code It&quot; it needs to convert the string into Morse code.   (this part is what isn't working)<br />
<br />
I don't know how to set it up to do it. I'm trying to use an array to do it.<br />
<br />
What it does:<br />
1) Takes user's input<br />
2) When user clicks button &quot;Code It&quot; it just displays the string they entered.<br />
<br />
Any ideas and help will be appreciated.<br />
 <pre style="margin:20px; line-height:13px">package morsecode;<br />
<br />
import javax.swing.*;<br />
import java.awt.*;<br />
import java.awt.event.*;<br />
<br />
public class MorseCode<br />
{<br />
&nbsp; &nbsp; public static class morseCode implements ActionListener<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; JFrame frame;<br />
&nbsp; &nbsp; &nbsp; &nbsp; JPanel contentPane;<br />
&nbsp; &nbsp; &nbsp; &nbsp; JTextField words;<br />
&nbsp; &nbsp; &nbsp; &nbsp; JButton CodeIt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; JLabel enterString, coded;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; public morseCode()<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Create and set up the frame<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; frame = new JFrame(&quot;Morse Code&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Create a content pane with a BoxLayout<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // and empty borders<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; contentPane = new JPanel();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; contentPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 100));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; contentPane.setLayout(new GridLayout(4,2,5,10));<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Create a text field and a descriptive label<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; enterString = new JLabel(&quot;Enter string: &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; contentPane.add(enterString);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; words = new JTextField(50);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; contentPane.add(words);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Create a display morseCode button<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CodeIt = new JButton(&quot;Code It&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CodeIt.addActionListener(this);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; contentPane.add(CodeIt);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Create a label that will display text in morse code<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; coded = new JLabel(&quot; &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; contentPane.add(coded);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Add content pane to frame<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; frame.setContentPane(contentPane);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Size and then diplay the frame<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; frame.pack();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; frame.setVisible(true);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
<br />
//////////// I think this is the section where I need to put my array<br />
//////////// set up since it retrieves the user input and I believe<br />
//////////// displays it<br />
&nbsp; &nbsp; &nbsp; &nbsp; public void actionPerformed(ActionEvent event)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String text = words.getText();<br />
//&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; char[] stringArray = text.toCharArray();<br />
//&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String[] morse = {&quot;.- &quot;,&quot;-... &quot;,&quot;-.-. &quot;,&quot;-.. &quot;,&quot;. &quot;,&quot;..-. &quot;,&quot;--. &quot;,&quot;.... &quot;,&quot;.. &quot;,&quot;.--- &quot;,&quot;-.- &quot;,&quot;.-.. &quot;,&quot;-- &quot;,&quot;-. &quot;,&quot;--- &quot;,&quot;.--. &quot;,&quot;--.- &quot;,&quot;.-. &quot;,&quot;... &quot;,&quot;- &quot;,&quot;..- &quot;,&quot;...- &quot;,&quot;.-- &quot;,&quot;-..- &quot;,&quot;-.-- &quot;,&quot;--.. &quot;};<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; coded.setText(text);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; private static void runGUI()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; JFrame.setDefaultLookAndFeelDecorated(true);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; morseCode greeting = new morseCode();<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public static void main(String[] args)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; javax.swing.SwingUtilities.invokeLater(new Runnable()<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void run()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; runGUI();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; });<br />
&nbsp; &nbsp; }<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>_dragonwolf_</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236334.html</guid>
		</item>
		<item>
			<title>Question about tables</title>
			<link>http://www.daniweb.com/forums/thread236321.html</link>
			<pubDate>Thu, 05 Nov 2009 16:41:24 GMT</pubDate>
			<description><![CDATA[I have an int table, consisting of 7 ints, and is wondering if there is any way of avoiding the same int to be entered twice. And if entering the same int twice, the user of the program would have to re-enter the int again. 
 
this is what i've got so far, but it doesn't seem to work at all.. 
 
 ...]]></description>
			<content:encoded><![CDATA[<div>I have an int table, consisting of 7 ints, and is wondering if there is any way of avoiding the same int to be entered twice. And if entering the same int twice, the user of the program would have to re-enter the int again.<br />
<br />
this is what i've got so far, but it doesn't seem to work at all..<br />
<br />
 <pre style="margin:20px; line-height:13px">&nbsp; &nbsp; &nbsp; &nbsp; if(tab1[i] == tab1[i])<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(tab1[i]+&quot; is already used&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //reduses index<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  i--;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  kb.nextLine();</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>2Mas</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236321.html</guid>
		</item>
		<item>
			<title>default contructor?</title>
			<link>http://www.daniweb.com/forums/thread236285.html</link>
			<pubDate>Thu, 05 Nov 2009 14:15:29 GMT</pubDate>
			<description>im a astudent @ LTHS, in my forst year of Java, how do i make a default, and non-default contructor, and how to they work?</description>
			<content:encoded><![CDATA[<div>im a astudent @ LTHS, in my forst year of Java, how do i make a default, and non-default contructor, and how to they work?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>brokenbentou</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236285.html</guid>
		</item>
		<item>
			<title>Reasigning variables</title>
			<link>http://www.daniweb.com/forums/thread236277.html</link>
			<pubDate>Thu, 05 Nov 2009 13:52:39 GMT</pubDate>
			<description><![CDATA[I'm getting StringIndexOutOfBoundsException when I try to reasign the value of a variable. 
 
protString = protString.substring(newRPos+1, input.length()); 
I understand that this is something I would rather not do... but as I don't know the index of newRPos I can't think of another way to iterate....]]></description>
			<content:encoded><![CDATA[<div>I'm getting StringIndexOutOfBoundsException when I try to reasign the value of a variable.<br />
<br />
 <pre style="margin:20px; line-height:13px">protString = protString.substring(newRPos+1, input.length());</pre><br />
I understand that this is something I would rather not do... but as I don't know the index of newRPos I can't think of another way to iterate.<br />
<br />
Thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>skiplatte</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236277.html</guid>
		</item>
		<item>
			<title>problem with character space (character search)</title>
			<link>http://www.daniweb.com/forums/thread236264.html</link>
			<pubDate>Thu, 05 Nov 2009 12:59:36 GMT</pubDate>
			<description><![CDATA[Hi :-) 
 
Yeah I'm new to this whole thing, that's why I'm probably going to ask a lot of stupid questions, I apologize in advance.. 
The story is: I'm writing a program to enter a string and a search character and output the number of times this character occured in the string. 
 
    // s for...]]></description>
			<content:encoded><![CDATA[<div>Hi :-)<br />
<br />
Yeah I'm new to this whole thing, that's why I'm probably going to ask a lot of stupid questions, I apologize in advance..<br />
The story is: I'm writing a program to enter a string and a search character and output the number of times this character occured in the string.<br />
<br />
 <pre style="margin:20px; line-height:13px">&nbsp; &nbsp; // s for string and c for search character<br />
&nbsp; &nbsp; &nbsp; &nbsp; int i = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int result = 0; //number of occurences<br />
&nbsp; &nbsp; &nbsp; &nbsp; for(i = 0; i &lt; s.length(); i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (s.charAt(i) == c) //<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; result++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }</pre><br />
Everything is fine, but I haven't got a clue how to handle the situation where the search character is a space (or other special characters i guess)..<br />
Thanks for the help :-)</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>snehula</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236264.html</guid>
		</item>
		<item>
			<title>applet</title>
			<link>http://www.daniweb.com/forums/thread236225.html</link>
			<pubDate>Thu, 05 Nov 2009 10:09:13 GMT</pubDate>
			<description>plz help me in resolving a error:applet started:applet not initialized 
 
 
import java.awt.*; 
import java.awt.Button; 
import java.awt.Label; 
import java.awt.TextField; 
import java.applet.*; 
import java.applet.Applet; 
import java.awt.event.*;</description>
			<content:encoded><![CDATA[<div>plz help me in resolving a error:applet started:applet not initialized<br />
<br />
 <pre style="margin:20px; line-height:13px">import java.awt.*;<br />
import java.awt.Button;<br />
import java.awt.Label;<br />
import java.awt.TextField;<br />
import java.applet.*;<br />
import java.applet.Applet;<br />
import java.awt.event.*;<br />
import java.awt.event.ActionListener;<br />
import java.awt.event.ActionEvent;<br />
//&lt;applet code=&quot;prg9.class&quot; height=600 width=500&gt; &lt;/applet&gt;<br />
&nbsp;<br />
public class prg9 extends Applet implements ActionListener<br />
{<br />
&nbsp;<br />
&nbsp;String str=&quot; &quot;;<br />
&nbsp;TextField tf&#91; &#93; = new TextField&#91;3&#93;;<br />
&nbsp;Label name,regno,percentage,per,result,res,totmarks;<br />
&nbsp;Button reset,report;<br />
&nbsp;Label lab&#91; &#93; = new Label&#91;9&#93;;<br />
&nbsp;public void init( )<br />
&nbsp;{<br />
&nbsp;  name=new Label(&quot;Enter name&quot;);<br />
&nbsp;  regno=new Label(&quot;Enter regno:&quot;);<br />
&nbsp;  totmarks=new Label(&quot;Enter total marks&quot;);<br />
&nbsp;  percentage=new Label(&quot;percentage&quot;);<br />
&nbsp;  per=new Label(&quot; &quot;);<br />
&nbsp;  result=new Label(&quot;result&quot;);<br />
&nbsp;  res=new Label(&quot; &quot;);<br />
&nbsp;  for(int i=0;i&lt;3;i++)<br />
&nbsp;  {<br />
&nbsp; &nbsp; TextField tf&#91;&#93;=new TextField&#91;20&#93;;<br />
&nbsp;  }<br />
&nbsp;  for(int i=0;i&lt;9;i++)<br />
&nbsp;  {<br />
&nbsp; &nbsp; Label lab&#91; &#93;=new Label&#91;9&#93;;<br />
&nbsp;  }<br />
&nbsp;  report =new Button(&quot;Create Report&quot;);<br />
&nbsp;  reset=new Button(&quot;Reset&quot;);<br />
&nbsp;  setLayout(new GridLayout(10,1));<br />
&nbsp;  add(name);<br />
&nbsp;  add(tf&#91;0&#93;);<br />
&nbsp;  add(lab&#91;0&#93;);<br />
&nbsp;  add(regno);<br />
&nbsp;  add(tf&#91;1&#93;);<br />
&nbsp;  add(lab&#91;0&#93;);<br />
&nbsp;  add(totmarks);<br />
&nbsp;  add(tf&#91;2&#93;);<br />
&nbsp;  add(lab&#91;0&#93;);<br />
&nbsp;  add(percentage);<br />
&nbsp;  add(per);<br />
&nbsp;  add(lab&#91;0&#93;);<br />
&nbsp;  add(result);<br />
&nbsp;  add(res);<br />
&nbsp;  add(lab&#91;0&#93;);<br />
&nbsp;  add(report);<br />
&nbsp;  add(lab&#91;0&#93;);<br />
&nbsp;  add(reset);<br />
&nbsp;  report.addActionListener(this);<br />
&nbsp;  reset.addActionListener(this);<br />
&nbsp;}<br />
public void actionPerformed(ActionEvent ae)<br />
{<br />
&nbsp; str=ae.getActionCommand();<br />
&nbsp; int tot=Integer.parseInt(tf&#91;2&#93;.getText());<br />
&nbsp; int perc=tot/5;<br />
&nbsp; per.setText(&quot; &quot; + perc);<br />
&nbsp; if(str.equals(&quot;Create Report&quot;))<br />
&nbsp;  {<br />
&nbsp; &nbsp;  if(perc&gt;=50 &amp;&amp; perc&lt;60)<br />
&nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; res.setText(&quot;Second Class&quot;);<br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(perc&gt;=60 &amp;&amp; perc&lt;85)<br />
&nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp;  res.setText(&quot;First Class&quot;);<br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp;  if(perc&gt;=85)<br />
&nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; res.setText(&quot;Distinction&quot;);<br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp;  if(perc&gt;=35 &amp;&amp; perc&lt;50)<br />
&nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; res.setText(&quot;Pass&quot;);<br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  res.setText(&quot;Fail&quot;);<br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp;  }<br />
&nbsp; &nbsp;  else<br />
&nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp;  Label msg=new Label(&quot;Passes Invalid Data&quot;);<br />
&nbsp; &nbsp;  }<br />
&nbsp; &nbsp;  if(str.equals(&quot;reset&quot;))<br />
&nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; per.setText(&quot; &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; res.setText(&quot; &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; for(int i=0;i&lt;3;i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tf&#91;i&#93;.setText(&quot; &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; }<br />
}<br />
public void paint(Graphics g)<br />
{<br />
&nbsp; g.drawString(str,200,200);<br />
}<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>rakheeindia</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236225.html</guid>
		</item>
		<item>
			<title><![CDATA[Noob: Declare & Initialise String Array]]></title>
			<link>http://www.daniweb.com/forums/thread236209.html</link>
			<pubDate>Thu, 05 Nov 2009 09:24:28 GMT</pubDate>
			<description><![CDATA[Hello 
 
I am just learning Java. I have some elmentary questions. In my code below there are 3 errors that occur: 
- How do I declare a string array of size 5 in Java correctly? 
- How do I cin :p, take in a string array element. Ie, in C++ cin >> string[i], how would I write that in Java? 
 
 
 
...]]></description>
			<content:encoded><![CDATA[<div>Hello<br />
<br />
I am just learning Java. I have some elmentary questions. In my code below there are 3 errors that occur:<br />
- How do I declare a string array of size 5 in Java correctly?<br />
- How do I cin :p, take in a string array element. Ie, in C++ cin &gt;&gt; string[i], how would I write that in Java?<br />
<br />
<br />
<br />
 <pre style="margin:20px; line-height:13px">package similie;<br />
<br />
import java.util.Scanner;<br />
<br />
<br />
public class Main {<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; public Main() {<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; public static void main() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; int cAdjective, cNoun;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int max;<br />
&nbsp; &nbsp; &nbsp; &nbsp; String adjective[5]; // error occurs here<br />
&nbsp; &nbsp; &nbsp; &nbsp; String noun[];<br />
&nbsp; &nbsp; &nbsp; &nbsp; Scanner scan = new Scanner(System.in);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Enter number of adjectives(must be less than 5): &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; cAdjective = scan.nextInt();<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Enter number of nouns(must be less than 5): &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; cNoun = scan.nextInt();<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; for (int i=0; i&lt;cAdjective; i++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  adjective[i] = scan.nextString();&nbsp; // I get an error here<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; for (int i=0; i&lt;cNoun; i++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; noun[i] = (String)System.in.read(); // I get an error here<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; if (cNoun &gt;= cAdjective) max = cNoun;<br />
&nbsp; &nbsp; &nbsp; &nbsp; else max = cAdjective;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;max =&quot;+max);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; for (int i=0; i&lt;cAdjective; i++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  for (int j=0; j&lt;cNoun; j++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  System.out.println(adjective[i]+&quot;as&quot;+noun[j]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; // do I write return 0; ??<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>gretty</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236209.html</guid>
		</item>
		<item>
			<title>problem with compiling</title>
			<link>http://www.daniweb.com/forums/thread236189.html</link>
			<pubDate>Thu, 05 Nov 2009 08:48:12 GMT</pubDate>
			<description>hi friends 
 
when i am running  my programe on cmd  in C:\Programe File\jdk1.6.0_14\bin  I got the message that  file name.java uses or overrides a deprecated API .  Recompile with -Xlint: deprecation for details . what it meant how it will solved  . please help me  
 
thanks in advance for reply...</description>
			<content:encoded><![CDATA[<div>hi friends<br />
<br />
when i am running  my programe on cmd  in C:\Programe File\jdk1.6.0_14\bin  I got the message that  file name.java uses or overrides a deprecated API .  Recompile with -Xlint: deprecation for details . what it meant how it will solved  . please help me <br />
<br />
thanks in advance for reply<br />
shashikant</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>shashikant.v</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236189.html</guid>
		</item>
		<item>
			<title>Interestin dilemma - See if you can help :)</title>
			<link>http://www.daniweb.com/forums/thread236167.html</link>
			<pubDate>Thu, 05 Nov 2009 07:03:53 GMT</pubDate>
			<description><![CDATA[Hi, 
 
I have stumbled on an interesting problem. I have thought 'n' thought, but haven't come up with any good ideas of how to handle this. 
 
I have a text file that contains many records, but without the records being seperated. I need to figure out how to seperate these files, or at least how...]]></description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
I have stumbled on an interesting problem. I have thought 'n' thought, but haven't come up with any good ideas of how to handle this.<br />
<br />
I have a text file that contains many records, but without the records being seperated. I need to figure out how to seperate these files, or at least how to write a program that recognizes different records and can then seperate them.<br />
<br />
I don't expect anyone to write my program for me, but I need help seperating the records.<br />
<br />
The beginning of every record looks like this: MSUBUGA JIMSON<br />
P O BOX 21273<br />
GABORONE<br />
(Obviously they are all different, but always have 3 values on 3 lines.)<br />
The end looks like this:<br />
P107.17 P0.00 P225.08 P0.00 P332.25<br />
(The numbers always vary, but there are always 5)<br />
<br />
Any help will be greatly appreciated, Thank you.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>P00dle</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236167.html</guid>
		</item>
		<item>
			<title><![CDATA[What's the difference between a parent and predecessor node in binary search tree?]]></title>
			<link>http://www.daniweb.com/forums/thread236161.html</link>
			<pubDate>Thu, 05 Nov 2009 06:48:42 GMT</pubDate>
			<description><![CDATA[Just wondering what the difference is. I don't think I need to post my code, but basically for my assignment, I have stubs for a binary search tree. There are nodes created in the constructor, and among them are: 
 
Node parent 
Node predecessor 
Node sucessor 
Node right 
Node left 
 
Is there a...]]></description>
			<content:encoded><![CDATA[<div>Just wondering what the difference is. I don't think I need to post my code, but basically for my assignment, I have stubs for a binary search tree. There are nodes created in the constructor, and among them are:<br />
<br />
Node parent<br />
Node predecessor<br />
Node sucessor<br />
Node right<br />
Node left<br />
<br />
Is there a point in predecessor and sucessor? Seems to me it would work with just parent, right, and left, no?<br />
<br />
Thanks :D</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>iamsmooth</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236161.html</guid>
		</item>
		<item>
			<title>Error on repairing program</title>
			<link>http://www.daniweb.com/forums/thread236137.html</link>
			<pubDate>Thu, 05 Nov 2009 04:17:23 GMT</pubDate>
			<description><![CDATA[Hi all. 
pls help me.I repair a program for my need.At that time Text are not appear.Original progarm is here. 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox"...]]></description>
			<content:encoded><![CDATA[<div>Hi all.<br />
pls help me.I repair a program for my need.At that time Text are not appear.Original progarm is here.<br />
 <pre style="margin:20px; line-height:13px"><br />
import java.awt.Color;<br />
import java.awt.Dimension;<br />
import java.awt.Rectangle;<br />
import java.awt.Toolkit;<br />
import java.awt.event.ActionEvent;<br />
import java.awt.event.ActionListener;<br />
import java.awt.event.MouseAdapter;<br />
import java.awt.event.MouseEvent;<br />
import java.io.IOException;<br />
import javax.swing.JFrame;<br />
import javax.swing.JLabel;<br />
import javax.swing.JPanel;<br />
import javax.swing.Timer;<br />
<br />
public class MarqueeFrame extends JFrame implements ActionListener {<br />
<br />
&nbsp; &nbsp; private Timer timer;<br />
&nbsp; &nbsp; private MarqueePanel marqueePanel;<br />
<br />
&nbsp; &nbsp; // Timer Event Handler<br />
&nbsp; &nbsp; public void actionPerformed(ActionEvent e) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; // move the Label in the MarqueePanel<br />
&nbsp; &nbsp; &nbsp; &nbsp; marqueePanel.moveLabel();<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public MarqueeFrame() {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; Dimension d = Toolkit.getDefaultToolkit().getScreenSize();<br />
&nbsp; &nbsp; &nbsp; &nbsp; setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);<br />
&nbsp; &nbsp; &nbsp; &nbsp; setSize(d.width,d.height);<br />
&nbsp; &nbsp; &nbsp; &nbsp; setTitle(&quot;Marquee&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; setResizable(false);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; timer = new Timer(150, this);<br />
&nbsp; &nbsp; &nbsp; &nbsp; marqueePanel = new MarqueePanel(timer);<br />
&nbsp; &nbsp; &nbsp; &nbsp; add(marqueePanel);<br />
&nbsp; &nbsp; &nbsp; &nbsp; timer.start();<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public static void main(String[] args) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; new MarqueeFrame().setVisible(true);<br />
&nbsp; &nbsp; }<br />
<br />
}<br />
<br />
<br />
class MarqueePanel extends JPanel {<br />
&nbsp; &nbsp; private int xLoc, yLoc;<br />
&nbsp; &nbsp; private Dimension dimension;<br />
&nbsp; &nbsp; private JLabel googleLabel;<br />
&nbsp; &nbsp; private JLabel yahooLabel;<br />
&nbsp; &nbsp; private Timer timer;<br />
<br />
&nbsp; &nbsp; public MarqueePanel(final Timer timer) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; this.timer = timer;<br />
&nbsp; &nbsp; &nbsp; &nbsp; setLayout(null);<br />
&nbsp; &nbsp; &nbsp; &nbsp; dimension = Toolkit.getDefaultToolkit().getScreenSize();<br />
&nbsp; &nbsp; &nbsp; &nbsp; xLoc = dimension.width;<br />
&nbsp; &nbsp; &nbsp; &nbsp; yLoc = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; googleLabel = new JLabel(&quot;Google&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; googleLabel.setForeground(Color.BLUE);<br />
&nbsp; &nbsp; &nbsp; &nbsp; yahooLabel = new JLabel(&quot;Yahoo&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; yahooLabel.setForeground(Color.RED);<br />
&nbsp; &nbsp; &nbsp; &nbsp; googleLabel.addMouseListener(new MouseAdapter() {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void mouseClicked(MouseEvent e) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (e.getClickCount() &gt; 0) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Runtime.getRuntime().exec(&quot;cmd.exe /c start http://www.google.com&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } catch (IOException ex) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(ex.getMessage());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void mouseEntered(MouseEvent e) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; timer.stop();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void mouseExited(MouseEvent e) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; timer.start();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; });<br />
&nbsp; &nbsp; &nbsp; &nbsp; yahooLabel.addMouseListener(new MouseAdapter() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void mouseClicked(MouseEvent e) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (e.getClickCount() &gt; 0) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Runtime.getRuntime().exec(&quot;cmd.exe /c start http://www.yahoo.com&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } catch (IOException ex) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(ex.getMessage());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void mouseEntered(MouseEvent e) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; timer.stop();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void mouseExited(MouseEvent e) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; timer.start();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; });<br />
&nbsp; &nbsp; &nbsp; &nbsp; add(googleLabel);<br />
&nbsp; &nbsp; &nbsp; &nbsp; add(yahooLabel);<br />
&nbsp; &nbsp; &nbsp; &nbsp; moveLabel();<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public void moveLabel() {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; Rectangle r = new Rectangle();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; r.x = xLoc;<br />
&nbsp; &nbsp; &nbsp; &nbsp; r.y = yLoc;<br />
&nbsp; &nbsp; &nbsp; &nbsp; Dimension size = googleLabel.getPreferredSize();<br />
&nbsp; &nbsp; &nbsp; &nbsp; r.width = size.width;<br />
&nbsp; &nbsp; &nbsp; &nbsp; r.height = size.height;<br />
&nbsp; &nbsp; &nbsp; &nbsp; googleLabel.setBounds(r);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; // Append the Width of First Label to avoid overlapping<br />
&nbsp; &nbsp; &nbsp; &nbsp; r.x += r.width + 5;<br />
&nbsp; &nbsp; &nbsp; &nbsp; size = yahooLabel.getPreferredSize();<br />
&nbsp; &nbsp; &nbsp; &nbsp; r.width = size.width;<br />
&nbsp; &nbsp; &nbsp; &nbsp; r.height = size.height;<br />
&nbsp; &nbsp; &nbsp; &nbsp; yahooLabel.setBounds(r);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; xLoc -= 5;<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (xLoc &lt; 0 )<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xLoc = dimension.width;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp;<br />
<br />
}</pre><br />
I repaired this as looping style.At that time.marquee text is not appear.Pls help me.Where I wrong?Thank in advance.Here is repaired program<br />
 <pre style="margin:20px; line-height:13px"><br />
import java.awt.Color;<br />
import java.awt.Dimension;<br />
import java.awt.Rectangle;<br />
import java.awt.Toolkit;<br />
import java.awt.event.ActionEvent;<br />
import java.awt.event.ActionListener;<br />
import java.awt.event.MouseAdapter;<br />
import java.awt.event.MouseEvent;<br />
import java.io.IOException;<br />
import javax.swing.JFrame;<br />
import javax.swing.JLabel;<br />
import javax.swing.JPanel;<br />
import javax.swing.Timer;<br />
<br />
public class MarqueeFrame extends JFrame implements ActionListener {<br />
<br />
&nbsp; &nbsp; private Timer timer;<br />
&nbsp; &nbsp; private MarqueePanel marqueePanel;<br />
<br />
&nbsp; &nbsp; // Timer Event Handler<br />
&nbsp; &nbsp; public void actionPerformed(ActionEvent e) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; // move the Label in the MarqueePanel<br />
&nbsp; &nbsp; &nbsp; &nbsp; marqueePanel.moveLabel();<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public MarqueeFrame() {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; Dimension d = Toolkit.getDefaultToolkit().getScreenSize();<br />
&nbsp; &nbsp; &nbsp; &nbsp; setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);<br />
&nbsp; &nbsp; &nbsp; &nbsp; setSize(d.width,d.height);<br />
&nbsp; &nbsp; &nbsp; &nbsp; setTitle(&quot;Marquee&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; setResizable(true);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; timer = new Timer(150, this);<br />
&nbsp; &nbsp; &nbsp; &nbsp; marqueePanel = new MarqueePanel(timer);<br />
&nbsp; &nbsp; &nbsp; &nbsp; add(marqueePanel);<br />
&nbsp; &nbsp; &nbsp; &nbsp; timer.start();<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public static void main(String[] args) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; new MarqueeFrame().setVisible(true);<br />
&nbsp; &nbsp; }<br />
<br />
}<br />
<br />
<br />
class MarqueePanel extends JPanel {<br />
&nbsp; &nbsp; private int xLoc, yLoc;<br />
&nbsp; &nbsp; private Dimension dimension;<br />
&nbsp; &nbsp; private JLabel googleLabel;<br />
&nbsp; &nbsp; private JLabel yahooLabel;<br />
&nbsp; &nbsp; private Timer timer;<br />
&nbsp; &nbsp; private JLabel stringlbl;<br />
&nbsp; &nbsp; String stringlabel[][];<br />
<br />
&nbsp; &nbsp; public MarqueePanel(final Timer timer) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; this.timer = timer;<br />
&nbsp; &nbsp; &nbsp; &nbsp; setLayout(null);<br />
&nbsp; &nbsp; &nbsp; &nbsp; dimension = Toolkit.getDefaultToolkit().getScreenSize();<br />
&nbsp; &nbsp; &nbsp; &nbsp; xLoc = dimension.width;<br />
&nbsp; &nbsp; &nbsp; &nbsp; yLoc = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; stringlabel =new String[2][2];<br />
&nbsp; &nbsp; &nbsp; &nbsp; stringlabel[0][0] = &quot;Google&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; stringlabel[0][1] = &quot;http://www.google.com&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; stringlabel[1][0] = &quot;Yahoo&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; stringlabel[1][1] = &quot;http://www.yahoo.com&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; for(int i=0;i&lt;stringlabel.length;i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stringlbl = new JLabel(stringlabel[i][0]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stringlbl.setForeground(Color.BLUE);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; final String link = stringlabel[i][1];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stringlbl.addMouseListener(new MouseAdapter() {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void mouseClicked(MouseEvent e) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (e.getClickCount() &gt; 0) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Runtime.getRuntime().exec(&quot;cmd.exe /c start &quot;+link);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } catch (IOException ex) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(ex.getMessage());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void mouseEntered(MouseEvent e) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; timer.stop();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void mouseExited(MouseEvent e) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; timer.start();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; });<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; add(stringlbl);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; moveLabel();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; /*googleLabel = new JLabel(&quot;Google&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; googleLabel.setForeground(Color.BLUE);<br />
&nbsp; &nbsp; &nbsp; &nbsp; yahooLabel = new JLabel(&quot;Yahoo&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; yahooLabel.setForeground(Color.RED);<br />
&nbsp; &nbsp; &nbsp; &nbsp; googleLabel.addMouseListener(new MouseAdapter() {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void mouseClicked(MouseEvent e) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (e.getClickCount() &gt; 0) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Runtime.getRuntime().exec(&quot;cmd.exe /c start http://www.google.com&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } catch (IOException ex) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(ex.getMessage());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void mouseEntered(MouseEvent e) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; timer.stop();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void mouseExited(MouseEvent e) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; timer.start();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; });<br />
&nbsp; &nbsp; &nbsp; &nbsp; yahooLabel.addMouseListener(new MouseAdapter() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void mouseClicked(MouseEvent e) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (e.getClickCount() &gt; 0) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Runtime.getRuntime().exec(&quot;cmd.exe /c start http://www.yahoo.com&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } catch (IOException ex) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(ex.getMessage());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void mouseEntered(MouseEvent e) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; timer.stop();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void mouseExited(MouseEvent e) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; timer.start();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; });<br />
&nbsp; &nbsp; &nbsp; &nbsp; add(googleLabel);<br />
&nbsp; &nbsp; &nbsp; &nbsp; add(yahooLabel);<br />
&nbsp; &nbsp; &nbsp; &nbsp; moveLabel();*/<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public void moveLabel() {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; Rectangle r = new Rectangle();<br />
&nbsp; &nbsp; &nbsp; &nbsp; r.x = xLoc;<br />
&nbsp; &nbsp; &nbsp; &nbsp; r.y = yLoc;<br />
&nbsp; &nbsp; &nbsp; &nbsp; Dimension size;// = googleLabel.getPreferredSize();<br />
&nbsp; &nbsp; &nbsp; &nbsp; for(int i=0;i&lt;stringlabel.length;i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JLabel label = new JLabel(stringlabel[i][0]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; size = label.getPreferredSize();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; r.width = size.width;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; r.height = size.height;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; label.setBounds(r);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; r.x += r.width+5;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; /*r.width = size.width;<br />
&nbsp; &nbsp; &nbsp; &nbsp; r.height = size.height;<br />
&nbsp; &nbsp; &nbsp; &nbsp; googleLabel.setBounds(r);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; // Append the Width of First Label to avoid overlapping<br />
&nbsp; &nbsp; &nbsp; &nbsp; r.x += r.width + 5;<br />
&nbsp; &nbsp; &nbsp; &nbsp; size = yahooLabel.getPreferredSize();<br />
&nbsp; &nbsp; &nbsp; &nbsp; r.width = size.width;<br />
&nbsp; &nbsp; &nbsp; &nbsp; r.height = size.height;<br />
&nbsp; &nbsp; &nbsp; &nbsp; yahooLabel.setBounds(r);*/<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; xLoc -= 5;<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (xLoc &lt; 0 )<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xLoc = dimension.width;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp;<br />
<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>Sandar Khin</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236137.html</guid>
		</item>
		<item>
			<title>Please give me a good idea to do my Individual Final year project in 6 months in Java</title>
			<link>http://www.daniweb.com/forums/thread236126.html</link>
			<pubDate>Thu, 05 Nov 2009 03:53:58 GMT</pubDate>
			<description><![CDATA[Hi All, 
Please tell me a good research idea to do a good project for my final year within 6 months. This is for my BSc Software Engineering degree. Its going to be an individual project and it would be great if its a research idea. :S 
 
I'm good in java, PHP, SQL, Groovy on Grails. Or pls let me...]]></description>
			<content:encoded><![CDATA[<div>Hi All,<br />
Please tell me a good research idea to do a good project for my final year within 6 months. This is for my BSc Software Engineering degree. Its going to be an individual project and it would be great if its a research idea. :S<br />
<br />
I'm good in java, PHP, SQL, Groovy on Grails. Or pls let me know a site or anything where I can get some new ideas of doing a project. <br />
<br />
Regards, <br />
Ushi</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>ushi324</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236126.html</guid>
		</item>
		<item>
			<title><![CDATA[Merging two files [editted]]]></title>
			<link>http://www.daniweb.com/forums/thread236125.html</link>
			<pubDate>Thu, 05 Nov 2009 03:51:27 GMT</pubDate>
			<description><![CDATA[I'm supposed to merge a ordered data of two files into a third file, keeping the data in order. I'm suppose to create a MergeFiles application that merges the integers ordered from low to high in two files into a third file, keeping the order from low to high. Then should merge the two files by...]]></description>
			<content:encoded><![CDATA[<div>I'm supposed to merge a ordered data of two files into a third file, keeping the data in order. I'm suppose to create a MergeFiles application that merges the integers ordered from low to high in two files into a third file, keeping the order from low to high. Then should merge the two files by taking one element at a time from each, and the third file should contain the numbers from both file from lowest to highest. so, i saved the numbers in wordpad as data1.txt, and data2.txt.<br />
<br />
Data1: 11 25 36 45 56 78 90<br />
Data2: 1 3 5 7 54 32 78 99 <br />
<br />
Then the third data should output: <br />
<br />
data3: 1 3 5 7 11 25 32 36 45 54 56 ..... so on (from low to high) <br />
<br />
So far I have this: <br />
import java.io.BufferedReader;<br />
import java.io.FileReader;<br />
import java.io.FileWriter;<br />
<br />
 <pre style="margin:20px; line-height:13px">public class Main {<br />
<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; public static void main(String[] args) {<br />
&nbsp; &nbsp; FileReader file1=new FileReader(&quot;Data1.txt&quot;);<br />
&nbsp; &nbsp; Scanner scan = new Scanner(new File(&quot;Data1.txt&quot;));<br />
&nbsp; &nbsp; ArrayList&lt;Integer&gt; values = new ArrayList&lt;Integer&gt;();<br />
&nbsp; &nbsp; collections.sort(values); <br />
<br />
&nbsp; &nbsp; while(scan.hasNextInt()) values.add(scan.nextInt());&nbsp; <br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; FileReader file2=new FileReader(&quot;Data2.txt&quot;);<br />
&nbsp; &nbsp; Scanner scan = new Scanner(new File(&quot;Data2.txt&quot;));<br />
&nbsp; &nbsp; ArrayList&lt;Integer&gt; values = new ArrayList&lt;Integer&gt;();<br />
&nbsp; &nbsp; collections.sot(values); <br />
<br />
&nbsp; &nbsp; while(scan.hasNextInt()) values.add(scan.nextInt());&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; BufferedReader br1 = new BufferedReader (file1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; BufferedReader br2 = new BufferedReader (file2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; String temp1, temp2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; while(br1.readLine() !=null)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; temp1=br1.readLine()+temp1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; while(br2.readLine()!=null)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; temp2=br2.readLine()+temp2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; String temp = temp1 + temp2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; FileWriter fw=new FileWriter(&quot;data3.txt&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; char buffer[]=new char[temp.length];<br />
&nbsp; &nbsp; &nbsp; &nbsp; temp.getChars(0,temp.length(),buffer,0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; fw.write(buffer);<br />
&nbsp; &nbsp; &nbsp; &nbsp; file1.close();<br />
&nbsp; &nbsp; &nbsp; &nbsp; file2.close();<br />
&nbsp; &nbsp; &nbsp; &nbsp; fw.close();<br />
&nbsp; &nbsp;  }<br />
}</pre><br />
I don't know what codes I'm missing... and when i compile there are 13 errors.... I would post the errors here but it's to long. <br />
So if u like just copy and paste this to ur java and test it.<br />
<br />
ugh whats wrong with my program &gt;&lt;&quot;</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>StarZ</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236125.html</guid>
		</item>
		<item>
			<title>button will not display</title>
			<link>http://www.daniweb.com/forums/thread236108.html</link>
			<pubDate>Thu, 05 Nov 2009 01:45:45 GMT</pubDate>
			<description><![CDATA[Hi, I am working on code to have a drop down menu from which you can pick items and add a button with that course.  Unfortunetally, I can't get the button to display.  And help is greatly appreciated. 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a...]]></description>
			<content:encoded><![CDATA[<div>Hi, I am working on code to have a drop down menu from which you can pick items and add a button with that course.  Unfortunetally, I can't get the button to display.  And help is greatly appreciated.<br />
<br />
 <pre style="margin:20px; line-height:13px">import java.awt.*;<br />
import java.awt.event.*;<br />
import javax.swing.*;<br />
<br />
public class ComboBoxFrame extends JFrame {<br />
&nbsp; &nbsp; &nbsp; &nbsp; /***/ private static final long serialVersionUID = 1L;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; private JComboBox b;<br />
&nbsp; &nbsp; &nbsp; &nbsp; private String s;<br />
&nbsp; &nbsp; &nbsp; &nbsp; private int x = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; private JButton g[] = new JButton[10];<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; private String courses[] = <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; { &quot;Advanced Functions&quot;, &quot;Calculus&quot;,&nbsp; &quot;Chemistry&quot;, &quot;Physics&quot; };<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; public ComboBoxFrame() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; super(&quot;Pick your courses!&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setLayout(new GridLayout(3, 3));<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b = new JComboBox(courses);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b.addItemListener( new ItemListener() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void itemStateChanged(ItemEvent event) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(event.getStateChange() == ItemEvent.SELECTED) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; s = (String) b.getSelectedItem();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; g[x] = new JButton(s);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; add(g[x]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //g[x].addActionListener(this);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; x++; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } } } );<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; add(b);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
/**&nbsp; &nbsp; &nbsp; &nbsp; public void actionPerformed(ActionEvent e) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String s;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for(int x = 0; x &lt; 10; x++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; s = courses[x];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(e.getSource() == s) remove(g[x]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }*/<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; public static void main(String args[]) { <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ComboBoxFrame comboBoxFrame = new ComboBoxFrame();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; comboBoxFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; comboBoxFrame.setSize( 350, 150 );<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; comboBoxFrame.setVisible( true );<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>vortex24</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236108.html</guid>
		</item>
		<item>
			<title>Java hang man, help please.</title>
			<link>http://www.daniweb.com/forums/thread236096.html</link>
			<pubDate>Thu, 05 Nov 2009 00:42:19 GMT</pubDate>
			<description><![CDATA[Hi, I'm new here. I have been looking around for the last few months. Very new to java and I need help with this assignment. I am to program hangman, I know that this has been asked multiple times. I just cannot seem to find the answers that I need. This is what I have so far. I can't seem to...]]></description>
			<content:encoded><![CDATA[<div>Hi, I'm new here. I have been looking around for the last few months. Very new to java and I need help with this assignment. I am to program hangman, I know that this has been asked multiple times. I just cannot seem to find the answers that I need. This is what I have so far. I can't seem to figure out what I need to do to print the letters in the correct underscore.  I was thinking the block comment section can be used to search for used letters. I think that is all that I have to do in my assignment, and it's the stuff that I don't understand or cannot think of a way to do it. Any help would be greatly appreciated. <br />
Thanks in advance<br />
 <pre style="margin:20px; line-height:13px"><br />
import java.util.*;<br />
import java.io.*;<br />
<br />
public class Assig3<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; public static void main(String &#91;&#93; args) throws IOException<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; boolean winYes;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int wins;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int i;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int guesses = 7;<br />
&nbsp; &nbsp; &nbsp; &nbsp; char &#91;&#93; letters = new char &#91;26&#93;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int index; <br />
&nbsp; &nbsp; &nbsp; &nbsp; char lettersGuessed;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int Wordquit = 2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int missWord = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; Scanner inScan = new Scanner(System.in);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Please enter your name\n&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Name.getName(inScan.next());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Loads the file as specifed by user<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; wordServer theWords = new wordServer();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Enter file name: &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Scanner keyScan = new Scanner(System.in);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String fName = keyScan.next();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; File inFile = new File(fName);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Scanner fScan = new Scanner(inFile);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; theWords.loadWords(fScan);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // creates current word object<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String current; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; current = theWords.getNextWord();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; StringBuilder guessedWord = new StringBuilder();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Shows user underscores of letters needed.<br />
&nbsp; &nbsp; &nbsp; &nbsp; do<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.print(&quot;Your word is: &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while( i &lt; current.length())<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; guessedWord.append('_');<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(guessedWord);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; index = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while(guesses &gt; 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;You have &quot; + guesses + &quot; left.&quot;); // tells user number of guesses left<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for(i = 0; i &lt;= index - 1; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(letters&#91;i&#93;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //prompts user to make a guess.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Please make a guess: &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lettersGuessed = inScan.nextChar();<br />
/*&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; char guess = letter.charAt(0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; boolean correctGuess = false;<br />
&nbsp; &nbsp; &nbsp; &nbsp; for(int k = 0; k &lt; current.length(); k++)&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(guess == digit&#91;i&#93;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hidden&#91;i&#93; = guess;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; correctGuess = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
*/&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; letters&#91;index&#93; = lettersGuessed; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; index++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Enter 0 to quit word: &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Enter 1 to quit word: &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; wordQuit = inScan.nextInt();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while(wordQuit = 2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}</pre><br />
 <pre style="margin:20px; line-height:13px">import java.util.*;<br />
import java.io.*;<br />
<br />
public class wordServer<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; String &#91;&#93; words;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int num;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int &#91;&#93; usedInd;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int i;<br />
&nbsp; &nbsp; &nbsp; &nbsp; String empty = &quot;&nbsp; &quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; public wordServer()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  i = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; public void loadWords(Scanner S) throws IOException // loads &quot;dictionary&quot; of words.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; num = S.nextInt();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; words = new String &#91;num&#93;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; usedInd = new int &#91;num&#93;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int i = 0; i &lt; num; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; words&#91;i&#93; = S.nextLine();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; S.close();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; public String getNextWord() // Finds a random index number. then returns a random word.<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; do<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int ranInd = (int)(words.length * Math.Random()) + 1<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int hit = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for(int j = 0; j &lt;= i - 1; j++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(ranInd == usedInd&#91;j&#93;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hit = 1;&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while(hit = 1);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; usedInd&#91;i&#93; = ranInd;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return words&#91;ranInd&#93;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}</pre><br />
I also have one last class which is hangPlayer. All this has is holding information of the player. name, wins, misses. And then a StringBuilder which returns the information in a neat and organized way.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>skelator</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236096.html</guid>
		</item>
		<item>
			<title>Taking too long to print out 500x500 2D Array</title>
			<link>http://www.daniweb.com/forums/thread236082.html</link>
			<pubDate>Wed, 04 Nov 2009 23:25:25 GMT</pubDate>
			<description>So one of the problems I have been having with my programs is the length of time it takes to print out a pixel map into the XPM file. 
 
I tested it with like : 
500 rows and 2 columns -- 1 second 
500 rows and 10 columns -- a few seconds 
500 rows and 200 columns -- about 20 seconds 
 
When I try...</description>
			<content:encoded><![CDATA[<div>So one of the problems I have been having with my programs is the length of time it takes to print out a pixel map into the XPM file.<br />
<br />
I tested it with like :<br />
500 rows and 2 columns -- 1 second<br />
500 rows and 10 columns -- a few seconds<br />
500 rows and 200 columns -- about 20 seconds<br />
<br />
When I try and output the full 500x500 grid after about 4 minutes it's still not done.<br />
<br />
Here is the only method I have been using to do this, maybe there is a more efficient way of doing it that I don't know about?<br />
<br />
 <pre style="margin:20px; line-height:13px">public void addRowsToGrid()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; String allRows = &quot;&quot;;<br />
&nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; for(int i = 0;i &lt; 500; i++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; allRows += &quot;\&quot;&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for(int j = 0;j &lt; 500; j++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; allRows += grid&#91;i&#93;&#91;j&#93;.getColor();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (i != 499) {allRows += &quot;\&quot;,\n&quot;;}<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if (i == 499) {allRows += &quot;\&quot;\n&quot;;}<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; allRows += &quot;};\n&quot;;<br />
&nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; XPM += allRows;<br />
&nbsp; &nbsp; }</pre><br />
Can I get some feedback?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>gotm</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236082.html</guid>
		</item>
		<item>
			<title>News Story Drag-and-drop GUI-testing for Windows 7</title>
			<link>http://www.daniweb.com/news/story236035.html</link>
			<pubDate>Wed, 04 Nov 2009 19:13:47 GMT</pubDate>
			<description><![CDATA[GUIdancer 3.2, the latest version of flagship automated GUI testing tool from Bredex, now "officially" supports Windows 7 and Vista, and includes additional enhancements to its library of pre-built test actions. It began shipping on Nov. 3. Before you decide that US$5785 is too much to pay for an...]]></description>
			<content:encoded><![CDATA[<div>GUIdancer 3.2, the latest version of flagship automated GUI testing tool from Bredex, now &quot;officially&quot; supports Windows 7 and Vista, and includes additional enhancements to its library of pre-built test actions. It began shipping on Nov. 3. Before you decide that US$5785 is too much to pay for an automated keyword testing tool (more if you're subject to Germany's voracious appropriation tax), take a look at <a rel="nofollow" class="t" href="http://www.bredex.de/en/guidancer/downloads.html<br />" target="_blank">these demos of the software</a> in action. You can also <a rel="nofollow" class="t" href="https://cgi.bredex.de/GUIdancerShop/downloadpage.do" target="_blank">try the software</a> for two weeks for free. There are versions for Linux and Windows; a Mac OX S version is in beta. <br />
<br />
According to the company, new actions in GUIdancer 3.2 improve support for testing GUI-embedded tables, context menus--such as those that pop up when something is right-clicked--and the tabbed panes common in Web applications. Also, UI elements can now be collected using mouse clicks whenever GUIdancer enters Object Mapping Mode, during which the tool detects and indicates objects that can be mapped (and automatically tested). It is also now possible to switch between databases while GUIdancer is running; the tool previously required a restart. Support for testing dynamic web-application components also has been added.<br />
<br />
GUIdancer 3.2 now includes more than one hundred pre-defined test actions for testing Java or HTML applications simply by drag-and-drop. The approach requires no code and no knowledge of the coding or the inner workings of an application, the company says. &quot;A variety of checks and synchronization actions are available alongside other flexible actions to automatically test applications through the GUI,&quot; it said in a <a rel="nofollow" class="t" href="http://www.bredex.de/en/news/pdf/GD_3.2_en.pdf" target="_blank">news release</a> (pdf).</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>EddieC</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236035.html</guid>
		</item>
		<item>
			<title>How to add QMainWindow</title>
			<link>http://www.daniweb.com/forums/thread236012.html</link>
			<pubDate>Wed, 04 Nov 2009 17:26:12 GMT</pubDate>
			<description><![CDATA[Hello, 
 
I have a problem.How I must add QMainWindow to my code, because the error is: 
 
Exception in thread "main" java.lang.Error: Unresolved compilation problem:  
	The method menuBar() is undefined for the type Calendar 
  <div class="codeblock"> <div class="spaced"> <div style="float:right;...]]></description>
			<content:encoded><![CDATA[<div>Hello,<br />
<br />
I have a problem.How I must add QMainWindow to my code, because the error is:<br />
<br />
<span style="color:Red">Exception in thread &quot;main&quot; java.lang.Error: Unresolved compilation problem: <br />
	The method menuBar() is undefined for the type Calendar</span><br />
 <pre style="margin:20px; line-height:13px">package Kalendarz;<br />
<br />
import com.trolltech.qt.gui.*;<br />
import com.trolltech.qt.core.*;<br />
import com.trolltech.qt.gui.QMenu;<br />
import com.trolltech.qt.gui.QAction;<br />
import com.trolltech.qt.gui.QApplication; <br />
import com.trolltech.qt.gui.QColor;<br />
import com.trolltech.qt.gui.QIcon;<br />
import com.trolltech.qt.gui.QMainWindow; <br />
import com.trolltech.qt.gui.QMenuBar;<br />
import com.trolltech.qt.gui.QPlainTextEdit; <br />
import com.trolltech.qt.gui.QTextDocument;<br />
import com.trolltech.qt.gui.QTextEdit;<br />
import com.trolltech.qt.gui.QToolBar;<br />
import com.trolltech.qt.gui.QWidget;<br />
<br />
public class Calendar extends QWidget <br />
{<br />
&nbsp; &nbsp; private QGroupBox previewGroupBox;<br />
&nbsp; &nbsp; private QGridLayout previewLayout;<br />
&nbsp; &nbsp; private QCalendarWidget calendar;<br />
<br />
&nbsp; &nbsp; private QMenu helpMenu;<br />
&nbsp; &nbsp; private QAction aboutAct;<br />
<br />
&nbsp; &nbsp; public Calendar() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; createPreviewGroupBox();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; QGridLayout layout = new QGridLayout();<br />
&nbsp; &nbsp; &nbsp; &nbsp; layout.addWidget(previewGroupBox, 0, 0);<br />
&nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; layout.setSizeConstraint(QLayout.SizeConstraint.SetFixedSize);<br />
&nbsp; &nbsp; &nbsp; &nbsp; setLayout(layout);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; previewLayout.setRowMinimumHeight(0, calendar.sizeHint().height());<br />
&nbsp; &nbsp; &nbsp; &nbsp; previewLayout.setColumnMinimumWidth(0, calendar.sizeHint().width());<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; setWindowIcon(new QIcon(&quot;images/cal.png&quot;));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setWindowTitle(tr(&quot;Kalendarz&quot;));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; QMenuBar menuBar = new QMenuBar();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; createMenus(); <br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; private void createActions()<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; aboutAct = new QAction(new QIcon(&quot;/help-16x16.png&quot;), tr(&quot;&amp;O programie&quot;), this);<br />
&nbsp; &nbsp; &nbsp; &nbsp; aboutAct.setShortcut(tr(&quot;F12&quot;));<br />
&nbsp; &nbsp; &nbsp; &nbsp; aboutAct.setStatusTip(tr(&quot;Informacje&quot;));<br />
&nbsp; &nbsp; &nbsp; &nbsp; aboutAct.triggered.connect(this, &quot;about()&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; private void createMenus()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; helpMenu = menuBar().addMenu(tr(&quot;&amp;Pomoc&quot;));<br />
&nbsp; &nbsp; &nbsp; &nbsp; helpMenu.addAction(aboutAct);<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; private void createPreviewGroupBox() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; previewGroupBox = new QGroupBox(tr(&quot;Preview&quot;));<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; calendar = new QCalendarWidget();<br />
&nbsp; &nbsp; &nbsp; &nbsp; calendar.setMinimumDate(new QDate(1900, 1, 1));<br />
&nbsp; &nbsp; &nbsp; &nbsp; calendar.setMaximumDate(new QDate(3000, 1, 1));<br />
&nbsp; &nbsp; &nbsp; &nbsp; calendar.setGridVisible(true);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; previewLayout = new QGridLayout();<br />
&nbsp; &nbsp; &nbsp; &nbsp; previewLayout.addWidget(calendar, 0, 0, Qt.AlignmentFlag.AlignCenter);<br />
&nbsp; &nbsp; &nbsp; &nbsp; previewGroupBox.setLayout(previewLayout);<br />
<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; public void about()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; QMessageBox.about (this,&quot;O programie&quot;,&quot;&lt;I&gt;&lt;/I&gt;&lt;center&gt;&lt;b&gt;&lt;font color=#004faf&gt;Text+&lt;/font&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;BIG&gt;Wersja 1.0.0&lt;/BIG&gt; &quot; +<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&lt;p&gt;&lt;/p&gt;Copyright &amp;copy;2009 by Kevin Ostajewski&lt;small&gt;&lt;p&gt;&lt;small&gt;Wszelkie prawa zastrzeżone.&lt;/p&gt;&quot; +<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&lt;p&gt;Nieautoryzowane rozpowszechnianie elementów &lt;br /&gt;programu jest łamaniem praw autorskich.&lt;/p&gt;&lt;/small&gt;&lt;/center&gt;&quot;);<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; public static void main(String args[]) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; QApplication.initialize(args);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; Calendar widget = new Calendar();<br />
&nbsp; &nbsp; &nbsp; &nbsp; widget.show();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; QApplication.exec();<br />
&nbsp; &nbsp; }<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>kjiu</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236012.html</guid>
		</item>
		<item>
			<title>Mail User Agent</title>
			<link>http://www.daniweb.com/forums/thread235997.html</link>
			<pubDate>Wed, 04 Nov 2009 16:05:15 GMT</pubDate>
			<description><![CDATA[For a computer networking course I was given a project to make a Mail User Agent.  We were given a few completed classes, but one of them is giving an error.  Here is the part of code in question: 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a...]]></description>
			<content:encoded><![CDATA[<div>For a computer networking course I was given a project to make a Mail User Agent.  We were given a few completed classes, but one of them is giving an error.  Here is the part of code in question:<br />
<br />
 <pre style="margin:20px; line-height:13px"> try {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Envelope envelope = new Envelope(mailMessage, <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  serverField.getText());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } catch (UnknownHostException e) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /* If there is an error, do not go further */<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SMTPConnection connection = new SMTPConnection(envelope);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; connection.send(envelope);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; connection.close();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } catch (IOException error) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Sending failed: &quot; + error);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Mail sent succesfully!&quot;);</pre><br />
The error is that it cannot find symbol &quot;envelope in the second try block.  Does the scope of try catch not extend outside?  Any suggestions on how to go about fixing this?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>krusso88</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235997.html</guid>
		</item>
		<item>
			<title>plllllzzz hellp me before next Suterday</title>
			<link>http://www.daniweb.com/forums/thread235976.html</link>
			<pubDate>Wed, 04 Nov 2009 13:51:39 GMT</pubDate>
			<description><![CDATA[hi guyz and GiRlzz (F) ;; 
 
how R u ? 
 
plllz I need 4 helpping from u !! 
 
I've a Q in Java ,, I'm trying to write it in jGRASP but I can't :s 
 
plllllzzz hellp me before next Suterday ;s]]></description>
			<content:encoded><![CDATA[<div>hi guyz and GiRlzz (F) ;;<br />
<br />
how R u ?<br />
<br />
plllz I need 4 helpping from u !!<br />
<br />
I've a Q in Java ,, I'm trying to write it in jGRASP but I can't :s<br />
<br />
plllllzzz hellp me before next Suterday ;s <br />
<br />
this is my Q <br />
<br />
<br />
3.Write expressions to compute both solutions for the quadratic formula. The formula is<br />
 - b + - ( b^2 - 4ac) / 2a<br />
The   - &amp; +  symbol means “plus or minus” and indicates that the equation has two solutions: one in which the result of the square root is added to -b and one in which the result is subtracted from -b. Assume all variables are float variables.<br />
<br />
this is my answer but when put it in jGRASP , it tell me ERROR !!!<br />
<br />
 <pre style="margin:20px; line-height:13px">import java.lang.Math; <br />
<br />
public class E3<br />
{<br />
public static void main(String[] args)<br />
{<br />
Scanner console = new Scanner (System.in);<br />
<br />
float x,y,a,b,c,f;<br />
double e;<br />
<br />
System.out.println(&quot;Enter a &quot;);<br />
a =console.nextDouble();<br />
<br />
System.out.println(&quot;Enter b &quot;);<br />
b = console.nextDouble();<br />
<br />
System.out.println(&quot;Enter c &quot;);<br />
c = console.nextDouble();<br />
<br />
f= (b*b)-(4*a*c);<br />
e= Math.pow(f, 0.5 );<br />
<br />
x=(-b + e)/(2*a);<br />
y=(-b - e)/(2*a);<br />
<br />
System.out.println(&quot;solution1 =&quot; + x);<br />
System.out.println(&quot;solution2 =&quot; + y);<br />
}<br />
}</pre><br />
<br />
<br />
and this is another Q :$<br />
<br />
2.Write a java program that reads two integers into the variables a and b then swaps the values of a and b.<br />
<br />
<br />
I'm so sorry :;s</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>GiRL,IT</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235976.html</guid>
		</item>
		<item>
			<title>help!</title>
			<link>http://www.daniweb.com/forums/thread235937.html</link>
			<pubDate>Wed, 04 Nov 2009 11:11:31 GMT</pubDate>
			<description><![CDATA[[IMG]http://i64.photobucket.com/albums/h200/chimine/Untitled-2.jpg[/IMG] 
 
it will then pop up this screen. 
 
[IMG]http://i64.photobucket.com/albums/h200/chimine/Untitled1-1.jpg[/IMG] 
 
how to do it?]]></description>
			<content:encoded><![CDATA[<div><a href="http://i64.photobucket.com/albums/h200/chimine/Untitled-2.jpg" target="_blank">http://i64.photobucket.com/albums/h2...Untitled-2.jpg</a><br />
<br />
it will then pop up this screen.<br />
<br />
<a href="http://i64.photobucket.com/albums/h200/chimine/Untitled1-1.jpg" target="_blank">http://i64.photobucket.com/albums/h2...ntitled1-1.jpg</a><br />
<br />
how to do it?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>hanzooi</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235937.html</guid>
		</item>
		<item>
			<title>hey guys...can someone help me??</title>
			<link>http://www.daniweb.com/forums/thread235870.html</link>
			<pubDate>Wed, 04 Nov 2009 06:36:59 GMT</pubDate>
			<description>well im thinking of making a program that can impress my instructors,, 
can you suggest what program should i make?? 
and please assist me..</description>
			<content:encoded><![CDATA[<div>well im thinking of making a program that can impress my instructors,,<br />
can you suggest what program should i make??<br />
and please assist me..</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>zrjamcrz</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235870.html</guid>
		</item>
		<item>
			<title><![CDATA[creating files with "outfile..." (file can't found!)]]></title>
			<link>http://www.daniweb.com/forums/thread235855.html</link>
			<pubDate>Wed, 04 Nov 2009 05:12:38 GMT</pubDate>
			<description><![CDATA[I did this .. 
 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox" title="Help with Code Tags" target="_blank">Help with Code Tags</a> </div> <div> <strong>Java...]]></description>
			<content:encoded><![CDATA[<div>I did this ..<br />
<br />
<br />
 <pre style="margin:20px; line-height:13px">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp;String filename = &quot;tempoutfile.txt&quot;;<br />
&nbsp;String tablename = &quot;table1&quot;;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; try{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Connection con = DriverManager.getConnection(&quot;jdbc:mysql://localhost/Test&quot;,&quot;root&quot;,&quot;&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Statement s=con.createStatement();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ResultSet r=s.executeQuery(&quot;SELECT * INTO OUTFILE '&quot;+ filename + &quot;' FROM &quot; + tablename);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }catch(SQLException se){System.out.println(se.getMessage());}</pre><br />
<br />
But I can't find the file that is created!!<br />
<br />
When I run the query in WAMP mysql console , it creates the out file in wamp\mysql\data . But not in previous case.<br />
<br />
Where is this file created?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>jrosh</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235855.html</guid>
		</item>
		<item>
			<title>Access wamp functions programatically??</title>
			<link>http://www.daniweb.com/forums/thread235847.html</link>
			<pubDate>Wed, 04 Nov 2009 04:33:48 GMT</pubDate>
			<description><![CDATA[I want to knw whether I can access WAMP 's function (of course mysql) such as export & import programatically. (I am using java) 
 
or as mysql commands??? 
 
Thanks]]></description>
			<content:encoded><![CDATA[<div>I want to knw whether I can access WAMP 's function (of course mysql) such as export &amp; import programatically. (I am using java)<br />
<br />
or as mysql commands???<br />
<br />
Thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>jrosh</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235847.html</guid>
		</item>
		<item>
			<title>scroll text with many link</title>
			<link>http://www.daniweb.com/forums/thread235844.html</link>
			<pubDate>Wed, 04 Nov 2009 04:05:33 GMT</pubDate>
			<description>Hi all, 
Pls help me .I want to make multile JLabel or JTextField with multiple Link in Marquee.I can do only one.Here is my code 
 
import java.awt.*; 
import java.io.IOException; 
import java.util.*; 
import javax.swing.*; 
import java.awt.event.*; 
 
public class MovingText extends JFrame...</description>
			<content:encoded><![CDATA[<div>Hi all,<br />
Pls help me .I want to make multile JLabel or JTextField with multiple Link in Marquee.I can do only one.Here is my code<br />
 <pre style="margin:20px; line-height:13px">import java.awt.*;<br />
import java.io.IOException;<br />
import java.util.*;<br />
import javax.swing.*;<br />
import java.awt.event.*;<br />
<br />
public class MovingText extends JFrame implements ActionListener{<br />
JLabel label;<br />
JLabel label2;<br />
JLabel label3;<br />
public MovingText()<br />
{<br />
label = new JLabel( &quot;Hello World,Where there is will there is&amp; nbsp;a way&quot;);<br />
//label2 = new JLabel(&quot; ......Testing&quot;);<br />
//label3 = new JLabel(label.getText().concat(label2.getText()));<br />
getContentPane().add(label, BorderLayout.NORTH);<br />
/*label.addMouseListener(new java.awt.event.MouseAdapter() {<br />
public void mouseClicked(java.awt.event.MouseEvent evt) {<br />
if(evt.getClickCount() &gt; 0){<br />
try {<br />
Process pc = Runtime.getRuntime().exec(&quot;cmd.exe /c start http://www.iwebie.com&quot;);<br />
} catch (IOException ex) {<br />
System.out.println(ex.getMessage());<br />
System.out.println();<br />
}<br />
}<br />
}<br />
});<br />
label2.addMouseListener(new java.awt.event.MouseAdapter() {<br />
public void mouseClicked(java.awt.event.MouseEvent evt) {<br />
if(evt.getClickCount() &gt; 0){<br />
try {<br />
Process pc = Runtime.getRuntime().exec(&quot;cmd.exe /c start http://www.google.com&quot;);<br />
} catch (IOException ex) {<br />
System.out.println(ex.getMessage());<br />
System.out.println();<br />
}<br />
}<br />
}<br />
});*/<br />
javax.swing.Timer timer = new javax.swing.Timer(100, this);<br />
timer.start();<br />
//System.out.println(&quot;Label 3 &quot;+label3.getText());<br />
}<br />
public void actionPerformed(ActionEvent e) {<br />
String oldText = label.getText();<br />
String newText = oldText.substring(1) + oldText.substring(0, 1);<br />
label.setText( newText );<br />
}<br />
public static void main(String&#91;&#93; args) {<br />
MovingText frame = new MovingText();<br />
frame.setDefaultCloseOperation( EXIT_ON_CLOSE );<br />
frame.setSize(300,100);<br />
frame.setVisible(true);<br />
}<br />
}</pre><br />
 I takes the times for many weeks about that.So Pls help me.Thank in advance.:)</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>Sandar Khin</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235844.html</guid>
		</item>
		<item>
			<title>Help with Threads needed</title>
			<link>http://www.daniweb.com/forums/thread235820.html</link>
			<pubDate>Wed, 04 Nov 2009 02:13:37 GMT</pubDate>
			<description>Hello, 
I am having a difficulty in passing a barrier of JAVA graphics generating. I hope you could explain some things to me, cause I have noone to help me and it is hard to get help in internet, because I feel like missing something important.  
 
The thing is I cannot find an example of JAVA...</description>
			<content:encoded><![CDATA[<div>Hello,<br />
I am having a difficulty in passing a barrier of JAVA graphics generating. I hope you could explain some things to me, cause I have noone to help me and it is hard to get help in internet, because I feel like missing something important. <br />
<br />
The thing is I cannot find an example of JAVA application which looks like similar to the one I am showing a picture to you. <br />
<br />
<a href="http://www.daniweb.com/forums/attachment.php?attachmentid=12446" target="_blank">Attachment 12446</a><br />
<br />
This is what I already managed to do and I was really happy about it. The problematic thing is, I am totally stuck with making it work in a beautiful way, which I want to be: being able to make a user of the program see step-by-step line drawing (once he clicks a button after placing points, the program should paint each line every half a second or so). That would be a demonstration of the algorithms used. Now the only thing I could do was just to painting all lines at once just after the button is clicked. I am trying to put a Thread.sleep(500) in a lines drawing loop, but it just ignores that and runs to the result. I also try to add that sleep in an algorithm and repaint() everything all the time, but it still skips all my efforts and I cannot do anything.<br />
<br />
I put a component Graphic(my written class) called G in my Main class. That Graphic has paint() method which paints all the points and lines. On PW(stands for package wrapping) button clicked I get the result of Lines I need to draw. Here is how it looks:<br />
<br />
 <pre style="margin:20px; line-height:13px">if (arg0.getSource() == pw) <br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; PackageWrapping PW = new PackageWrapping(G);<br />
&nbsp; &nbsp; &nbsp; &nbsp; Vector&lt;Line&gt;BE = PW.lines(POINTS);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; G.transfer(POINTS, BE);<br />
&nbsp; &nbsp; &nbsp; &nbsp; G.repaint();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
}</pre><br />
<br />
I do not have anyone to turn to, who could give me a working example, explain my mistakes or just give any good advice. <br />
<br />
I really expect you could help me. If you need any deeper information related to my code, just let me know.</div>  <br /> <div style="padding:5px">    <fieldset class="fieldset"> <legend>Attached Images</legend> <table cellpadding="0" cellspacing="5" border="0"> <tr> <td><img class="inlineimg" src="http://www.daniweb.com/forums/images/attach/jpg.gif" alt="File Type: jpg" width="16" height="16" border="0" style="vertical-align:baseline" /></td> <td><a href="http://www.daniweb.com/forums/attachment.php?attachmentid=12446&amp;d=1257300636" target="_blank">application - how it looks.JPG</a> (27.9 KB)</td> </tr> </table> </fieldset>   </div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>kolibrizas</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235820.html</guid>
		</item>
		<item>
			<title>Merging two files</title>
			<link>http://www.daniweb.com/forums/thread235793.html</link>
			<pubDate>Tue, 03 Nov 2009 23:19:12 GMT</pubDate>
			<description><![CDATA[I'm supposed to merge a ordered data of two files into a third file, keeping the data in order. I'm suppose to create a MergeFiles application that merges the integers ordered from low to high in two files into a third file, keeping the order from low to high.  Then should merge the two files by...]]></description>
			<content:encoded><![CDATA[<div>I'm supposed to merge a ordered data of two files into a third file, keeping the data in order. I'm suppose to create a MergeFiles application that merges the integers ordered from low to high in two files into a third file, keeping the order from low to high.  Then should merge the two files by taking one element at a time from each, and the third file should contain the numbers from both file from lowest to highest. so, i saved the numbers in wordpad as data1.txt, and data2.txt.<br />
<br />
Data1: 11 25 36 45 56 78 90<br />
Data2: 1 3 5 7 54 32 78 99 <br />
<br />
I can't compile my program because there are still errors and missing codes... can someone help me edit it, and is this how i do it according to the requirements. thx. <br />
<br />
<br />
so far: <br />
 <pre style="margin:20px; line-height:13px">package mergetwofiles;<br />
<br />
import java.io.BufferedReader;<br />
import java.io.FileReader;<br />
import java.io.FileWriter;<br />
<br />
public class Main {<br />
<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; public static void main(String[] args) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; FileReader file1=new FileReader(&quot;Data1.txt&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; FileReader file2=new FileReader(&quot;Data2.txt&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; BufferedReader br1 = new BufferedReader of(file1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; BufferedReader br2 = new BufferedReader of(file2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; String temp1, temp2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; while(br1.readLine() !=null)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; temp1=br1.readLine()+temp1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; while(br2.readLine()!=null)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; temp2=br2.readLine()+temp2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; String temp = temp1 + temp2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; FileWriter fw=new FileWriter(&quot;data3.txt&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; char buffer[]=new char[temp.length];<br />
&nbsp; &nbsp; &nbsp; &nbsp; temp.getChars(0,temp.length(),buffer,0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; fw.write(buffer);<br />
&nbsp; &nbsp; &nbsp; &nbsp; file1.close();<br />
&nbsp; &nbsp; &nbsp; &nbsp; file2.close();<br />
&nbsp; &nbsp; &nbsp; &nbsp; fw.close();<br />
&nbsp; &nbsp;  }<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>StarZ</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235793.html</guid>
		</item>
		<item>
			<title>Issue with MouseListener</title>
			<link>http://www.daniweb.com/forums/thread235766.html</link>
			<pubDate>Tue, 03 Nov 2009 21:24:38 GMT</pubDate>
			<description>Hey!! 
 
I am trying to make a 2-player game; where one player plays after the next. I have used socket programming in the code; so that, when the client (player 1) clicks on the window, the co-ordinates are sent to the server (player 2) and vice-versa. (For now, both player screen are displayed on...</description>
			<content:encoded><![CDATA[<div>Hey!!<br />
<br />
I am trying to make a 2-player game; where one player plays after the next. I have used socket programming in the code; so that, when the client (player 1) clicks on the window, the co-ordinates are sent to the server (player 2) and vice-versa. (For now, both player screen are displayed on the same host.)<br />
<br />
So, here's the issue: Suppose I click somewhere on the client's screen - lets call it click 1. The co-ordinates of click 1 are correctly sent to the server. Now suppose I click again on the client's screen (call it click 2) - ideally nothing should happen since it's not player 1's turn - and for now, it doesn't. So far, so good. Now, suppose I click on the server's screen (call it click 3) - click 3's co-ordinates are sent to the client correctly. However, now, without clicking anywhere at all, the client sends click 2's co-ordinates to the server!! I don't want the last part to happen - i.e. when it's not someone's turn to play, all the mouse clicks on that screen should be ignored.<br />
<br />
I can't figure this out!! I am using removeMouseListener right after a click is done (provided its the right person's turn), and I am not calling the addMouseListener until after co-ordinates are received. So, why is this happening?!! I am not very good at jav coding, so even if it is a very dumb error, please be patient and let me know!! I've already spent hours trying to debug this, to no avail!!<br />
<br />
Thanks,<br />
Chand</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>chandini.david</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235766.html</guid>
		</item>
		<item>
			<title>HELP with code</title>
			<link>http://www.daniweb.com/forums/thread235745.html</link>
			<pubDate>Tue, 03 Nov 2009 19:35:32 GMT</pubDate>
			<description><![CDATA[I have to write a program that has a tic tac toe board. When you click it, it should go from one image to another. My code compiles fine, but it doesnt run. I get some errors: 
 
Exception in thread "main" java.lang.NullPointerException 
	at TicTacToe3.<init>(TicTacToe3.java:27) 
	at...]]></description>
			<content:encoded><![CDATA[<div>I have to write a program that has a tic tac toe board. When you click it, it should go from one image to another. My code compiles fine, but it doesnt run. I get some errors:<br />
<br />
Exception in thread &quot;main&quot; java.lang.NullPointerException<br />
	at TicTacToe3.&lt;init&gt;(TicTacToe3.java:27)<br />
	at TicTacToe3.main(TicTacToe3.java:41)<br />
<br />
My code:<br />
<br />
 <pre style="margin:20px; line-height:13px">import java.awt.*;<br />
import java.awt.event.*;<br />
import javax.swing.*;<br />
<br />
public class TicTacToe3 extends JFrame{<br />
<br />
JButton x;<br />
ImageIcon imageO;<br />
JButton o;<br />
ImageIcon imageX;<br />
JButton[][] button = new JButton[3][3];<br />
int i;<br />
int j;<br />
<br />
TicTacToe3(){<br />
&nbsp; super(&quot;TicTacToe2&quot;);<br />
&nbsp; setSize(600, 300);<br />
&nbsp; setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);<br />
&nbsp; setLocationRelativeTo(null);<br />
&nbsp; setLayout(new GridLayout(3,3));<br />
<br />
&nbsp; JButton[][] button = new JButton[3][3];<br />
&nbsp; &nbsp; for(int i=0;i&lt;3;i++){<br />
&nbsp; &nbsp; for(int j=0;j&lt;3;j++){<br />
&nbsp; &nbsp; button[i][j].addMouseListener(new ButtonListener());<br />
&nbsp; &nbsp; add(button[i][j]);<br />
}<br />
}<br />
<br />
&nbsp; &nbsp; ImageIcon imageX = new ImageIcon(&quot;kate.jpg&quot;); <br />
&nbsp; &nbsp; button[i][j].setIcon(imageX);<br />
<br />
<br />
&nbsp; setVisible(true);<br />
}<br />
<br />
public static void main(String args[]) {<br />
&nbsp; TicTacToe3 e = new TicTacToe3();<br />
} <br />
<br />
<br />
&nbsp;class ButtonListener extends MouseAdapter {<br />
&nbsp;  public&nbsp; &nbsp; &nbsp; &nbsp; void mouseClicked(MouseEvent e){<br />
&nbsp; &nbsp; ImageIcon imageO = new ImageIcon(&quot;jon.jpg&quot;);<br />
&nbsp; &nbsp; button[i][j].setIcon(imageO);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp;  }</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>treyd</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235745.html</guid>
		</item>
		<item>
			<title>How do I change my repeated code to pass arguments?</title>
			<link>http://www.daniweb.com/forums/thread235744.html</link>
			<pubDate>Tue, 03 Nov 2009 19:35:25 GMT</pubDate>
			<description><![CDATA[I have my program working but, I need to cut out the repeated code. How do I change this part of my code to pass arguments to a user defined method? I'm lost. I really have no clue exactly where to start on this. Basically when a user clicks a certain radio button it enables and disables the...]]></description>
			<content:encoded><![CDATA[<div>I have my program working but, I need to cut out the repeated code. How do I change this part of my code to pass arguments to a user defined method? I'm lost. I really have no clue exactly where to start on this. Basically when a user clicks a certain radio button it enables and disables the jlabels and textfield associated with them. Please help.<br />
  <pre style="margin:20px; line-height:13px">&nbsp; &nbsp; &nbsp; &nbsp; public void itemStateChanged(ItemEvent choice)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (choice.getStateChange() == ItemEvent.SELECTED)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (optBox.isSelected()==true)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; txtLength.setEnabled(true);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; txtWidth.setEnabled(true);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; txtHeight.setEnabled(true);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; txtRadius.setEnabled(false);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lblLength.setEnabled(true);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lblWidth.setEnabled(true);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lblHeight.setEnabled(true);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lblRadius.setEnabled(false);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if (optCylinder.isSelected()==true)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; txtLength.setEnabled(false);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; txtWidth.setEnabled(false);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; txtHeight.setEnabled(true);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; txtRadius.setEnabled(true);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lblLength.setEnabled(false);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lblWidth.setEnabled(false);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lblHeight.setEnabled(true);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lblRadius.setEnabled(true);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if (optCone.isSelected()==true)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; txtLength.setEnabled(false);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; txtWidth.setEnabled(false);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; txtHeight.setEnabled(true);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; txtRadius.setEnabled(true);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lblLength.setEnabled(false);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lblWidth.setEnabled(false);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lblHeight.setEnabled(true);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lblRadius.setEnabled(true);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if (optSphere.isSelected()==true)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; txtLength.setEnabled(false);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; txtWidth.setEnabled(false);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; txtHeight.setEnabled(false);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; txtRadius.setEnabled(true);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lblLength.setEnabled(false);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lblWidth.setEnabled(false);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lblHeight.setEnabled(false);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lblRadius.setEnabled(true);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; }//End ItemStateChanged</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>jko2326</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235744.html</guid>
		</item>
		<item>
			<title>How to change application design? (custom jFrame, buttons)</title>
			<link>http://www.daniweb.com/forums/thread235742.html</link>
			<pubDate>Tue, 03 Nov 2009 19:26:05 GMT</pubDate>
			<description>Hello, 
I am trying to design an java desktop application. My question is: Is there a way to change the whole look? From example different titlebar, different jFrame, buttons... (designed with PNG images, transparency, etc.). Is it possible? If so, how? In VB or C# I can easely change those......</description>
			<content:encoded><![CDATA[<div>Hello,<br />
I am trying to design an java desktop application. My question is: Is there a way to change the whole look? From example different titlebar, different jFrame, buttons... (designed with PNG images, transparency, etc.). Is it possible? If so, how? In VB or C# I can easely change those... E.G.: Make the FORM &quot;borderless&quot; then I add my own buttons with background image, etc. It is so important to me... I work on a project that requires not only developing but design too. please help if you can :). Thanks.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>Clawsy</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235742.html</guid>
		</item>
		<item>
			<title>array</title>
			<link>http://www.daniweb.com/forums/thread235728.html</link>
			<pubDate>Tue, 03 Nov 2009 18:40:43 GMT</pubDate>
			<description>i have a question but am confuse  
the question is create and array of random double floating point numbers,calculate and print the sum off all the numbers in the array.truncates all of the numbers in the array up to 7 decimal places and then calculate and print the sum of the truncated...</description>
			<content:encoded><![CDATA[<div>i have a question but am confuse <br />
the question is create and array of random double floating point numbers,calculate and print the sum off all the numbers in the array.truncates all of the numbers in the array up to 7 decimal places and then calculate and print the sum of the truncated numbers.calculate and print the difference between the actual sum of the numbersand the sum of the truncated numbers.the part i understand was how to<br />
then you can use the java.text.NumberFormat class.<br />
<br />
double value = 5.9999999999999;<br />
NumberFormat nf = NumberFormat.getInstance();<br />
nf.setMaximumFractionDigits(7);<br />
String displayValue = nf.format(value);<br />
System.out.println(displayValue);<br />
<br />
//should print &gt;5.9999999<br />
but i dont kbnow haw to create a random double floating point numbers it just confuse me ,can someon help me out?please</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>asong</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235728.html</guid>
		</item>
		<item>
			<title><![CDATA[Hibernate HBM with many <class> tags]]></title>
			<link>http://www.daniweb.com/forums/thread235725.html</link>
			<pubDate>Tue, 03 Nov 2009 18:32:08 GMT</pubDate>
			<description><![CDATA[I am a beginner with Hibernates. I added the appropriate files / Jar to my Project in netbeans ide 6.7.1.  
My Hbm file has multiple <class> </class>.. and i get this error. 
errororg.hibernate.InvalidMappingException: Could not parse mapping document from resource Customer.hbm.xml 
 
Was wondering...]]></description>
			<content:encoded><![CDATA[<div>I am a beginner with Hibernates. I added the appropriate files / Jar to my Project in netbeans ide 6.7.1. <br />
My Hbm file has multiple &lt;class&gt; &lt;/class&gt;.. and i get this error.<br />
errororg.hibernate.InvalidMappingException: Could not parse mapping document from resource Customer.hbm.xml<br />
<br />
Was wondering this issue is associated with multiple &lt;class&gt;tags.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>GradStudent</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235725.html</guid>
		</item>
		<item>
			<title>Connecting to a mysql database</title>
			<link>http://www.daniweb.com/forums/thread235718.html</link>
			<pubDate>Tue, 03 Nov 2009 18:14:43 GMT</pubDate>
			<description><![CDATA[Ok so what i want to be able to do is connect to a mysql database. Here's my code so far:  
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox" title="Help with...]]></description>
			<content:encoded><![CDATA[<div>Ok so what i want to be able to do is connect to a mysql database. Here's my code so far: <br />
<br />
 <pre style="margin:20px; line-height:13px">Connection connection = null; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try { <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Load the JDBC driver <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String driverName = &quot;postgresql-8.4-701.jdbc4.jar&quot;; // MySQL MM JDBC driver <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Class.forName(driverName); <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Create a connection to the database <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String serverName = &quot;mysql10.000webhost.com&quot;; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String mydatabase = &quot;a2362883_test&quot;; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String url = &quot;jdbc:mysql://&quot; + serverName + &quot;/&quot; + mydatabase; // a JDBC url <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String username = &quot;a2362883_admin&quot;; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String password = &quot;test&quot;; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; connection = (Connection) DriverManager.getConnection(url, username, password);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Connected&quot;);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; catch (ClassNotFoundException e) { <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Could not find the database driver&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } catch (SQLException e) { <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Could not connect to the database&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre><br />
The problem is though that it keeps saying it could not find the database driver, even though i put postgresql-8.4-701.jdbc4.jar in the project file. So therefore it should find it, or is this not the driver? Im using java 1.6, snow leopard os and eclipse. By the way, the password isnt test but im not going to tell you it :P<br />
<br />
Thanks,<br />
<br />
jakx12.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>jakx12</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235718.html</guid>
		</item>
		<item>
			<title>Java object persistance</title>
			<link>http://www.daniweb.com/forums/thread235704.html</link>
			<pubDate>Tue, 03 Nov 2009 16:51:50 GMT</pubDate>
			<description>Hi all, 
 
Im trying to get my head around object persistance, yet im getting nowhere.  All i have found is examples of stuff to do with databases. 
 
Can somebody offer an explination for an idiot please. 
 
Regards 
 
Paul</description>
			<content:encoded><![CDATA[<div>Hi all,<br />
<br />
Im trying to get my head around object persistance, yet im getting nowhere.  All i have found is examples of stuff to do with databases.<br />
<br />
Can somebody offer an explination for an idiot please.<br />
<br />
Regards<br />
<br />
Paul</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>whiteyoh</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235704.html</guid>
		</item>
		<item>
			<title><![CDATA[Dumb NetBeans IDE question: I've lost my palette!]]></title>
			<link>http://www.daniweb.com/forums/thread235699.html</link>
			<pubDate>Tue, 03 Nov 2009 16:38:19 GMT</pubDate>
			<description><![CDATA[In Design mode in NetBeans IDE, I had a palette with all of my AWT and Swing controls and some netbeans that I can drag and drop onto the Jframe I'm designing, I accidentally closed it. I am not seeing a menu option anywhere to add that palette back as an IDE pane. there's tools->palette, but that...]]></description>
			<content:encoded><![CDATA[<div>In Design mode in NetBeans IDE, I had a palette with all of my AWT and Swing controls and some netbeans that I can drag and drop onto the Jframe I'm designing, I accidentally closed it. I am not seeing a menu option anywhere to add that palette back as an IDE pane. there's tools-&gt;palette, but that just brings up the set of controls for a specific component.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>eggmatters</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235699.html</guid>
		</item>
		<item>
			<title>String splitting to array...</title>
			<link>http://www.daniweb.com/forums/thread235693.html</link>
			<pubDate>Tue, 03 Nov 2009 16:13:07 GMT</pubDate>
			<description><![CDATA[I'm trying to split an input string into an array of substrings and currently trying something like this... 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox"...]]></description>
			<content:encoded><![CDATA[<div>I'm trying to split an input string into an array of substrings and currently trying something like this...<br />
<br />
 <pre style="margin:20px; line-height:13px">public static void tryp(String inputString){&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int index = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String[] rArray = new String[1000];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String[] kArray = new String[1000];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int startPos = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int x;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int newRPos = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int newKPos = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String protString;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while (newRPos != -1){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (x = 0; x &lt; inputString.length(); x++){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int ind = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; newRPos = inputString.indexOf('R');<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
String nextRPep = inputString.substring(startPos, (newRPos+1));<br />
protString = inputString.substring(newRPos+1, inputString.length());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rArray[ind] = nextRPep;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ind++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; startPos = newRPos+1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; newRPos = protString.indexOf('R');<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rArray[ind+1] = protString;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (index = 0; index &lt; rArray.length; index++){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; newKPos = inputString.indexOf('K');&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while (newKPos != -1){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (x = 0; x &lt; rArray.length; x++){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int ind = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String rPep = rArray[x];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String nextPep = rPep.substring(startPos, (newKPos+1));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; protString = rPep.substring(newKPos+1, rPep.length());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; kArray[ind] = nextPep;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ind++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; startPos = newKPos+1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; newKPos = protString.indexOf('K');<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; kArray[ind+1] = protString;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}</pre><br />
This compiles but doesn't do what I want....?<br />
<br />
Any help much appreciated as I can't think what else I can try (have tried lots that didn't help!)<br />
<br />
Thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>skiplatte</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235693.html</guid>
		</item>
		<item>
			<title>Java ActionListener Question</title>
			<link>http://www.daniweb.com/forums/thread235690.html</link>
			<pubDate>Tue, 03 Nov 2009 16:04:37 GMT</pubDate>
			<description>I have a Java Program that I need to create that will show five random images selected form my image folder of 50 images. upon clicking a button the program should select 5 new random images. I have most of it figured out except for my ActionListener. Is it possible to implement an ActionListener...</description>
			<content:encoded><![CDATA[<div>I have a Java Program that I need to create that will show five random images selected form my image folder of 50 images. upon clicking a button the program should select 5 new random images. I have most of it figured out except for my ActionListener. Is it possible to implement an ActionListener that will simply run my main class over again thereby &quot;restarting&quot; the program and selecting 5 new images?<br />
<br />
Any help would be greatly appreciated<br />
<br />
Heres what I have so far<br />
<br />
<br />
import java.awt.*;<br />
import javax.swing.*;<br />
import java.awt.event.*;<br />
<br />
public class CardDisplay extends JFrame {<br />
<br />
//Creat JButton<br />
JButton jbtNew = new JButton(&quot;New Cards&quot;);<br />
<br />
//Initialize Variables 	<br />
		int number1 = (int)(Math.random()*54+1);  <br />
		int number2 = (int)(Math.random()*54+1);<br />
		int number3 = (int)(Math.random()*54+1);<br />
		int number4 = (int)(Math.random()*54+1);<br />
		int number5 = (int)(Math.random()*54+1);	<br />
	<br />
  		private ImageIcon card1 = new ImageIcon(number1 + &quot;.png&quot;);<br />
  		private ImageIcon card2 = new ImageIcon(number2 + &quot;.png&quot;);<br />
  		private ImageIcon card3 = new ImageIcon(number3 + &quot;.png&quot;);<br />
		private ImageIcon card4 = new ImageIcon(number4 + &quot;.png&quot;);<br />
		private ImageIcon card5 = new ImageIcon(number5 + &quot;.png&quot;);<br />
		<br />
		<br />
	<br />
//Construct Layout<br />
	public CardDisplay() {<br />
		setLayout(new GridLayout(1,5));<br />
		add(new JLabel(card1));<br />
		add(new JLabel(card2));<br />
		add(new JLabel(card3));<br />
		add(new JLabel(card4));<br />
		add(new JLabel(card5));<br />
		<br />
		//Create Panel<br />
		JPanel panel = new JPanel();<br />
			panel.add(jbtNew);<br />
			add(panel); //add Panel<br />
			<br />
		//Register Listener<br />
		ListenerClass listener = new ListenerClass();<br />
		jbtNew.addActionListener(listener);<br />
		<br />
		<br />
	} <br />
//Main Method<br />
	public static void main(String[] args) {<br />
<br />
		CardDisplay frame = new CardDisplay();<br />
    	frame.setSize(800, 200);<br />
    	frame.setTitle(&quot;Card Display&quot;);<br />
    	frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);<br />
    	frame.setVisible(true);<br />
	}<br />
	<br />
	private static class ListenerClass implements ActionListener{<br />
		public void actionPerformer(ActionEvent e) {<br />
		<br />
		<br />
		<br />
		}<br />
	}<br />
}</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>geek_till_itMHZ</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235690.html</guid>
		</item>
		<item>
			<title>Java bitwise operation</title>
			<link>http://www.daniweb.com/forums/thread235689.html</link>
			<pubDate>Tue, 03 Nov 2009 15:54:47 GMT</pubDate>
			<description><![CDATA[i am new to this kind of programming. please help me,. 
 
i got an IP address (32bits) & 3 int (32 X 3 = 96bits) totaling for 128bits i.e., 16bytes. 
 
my problem here is, how to club them all together to create a 16byte string. 
 
please help. thanks in advance]]></description>
			<content:encoded><![CDATA[<div>i am new to this kind of programming. please help me,.<br />
<br />
i got an IP address (32bits) &amp; 3 int (32 X 3 = 96bits) totaling for 128bits i.e., 16bytes.<br />
<br />
my problem here is, how to club them all together to create a 16byte string.<br />
<br />
please help. thanks in advance</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>rameshnerella</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235689.html</guid>
		</item>
		<item>
			<title><![CDATA[Error [for the type QPlainTextEdit]]]></title>
			<link>http://www.daniweb.com/forums/thread235684.html</link>
			<pubDate>Tue, 03 Nov 2009 15:40:55 GMT</pubDate>
			<description><![CDATA[Hello, 
 
I have the code: 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox" title="Help with Code Tags" target="_blank">Help with Code Tags</a> </div> <div>...]]></description>
			<content:encoded><![CDATA[<div>Hello,<br />
<br />
I have the code:<br />
<br />
 <pre style="margin:20px; line-height:13px"> public void color() <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; { <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  QColor color = QColorDialog.getColor(textEdit.textColor(), this); <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!color.isValid()) <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; editor.setTextColor(color); <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; private void setupEditor() <br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; QFont font = new QFont();<br />
&nbsp; &nbsp; &nbsp; &nbsp; font.setFamily(&quot;Arial&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; font.setFixedPitch(true);<br />
&nbsp; &nbsp; &nbsp; &nbsp; font.setPointSize(10);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; editor = new CodeEditor();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; editor.setLineWrapMode(QPlainTextEdit.LineWrapMode.NoWrap);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; editor.setFont(font);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; new Highlighter(editor.document());<br />
&nbsp; &nbsp; &nbsp; &nbsp; }</pre>but the error is :<br />
<br />
<span style="font-weight:bold">The method setTextColor(QColor) is undefined for the type QPlainTextEdit </span><br />
<br />
Why ?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>kjiu</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235684.html</guid>
		</item>
		<item>
			<title><![CDATA[Casting of int[] to Object[]]]></title>
			<link>http://www.daniweb.com/forums/thread235669.html</link>
			<pubDate>Tue, 03 Nov 2009 13:44:16 GMT</pubDate>
			<description><![CDATA[When i do something like  
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox" title="Help with Code Tags" target="_blank">Help with Code Tags</a> </div> <div>...]]></description>
			<content:encoded><![CDATA[<div>When i do something like <br />
 <pre style="margin:20px; line-height:13px">static int call (Object a){<br />
}<br />
<br />
main(){<br />
call(10);<br />
}</pre>it works because of autoboxing<br />
<br />
But why didn't the language designers support something like this ?<br />
<br />
 <pre style="margin:20px; line-height:13px">static int call (Object []a){<br />
}<br />
<br />
main(){<br />
int []a = new int[10];<br />
call(a);<br />
}</pre><br />
Why didn't they support something like this. Went through JLS but couldnt find what i wanted.<br />
<br />
Thanks in advance for your time.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>legilimen</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235669.html</guid>
		</item>
		<item>
			<title>Correcting inefficiency in pseudocode</title>
			<link>http://www.daniweb.com/forums/thread235619.html</link>
			<pubDate>Tue, 03 Nov 2009 10:41:49 GMT</pubDate>
			<description><![CDATA[I have been asked to find the inefficiency in a piece of pseducode. I've looked at it but can't see it. 
 
IF count > 10 THEN 
   WHILE x < 0 DO 
      INPUT x 
   ENDWHILE 
ENDIF 
 
My understanding: 
Count is evaluated. If count is <10, the app moves onto the next section. If count is > 10, X is...]]></description>
			<content:encoded><![CDATA[<div>I have been asked to find the inefficiency in a piece of pseducode. I've looked at it but can't see it.<br />
<br />
IF count &gt; 10 THEN<br />
   WHILE x &lt; 0 DO<br />
      INPUT x<br />
   ENDWHILE<br />
ENDIF<br />
<br />
My understanding:<br />
Count is evaluated. If count is &lt;10, the app moves onto the next section. If count is &gt; 10, X is evaluated. Until x is &lt;0, the user will keep being prompted to input x. Once they input x&gt;=0, the loop finishes.<br />
<br />
Please note: this is one question on a mock test - it is the whole code. I'm supposed to find the problem with this snippet. eg. there is no mention of x being a value outside of the IF section.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>tom.t</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235619.html</guid>
		</item>
		<item>
			<title>Pseduocode help - extracting parts of a real number</title>
			<link>http://www.daniweb.com/forums/thread235614.html</link>
			<pubDate>Tue, 03 Nov 2009 10:37:08 GMT</pubDate>
			<description><![CDATA[I'm writing pseducode for a Java class. Obviously being pseudo the language shouldn't matter but thought I'd mention it as it would explain any 'bias' I have. BTW, this is my first programming class. I'm revising for my end of semester exam. 
 
Write a pseudo code algorithm which will input a real...]]></description>
			<content:encoded><![CDATA[<div>I'm writing pseducode for a Java class. Obviously being pseudo the language shouldn't matter but thought I'd mention it as it would explain any 'bias' I have. BTW, this is my first programming class. I'm revising for my end of semester exam.<br />
<br />
Write a pseudo code algorithm which will input a real number. The number represents a length of time, hh.mmss where hh=hours, mm = minutes and ss = seconds. If the input is valid then the algorithm should output the time hours, minutes and seconds.<br />
<br />
My attempt:<br />
MAIN<br />
   INPUT time<br />
   hours = extractHours&lt;-time<br />
   minutes=extractMinutes&lt;-time<br />
   seconds=extractSeconds&lt;-time<br />
   IF (validateTime&lt;-hours, minutes, seconds) THEN<br />
      OUTPUT hours, minutes, seconds<br />
   END IF<br />
<br />
extractHours<br />
hours=(int)time<br />
<br />
extractMinutes<br />
tempMinutes=(int)(time*100)<br />
minutes=tempMinutes MOD 100<br />
<br />
extractSeconds<br />
tempSeconds=(int)(time*10000)<br />
seconds=tempSeconds MOD 10000<br />
<br />
validateTime<br />
isValid=false<br />
IF (0 &lt;= hours &lt;=23) AND (0&lt;= minutes &lt;=59) AND (0&lt;=seconds &lt;=60) THEN<br />
   isValid=true<br />
END IF</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>tom.t</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235614.html</guid>
		</item>
		<item>
			<title>java applets</title>
			<link>http://www.daniweb.com/forums/thread235595.html</link>
			<pubDate>Tue, 03 Nov 2009 09:16:51 GMT</pubDate>
			<description>hi everyone, im have just started my java course and im currently doing a project using java applets.  my project is web music website and the envisioned system should contain a shopping cart made of an applet. i would like to you to help me with just a syntax of how to go about it</description>
			<content:encoded><![CDATA[<div>hi everyone, im have just started my java course and im currently doing a project using java applets.  my project is web music website and the envisioned system should contain a shopping cart made of an applet. i would like to you to help me with just a syntax of how to go about it</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>t.boy</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235595.html</guid>
		</item>
		<item>
			<title>Regarding Coverting multiple images to a single pdf in an  applet</title>
			<link>http://www.daniweb.com/forums/thread235570.html</link>
			<pubDate>Tue, 03 Nov 2009 05:45:40 GMT</pubDate>
			<description>Hi Everybody, 
         I have an issue converting images from an image panel  to a pdf .I am able to convert a single image to a pdf file but not multiple images.Can anyone help me in this.  Below is the code which iam using now  
public void send(String fn){ 
	    BufferedImage oldimage=image; 
	...</description>
			<content:encoded><![CDATA[<div>Hi Everybody,<br />
         I have an issue converting images from an image panel  to a pdf .I am able to convert a single image to a pdf file but not multiple images.Can anyone help me in this.  Below is the code which iam using now <br />
public void send(String fn){<br />
	    BufferedImage oldimage=image;<br />
	    try{<br />
	    <br />
	      File    dir;<br />
	     <br />
	      File home = new File(System.getProperty(&quot;user.home&quot;));<br />
          dir  = new File(home,&quot;My Documents&quot;);<br />
          if(!dir.exists()){ dir = home;}<br />
          File file = new File(dir,fn+&quot;.pdf&quot;);file.delete();<br />
          System.out.println(file.getCanonicalPath());<br />
          ImageIO.write(getImage(), &quot;pdf&quot;, file);<br />
         <br />
	    }catch(Exception e){<br />
	      System.out.println(&quot;9\b&quot;+getClass().getName()+&quot;\n\t.send:\n\t&quot;+e.getMessage());<br />
	      image=oldimage;<br />
	      e.printStackTrace();<br />
	    }catch(OutOfMemoryError e){<br />
	      System.out.println(&quot;9\b&quot;+getClass().getName()+&quot;\n\t.send:\n\t&quot;+e.getMessage());<br />
	      image=oldimage;<br />
	    }<br />
	  }<br />
Thanks,<br />
venkat</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>gouredyyvenkat</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235570.html</guid>
		</item>
		<item>
			<title>Making a Grid with a picture</title>
			<link>http://www.daniweb.com/forums/thread235567.html</link>
			<pubDate>Tue, 03 Nov 2009 05:29:20 GMT</pubDate>
			<description>Alright, I posted earlier with help on compiling my method, now it compiles and now I am stuck again. Help would be great since this awful head cold is getting the best of me.  
 
Ok so, so far I have my method almost where I need it, I have my picture that opens up in to a black area in the upper...</description>
			<content:encoded><![CDATA[<div>Alright, I posted earlier with help on compiling my method, now it compiles and now I am stuck again. Help would be great since this awful head cold is getting the best of me. <br />
<br />
Ok so, so far I have my method almost where I need it, I have my picture that opens up in to a black area in the upper left hand corner. Now the tricky part, multiplying that image within these parameters. So if I do makeGrid(2) I should see 4 of the same picture in a grid like manner. Here is my code again: <br />
<br />
 <pre style="margin:20px; line-height:13px">public Picture makeGrid(int size)<br />
{<br />
&nbsp; Picture targetPicture = new Picture(this.getWidth()*size, this.getHeight()*size);<br />
&nbsp; Pixel sourcePixel = null;<br />
&nbsp; Pixel targetPixel = null;<br />
&nbsp; int targetX = 0;<br />
&nbsp; int targetY = 0;<br />
&nbsp; <br />
//loop through the source picture columns<br />
&nbsp; for(int sourceX = 0; sourceX &lt; this.getWidth(); sourceX++)<br />
&nbsp; {<br />
//loop through the source picture rows<br />
&nbsp; &nbsp; for(int sourceY = 0; sourceY &lt; this.getHeight(); sourceY++)<br />
&nbsp; &nbsp; {<br />
// get the source pixel<br />
&nbsp; &nbsp; &nbsp; sourcePixel = this.getPixel(sourceX,sourceY);<br />
&nbsp; &nbsp; &nbsp; <br />
// loop copying to the target y<br />
&nbsp; &nbsp; &nbsp; for(int indexY = 0; indexY &lt;size; indexY++)<br />
&nbsp; &nbsp; &nbsp; {<br />
// loop copying to the target x<br />
&nbsp; &nbsp; &nbsp; &nbsp; for(int indexX = 0; indexX &lt; size; indexX++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; targetX = sourceX * size + indexX;<br />
targetY = sourceY * size + indexY;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; targetPixel =targetPicture.getPixel(targetX, targetY);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; targetPixel.setColor(sourcePixel.getColor());<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
&nbsp; }<br />
&nbsp; return targetPicture;<br />
}<br />
}</pre><br />
Any helpful hints or suggestions would be much appreciated! Thanks =D</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>ah124131</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235567.html</guid>
		</item>
		<item>
			<title>Poker Data Retreival</title>
			<link>http://www.daniweb.com/forums/thread235548.html</link>
			<pubDate>Tue, 03 Nov 2009 04:02:24 GMT</pubDate>
			<description>I play poker online at PartyPoker, UltimateBet, et. al. During play various hand data is displayed. Can I write a Java program to read and process that data during live play? There is a program called Poker Indicator (not sure what platform) that does this, but I want to add more features. Is Java...</description>
			<content:encoded><![CDATA[<div>I play poker online at PartyPoker, UltimateBet, et. al. During play various hand data is displayed. Can I write a Java program to read and process that data during live play? There is a program called Poker Indicator (not sure what platform) that does this, but I want to add more features. Is Java the correct program to use or which one do you recommend?<br />
Thanks in advance...GoldMiner1849</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>GoldMiner1849</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235548.html</guid>
		</item>
		<item>
			<title>Error: Missing Return Statement</title>
			<link>http://www.daniweb.com/forums/thread235541.html</link>
			<pubDate>Tue, 03 Nov 2009 03:26:43 GMT</pubDate>
			<description><![CDATA[After completing my code I got an error message at the second to last closing bracket that said I was missing a return statement, I looked in to it online and found that some said to put return 0; but that didn't work it just gave me a new error that said Incompatible types found: int required:...]]></description>
			<content:encoded><![CDATA[<div>After completing my code I got an error message at the second to last closing bracket that said I was missing a return statement, I looked in to it online and found that some said to put return 0; but that didn't work it just gave me a new error that said Incompatible types found: int required: Picture . Any suggestions?<br />
<br />
 <pre style="margin:20px; line-height:13px">public Picture makeGrid(int size)<br />
{<br />
&nbsp; Picture targetPicture = new Picture(this.getWidth()*size, this.getHeight()*size);<br />
&nbsp; Pixel sourcePixel = null;<br />
&nbsp; Pixel targetPixel = null;<br />
&nbsp; int targetX = 0;<br />
&nbsp; int targetY = 0;<br />
&nbsp; <br />
//loop through the source picture columns<br />
&nbsp; for(int sourceX = 0; sourceX &lt; this.getWidth(); sourceX++)<br />
&nbsp; {<br />
//loop through the source picture rows<br />
&nbsp; &nbsp; for(int sourceY = 0; sourceY &lt; this.getHeight(); sourceY++)<br />
&nbsp; &nbsp; {<br />
// get the source pixel<br />
&nbsp; &nbsp; &nbsp; sourcePixel = this.getPixel(sourceX,sourceY);<br />
&nbsp; &nbsp; &nbsp; <br />
// loop copying to the target y<br />
&nbsp; &nbsp; &nbsp; for(int indexY = 0; indexY &lt;size; indexY++)<br />
&nbsp; &nbsp; &nbsp; {<br />
// loop copying to the target x<br />
&nbsp; &nbsp; &nbsp; &nbsp; for(int indexX = 0; indexX &lt; size; indexX++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; targetX = sourceX + size*2 + indexX;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; targetY = sourceY + size*2 + indexY;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; targetPixel =targetPicture.getPixel(targetX, targetY);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; targetPixel.setColor(sourcePixel.getColor());<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
&nbsp; }<br />
}<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>ah124131</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235541.html</guid>
		</item>
		<item>
			<title><![CDATA[Palindrome program using stack & queue]]></title>
			<link>http://www.daniweb.com/forums/thread235537.html</link>
			<pubDate>Tue, 03 Nov 2009 02:58:00 GMT</pubDate>
			<description><![CDATA[I have two issues that I need to solve on this program that are giving me some troubles. I have scanned google and my text book and so far coming up empty. 
Problem #1 - My program works for palindrome words and 2 word palindromes like "race car". But I need it to work for any length of a sentence,...]]></description>
			<content:encoded><![CDATA[<div>I have two issues that I need to solve on this program that are giving me some troubles. I have scanned google and my text book and so far coming up empty.<br />
Problem #1 - My program works for palindrome words and 2 word palindromes like &quot;race car&quot;. But I need it to work for any length of a sentence, like &quot;Borrow or rob?&quot; or &quot;Egad! A base life defiles a bad age&quot;. So somehow I need to add code to the isPalindrome method.<br />
<br />
Problem #2 - Currently I am using system.out.println (mainly to test program), but the final product must use JOptionPane. The code is currently commented out since it errors out otherwise. Currently I do not have the normal JFrame code that initializes the frame variable, but when I insert it, I get &lt;identifier&gt; expected error messages.<br />
<br />
<br />
 <pre style="margin:20px; line-height:13px">import java.util.Scanner;<br />
import java.util.LinkedList;<br />
import java.util.Queue;<br />
import java.util.Stack;<br />
import java.io.*;<br />
<br />
public class Palindrometest<br />
{<br />
&nbsp;public static void main(String[] args) throws IOException<br />
&nbsp;{<br />
&nbsp; Scanner stdin = new Scanner(System.in);<br />
&nbsp; //Scanner stdin = new Scanner(new File(&quot;input.txt&quot;));<br />
&nbsp; String line;<br />
&nbsp; <br />
&nbsp; do<br />
&nbsp; {<br />
&nbsp;  System.out.print(&quot;Your expression (or return to end): &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; line = stdin.nextLine();<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (is_palindrome(line))<br />
&nbsp; &nbsp; &nbsp; &nbsp;  System.out.println(&quot;that is a palindrome&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp;  //JOptionPane.showMessageDialog(frame, &quot;That is a palindrome&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp;  //JOptionPane.showMessageDialog(frame, &quot;That is NOT a palinfrome&quot;); <br />
&nbsp; &nbsp; &nbsp; &nbsp;  System.out.println(&quot;that is NOT a palindrome&quot;);<br />
&nbsp; }<br />
&nbsp; while (line.length() != 0);<br />
&nbsp;}<br />
&nbsp;<br />
&nbsp;public static boolean is_palindrome(String input)<br />
&nbsp;{<br />
&nbsp; Queue&lt;Character&gt; q = new LinkedList&lt;Character&gt;();<br />
&nbsp; Stack&lt;Character&gt; s = new Stack&lt;Character&gt;();<br />
&nbsp; Character letter;<br />
&nbsp; int mismatches = 0;<br />
&nbsp; <br />
&nbsp; for (int i = 0; i &lt; input.length(); i++)<br />
&nbsp; {<br />
&nbsp;  letter = input.charAt(i);<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (Character.isLetter(letter))<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  q.add(letter);<br />
&nbsp; &nbsp; &nbsp; &nbsp;  s.push(letter);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; }<br />
&nbsp; while (!q.isEmpty())<br />
&nbsp; {<br />
&nbsp;  if (q.remove() != s.pop())<br />
&nbsp; &nbsp; &nbsp; &nbsp;  mismatches++;<br />
&nbsp; }<br />
&nbsp; return (mismatches == 0);<br />
&nbsp;}<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>tnccjavaMatt</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235537.html</guid>
		</item>
		<item>
			<title>netbeans troubles</title>
			<link>http://www.daniweb.com/forums/thread235517.html</link>
			<pubDate>Tue, 03 Nov 2009 01:20:12 GMT</pubDate>
			<description><![CDATA[Hello again DW.  Tomorrow I have an interview and I'm trying to make a jar of my latest project.  Using netbeans, I've created a jar and everything looks fine.  I can see all the card IconImages in the Jlabels and it looks fine.  But when I repaint the frame, the card images arent repainted.  Its...]]></description>
			<content:encoded><![CDATA[<div>Hello again DW.  Tomorrow I have an interview and I'm trying to make a jar of my latest project.  Using netbeans, I've created a jar and everything looks fine.  I can see all the card IconImages in the Jlabels and it looks fine.  But when I repaint the frame, the card images arent repainted.  Its like the path is incorrect or something.  But when I run the project, the repainting runs fine.  Its only in the jar that I'm having this issue.  I appreciate any help.  <br />
<br />
Here is some code:<br />
 <pre style="margin:20px; line-height:13px">//---------This code re sets the ImageIcon of the JLabels.<br />
&nbsp; if (comp.equals(&quot;pHand1&quot;))<br />
&nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pat = getCardImagePath(card);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; catch(Exception e)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Error999: &quot;+e);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pHand1.setIcon(new ImageIcon(pat));<br />
&nbsp; &nbsp; &nbsp; }<br />
//............This code is part of getCardImagePath method and gets the path based on param.&nbsp; It returns the path string representing the image path.<br />
<br />
char sut = card.getSuite();<br />
&nbsp; &nbsp; &nbsp; &nbsp; int nub = card.getNumb();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (sut == 'S')<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (nub == 14)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; path = &quot;src/poker/resources/spades-a-75.png&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if (nub == 2)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; path = &quot;src/poker/resources/spades-2-75.png&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if (nub == 3)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; path = &quot;src/poker/resources/spades-3-75.png&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if (nub == 4)<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>ryno365</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235517.html</guid>
		</item>
		<item>
			<title>Put ArrayList in HashMap</title>
			<link>http://www.daniweb.com/forums/thread235514.html</link>
			<pubDate>Tue, 03 Nov 2009 00:59:59 GMT</pubDate>
			<description><![CDATA[I have put an array list in a hash map, but the problem is the old values of the hash map are over written everytime. So the old values of the hashmap aren't stored. Could someone tell me what mistake I am making? 
  
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right;...]]></description>
			<content:encoded><![CDATA[<div>I have put an array list in a hash map, but the problem is the old values of the hash map are over written everytime. So the old values of the hashmap aren't stored. Could someone tell me what mistake I am making?<br />
 <br />
<br />
 <pre style="margin:20px; line-height:13px">import java.util.*;<br />
public class Cain {<br />
<br />
&nbsp; &nbsp;  static List values;<br />
&nbsp; &nbsp; /**<br />
&nbsp; &nbsp;  * @param args the command line arguments<br />
&nbsp; &nbsp;  */<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; private static String Board [][] = {{ &quot; &quot;, &quot; &quot;, &quot; &quot;},<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; { &quot; &quot;, &quot; &quot;, &quot; &quot;},<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; { &quot; &quot;, &quot; &quot;, &quot; &quot;}};<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //////RESETS BOARD AFTER GAME<br />
&nbsp; &nbsp; &nbsp; &nbsp; private static String BoardB [][] = {{ &quot; &quot;, &quot; &quot;, &quot; &quot;},<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  { &quot; &quot;, &quot; &quot;, &quot; &quot;},<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  { &quot; &quot;, &quot; &quot;, &quot; &quot;}};<br />
&nbsp; &nbsp; &nbsp; &nbsp; private static String BoardC [][] = {{ &quot; &quot;, &quot; &quot;, &quot; &quot;},<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  { &quot; &quot;, &quot; &quot;, &quot; &quot;},<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  { &quot; &quot;, &quot; &quot;, &quot; &quot;}};<br />
&nbsp; &nbsp; &nbsp; &nbsp; private static String BoardD [][] = {{ &quot; &quot;, &quot; &quot;, &quot; &quot;},<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  { &quot; &quot;, &quot; &quot;, &quot; &quot;},<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  { &quot; &quot;, &quot; &quot;, &quot; &quot;}};<br />
&nbsp; &nbsp; &nbsp; &nbsp; private static String BoardE [][] = {{ &quot; &quot;, &quot; &quot;, &quot; &quot;},<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  { &quot; &quot;, &quot; &quot;, &quot; &quot;},<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  { &quot; &quot;, &quot; &quot;, &quot; &quot;}};<br />
<br />
<br />
&nbsp; &nbsp; /////VALUES OF BEST SPOTS TO PLAY IN FOR THE GAMES/////////////////<br />
&nbsp; &nbsp; /////////////DISPLAYS BOARD//////////////////////<br />
&nbsp; &nbsp; public static void displayBoard (String z[][])<br />
{<br />
System.out.println(&quot; &quot;+z[0][0]+&quot; | &quot;+z[0][1]+&quot; | &quot;+z[0][2] + &quot; | &quot;);<br />
System.out.println(&quot; --------------&quot;);<br />
System.out.println(&quot; &quot;+z[1][0]+&quot; | &quot;+z[1][1]+&quot; | &quot;+z[1][2] + &quot; | &quot;);<br />
System.out.println(&quot; --------------&quot;);<br />
System.out.println(&quot; &quot;+z[2][0]+&quot; | &quot;+z[2][1]+&quot; | &quot;+z[2][2] + &quot; | &quot;);<br />
System.out.println(&quot; --------------&quot;);<br />
<br />
}<br />
&nbsp; &nbsp; public static boolean GoalState(String z[][])<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(<br />
&nbsp; &nbsp; &nbsp; &nbsp; z[0][0].equals(&quot;0&quot;)&amp;&amp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; z[0][1].equals(&quot;1&quot;)&amp;&amp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; z[0][2].equals(&quot;2&quot;)&amp;&amp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; z[1][0].equals(&quot;3&quot;)&amp;&amp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; z[1][1].equals(&quot;4&quot;)&amp;&amp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; z[1][2].equals(&quot;5&quot;)&amp;&amp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; z[2][0].equals(&quot;6&quot;)&amp;&amp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; z[2][1].equals(&quot;7&quot;)&amp;&amp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; z[2][2].equals(&quot;8&quot;))<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return false;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public static void main(String[] args)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; Random randomGenerator = new Random();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; int count = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; String Blank = &quot; &quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int avail&nbsp; = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int avail2 = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int posv&nbsp;  = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int posh&nbsp;  = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int posv2&nbsp; = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int posh2&nbsp; = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int posv3&nbsp; = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int posh3&nbsp; = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int posv4&nbsp; = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int posh4&nbsp; = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int posv5&nbsp; = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int posh5&nbsp; = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int mov&nbsp; &nbsp; = 0; int mov1&nbsp; &nbsp; = 0; int mov2&nbsp; &nbsp; = 0; int mov3&nbsp; &nbsp; = 0; int mov4&nbsp; &nbsp; = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int mov5&nbsp; &nbsp; = 0; int mov6&nbsp; &nbsp; = 0; int mov7&nbsp; &nbsp; = 0; int mov8&nbsp; &nbsp; = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; boolean possible = false;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int Rand = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int Rand1 = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int Rand2 = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int Rand3 = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int Random = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int temp = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int temp2 = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int posh5B = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int posv5B = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int posh5C = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int posv5C = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int posh5D = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int posv5D = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int posh5E = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int posv5E = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; String [] Array = new String [8];<br />
&nbsp; &nbsp; &nbsp; &nbsp; String This = &quot; &quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; String This2= &quot; &quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; String This3= &quot; &quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; ArrayList arrayList = new ArrayList();<br />
&nbsp; &nbsp; &nbsp; &nbsp; boolean Goal = false;<br />
&nbsp; &nbsp; &nbsp; &nbsp; HashMap&nbsp; hashm = new HashMap ();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; Board[0][0] = (&quot;2&quot;);&nbsp;  BoardB[0][0] = (&quot;3&quot;); BoardC[0][0] = (&quot;3&quot;); BoardD[0][0] = (&quot;3&quot;);&nbsp; BoardE[0][0] = (&quot;3&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; Board[0][1] = (&quot;1&quot;);&nbsp;  BoardB[0][1] = (&quot;0&quot;); BoardC[0][1] = (&quot;0&quot;); BoardD[0][1] = (&quot;0&quot;);&nbsp; BoardE[0][1] = (&quot;0&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; Board[0][2] = (&quot;0&quot;);&nbsp;  BoardB[0][2] = (&quot;5&quot;); BoardC[0][2] = (&quot;5&quot;); BoardD[0][2] = (&quot;5&quot;);&nbsp; BoardE[0][2] = (&quot;5&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; Board[1][0] = (&quot;3&quot;);&nbsp;  BoardB[1][0] = (&quot;6&quot;); BoardC[1][0] = (&quot;6&quot;); BoardD[1][0] = (&quot;6&quot;);&nbsp; BoardE[1][0] = (&quot;6&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; Board[1][1] = (&quot;4&quot;);&nbsp;  BoardB[1][1] = (&quot;1&quot;); BoardC[1][1] = (&quot;1&quot;); BoardD[1][1] = (&quot;1&quot;);&nbsp; BoardE[1][1] = (&quot;1&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; Board[1][2] = (&quot;5&quot;);&nbsp;  BoardB[1][2] = (&quot;7&quot;); BoardC[1][2] = (&quot;7&quot;); BoardD[1][2] = (&quot;7&quot;);&nbsp; BoardE[1][2] = (&quot;7&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; Board[2][0] = (&quot;6&quot;);&nbsp;  BoardB[2][0] = (&quot;4&quot;); BoardC[2][0] = (&quot;4&quot;); BoardD[2][0] = (&quot;4&quot;);&nbsp; BoardE[2][0] = (&quot;4&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; Board[2][1] = (&quot;7&quot;);&nbsp;  BoardB[2][1] = (&quot;2&quot;); BoardC[2][1] = (&quot;2&quot;); BoardD[2][1] = (&quot;2&quot;);&nbsp; BoardE[2][1] = (&quot;2&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; Board[2][2] = (&quot;8&quot;);&nbsp;  BoardB[2][2] = (&quot;8&quot;); BoardC[2][2] = (&quot;8&quot;); BoardD[2][2] = (&quot;8&quot;);&nbsp; BoardE[2][2] = (&quot;8&quot;);<br />
<br />
&nbsp; &nbsp;  Scanner choice = new Scanner(System.in);<br />
&nbsp; //&nbsp;  while(Goal == false)<br />
<br />
&nbsp; &nbsp;  while(GoalState(Board) == false)<br />
&nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  if(GoalState(Board) == true)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  displayBoard(Board);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; avail&nbsp; &nbsp; = 2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; avail2 = 2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; for(int i =0; i &lt; 3; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for(int j = 0; j &lt; 3; j++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Array[i] = Board[i][j];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; arrayList.add(Array[i]);<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp;  System.out.println(&quot;Array is drum roll &quot; + Array[i]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(BoardB[i][j].equals(&quot;0&quot;))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; { posh5B&nbsp; = i;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; posv5B = j;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(BoardC[i][j].equals(&quot;0&quot;))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; { posh5C&nbsp; = i;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; posv5C = j;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(BoardD[i][j].equals(&quot;0&quot;))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; { posh5D&nbsp; = i;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; posv5D = j;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(BoardE[i][j].equals(&quot;0&quot;))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; { posh5E&nbsp; = i;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; posv5E = j;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(Board[i][j].equals(&quot;0&quot;))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; { posh5&nbsp; = i;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; posv5 = j;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //&nbsp;  displayBoard(Board);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println (&quot;KA CHING AL LING A LING BLING BLING &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //MOVE LEFT<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if(j&nbsp; &gt; 0 )<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;LEFTMOVE &quot; + i + &quot; &quot; + (j-1));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mov = i; mov2 = j-1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; avail = i; avail2 = j-1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //&nbsp; &nbsp; al.add(This);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp;  String TempB = BoardB[avail][avail2];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp;  BoardB[avail][avail2] = BoardB[posh5B][posv5B];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp;  BoardB[posh5B][posv5B]&nbsp; = TempB;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //&nbsp; &nbsp; &nbsp;  displayBoard(BoardB);&nbsp; //*/<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  // MOVE DOWN<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if(i &gt;= 0 &amp;&amp; i &lt; 2)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;DOWNMOVE &quot; + (i+1)&nbsp; + &quot; &quot; + j );<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  mov3 = i+1; mov4 = j;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /*&nbsp; &nbsp;  avail = mov3; avail2 = mov4;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String TempC = BoardC[avail][avail2];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; BoardC[avail][avail2] = BoardC[posh5C][posv5C];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; BoardC[posh5C][posv5C]&nbsp; = TempC;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; displayBoard(BoardC);//*/<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  // MOVE RIGHT\<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if(j == 1 || j == 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  System.out.println(&quot;RIGHTMOVER &quot; +i + &quot; &quot; + (j+1));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  mov5 = i; mov6 = j+1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /* avail = mov5; avail2 = mov6;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String TempD = BoardD[avail][avail2];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; BoardD[avail][avail2] = BoardD[posh5D][posv5D];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; BoardD[posh5D][posv5D]&nbsp; = TempD;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; displayBoard(BoardD);//*/<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  // MOVE UP<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if(i == 1 || i == 2)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;UPMOVE &quot; + (i-1)&nbsp; + &quot; &quot; + j);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  mov7 = i-1; mov8 = j;<br />
/*&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; avail = mov7; avail2 = mov8;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String TempU = BoardE[avail][avail2];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; BoardE[avail][avail2] = BoardE[posh5E][posv5E];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; BoardE[posh5E][posv5E]&nbsp; = TempU;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; displayBoard(BoardE);//*/<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(mov&nbsp; + mov2 !=0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Rand = 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(mov3 + mov4 !=0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Rand1 = 2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(mov5 + mov6 !=0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Rand2 = 3;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(mov7 + mov8 !=0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Rand3 = 4;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int randomInts = randomGenerator.nextInt(4);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int randoms&nbsp; &nbsp; = randomGenerator.nextInt(5);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int randomia&nbsp;  = randomGenerator.nextInt(5);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; randomInts +=1;// ((randoms + randomia)/3) +1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //&nbsp;  System.out.println(&quot;Random no is &quot; + randomInts);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if(randomInts == Rand)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  avail = mov; avail2 = mov2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  else if(randomInts == Rand1)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  avail = mov3; avail2 = mov4;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  else if(randomInts == Rand2)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  avail = mov5; avail2 =&nbsp; mov6;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  else if(randomInts == Rand3)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  avail = mov7; avail2 =&nbsp; mov8;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  displayBoard(Board);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  System.out.println(&quot; &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp;  count +=1;<br />
//hm.put(&quot;one&quot;,new Integer(1));<br />
&nbsp;  // System.out.println(&quot;AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA&quot; + hm.get(count-1));<br />
&nbsp; &nbsp;  //&nbsp; &nbsp; if(count/9 == 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //&nbsp; al = null;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  //if(count &gt; 3){<br />
&nbsp; &nbsp; &nbsp; &nbsp;  String Temp = Board[avail][avail2];<br />
&nbsp; &nbsp; &nbsp; &nbsp;  Board[avail][avail2] = Board[posh5][posv5];<br />
&nbsp; &nbsp; &nbsp; &nbsp;  Board[posh5][posv5]&nbsp; = Temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Goal = true;<br />
&nbsp; &nbsp; &nbsp;  //&nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp;System.out.println(&quot; a &quot; + arrayList );<br />
hashm.put(count, arrayList);<br />
//hashm.get(2);<br />
<br />
&nbsp;System.out.println(&quot; The hash isst &quot; + hashm);<br />
// System.out.println(&quot; HASSS IS&nbsp; &nbsp; &quot; + hashm.get(1));<br />
// System.out.println(&quot; The hash is &quot; + hm);<br />
&nbsp;arrayList.clear();//*/<br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  }<br />
//System.out.println(&quot; The hash is &quot; + hashm);<br />
&nbsp; &nbsp; }<br />
<br />
<br />
&nbsp; &nbsp; }</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>torbecire</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235514.html</guid>
		</item>
		<item>
			<title>WTF!!! Vigenère Ciphering</title>
			<link>http://www.daniweb.com/forums/thread235506.html</link>
			<pubDate>Mon, 02 Nov 2009 23:41:21 GMT</pubDate>
			<description>Vigenère Ciphering 
You are to develop a program to implement Vigenère ciphering to encrypt and decrypt text 
information. A description of Vigenère ciphering can be found at: 
http://en.wikipedia.org/wiki/Vigen%C3%A8re_cipher. 
To illustrate encryption, a table of characters shown below can be...</description>
			<content:encoded><![CDATA[<div>Vigenère Ciphering<br />
You are to develop a program to implement Vigenère ciphering to encrypt and decrypt text<br />
information. A description of Vigenère ciphering can be found at:<br />
<a rel="nofollow" class="t" href="http://en.wikipedia.org/wiki/Vigen%C3%A8re_cipher" target="_blank">http://en.wikipedia.org/wiki/Vigen%C3%A8re_cipher</a>.<br />
To illustrate encryption, a table of characters shown below can be used, termed a tabula recta,<br />
Vigenère square, or Vigenère table. It consists of the alphabet written out 26 times in different<br />
rows, each alphabet shifted cyclically to the left compared to the previous alphabet,<br />
corresponding to the 26 possible Caesar ciphers. For each letter in the plain text, a letter from a<br />
repeated keyword is used to define which row in the table is used to encrypt the character.<br />
<br />
For example, suppose that the plaintext to be encrypted is (note that spaces an non alphabetic<br />
characters are not allowed):<br />
ATTACKATDAWN<br />
The person sending the message chooses an encryption keyword which is repeated until it<br />
matches the length of the plaintext, for example, consider the keyword &quot;LEMON&quot;:<br />
LEMONLEMONLE<br />
The first letter of the plaintext, A, is encrypted using the alphabet in row L, which is the first<br />
letter of the key. This is done by looking at the letter in row L and column A of the Vigenère<br />
square, namely L. Similarly, for the second letter of the plaintext, the second letter of the key is<br />
used; the letter at row E and column T is X. The rest of the plaintext is enciphered in a similar<br />
fashion:<br />
Plaintext: ATTACKATDAWN<br />
Key: LEMONLEMONLE<br />
Ciphertext LXFOPVEFRNHR<br />
Decryption is performed by finding the position of the ciphertext letter in a row of the table<br />
(using the character from the keyword to select the row), and then taking the label of the column<br />
in which it appears as the plaintext. For example, in row L, the ciphertext L appears in column A,<br />
which taken as the first plaintext letter. The second letter is decrypted by looking up X in row E<br />
of the table; it appears in column T, which is taken as the plaintext letter.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>bmanoman</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235506.html</guid>
		</item>
		<item>
			<title>how to output the result in jframe</title>
			<link>http://www.daniweb.com/forums/thread235502.html</link>
			<pubDate>Mon, 02 Nov 2009 23:21:46 GMT</pubDate>
			<description><![CDATA[This code outputs the result in console. I want to implement a Swing JFrame, producing output readable by user.  Do I have to change all my code if I want to use JFrame? Can anyone help? I am not familiar with JFrame at all. Thanks : ) 
 
  <div class="codeblock"> <div class="spaced"> <div...]]></description>
			<content:encoded><![CDATA[<div>This code outputs the result in console. I want to implement a Swing JFrame, producing output readable by user.  Do I have to change all my code if I want to use JFrame? Can anyone help? I am not familiar with JFrame at all. Thanks : )<br />
<br />
 <pre style="margin:20px; line-height:13px">import javax.swing.*;<br />
<br />
/**<br />
&nbsp;* Process payroll.<br />
<br />
&nbsp;*/<br />
public class payroll <br />
{<br />
&nbsp; &nbsp; /**<br />
&nbsp; &nbsp;  * Creates an array of employees (currently hard coded), and asks<br />
&nbsp; &nbsp;  * for the hours of each, then prints paystubs for each and total<br />
&nbsp; &nbsp;  * amount paid at the end.<br />
&nbsp; &nbsp;  */<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; public static void main(String[] args)<br />
&nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Employee[] emp = new Employee[5];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; emp[0] = new HourlyEmployee(&quot;Glenn, James&quot;, &quot;123456789&quot;, 6.00);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; emp[1] = new HourlyEmployee(&quot;Eastman, Roger&quot;, &quot;222222222&quot;, 8.00);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; emp[2] = new SalariedEmployee(&quot;Haddad, David&quot;, &quot;823712468&quot;, 150000);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; emp[3] = new SalariedEmployee(&quot;Buckley, James&quot;, &quot;284618461&quot;, 125000);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; emp[4] = new SalariedEmployee(&quot;Thomas, Amanda&quot;, &quot;184649714&quot;, 110000);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // do this for two weeks<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int wk = 0; wk &lt; 2; wk++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double totalPaid = 0.0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // go over all employees<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int e = 0; e &lt; emp.length; e++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double hrs = Double.parseDouble(JOptionPane.showInputDialog(&quot;Enter hours worked during week &quot; + (wk + 1) + &quot; for &quot; + emp[e]));<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; totalPaid += emp[e].calcWeeklyPay(hrs);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(emp[e].makePaystub(hrs)); <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; emp[e].updateRecord(hrs);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Total paid for week = &quot; + totalPaid);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.exit(0);<br />
&nbsp; &nbsp; }<br />
}<br />
<br />
public class Employee<br />
{<br />
&nbsp; <br />
&nbsp; &nbsp; private String ssn;<br />
&nbsp; &nbsp; private String name;&nbsp;  <br />
&nbsp; &nbsp; private double ytdPay;<br />
<br />
&nbsp; &nbsp; public Employee(String n, String s)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; name = n;<br />
&nbsp; &nbsp; &nbsp; &nbsp; ssn = s;<br />
&nbsp; &nbsp; &nbsp; &nbsp; ytdPay = 0;<br />
&nbsp; &nbsp; }&nbsp; &nbsp; <br />
&nbsp; &nbsp; public double getYTDPay()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; return ytdPay;<br />
&nbsp; &nbsp; }&nbsp;  <br />
&nbsp; &nbsp; public double calcWeeklyPay(double hrs)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; return 0.0;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp;  public void updateRecord(double hrs)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; ytdPay += calcWeeklyPay(hrs);<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp;  public String toString()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; return (ssn.substring(0, 3) + &quot;-&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  + ssn.substring(3, 5) + &quot;-&quot; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + ssn.substring(5, 9) + &quot; &quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + name);<br />
&nbsp; &nbsp; }&nbsp;  <br />
&nbsp; &nbsp; public String makePaystub(double hrs)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; return &quot;&quot;;<br />
&nbsp; &nbsp; }<br />
}<br />
<br />
public class HourlyEmployee extends Employee <br />
{<br />
&nbsp; &nbsp; &nbsp; private double wage;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; public HourlyEmployee(String n, String s, double w)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; super(n, s);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; wage = w;<br />
&nbsp; &nbsp; }<br />
&nbsp;  <br />
&nbsp; &nbsp; public double calcWeeklyPay(double hrs)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; return wage * hrs;<br />
&nbsp; &nbsp; }&nbsp;  <br />
&nbsp; &nbsp; public String makePaystub(double hrs)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; return (toString() + &quot; &quot; + hrs + &quot; 0 &quot; + wage + &quot; &quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + calcWeeklyPay(hrs) + &quot; &quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + (getYTDPay() + calcWeeklyPay(hrs)));<br />
&nbsp; &nbsp; }<br />
}<br />
<br />
public class SalariedEmployee extends Employee<br />
{<br />
&nbsp; &nbsp;  private double salary;<br />
&nbsp; &nbsp;  private double leave;<br />
<br />
&nbsp; &nbsp;  public SalariedEmployee(String n, String s, double sal)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; super(n, s);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; salary = sal;<br />
&nbsp; &nbsp; &nbsp; &nbsp; leave = 0.0;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp;  public double calcWeeklyPay(double hrs)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; double weeklySalary = salary / (365.0 / 7);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; return weeklySalary * Math.min(40.0, hrs + calcLeaveUsed(hrs)) / 40.0;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public double calcLeaveUsed(double hrs)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (hrs &gt; 40.0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return 0; // worked full week; no leave used<br />
&nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return Math.min(leave, 40.0 - hrs);<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp;  public void updateRecord(double hrs)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; // update year to date pay<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; super.updateRecord(hrs);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; // take out any leave used<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; double leaveUsed = calcLeaveUsed(hrs);<br />
&nbsp; &nbsp; &nbsp; &nbsp; leave -= leaveUsed;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; // put back in leave earned (leave earned if paid for &gt;= 40 hrs)<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (hrs + leaveUsed &gt;= 40.0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; leave += 4;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp;  public String makePaystub(double hrs)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; return (toString() + &quot; &quot; + hrs + &quot; &quot; + calcLeaveUsed(hrs) + &quot; &quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + salary + &quot; &quot; + calcWeeklyPay(hrs) + &quot; &quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + (getYTDPay() + calcWeeklyPay(hrs)));<br />
&nbsp; &nbsp; }<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>YingKang</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235502.html</guid>
		</item>
		<item>
			<title>hangman on the phone problem Java</title>
			<link>http://www.daniweb.com/forums/thread235490.html</link>
			<pubDate>Mon, 02 Nov 2009 22:23:58 GMT</pubDate>
			<description><![CDATA[I have a question about my java program. 
 
I'm new to Java, but I learn fast:P. 
 
I have the following problem. 
 
I need to communicatie between 2 mobile phones. The entered character will be checked by methode checkletter. After completing the check, the frame will be set. The first 7 frames...]]></description>
			<content:encoded><![CDATA[<div>I have a question about my java program.<br />
<br />
I'm new to Java, but I learn fast:P.<br />
<br />
I have the following problem.<br />
<br />
I need to communicatie between 2 mobile phones. The entered character will be checked by methode checkletter. After completing the check, the frame will be set. The first 7 frames are for the sender. The next 7 frames are of the receiver. The 14th frame is an actionframe. From 15 and counting, the frames are for the letter that is entered.<br />
<br />
The most important frame is 15. resulltString has an hexdecimal notation. If you entered &quot;hello&quot; as the play-word. If I search for the &quot;l&quot;, it gives me this number 12.<br />
<br />
12 means binair number like 01100. l is on the 3rd and 4th place.<br />
<br />
The other player needs to open these slots.<br />
<br />
That needs to happen within the if statement of method frameEvent().<br />
<br />
That my problem. How do I get hex 12 to be a biniar number and also open the slots of the word. The null needs to get a dot. It has to be remembered for the next turn.<br />
<br />
 <pre style="margin:20px; line-height:13px">public void checkletter(String letter)<br />
setFrameSender(getName());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setFrameReceiver(Opponent);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; frame[14] = 'R';<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; copyStringToFrame(resultString, 15, resultString.length());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sendFrame(frame);</pre> <pre style="margin:20px; line-height:13px">public void frameEvent(byte[] frame)<br />
<br />
String sendername = new String(frame, 0, 7).trim();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String recname = new String(frame, 7, 7).trim();<br />
<br />
if (frame[14] == 'R')<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
...........................................................<br />
...........................................................<br />
..........................................................<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>AccessFreak</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235490.html</guid>
		</item>
		<item>
			<title>Flash .swf files in Java application</title>
			<link>http://www.daniweb.com/forums/thread235478.html</link>
			<pubDate>Mon, 02 Nov 2009 21:15:51 GMT</pubDate>
			<description><![CDATA[Hello to all, I would like to ask if someone knows any way to display a .swf file in a Java application. I found this link about an API that allows that - http://www.jpackages.com/jflashplayer/ , but it's for Windows only (including some way of converting, so Mac would not be excluded), but there...]]></description>
			<content:encoded><![CDATA[<div>Hello to all, I would like to ask if someone knows any way to display a .swf file in a Java application. I found this link about an API that allows that - <a rel="nofollow" class="t" href="http://www.jpackages.com/jflashplayer/" target="_blank">http://www.jpackages.com/jflashplayer/</a> , but it's for Windows only (including some way of converting, so Mac would not be excluded), but there is nothing there about applying it to a Linux system. I strictly need this to work on a Linux platform. Any help would be appreciated. <br />
Regards, Robert</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>robertmacedonia</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235478.html</guid>
		</item>
		<item>
			<title>Input an integer number and display its largest factor</title>
			<link>http://www.daniweb.com/forums/thread235464.html</link>
			<pubDate>Mon, 02 Nov 2009 20:34:40 GMT</pubDate>
			<description>Alright guys i got another one: 
 
 In the class Mymath, create a public method called calculateFactor. The method has two two arguments of type integer and checks whether the smaller of the two integers is a factor of the larger of the two integers. The method will return a factor or a zero. 
...</description>
			<content:encoded><![CDATA[<div>Alright guys i got another one:<br />
<br />
 In the class Mymath, create a public method called calculateFactor. The method has two two arguments of type integer and checks whether the smaller of the two integers is a factor of the larger of the two integers. The method will return a factor or a zero.<br />
<br />
Write a main method which reads in a positive integer n and displays out the largest proper divisor of n (that is, the largest factor of n that is less than n itself).<br />
<br />
Sample output:<br />
<br />
Input an integer number:<br />
124<br />
Largest divisor: 62<br />
Another input (y/n)?<br />
y<br />
Input an integer number:<br />
18<br />
Largest divisor: 9<br />
<br />
Sample Run:<br />
<br />
6<br />
28<br />
496<br />
<br />
Im having alot of trouble with this one. Please Help.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>kulrik</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235464.html</guid>
		</item>
		<item>
			<title>Anonymous class</title>
			<link>http://www.daniweb.com/forums/thread235455.html</link>
			<pubDate>Mon, 02 Nov 2009 19:51:42 GMT</pubDate>
			<description><![CDATA[I have this code, but instead of implementing class enumeration I want to create an anonymous class in the method getEnumeration that does the job right in the return, hwo do I do that? 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a...]]></description>
			<content:encoded><![CDATA[<div>I have this code, but instead of implementing class enumeration I want to create an anonymous class in the method getEnumeration that does the job right in the return, hwo do I do that?<br />
 <pre style="margin:20px; line-height:13px">// File: TestList.java (Module 10)<br />
//<br />
// Author: Rahul Simha<br />
// Created: Nov 2, 1998<br />
//<br />
// Starting point for Ex. 10.1: an anonymous class<br />
// implementation of an Enumeration.<br />
// The current file has the list implement the enumeration.<br />
<br />
import java.util.*;<br />
<br />
abstract class ComparableObject {<br />
&nbsp; public abstract String toString ();<br />
&nbsp; public abstract int compare (ComparableObject c);<br />
}<br />
<br />
class ListItem {<br />
<br />
&nbsp; ComparableObject data = null; <br />
&nbsp; ListItem next = null;<br />
<br />
&nbsp; // Constructor.<br />
&nbsp; public ListItem (ComparableObject obj)<br />
&nbsp; {<br />
&nbsp; &nbsp; data = obj;&nbsp; next = null;<br />
&nbsp; }<br />
&nbsp; <br />
&nbsp; // Accessor.<br />
&nbsp; public ComparableObject getData () <br />
&nbsp; {<br />
&nbsp; &nbsp; return data;<br />
&nbsp; }<br />
}<br />
<br />
<br />
// LinkedList now implements Enumeration itself.<br />
<br />
class LinkedList implements Enumeration {<br />
<br />
&nbsp; ListItem front = null;<br />
&nbsp; ListItem rear = null;<br />
&nbsp; int numItems = 0;&nbsp; &nbsp; &nbsp; // Current number of items.<br />
<br />
&nbsp; // Instance method to add a data item.<br />
&nbsp; public void addData (ComparableObject obj)<br />
&nbsp; {<br />
&nbsp; &nbsp; if (front == null) {<br />
&nbsp; &nbsp; &nbsp; front = new ListItem (obj);<br />
&nbsp; &nbsp; &nbsp; rear = front;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; else {<br />
&nbsp; &nbsp; &nbsp; // Find the right place.<br />
&nbsp; &nbsp; &nbsp; ListItem tempPtr=front, prevPtr=front;<br />
&nbsp; &nbsp; &nbsp; boolean found = false;<br />
&nbsp; &nbsp; &nbsp; while ( (!found) &amp;&amp; (tempPtr != null) ) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (tempPtr.data.compare(obj) &gt; 0) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; found = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; prevPtr = tempPtr;<br />
&nbsp; &nbsp; &nbsp; &nbsp; tempPtr = tempPtr.next;<br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; // Now insert.<br />
&nbsp; &nbsp; &nbsp; if (!found) { // Insert at rear.<br />
&nbsp; &nbsp; &nbsp; &nbsp; rear.next = new ListItem (obj);<br />
&nbsp; &nbsp; &nbsp; &nbsp; rear = rear.next;<br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; else if (tempPtr == front) { // Insert in front.<br />
&nbsp; &nbsp; &nbsp; &nbsp; ListItem Lptr = new ListItem (obj);<br />
&nbsp; &nbsp; &nbsp; &nbsp; Lptr.next = front;<br />
&nbsp; &nbsp; &nbsp; &nbsp; front = Lptr;<br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; else { // Insert in the middle.<br />
&nbsp; &nbsp; &nbsp; &nbsp; ListItem Lptr = new ListItem (obj);<br />
&nbsp; &nbsp; &nbsp; &nbsp; prevPtr.next = Lptr;<br />
&nbsp; &nbsp; &nbsp; &nbsp; Lptr.next = tempPtr;<br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; numItems++;<br />
&nbsp; }<br />
<br />
&nbsp; public void printList ()<br />
&nbsp; {<br />
&nbsp; &nbsp; ListItem listPtr = front;<br />
&nbsp; &nbsp; System.out.println (&quot;List: (&quot; + numItems + &quot; items)&quot;);<br />
&nbsp; &nbsp; int i = 1;<br />
&nbsp; &nbsp; while (listPtr != null) {<br />
&nbsp; &nbsp; &nbsp; System.out.println (&quot;Item# &quot; + i + &quot;: &quot; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + listPtr.getData());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Must implement toString()<br />
&nbsp; &nbsp; &nbsp; i++;<br />
&nbsp; &nbsp; &nbsp; listPtr = listPtr.next;<br />
&nbsp; &nbsp; }<br />
&nbsp; }<br />
<br />
&nbsp; ListItem enumPtr;<br />
<br />
&nbsp; // Must implement this method.<br />
&nbsp; public boolean hasMoreElements ()<br />
&nbsp; {<br />
&nbsp; &nbsp; if (enumPtr == null)<br />
&nbsp; &nbsp; &nbsp; return false;<br />
&nbsp; &nbsp; else <br />
&nbsp; &nbsp; &nbsp; return true;<br />
&nbsp; }<br />
<br />
&nbsp; // Must implement this method.<br />
&nbsp; public Object nextElement() <br />
&nbsp; {<br />
&nbsp; &nbsp; Object obj = enumPtr.data;<br />
&nbsp; &nbsp; enumPtr = enumPtr.next;<br />
&nbsp; &nbsp; return obj;<br />
&nbsp; }<br />
<br />
&nbsp; // This is needed to return an Enumeration<br />
&nbsp; // instance to the user.<br />
&nbsp; public Enumeration getEnumeration ()<br />
&nbsp; {<br />
&nbsp; &nbsp; enumPtr = front;<br />
&nbsp; &nbsp; return this;&nbsp; &nbsp; &nbsp; // Using the &quot;this&quot; reserved word.<br />
&nbsp; }<br />
<br />
} // End of class &quot;LinkedList&quot;<br />
<br />
<br />
// An object to use in the list:<br />
<br />
class Person extends ComparableObject {<br />
<br />
&nbsp; String name;<br />
&nbsp; String ssn;<br />
<br />
&nbsp; // Constructor.<br />
&nbsp; public Person (String nameIn, String ssnIn)<br />
&nbsp; {<br />
&nbsp; &nbsp; name = nameIn;&nbsp; ssn = ssnIn;<br />
&nbsp; }<br />
<br />
&nbsp; // Override toString()<br />
&nbsp; public String toString ()<br />
&nbsp; {<br />
&nbsp; &nbsp; return &quot;Person: name=&quot; + name + &quot;, ssn=&quot; + ssn;<br />
&nbsp; }<br />
<br />
&nbsp; // Must implement compare<br />
&nbsp; public int compare (ComparableObject obj)<br />
&nbsp; {<br />
&nbsp; &nbsp; Person p = (Person) obj;<br />
&nbsp; &nbsp; return name.compareTo (p.name);<br />
&nbsp; }<br />
<br />
} // End of class &quot;Person&quot;<br />
<br />
<br />
// Test class.<br />
<br />
public class TestList {<br />
<br />
&nbsp; public static void main (String[] argv)<br />
&nbsp; {<br />
&nbsp; &nbsp; // Create a new list object.<br />
&nbsp; &nbsp; LinkedList L = new LinkedList ();<br />
<br />
&nbsp; &nbsp; // Create a Person instance and add it to list.<br />
&nbsp; &nbsp; L.addData (new Person (&quot;Terminator&quot;, &quot;444-43-4343&quot;));<br />
&nbsp; &nbsp; L.addData (new Person (&quot;James Bond&quot;, &quot;666-65-6565&quot;));<br />
&nbsp; &nbsp; L.addData (new Person (&quot;Rambo&quot;, &quot;555-54-5454&quot;));<br />
&nbsp; &nbsp; L.addData (new Person (&quot;Bruce Lee&quot;, &quot;777-76-7676&quot;));<br />
<br />
&nbsp; &nbsp; // Print contents via an Enumeration.<br />
&nbsp; &nbsp; Enumeration e = L.getEnumeration();<br />
&nbsp; &nbsp; while (e.hasMoreElements())<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; Person p = (Person) e.nextElement();<br />
&nbsp; &nbsp; &nbsp; System.out.println (p);<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; }<br />
<br />
} // End of class &quot;TestList&quot;</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>Samyx</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235455.html</guid>
		</item>
		<item>
			<title>setEditable to JEditorPane</title>
			<link>http://www.daniweb.com/forums/thread235454.html</link>
			<pubDate>Mon, 02 Nov 2009 19:51:27 GMT</pubDate>
			<description><![CDATA[Hello All, 
 
I am developing Chat Application, But facing a problem  
in displaying Chat text 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox" title="Help...]]></description>
			<content:encoded><![CDATA[<div>Hello All,<br />
<br />
I am developing Chat Application, But facing a problem <br />
in displaying Chat text<br />
<br />
 <pre style="margin:20px; line-height:13px"><br />
public void appendText(String text)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; displayChats.replaceSelection(&quot;\n&quot;+text);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; displayChats.setCaretPosition(displayChats.getDocument().getLength()); //Scroll to bottom<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; }</pre><br />
<br />
Works fine while i append the text to JEditorPane(displayChats).<br />
<br />
But when I use setEditable(false); (so that user cannot edit it).<br />
then I need to again Enable the editing just before the replaceSelection<br />
as shown below:<br />
 <pre style="margin:20px; line-height:13px"><br />
&nbsp; &nbsp; &nbsp; &nbsp; public void appendText(String text)//throws NullPointerException<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; displayChats.setEditable(true);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; displayChats.replaceSelection(&quot;\n&quot;+text);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; displayChats.setCaretPosition(displayChats.getDocument().getLength());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; displayChats.setEditable(false);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }</pre><br />
When i use this A following error occurs:<br />
 <pre style="margin:20px; line-height:13px">Exception in thread &quot;AWT-EventQueue-0&quot; java.lang.NullPointerException<br />
&nbsp; &nbsp; &nbsp; &nbsp; at javax.swing.plaf.basic.BasicTextUI$RootView.paint(Unknown Source)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at javax.swing.plaf.basic.BasicTextUI.paintSafely(Unknown Source)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at javax.swing.plaf.basic.BasicTextUI.paint(Unknown Source)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at javax.swing.plaf.basic.BasicTextUI.update(Unknown Source)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at javax.swing.JComponent.paintComponent(Unknown Source)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at javax.swing.JComponent.paint(Unknown Source)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at javax.swing.JComponent.paintToOffscreen(Unknown Source)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at javax.swing.BufferStrategyPaintManager.paint(Unknown Source)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at javax.swing.RepaintManager.paint(Unknown Source)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at javax.swing.JComponent._paintImmediately(Unknown Source)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at javax.swing.JComponent.paintImmediately(Unknown Source)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at java.awt.event.InvocationEvent.dispatch(Unknown Source)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at java.awt.EventQueue.dispatchEvent(Unknown Source)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at java.awt.EventDispatchThread.pumpEvents(Unknown Source)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at java.awt.EventDispatchThread.pumpEvents(Unknown Source)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at java.awt.EventDispatchThread.run(Unknown Source)</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>topest1</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235454.html</guid>
		</item>
		<item>
			<title>Hibernate Issue</title>
			<link>http://www.daniweb.com/forums/thread235397.html</link>
			<pubDate>Mon, 02 Nov 2009 16:03:40 GMT</pubDate>
			<description>I m newbie with Hibernate. I use Netbeans IDE for my Java projects. I wrote the *.hbm file and mapping.xml file. and when i try to create the POJO classes, It apparantly does not show the *.hbm and mappng files associated with the project... 
Any pointers to where I mite be going wrong..  
One more...</description>
			<content:encoded><![CDATA[<div>I m newbie with Hibernate. I use Netbeans IDE for my Java projects. I wrote the *.hbm file and mapping.xml file. and when i try to create the POJO classes, It apparantly does not show the *.hbm and mappng files associated with the project...<br />
Any pointers to where I mite be going wrong.. <br />
One more Question, I downloaded the NEtbeans plugin for ANT.. And I updated the path variable(Environment Variable) with the ANT - bin, yet i m not able to execute &quot;ant&quot; command..</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>GradStudent</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235397.html</guid>
		</item>
		<item>
			<title>simple non gui menu</title>
			<link>http://www.daniweb.com/forums/thread235383.html</link>
			<pubDate>Mon, 02 Nov 2009 15:06:33 GMT</pubDate>
			<description>Hi All, 
 
Im attempting to make a simple java menu system.  the psueo code is as follows 
 
1.  user is presented with menu 
2.  selection is made 
3.  that action is ran, i.e make a new user (i have this code seperate, which works) 
4.  the user is returned to the main menu. 
 
what is actually...</description>
			<content:encoded><![CDATA[<div>Hi All,<br />
<br />
Im attempting to make a simple java menu system.  the psueo code is as follows<br />
<br />
1.  user is presented with menu<br />
2.  selection is made<br />
3.  that action is ran, i.e make a new user (i have this code seperate, which works)<br />
4.  the user is returned to the main menu.<br />
<br />
what is actually happening is it keeps ending.  I tried using a do while, but i cant seem to get my head around it.<br />
<br />
 <pre style="margin:20px; line-height:13px">/*<br />
&nbsp;* To change this template, choose Tools | Templates<br />
&nbsp;* and open the template in the editor.<br />
&nbsp;*/<br />
<br />
package week7;<br />
//import java.io.*;<br />
//import java.io.IOException;<br />
import java.util.Scanner;<br />
/**<br />
&nbsp;*<br />
&nbsp;* @author Administrator<br />
&nbsp;*/<br />
public class whileDoTest {<br />
<br />
&nbsp; &nbsp; @SuppressWarnings(&quot;empty-statement&quot;)<br />
&nbsp; &nbsp; public static void main (String[]arguments)<br />
&nbsp; &nbsp; {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; int menuSelect = 0;<br />
&nbsp; &nbsp; &nbsp;  if (menuSelect ==0){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Please make your selection&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;(1) - New book&nbsp; &nbsp;  :&nbsp; &nbsp;  (2) - New user&nbsp; &nbsp;  :&nbsp; &nbsp;  (3) - New Load&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Scanner scan = new Scanner(System.in);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; menuSelect = scan.nextInt();<br />
&nbsp; &nbsp; &nbsp;  }else{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; switch (menuSelect)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 1:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if(menuSelect == 1) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Selection 1&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;(1) - Main Menu&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }menuSelect = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 2:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(menuSelect ==2) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Selection 2&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 3:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (menuSelect ==3){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Selection 3&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>whiteyoh</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235383.html</guid>
		</item>
	</channel>
</rss>
