<?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>Fri, 20 Nov 2009 23:29:38 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>perfect numbers . . !</title>
			<link>http://www.daniweb.com/forums/thread240095.html</link>
			<pubDate>Fri, 20 Nov 2009 21:14:26 GMT</pubDate>
			<description><![CDATA[Can any one help me with this exercise . . ! 
I did not understnd it . ? 
 
 
 
 
 
* A number  is called a proper divisor of N if M < N and M divides N. A positive integer is called perfect if it is the sum of its positive proper divisors. For example, the positive proper divisors of 28 are 1, 2,...]]></description>
			<content:encoded><![CDATA[<div>Can any one help me with this exercise . . !<br />
I did not understnd it . ?<br />
<br />
<br />
<br />
<br />
<br />
<span style="font-weight:bold"> A number  is called a proper divisor of N if M &lt; N and M divides N. A positive integer is called perfect if it is the sum of its positive proper divisors. For example, the positive proper divisors of 28 are 1, 2, 4, 7, and 14 and 1+2+4+7+14=28. Therefore, 28 is perfect. Write a program to display the first 4 perfect integer  .. </span></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>alreem</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240095.html</guid>
		</item>
		<item>
			<title>String to char</title>
			<link>http://www.daniweb.com/forums/thread240050.html</link>
			<pubDate>Fri, 20 Nov 2009 17:33:11 GMT</pubDate>
			<description><![CDATA[I am writing a simple program that is supposed to take a user input and convert it to char and for each char it should change it to the designated change. 
I'm using switch statements to do this. 
 
Ex. 
blue 
b = bravo 
l = llama 
u = union 
e = excite]]></description>
			<content:encoded><![CDATA[<div>I am writing a simple program that is supposed to take a user input and convert it to char and for each char it should change it to the designated change.<br />
I'm using switch statements to do this.<br />
<br />
Ex.<br />
blue<br />
b = bravo<br />
l = llama<br />
u = union<br />
e = excite<br />
<br />
That is just an example.<br />
This is just a console program and I am wondering if it is possible to do this within the console or if a JOptionPane has to be used?<br />
<br />
if it can be done in the console can I please have a pseudo-code that I could try to implement.<br />
<br />
Hope this stuff makes sense.</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/thread240050.html</guid>
		</item>
		<item>
			<title>Error in Java</title>
			<link>http://www.daniweb.com/forums/thread240005.html</link>
			<pubDate>Fri, 20 Nov 2009 12:38:43 GMT</pubDate>
			<description><![CDATA[Hey, getting a new error in my code... Its almost done, cant figure out what is wrong with this. 
 
ERROR: 
non-static method isPrime(int) cannot be referenced from a static context 
 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a...]]></description>
			<content:encoded><![CDATA[<div>Hey, getting a new error in my code... Its almost done, cant figure out what is wrong with this.<br />
<br />
ERROR:<br />
non-static method isPrime(int) cannot be referenced from a static context<br />
<br />
<br />
 <pre style="margin:20px; line-height:13px">import java.util.Scanner;<br />
<br />
public class primenumbertest {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; public boolean isPrime(int x){<br />
&nbsp; &nbsp; int divisor = 1;<br />
&nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  do{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  divisor += 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  } while ((x % divisor) !=0);<br />
}<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; public static void main(String[] args) {<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; int num;<br />
&nbsp; &nbsp; boolean isItPrimeorNot;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; Scanner input = new Scanner(System.in);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; System.out.println(&quot;Enter a number to find out if it's prime or not&nbsp; (greater than 1): &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp;  num = input.nextInt();<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; input.close();<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; isItPrimeorNot = isPrime(num);<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; System.out.println(isItPrimeorNot);<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; if (isItPrimeorNot == false) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(num + &quot; is not a prime number.&quot;);<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; else { <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(num + &quot;is a prime number.&quot;);<br />
&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>GTJava</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240005.html</guid>
		</item>
		<item>
			<title><![CDATA[java code to access vm's(virtual Machine)]]></title>
			<link>http://www.daniweb.com/forums/thread239988.html</link>
			<pubDate>Fri, 20 Nov 2009 10:46:56 GMT</pubDate>
			<description><![CDATA[i have a project from my college  to be completed this weekend ... The project is to accessing the Vm's using java Program..... 
I know java std.Functions only not a high level... pls anyone know the steps how to solve pls explain me...... 
Thank u in Advance;;;;;;;;;]]></description>
			<content:encoded><![CDATA[<div>i have a project from my college  to be completed this weekend ... The project is to accessing the Vm's using java Program.....<br />
I know java std.Functions only not a high level... pls anyone know the steps how to solve pls explain me......<br />
Thank u in Advance;;;;;;;;;</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>ManjuMidhu</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239988.html</guid>
		</item>
		<item>
			<title>Reading Large amount of data in java</title>
			<link>http://www.daniweb.com/forums/thread239956.html</link>
			<pubDate>Fri, 20 Nov 2009 08:10:32 GMT</pubDate>
			<description>please help me, how to read large amount of data in java like 5gb or more than that, if you know please reply me soon................</description>
			<content:encoded><![CDATA[<div>please help me, how to read large amount of data in java like 5gb or more than that, if you know please reply me soon................</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>vasunttfshimoga</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239956.html</guid>
		</item>
		<item>
			<title>Linear and Binary Search not working! :(</title>
			<link>http://www.daniweb.com/forums/thread239910.html</link>
			<pubDate>Fri, 20 Nov 2009 03:49:59 GMT</pubDate>
			<description><![CDATA[Hello! I am doing an assignment for one of my classes and there seems to be something wrong with my code. It's supposed to allow the user to input a string and it will perform the linear search on the first array and binary search on the second array and return their positions in the array if the...]]></description>
			<content:encoded><![CDATA[<div>Hello! I am doing an assignment for one of my classes and there seems to be something wrong with my code. It's supposed to allow the user to input a string and it will perform the linear search on the first array and binary search on the second array and return their positions in the array if the string is found. <br />
<br />
Here's the code:<br />
<br />
 <pre style="margin:20px; line-height:13px">import java.util.Scanner;<br />
import java.io.*;<br />
<br />
public class Lab9b {<br />
<br />
public static int binarySearch(String [] strArray, String strValue){<br />
&nbsp; &nbsp; &nbsp; &nbsp; int i,n,mid,low=0,high=strArray.length-1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; mid = (low+high)/2;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; while(true){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(strValue == strArray[mid])<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return mid;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(strArray[mid].compareTo(strValue) &lt; 0){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; low=mid;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; high = mid;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; n = mid;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mid = (low+high)/2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(n==mid)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; return -1;<br />
} // end binarySearch method<br />
<br />
<br />
public static void printStringArray(String [] strArray){<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; for(int i = 0; i &lt; strArray.length; i++){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (strArray[i] != null) <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(strArray[i]); <br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
} // end printStringArray method<br />
<br />
<br />
public static int linearSearch(String [] strArray, String strValue){<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; for(int n=0;n&lt;strArray.length;n++){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(strArray[n]==strValue)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return n;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; return -1;<br />
<br />
} // end linearSearch method<br />
<br />
<br />
public static void main(String[] args) throws FileNotFoundException{<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; // (A) Declare our 25 string array unsorted<br />
&nbsp; &nbsp; &nbsp; &nbsp; String[] s = new String[25];<br />
&nbsp; &nbsp; &nbsp; &nbsp; Scanner file = new Scanner(new File(&quot;unsorted.txt&quot;));<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; int loc = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  while(file.hasNextLine()){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  s[loc++] = file.nextLine();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; System.out.println(&quot;Number of lines in s read: &quot; + loc);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp;  // (B) Declare our 30 string array sorted <br />
&nbsp; &nbsp; &nbsp; &nbsp; String[] j = new String[30];<br />
&nbsp; &nbsp; &nbsp; &nbsp; Scanner file2 = new Scanner(new File(&quot;sorted.txt&quot;));<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; int loca = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  while(file2.hasNextLine()){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  j[loca++] = file2.nextLine();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Number of lines in j read: &quot; + loca);&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
System.out.println();<br />
<br />
// Now we will prompt the user to enter strings to check if they are in the arrays<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; Scanner scan = new Scanner(System.in);<br />
&nbsp; &nbsp; &nbsp; &nbsp; String q;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; for (int x = 0; x &lt; s.length; x++){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Enter a String to see if it's in the arrays.&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; q = scan.nextLine();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (q.equals(&quot;quit&quot;))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.exit(0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Using linear search: &quot; + linearSearch(s,q));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Using binary search: &quot; + binarySearch(j,q));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; }//end for<br />
<br />
<br />
} // end main<br />
<br />
} // end class</pre><br />
I think around line 75 of the code is where something is terribly wrong. Is there anything I can do to fix it???<br />
<br />
My unsorted.txt and sorted.txt is just a list of random names.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>clem998</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239910.html</guid>
		</item>
		<item>
			<title>Please Help Java Stack</title>
			<link>http://www.daniweb.com/forums/thread239906.html</link>
			<pubDate>Fri, 20 Nov 2009 03:37:57 GMT</pubDate>
			<description>The Question is : 
Three stacks can be used to sort a list of numbers.  Assuming stack in holds the input list of numbers, stack out is to hold the output list after sorting the numbers and temp is used during the sorting process.  The sorting algorithm follows. 
 
1	set up stack in and print it...</description>
			<content:encoded><![CDATA[<div>The Question is :<br />
Three stacks can be used to sort a list of numbers.  Assuming stack in holds the input list of numbers, stack out is to hold the output list after sorting the numbers and temp is used during the sorting process.  The sorting algorithm follows.<br />
<br />
1	set up stack in and print it<br />
2	while stack in is not empty repeat<br />
2.1	 max = in.pop<br />
2.2   while there are still element in stack in repeat<br />
2.2.1 value = in.pop<br />
2.2.2 if value &gt; max<br />
	       2.2.2.1  temp.push(max)<br />
                       2.2.2.2  max = value<br />
2.2.3 else<br />
          2.2.3.1 temp.push(value)<br />
                         2.3   in = temp<br />
                         2.4   out.push(max)<br />
                         2.5   temp.clear<br />
                                 3  print sorted stack<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
 <pre style="margin:20px; line-height:13px">import java.util.*;<br />
public class MainAssignment3<br />
{<br />
&nbsp; public static void main(String[]args) <br />
&nbsp; {<br />
&nbsp;  int Max =0;<br />
&nbsp;  int Value =0;<br />
<br />
&nbsp;  LinkedList&lt;Integer&gt;Input=new LinkedList&lt;Integer&gt;();<br />
&nbsp;  LinkedList&lt;Integer&gt;Temp=new LinkedList&lt;Integer&gt;();<br />
&nbsp;  LinkedList&lt;Integer&gt;OutPut=new LinkedList&lt;Integer&gt;();<br />
<br />
&nbsp;  Input.addLast(90);<br />
&nbsp;  Input.addLast(21);<br />
&nbsp;  Input.addLast(33);<br />
&nbsp;  Input.addLast(80);<br />
&nbsp;  Input.addLast(67);<br />
<br />
&nbsp;  System.out.println(&quot;The Input Stack is : &quot; + Input);<br />
&nbsp; &nbsp;  <br />
&nbsp;  while(!Input.isEmpty())<br />
&nbsp;  {<br />
&nbsp; &nbsp; &nbsp;  Max = Input.removeLast();&nbsp; <br />
&nbsp; &nbsp; &nbsp;  Value = Input.removeLast();&nbsp;  <br />
&nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; System.out.println(&quot;MAx: &quot; +Max);<br />
&nbsp; &nbsp; &nbsp; System.out.println(&quot;Value: &quot; +Value);<br />
&nbsp;<br />
&nbsp; &nbsp;  if (Value &gt; Max)<br />
&nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; Temp.push(Max);<br />
&nbsp; &nbsp; &nbsp; Max=Value;<br />
&nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; } else {<br />
&nbsp; &nbsp; &nbsp; Temp.push(Value);<br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp;  }<br />
&nbsp; &nbsp;  <br />
&nbsp; &nbsp;  Input=Temp;<br />
&nbsp; &nbsp;  OutPut.push(Max);<br />
&nbsp; &nbsp;  Temp.clear();<br />
&nbsp; <br />
&nbsp;}<br />
&nbsp; &nbsp;  System.out.println(&quot;The Output Stack is: &quot; + OutPut);&nbsp;  <br />
&nbsp; <br />
&nbsp;}<br />
}</pre><br />
can any one guide me how to sort a number ? <br />
beause the OutPut Stack Should is [21, 33, 67, 80 ,90]<br />
But i Only Get [67], any one can guide how to do ? thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>ShuiYinDeng</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239906.html</guid>
		</item>
		<item>
			<title>Friends database program</title>
			<link>http://www.daniweb.com/forums/thread239905.html</link>
			<pubDate>Fri, 20 Nov 2009 03:24:59 GMT</pubDate>
			<description><![CDATA[Hi, I've read the rules for this website and i'm aware that we should not expect people to do our homework. But I really need help on this program.. and I'm not sure how to start it, and it's last minute help please. 
 
I'm suppose to do this using sorting algorithm..so it asks to creat a friends...]]></description>
			<content:encoded><![CDATA[<div>Hi, I've read the rules for this website and i'm aware that we should not expect people to do our homework. But I really need help on this program.. and I'm not sure how to start it, and it's last minute help please.<br />
<br />
I'm suppose to do this using sorting algorithm..so it asks to creat a friends database application that maintains a file of friend objects that contain names, telephone numberrs, and email adresses..etc. The friends application should load friend records from a file and then allow the user to add new friends, delete friends, display a list of all friends by either first naem or last name, and search for a friend. Well the output should look something like this: <br />
<br />
1. add a friend<br />
2. display a friends by last name<br />
3. display a friends by first name<br />
4. find a friend<br />
5. delete a friend<br />
6. quit.<br />
<br />
Yea.. 've been trying to at least find some examples that are similar to this type of program.. but I didn't really find any. So any help, or similar type of examples/codes for me. thank you!</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/thread239905.html</guid>
		</item>
		<item>
			<title>java xml-rpc response parsing xml</title>
			<link>http://www.daniweb.com/forums/thread239827.html</link>
			<pubDate>Thu, 19 Nov 2009 19:29:53 GMT</pubDate>
			<description><![CDATA[Hi, 
I have a variable of type Object, which is obtained from an xml-rpc call 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...]]></description>
			<content:encoded><![CDATA[<div>Hi,<br />
I have a variable of type Object, which is obtained from an xml-rpc call like:<br />
<br />
 <pre style="margin:20px; line-height:13px">Object[] params = new Object[]{new Double(4.0), new Double(5.0)};<br />
Object result = client.execute( &quot;foobar.add&quot;, params );</pre><br />
and I know that it contains this xml data:<br />
 <pre style="margin:20px; line-height:13px">&lt;methodResponse&gt; <br />
&lt;params&gt; &lt;param&gt; <br />
&lt;value&gt;&lt;struct&gt; <br />
&lt;member&gt;&lt;name&gt;value1&lt;/name&gt; &lt;value&gt;&lt;double&gt;4.2&lt;/double&gt;&lt;/value&gt; &lt;/member&gt; <br />
&lt;member&gt;&lt;name&gt;value2&lt;/name&gt; &lt;value&gt;&lt;double&gt;9.6&lt;/double&gt;&lt;/value&gt; &lt;/member&gt; <br />
&lt;member&gt;&lt;name&gt;product&lt;/name&gt; &lt;value&gt;&lt;double&gt;13.8&lt;/double&gt;&lt;/value&gt; &lt;/member&gt; <br />
&lt;/struct&gt;&lt;/value&gt; <br />
&lt;/param&gt; &lt;/params&gt; <br />
&lt;/methodResponse&gt;</pre><br />
I also tested it this way:<br />
 <pre style="margin:20px; line-height:13px">System.out.println(result.toString());</pre><br />
and I got the result as:<br />
 <pre style="margin:20px; line-height:13px">{product=9.0, value1=4.0, value2=5.0}</pre><br />
I tried to parse it to xml which didn't work in my way:<br />
 <pre style="margin:20px; line-height:13px">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  DocumentBuilderFactory dbf =<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  DocumentBuilderFactory.newInstance();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  DocumentBuilder db = dbf.newDocumentBuilder();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  InputSource is = new InputSource();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  is.setCharacterStream(new StringReader(result.toString()));<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Document doc = db.parse(is);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  NodeList nodes = doc.getElementsByTagName(&quot;member&quot;);</pre>and generated error which I couldn't figure it out, why it can't read the output string of the &quot;result&quot;!<br />
<br />
What I need is, to insert the obtained data to a database, and I don't know how to extract these obtained values for my table filed in the database!<br />
<br />
Could anybody help me to find out, what is the easiest method to extract data and insert to the database?<br />
<br />
Thank you!</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>kievari</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239827.html</guid>
		</item>
		<item>
			<title>Can I spawn a new process and return back?</title>
			<link>http://www.daniweb.com/forums/thread239819.html</link>
			<pubDate>Thu, 19 Nov 2009 18:31:03 GMT</pubDate>
			<description>I am sorry if this question is really basic. 
I was creating a Web Service which sets a watch on a database trigger. And when the trigger fires, I get an email. I couldnt find anything which would help me send an email directly from MYSQL using some kind of a stored procedure. So in Java, I used...</description>
			<content:encoded><![CDATA[<div>I am sorry if this question is really basic.<br />
I was creating a Web Service which sets a watch on a database trigger. And when the trigger fires, I get an email. I couldnt find anything which would help me send an email directly from MYSQL using some kind of a stored procedure. So in Java, I used the cron4j scheduler like cron in Linux, which periodically checks if trigger is fired.<br />
Problem is, I want the process which spawned cron to finish and return while this scheduler(cron4j) runs in background so that I dont have to keep the connection with my client running.<br />
<br />
Thank You for reading.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>wakydevil1</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239819.html</guid>
		</item>
		<item>
			<title>Regression testing</title>
			<link>http://www.daniweb.com/forums/thread239814.html</link>
			<pubDate>Thu, 19 Nov 2009 18:02:24 GMT</pubDate>
			<description><![CDATA[I am doing a project on "performing automated testing on open office tools" (Open Office bcoz -being open source ,its source code is available for testing & its modifiable too). 
 
I m either to use an already existing tool : winrunner or QTP, to generate and check test cases or to start from...]]></description>
			<content:encoded><![CDATA[<div>I am doing a project on &quot;performing automated testing on open office tools&quot; (Open Office bcoz -being open source ,its source code is available for testing &amp; its modifiable too).<br />
<br />
I m either to use an already existing tool : winrunner or QTP, to generate and check test cases or to start from scratch- java code.What do u suggest, how should I proceed?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>sam_inquisitive</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239814.html</guid>
		</item>
		<item>
			<title><![CDATA[[JAVA] How can I make a function to count equal characters among two strings]]></title>
			<link>http://www.daniweb.com/forums/thread239804.html</link>
			<pubDate>Thu, 19 Nov 2009 17:13:03 GMT</pubDate>
			<description><![CDATA[I need to create a function that returns a number with the amount of characters in common among one string and a vector of them. 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a...]]></description>
			<content:encoded><![CDATA[<div>I need to create a function that returns a number with the amount of characters in common among one string and a vector of them.<br />
<br />
 <pre style="margin:20px; line-height:13px">public int sameChars (Vector&lt;String&gt; otherStrs){<br />
&nbsp; &nbsp; &nbsp; &nbsp; int result = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; String original = &quot;aab&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; for (int i=0; i&lt; original.length(); i++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; char aux = original.charAt(i);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String targetStr = otherStrs.get(i);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int j=0; j&lt; targetStr.length(); j++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; char targetAux = targetStr.charAt(j);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (aux.compareTo(targetAux) == 0) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; result++;<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; return result;<br />
&nbsp; &nbsp; }</pre><br />
3 problems in this initial stage:<br />
- Getting error on compareTo, char cannot be dereferenced.<br />
- I need to distinguish 'A' from 'a'. Equals doesnt do it.<br />
- I need to account only for 1 of each character type. (&quot;aab&quot; compared to &quot;ababababba&quot; should only give a total count of 2.<br />
<br />
Help is appreciatted to the newbie :)</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>d0pe</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239804.html</guid>
		</item>
		<item>
			<title>Making simon game</title>
			<link>http://www.daniweb.com/forums/thread239794.html</link>
			<pubDate>Thu, 19 Nov 2009 16:35:19 GMT</pubDate>
			<description>Okay so i am started a project for a java class of mine, i would like to make the game simon, you know where there are four different colored buttons and it plays random sequences and you have to repeat them. I was thinking of using the random function, but i have never used it before. So if anyone...</description>
			<content:encoded><![CDATA[<div>Okay so i am started a project for a java class of mine, i would like to make the game simon, you know where there are four different colored buttons and it plays random sequences and you have to repeat them. I was thinking of using the random function, but i have never used it before. So if anyone can help me with any ideas, and if possible explain how i could use the random function in this case it would be greatly appreciated. Any help or ideas would be great? thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>c.pentasuglia</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239794.html</guid>
		</item>
		<item>
			<title>Help with Java Switch Statement</title>
			<link>http://www.daniweb.com/forums/thread239778.html</link>
			<pubDate>Thu, 19 Nov 2009 15:21:29 GMT</pubDate>
			<description><![CDATA[Hi all, 
 
Can some please have a look at the codes below and tell how I can make the switch statement accept the value from the variable named answer. I think the switch statement only accepts certain data type but I don't know to make this work. 
 
Please help me with this problem. Thank you. 
 
...]]></description>
			<content:encoded><![CDATA[<div>Hi all,<br />
<br />
Can some please have a look at the codes below and tell how I can make the switch statement accept the value from the variable named answer. I think the switch statement only accepts certain data type but I don't know to make this work.<br />
<br />
Please help me with this problem. Thank you.<br />
<br />
 <pre style="margin:20px; line-height:13px"><br />
package game;<br />
<br />
import java.util.*;<br />
import java.io.*;<br />
<br />
public class GameInfo<br />
{<br />
&nbsp; &nbsp; private ArrayList&lt;Game&gt; games = new ArrayList&lt;Game&gt;();//Array to store game Info, Name and Type<br />
<br />
&nbsp; &nbsp; private GameInfo()//game array<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; games.add( new Game (&quot;RPG&quot;, &quot;EVE Online&quot;,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;EVE is a sci-fi massively multiplayer online game. &quot; +<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;Players take the role of spaceship pilots seeking &quot; +<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;fame, fortune, and adventure in a huge, complex, &quot; +<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;exciting, and sometimes hostile galaxy.&quot;));<br />
&nbsp; &nbsp; &nbsp; &nbsp; games.add( new Game (&quot;RPG&quot;, &quot;Dark Ages&quot;,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;Dark Ages is an online role-playing game set in a &quot; +<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;fantasy world of faeries and magic. Customize your &quot; +<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;character and go adventuring.&quot; ) );<br />
&nbsp; &nbsp; &nbsp; &nbsp; games.add( new Game (&quot;RPG&quot;, &quot;City of Heroes&quot;,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;City of Heroes brings the world of comic books &quot; +<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;alive. Craft your hero's identity and join millions &quot; +<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;of Hero characters in a constantly expanding &quot; +<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;universe, explore the sprawling online metropolis &quot; +<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;of Paragon City, and battle a host of foes &quot; +<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;including criminals, villains, and monsters.&quot;));<br />
&nbsp; &nbsp; &nbsp; &nbsp; games.add( new Game (&quot;Simulation&quot;, &quot;King of Drift&quot;,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;Race around the track as you try to win against the &quot; +<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;AI. Drift around corners for an advantage&quot; ) );<br />
&nbsp; &nbsp; &nbsp; &nbsp; games.add( new Game(&quot;Simulation&quot;, &quot;Jet Ski Rush&quot;,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;Drive your jet-ski through the wavey waters and &quot; +<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;complete all 10 extreme levels! Hop over gators, &quot; +<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;hippos, penguins to hit ramps and do tricks! Grab &quot; +<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;NOS to speed up through super loops! &quot; ) );<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  games.add( new Game(&quot;FPS&quot;, &quot;Hover Tanks&quot;,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;Blast away at your opponents to set a highscore in &quot; +<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;this awesome 3D first-person shooter.&quot; ) );<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; games.add( new Game(&quot;FPS&quot;, &quot;Pearl Habour 1941&quot;,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;Shoot all incoming Kamikaze pilots and protect &quot; +<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;Pearl Habour&quot;) );<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; InputStreamReader istream = new InputStreamReader(System.in) ;<br />
&nbsp; &nbsp; &nbsp; &nbsp; BufferedReader bufRead = new BufferedReader(istream) ;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;------------------------\nTypes of Games available\n------------------------&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; try<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Please enter a choise based on the following available game types&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;(1) First Person Shooter&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;(2) Role Palaying Games&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;(3) Simulation games&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String chooseType = bufRead.readLine();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int cType = Integer.parseInt(chooseType);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int answer = cType;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; switch (answer)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case '1':<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;--------------------------\nFirts Person Shooter Games\n--------------------------&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for ( int i = 0; i &lt; games.size(); i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ( games.get(i).getType().equals(&quot;FPS&quot;))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(games.get(i).toString());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case '2':<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;------------------\nRole Playing Games\n------------------&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; for ( int i = 0; i &lt; games.size(); i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ( games.get(i).getType().equals(&quot;RPG&quot;))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(games.get(i).toString());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case '3':<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;----------------\nSimulation Games\n----------------&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; for ( int i = 0; i &lt; games.size(); i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ( games.get(i).getType().equals(&quot;Simulation&quot;))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(games.get(i).toString());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; default:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Please press 1, 2 or 3&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; catch (IOException err)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  System.out.println(&quot;Error reading line&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; public static void main(String[] args)// main method to start the program<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; new GameInfo();<br />
&nbsp; &nbsp; }<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>kumaran21</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239778.html</guid>
		</item>
		<item>
			<title>Calculating Cosine without Using Math.cos</title>
			<link>http://www.daniweb.com/forums/thread239768.html</link>
			<pubDate>Thu, 19 Nov 2009 14:31:25 GMT</pubDate>
			<description><![CDATA[I'm trying to make a program that will compare the results in calculating the Cosine with powerseries method and Math.cos method. This is what i have. 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a...]]></description>
			<content:encoded><![CDATA[<div>I'm trying to make a program that will compare the results in calculating the Cosine with powerseries method and Math.cos method. This is what i have.<br />
<br />
 <pre style="margin:20px; line-height:13px">import java.util.*;<br />
<br />
class Cosine{<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; int degrees = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Scanner myScanner = new Scanner(System.in);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while(true){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Enter some integer value of degrees (-1 to quit)&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; degrees = myScanner.nextInt();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (degrees == -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; break;<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;\nCosine calculation for &quot;+ degrees +&quot; degrees using...&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;&nbsp; &nbsp; &nbsp; ...Power Series: &quot;+ myCos(degrees * Math.PI/180));// convert degrees to radians<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;&nbsp; &nbsp; &nbsp; &nbsp; ...Math class: &quot;+ Math.cos(degrees * Math.PI/180));//check result vs Math class<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Have a nice day!&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; private static double myCos(double radians) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int expFact = 2;//the exponent &amp; factorial term<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double negationFactor = 1.0;// used to alternate between addition and subtraction of terms<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double powerSeries = 0.0;//accumulator for power series<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double factorialResult = 0.0;//result of the factorial<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while (factorialResult &lt; Double.POSITIVE_INFINITY) {// stop when factorialResult overflow is reached<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; factorialResult = factorial(expFact);// calculate the factorial<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; powerSeries = 1 +(negationFactor * (Math.pow(radians, expFact))/factorialResult);// the next statement calculates power series<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; negationFactor *= -1.0;// the negation factor alternates + - + - +.....<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; expFact +=2;//increment exponent and factorial term by two<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return radians - powerSeries;//subtraction, as specified in the formula<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; //calculates the factorial<br />
&nbsp; &nbsp; &nbsp; &nbsp; private static double factorial(int x) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double f = (double) x;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int i= x-1; i&gt;0; i--)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; f = f*(double)i;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return f;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>leoeroy</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239768.html</guid>
		</item>
		<item>
			<title>J2me List</title>
			<link>http://www.daniweb.com/forums/thread239726.html</link>
			<pubDate>Thu, 19 Nov 2009 11:58:15 GMT</pubDate>
			<description><![CDATA[I am trying to create file using RMS. I couldn't use List Command to create a file using RMS. Can you suggest easier way to create a file using List.  
 
 
import javax.microedition.midlet.*; 
import javax.microedition.rms.*; 
import javax.microedition.lcdui.*; 
 
 
public class RmsNormal extends...]]></description>
			<content:encoded><![CDATA[<div>I am trying to create file using RMS. I couldn't use List Command to create a file using RMS. Can you suggest easier way to create a file using List. <br />
<br />
 <pre style="margin:20px; line-height:13px">import javax.microedition.midlet.*;<br />
import javax.microedition.rms.*;<br />
import javax.microedition.lcdui.*;<br />
<br />
<br />
public class RmsNormal extends MIDlet implements CommandListener<br />
{<br />
&nbsp; &nbsp; private Display disp;<br />
&nbsp; &nbsp; private Command exit;<br />
&nbsp; &nbsp; private List list;<br />
&nbsp; &nbsp; private Alert alert;<br />
&nbsp; &nbsp; private RecordStore recordstore = null;<br />
<br />
<br />
public RmsNormal()<br />
{<br />
&nbsp; &nbsp; disp = Display.getDisplay(this);<br />
&nbsp; &nbsp; exit = new Command(&quot;Exit&quot;, Command.EXIT, 1);<br />
&nbsp; &nbsp; list = new List(&quot;Menu&quot;, List.IMPLICIT);<br />
&nbsp; &nbsp; list.append(&quot;Create&quot;, null);<br />
&nbsp; &nbsp; list.append(&quot;Write&quot;, null);<br />
&nbsp; &nbsp; list.addCommand(exit);<br />
&nbsp; &nbsp; list.setCommandListener(this);<br />
}<br />
&nbsp;  <br />
&nbsp; &nbsp; protected void startApp()<br />
&nbsp; &nbsp; {&nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; disp.setCurrent(list);<br />
&nbsp; &nbsp; }<br />
&nbsp;  <br />
&nbsp; &nbsp; protected void pauseApp()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; }<br />
&nbsp;  <br />
&nbsp; &nbsp; protected void destroyApp(boolean uncond)<br />
&nbsp; &nbsp; {&nbsp;  <br />
&nbsp; &nbsp; }<br />
&nbsp;  <br />
&nbsp; &nbsp; public void commandAction(Command cmd, Displayable display)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(cmd == List.SELECT_COMMAND)&nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String selection = list.getString(list.getSelectedIndex());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // couldn't get idea to use List Command to Create File<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {&nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; recordstore = RecordStore.openRecordStore(&quot;RecorStore&quot;, true);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; alert = new Alert(&quot;File Created&quot;, null, null, AlertType.WARNING);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; alert.setTimeout(Alert.FOREVER);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; disp.setCurrent(alert);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; catch (Exception error)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; alert = new Alert(&quot;Error Removing&quot;, error.toString(), null, AlertType.WARNING);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; alert.setTimeout(Alert.FOREVER);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; disp.setCurrent(alert);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String outputData = &quot;My&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; byte&#91;&#93; byteOutputData = outputData.getBytes();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; recordstore.addRecord(byteOutputData, 0, byteOutputData.length);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; catch (Exception error)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; alert = new Alert(&quot;Alert&quot;, error.toString(), null, AlertType.WARNING);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; alert.setTimeout(Alert.FOREVER);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; disp.setCurrent(alert);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; else if (cmd == exit)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; destroyApp(true);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; notifyDestroyed();<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>nukabolhi</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239726.html</guid>
		</item>
		<item>
			<title>Reading large amount data from file in java</title>
			<link>http://www.daniweb.com/forums/thread239723.html</link>
			<pubDate>Thu, 19 Nov 2009 11:55:20 GMT</pubDate>
			<description>Hello, have a good day. please help me to read large amount of data from secondary storage device in java very quickly..............pls.......pls........ls..........s........</description>
			<content:encoded><![CDATA[<div>Hello, have a good day. please help me to read large amount of data from secondary storage device in java very quickly..............pls.......pls........ls..........s........</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>vasunttfshimoga</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239723.html</guid>
		</item>
		<item>
			<title>Hijri calender</title>
			<link>http://www.daniweb.com/forums/thread239718.html</link>
			<pubDate>Thu, 19 Nov 2009 11:39:20 GMT</pubDate>
			<description>i wttched a pdf file can you open and c it please help me and solve this assignment..... 
 
 
please i want it neccessary....</description>
			<content:encoded><![CDATA[<div>i wttched a pdf file can you open and c it please help me and solve this assignment.....<br />
<br />
<br />
please i want it neccessary....</div>  <br /> <div style="padding:5px">     <fieldset class="fieldset"> <legend>Attached Files</legend> <table cellpadding="0" cellspacing="5" border="0"> <tr> <td><img class="inlineimg" src="http://www.daniweb.com/forums/images/attach/pdf.gif" alt="File Type: pdf" width="16" height="16" border="0" style="vertical-align:baseline" /></td> <td><a href="http://www.daniweb.com/forums/attachment.php?attachmentid=12637&amp;d=1258630724">cwrk2.pdf</a> (75.4 KB)</td> </tr> </table> </fieldset>  </div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>system analysis</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239718.html</guid>
		</item>
		<item>
			<title>jdbc connectivity problem</title>
			<link>http://www.daniweb.com/forums/thread239712.html</link>
			<pubDate>Thu, 19 Nov 2009 11:29:11 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 />
import java.io.*;<br />
import java.sql.*;<br />
import java.net.*;<br />
<br />
public class sqlDemo <br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; int eno;<br />
&nbsp; &nbsp; &nbsp; &nbsp; ResultSet rs;<br />
&nbsp; &nbsp; &nbsp; &nbsp; ResultSetMetaData md;<br />
&nbsp; &nbsp; &nbsp; &nbsp; String /*insq,*/ selq;<br />
&nbsp; &nbsp; &nbsp; &nbsp; Statement stmt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; public sqlDemo()<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Class.forName(&quot;com.microsoft.jdbc.sqlserver.SQLServerDriver&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Connection con=DriverManager.getConnection(&quot;jdbc:microsoft:sqlserver; DatabaseName= Admin.sdf&quot;, &quot;sa&quot;, &quot;deepa#247&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; &nbsp; &nbsp; //BufferedReader br=new BufferedReader(new InputStreamReader(System.in));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //System.out.println(&quot;Enter Employee id&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //eno=Integer.parseInt(br.readLine());<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stmt=con.createStatement();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; selq=&quot;select * from emp&quot;;<br />
&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; //insq=&quot;insert into emp values(?,?,?)&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //int j=stmt.executeUpdate(insq);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //System.out.println(&quot;No of rows inserted \t&quot; +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; rs=stmt.executeQuery(selq);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; md=rs.getMetaData();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int col=md.getColumnCount();<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(rs.next())<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; for(int i=0; i &lt;= col; 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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.print(rs.getString(i) + &quot;\t&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //rs.next();<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; System.out.println();<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; rs.close();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stmt.close();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; con.close();<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; &nbsp; &nbsp; catch(Exception e)<br />
&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;Exception&nbsp; \t&quot; +e.getMessage());<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[]) throws Exception<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; new sqlDemo();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}</pre><br />
<span style="font-weight:bold">there are no errors in this program but wen i execute it an exception is raised at &quot;com.microsoft.jdbc.sqlserver.SQLServerDriver&quot;<br />
</span><br />
Please help me.....</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>jeniferandrews</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239712.html</guid>
		</item>
		<item>
			<title>Writing in a file</title>
			<link>http://www.daniweb.com/forums/thread239692.html</link>
			<pubDate>Thu, 19 Nov 2009 09:58:16 GMT</pubDate>
			<description>I have a file which is already written till some lines. I have a blank line at the start of the file and I want to write in that line using Java.  
I thought creating a FileWriter object by using FileWriter(filename, true) and then a BufferedWriter object will start writing from top. But its...</description>
			<content:encoded><![CDATA[<div>I have a file which is already written till some lines. I have a blank line at the start of the file and I want to write in that line using Java. <br />
I thought creating a FileWriter object by using FileWriter(filename, true) and then a BufferedWriter object will start writing from top. But its appending at the end of file. I dont want to destroy my data of file already written. How can I do that.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>gunjannigam</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239692.html</guid>
		</item>
		<item>
			<title>java.lang.classnotfoundexception com.microsoft.sqlserver.jdbc.sqlserverdriver</title>
			<link>http://www.daniweb.com/forums/thread239685.html</link>
			<pubDate>Thu, 19 Nov 2009 09:01:01 GMT</pubDate>
			<description>Hi, 
 
I need help, 
I am trying to connect from remote windows xp computer B to ms sqlserver2005 express edition in another windows xp computer A and got this error: 
 
java.lang.classnotfoundexception com.microsoft.sqlserver.jdbc.sqlserverdriver 
 
My software  can connect locally to the...</description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
I need help,<br />
I am trying to connect from remote windows xp computer B to ms sqlserver2005 express edition in another windows xp computer A and got this error:<br />
<br />
java.lang.classnotfoundexception com.microsoft.sqlserver.jdbc.sqlserverdriver<br />
<br />
My software  can connect locally to the sqlserver 2005 though in the local computer A, however when i tried to connect remotely, i just got that error. <br />
<br />
In the remote computer B, i have sqljdbc.jar in lib but there is no ms sqlserver 2005 installed. i try to set the classpath c:\program files\smcpl\btrek\lib\sqljdbc.jar but still get the same error.<br />
Please advise how to resolve this. Thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>btreksql</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239685.html</guid>
		</item>
		<item>
			<title>Dashed Line Display</title>
			<link>http://www.daniweb.com/forums/thread239682.html</link>
			<pubDate>Thu, 19 Nov 2009 08:32:12 GMT</pubDate>
			<description>I have a toolbar and various buttons in. There is always a dashed line displyad along the borders on last button clicked. Aslo there are some sliders in my panel. When I try to adjust the value of a slider it also has a dashed border. This border is only on the last selected values either buttons...</description>
			<content:encoded><![CDATA[<div>I have a toolbar and various buttons in. There is always a dashed line displyad along the borders on last button clicked. Aslo there are some sliders in my panel. When I try to adjust the value of a slider it also has a dashed border. This border is only on the last selected values either buttons or sliders. I dont know what it is called. What I want is that these dashed borders should not be displayed.   <br />
You can see in the image what i am talking about</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=12636&amp;d=1258619229" target="_blank">g.jpg</a> (218.7 KB)</td> </tr> </table> </fieldset>   </div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>gunjannigam</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239682.html</guid>
		</item>
		<item>
			<title>print shape star in console  :-(</title>
			<link>http://www.daniweb.com/forums/thread239680.html</link>
			<pubDate>Thu, 19 Nov 2009 08:14:41 GMT</pubDate>
			<description>i need to print stars on console like this  
 
* * * * * * * * 
 * $ $ $ $ $ $ * 
  * $ $ $ $ $ $ * 
   * $ $ $ $ $ $ * 
    * $ $ $ $ $ $ * 
     * $ $ $ $ $ $ * 
      * * * * * * * *</description>
			<content:encoded><![CDATA[<div>i need to print stars on console like this <br />
<br />
* * * * * * * *<br />
 * $ $ $ $ $ $ *<br />
  * $ $ $ $ $ $ *<br />
   * $ $ $ $ $ $ *<br />
    * $ $ $ $ $ $ *<br />
     * $ $ $ $ $ $ *<br />
      * * * * * * * *</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>saadismail85</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239680.html</guid>
		</item>
		<item>
			<title><![CDATA[actionPerformed won't work]]></title>
			<link>http://www.daniweb.com/forums/thread239677.html</link>
			<pubDate>Thu, 19 Nov 2009 07:57:12 GMT</pubDate>
			<description><![CDATA[I can't figure out what's wrong - I was remaking the code from an older and messier version, but now I've hit a roadblock because what I say in the actionPerformed section just doesn't happen. 
 
I suspect that it's because of the Timer, which a friend adviced me to link to an empty method...]]></description>
			<content:encoded><![CDATA[<div>I can't figure out what's wrong - I was remaking the code from an older and messier version, but now I've hit a roadblock because what I say in the actionPerformed section just doesn't happen.<br />
<br />
I suspect that it's because of the Timer, which a friend adviced me to link to an empty method (NullListener). But even when I move around using the keyListener, nothing happens! Why?<br />
<br />
(Please remember that the things currently in the actionPerformed section are only there so I can see if it works at all, so the problem can't be within the method itself.)<br />
<br />
 <pre style="margin:20px; line-height:13px">import java.awt.event.*;<br />
import javax.swing.*;<br />
<br />
public class gameinit implements ActionListener<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; public static int number;<br />
&nbsp; &nbsp; &nbsp; &nbsp; public static JFrame p;<br />
&nbsp; &nbsp; &nbsp; &nbsp; public static Timer t;<br />
&nbsp; &nbsp; &nbsp; &nbsp; public static JLabel Iz;<br />
&nbsp; &nbsp; &nbsp; &nbsp; public static char rar = 'T';<br />
<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; p = new JFrame(&quot;Version 2.4&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.setSize(600,393);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NullListener Blanky = new NullListener();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; t = new Timer(50, Blanky);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; t.start();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Maps.map0();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.setVisible(true);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.addKeyListener(new KeyListen());<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void actionPerformed(ActionEvent e)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Izzy.hittable();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Izzy.movement();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(rar == 'T')<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.print(&quot;Sky High(Grand Nuave)&quot;);<br />
&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; static class KeyListen implements KeyListener<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; KeyListen(){}<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void keyPressed(KeyEvent e)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(e.getKeyCode() == 39)<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; number = 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Controls.test(number);<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(e.getKeyCode() == 37)<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; number = 2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Controls.test(number);<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(e.getKeyCode() == 32)<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; number = 3;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Controls.test(number);<br />
&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; &nbsp; &nbsp; &nbsp; &nbsp; public void keyReleased(KeyEvent e)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(e.getKeyCode() == 39 || e.getKeyCode() == 37)<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; char direction = Controls.test(number), dir;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Izzy.stop(direction);<br />
&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; &nbsp; &nbsp; &nbsp; &nbsp; public void keyTyped(KeyEvent e)<br />
&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>CuteCat</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239677.html</guid>
		</item>
		<item>
			<title>Need to assign a value?</title>
			<link>http://www.daniweb.com/forums/thread239662.html</link>
			<pubDate>Thu, 19 Nov 2009 06:28:59 GMT</pubDate>
			<description><![CDATA[I cant get "\nNet Pay: " + netPay(dGrossPay, dRetirement)); to display anything other than 0.0. 
I know I need to assign a value to dGrossPay but im not sure how to. 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a...]]></description>
			<content:encoded><![CDATA[<div>I cant get &quot;\nNet Pay: &quot; + netPay(dGrossPay, dRetirement)); to display anything other than 0.0.<br />
I know I need to assign a value to dGrossPay but im not sure how to.<br />
 <pre style="margin:20px; line-height:13px">public int menu()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Scanner keyboard = new Scanner(System.in);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String strUserName;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double dHours;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double dRate;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double dGross = 0.0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double dRetirement;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double dNetPay = 0.0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int iChoice;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double dGrade = 0.0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double dGrossPay = 0.0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.print(&quot;\n\t\tMENU&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  + &quot;\n1&gt;&nbsp; &nbsp; &nbsp; &nbsp; Calculate and display grade point average and letter grade&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  + &quot;\n2&gt;&nbsp; &nbsp; &nbsp; &nbsp; Find the maximum of three integers and display result&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  + &quot;\n3&gt;&nbsp; &nbsp; &nbsp; &nbsp; Find Gross Pay and net pay and display results&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  + &quot;\n4&gt;&nbsp; &nbsp; &nbsp; &nbsp; Terminate Program&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  + &quot;\n\nWhich is your choice? &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; iChoice = keyboard.nextInt();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; switch(iChoice)<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; case 1:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; calcGradeAverage();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(calcLetter(dGrade));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; findMax();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &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; &nbsp; &nbsp; &nbsp; &nbsp; keyboard.nextLine();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.print(&quot;Enter you name: &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; strUserName = keyboard.nextLine();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.print(&quot;Enter hours worked: &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dHours = keyboard.nextDouble();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.print(&quot;Enter your payrate: &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dRate = keyboard.nextDouble();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.print(&quot;How much would you like to set aside for retirement: &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dRetirement = keyboard.nextDouble();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; grossPay(dHours, dRate);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //netPay(dGrossPay, dRetirement);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.print(&quot;\nName:&nbsp; &nbsp; &nbsp; &nbsp; &quot; + strUserName<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;  + &quot;\nHours:&nbsp; &nbsp; &nbsp;  &quot; + dHours<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;  + &quot;\nRate:&nbsp; &nbsp; &nbsp; &nbsp; &quot; + dRate<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;  + &quot;\nGross:&nbsp; &nbsp; &nbsp;  &quot; + grossPay(dHours, dRate)<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;  + &quot;\nRetirement:&nbsp; &quot; + dRetirement<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;  + &quot;\nNet Pay:&nbsp; &nbsp;  &quot; + netPay(dGrossPay, dRetirement));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<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; case 4:<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; default:<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;That choice is not valid.&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }//end switch(iChoice)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return iChoice;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }//end menu</pre><br />
 <pre style="margin:20px; line-height:13px">public double grossPay(double dHours, double dRate)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double dGross;&nbsp; &nbsp; &nbsp; &nbsp; //holds the gross pay<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(dHours &lt; 40)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dGross = dHours * dRate;<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; &nbsp; &nbsp; &nbsp; &nbsp; dGross = (1.5 * dRate) * (dHours-40) + (dRate*40);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return dGross;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }//end grossPay(double dHours, double dRate)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public double netPay(double dGrossPay, double dRetirement)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double dTax;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double dNetPay;<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; if(dGrossPay &gt; 10000)<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; dTax = .30;<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; else if(dGrossPay &lt;= 10000 &amp;&amp; dGrossPay &gt; 7000)<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; dTax = .25;<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; else if(dGrossPay &lt;= 7000 &amp;&amp; dGrossPay &gt; 6000)<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; dTax = .20;<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; else if(dGrossPay &lt;= 6000 &amp;&amp; dGrossPay &gt; 4000)<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; dTax = .15;<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; else if(dGrossPay &lt;= 4000 &amp;&amp; dGrossPay &gt; 2000)<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; dTax = .10;<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; else if(dGrossPay &lt;= 2000 &amp;&amp; dGrossPay &gt; 1000)<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; dTax = .5;<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; else if(dGrossPay &lt;= 1000)<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; dTax = 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; &nbsp; &nbsp; &nbsp; &nbsp; dNetPay = dGrossPay - dGrossPay * .07;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return dNetPay;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }//end netPay(double dGrossPay, double dRetirement)</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>brandon84</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239662.html</guid>
		</item>
		<item>
			<title>Language Translation</title>
			<link>http://www.daniweb.com/forums/thread239644.html</link>
			<pubDate>Thu, 19 Nov 2009 04:58:05 GMT</pubDate>
			<description>There is any java Language Translation API. If so means, please indicate that API.</description>
			<content:encoded><![CDATA[<div>There is any java Language Translation API. If so means, please indicate that API.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>cute.sridhar</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239644.html</guid>
		</item>
		<item>
			<title>How to convert String to float with exact value</title>
			<link>http://www.daniweb.com/forums/thread239642.html</link>
			<pubDate>Thu, 19 Nov 2009 04:35:23 GMT</pubDate>
			<description><![CDATA[Hi, 
 
When I convert a String value to float by using Float.valueOf(String), The return value is not containing last decimal. 
 
Ex: String a = 2.50; 
float b = Float.valueOf(a); 
 
Now the float "b" is holding only upto 2.5. It is not converting String value to float properly. My requirement is...]]></description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
When I convert a String value to float by using Float.valueOf(String), The return value is not containing last decimal.<br />
<br />
Ex: String a = 2.50;<br />
float b = Float.valueOf(a);<br />
<br />
Now the float &quot;b&quot; is holding only upto 2.5. It is not converting String value to float properly. My requirement is to convert a String value to Float with exact decimals.<br />
<br />
Please tell me how can I convert a String to float with complete decimals. <br />
<br />
Thanks <br />
Naresh.D</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>dharm_naresh</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239642.html</guid>
		</item>
		<item>
			<title>Help with Recursion</title>
			<link>http://www.daniweb.com/forums/thread239628.html</link>
			<pubDate>Thu, 19 Nov 2009 03:07:49 GMT</pubDate>
			<description><![CDATA[Hello.  I need to write a static recursive method that returns the frequency of occurrence a particular digit d in an integer n.  For example, if passed (1342457,4) it should return 2, whereas when passed (1342457,6) it should return 0. 
 
I won't put my code in as it is arbitrary, I just need help...]]></description>
			<content:encoded><![CDATA[<div>Hello.  I need to write a static recursive method that returns the frequency of occurrence a particular digit d in an integer n.  For example, if passed (1342457,4) it should return 2, whereas when passed (1342457,6) it should return 0.<br />
<br />
I won't put my code in as it is arbitrary, I just need help with the logic in this one; I can't grasp what needs to be done.<br />
<br />
I should also note that no variables are allowed besides the two that the user inputs as the integer, and digit to be checked for (so it must be calculated completely recursively).</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>Farfie</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239628.html</guid>
		</item>
		<item>
			<title>How to use printStringArrayMethod</title>
			<link>http://www.daniweb.com/forums/thread239625.html</link>
			<pubDate>Thu, 19 Nov 2009 02:59:53 GMT</pubDate>
			<description><![CDATA[Hi, I have an assignment requiring me to use the printStringArray method, but I can't find any examples on how to do so in my textbook or on the web. Can anyone provide an example please? I'd be very greatful!]]></description>
			<content:encoded><![CDATA[<div>Hi, I have an assignment requiring me to use the printStringArray method, but I can't find any examples on how to do so in my textbook or on the web. Can anyone provide an example please? I'd be very greatful!</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/thread239625.html</guid>
		</item>
		<item>
			<title>Card</title>
			<link>http://www.daniweb.com/forums/thread239621.html</link>
			<pubDate>Thu, 19 Nov 2009 02:54:22 GMT</pubDate>
			<description><![CDATA[can some one help in this code because their is two error in my code. 
need reply ASAP. please. 
  <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>can some one help in this code because their is two error in my code.<br />
need reply ASAP. please.<br />
 <pre style="margin:20px; line-height:13px">import java.util.*;<br />
public class Card<br />
{<br />
&nbsp;private int point;<br />
&nbsp;public Card()<br />
&nbsp;{<br />
&nbsp; Random r = new Random();<br />
&nbsp; //2-10<br />
&nbsp; point = r.nextInt(10);<br />
&nbsp; while(point&lt;2)<br />
&nbsp; {<br />
&nbsp;  point = r.nextInt(10);<br />
&nbsp; }<br />
&nbsp; public void setPoint(int p) &lt;--------- illegal start of expression<br />
&nbsp; {<br />
&nbsp;  point = p;<br />
&nbsp; }<br />
&nbsp; public int getPoint()<br />
&nbsp; {<br />
&nbsp;  return point;<br />
&nbsp; }<br />
&nbsp;}<br />
}&nbsp;  &lt;------- class,interface or enum expected</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>bubblegum09</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239621.html</guid>
		</item>
		<item>
			<title>Discounted Price issue</title>
			<link>http://www.daniweb.com/forums/thread239598.html</link>
			<pubDate>Thu, 19 Nov 2009 00:20:25 GMT</pubDate>
			<description><![CDATA[The program runs perfectly, however I am having an issue adding a discounted price. Another thing I noticed when I run the program is that the switch statement doesn't calculate the discounts at all. 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a...]]></description>
			<content:encoded><![CDATA[<div>The program runs perfectly, however I am having an issue adding a discounted price. Another thing I noticed when I run the program is that the switch statement doesn't calculate the discounts at all.<br />
<br />
 <pre style="margin:20px; line-height:13px">// DiscountPrices.java - This program calculates total cost for discounted items.<br />
// Input:&nbsp; Interactive.<br />
// Output:&nbsp; Original price, discount, discounted price, and total price for all items.<br />
<br />
import javax.swing.*;<br />
<br />
public class DiscountPrices<br />
{<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; final double DISCOUNT_ONE = .05;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; final double DISCOUNT_TWO = .10;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; final double DISCOUNT_THREE = .15;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double price;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String priceString;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int quantity;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String quantityString;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; priceString = JOptionPane.showInputDialog(&quot;Enter price of item: &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; price = Double.parseDouble(priceString);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; quantityString = JOptionPane.showInputDialog(&quot;Enter quantity ordered: &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; quantity = Integer.parseInt(quantityString);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Test price here and call calculatePrice method.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; calculatePrice(price, quantity);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int discountValue = 3;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; switch(discountValue)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 1: if(price &lt; 5.00);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; price = price * DISCOUNT_ONE;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 2: if(price &lt; 10.00);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; price = price * DISCOUNT_TWO;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 3: if(price &gt; 10.00);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; price = price * DISCOUNT_THREE;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.exit(0);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; } // End of main() method.<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; // Write calculatePrice method here.<br />
&nbsp; &nbsp; &nbsp; &nbsp; public static void calculatePrice(double amount, int quantity)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double total;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double discountPercent;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double discountPrice;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; discountPercent = (amount / 100);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; total = (amount * quantity);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Original Price:&nbsp; &quot; + amount + &quot; Discount Percent:&nbsp; &quot; + discountPercent + &quot; Quantity:&nbsp; &quot; + quantity + &quot; Total Price:&nbsp; &quot; + total);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
<br />
} // End of DiscountPrices class.</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>Jay V.</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239598.html</guid>
		</item>
		<item>
			<title>design patterns or OODA</title>
			<link>http://www.daniweb.com/forums/thread239596.html</link>
			<pubDate>Thu, 19 Nov 2009 00:03:10 GMT</pubDate>
			<description><![CDATA[Hi guys, 
 
I demand to know the correct order of the following topics to study 
 
Object Oriented Design and Analysis, Design Patterns, and UML 
 
Thanks in advance 
 
[EL-Prince]]]></description>
			<content:encoded><![CDATA[<div>Hi guys,<br />
<br />
I demand to know the correct order of the following topics to study<br />
<br />
<span style="color:Green">Object Oriented Design and Analysis</span>, <span style="color:Red">Design Patterns</span>, and <span style="color:Green">UML</span><br />
<br />
Thanks in advance<br />
<br />
[EL-Prince]</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>MxDev</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239596.html</guid>
		</item>
		<item>
			<title>Javadoc ?!</title>
			<link>http://www.daniweb.com/forums/thread239560.html</link>
			<pubDate>Wed, 18 Nov 2009 21:13:50 GMT</pubDate>
			<description><![CDATA[hey everyone, 
 
I have a quick question, and appretiate any help given, 
 
I need to check if my Javadoc is correct or not, 
I have this assignment due, but don't know if there would be a javadoc comment for the "boolean" 
I added a javadoc comment to check with you and see if this is correct. 
...]]></description>
			<content:encoded><![CDATA[<div>hey everyone,<br />
<br />
I have a quick question, and appretiate any help given,<br />
<br />
I need to check if my Javadoc is correct or not,<br />
I have this assignment due, but don't know if there would be a javadoc comment for the &quot;boolean&quot;<br />
I added a javadoc comment to check with you and see if this is correct.<br />
<br />
thanx for any help given. :)<br />
 <pre style="margin:20px; line-height:13px">&nbsp; &nbsp; &nbsp; &nbsp; /**<br />
&nbsp; &nbsp; &nbsp; &nbsp; * checks if a line is number or not, and then prints specified line.<br />
&nbsp; &nbsp; &nbsp; &nbsp; * @param true prints specfied line if number is true<br />
&nbsp; &nbsp; &nbsp; &nbsp; * @param false prints specified line if false is flase<br />
&nbsp; &nbsp; &nbsp; &nbsp; * @return true if the input is a number, otherwise false<br />
&nbsp; &nbsp; &nbsp; &nbsp; */<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; boolean Number = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int r;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; for (r = 0; r &lt; input.length(); r++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(!(begin.next() == end.previous()))<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; number = false;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>d7o0om</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239560.html</guid>
		</item>
		<item>
			<title>Build method for a tree</title>
			<link>http://www.daniweb.com/forums/thread239557.html</link>
			<pubDate>Wed, 18 Nov 2009 21:01:27 GMT</pubDate>
			<description><![CDATA[I have this build method for my expression tree. I want to build it in infix but its not coming out correctly. So, I was wondering if anyone can help me. Thanks. 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a...]]></description>
			<content:encoded><![CDATA[<div>I have this build method for my expression tree. I want to build it in infix but its not coming out correctly. So, I was wondering if anyone can help me. Thanks.<br />
<br />
 <pre style="margin:20px; line-height:13px">private TreeNode build(Scanner input)<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; boolean leaf;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String token;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int value;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TreeNode node;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; leaf = input.hasNextInt();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (leaf)<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value = input.nextInt();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; node = new TreeNode(leaf, '\0', value);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; token = input.next();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; node = new TreeNode(leaf, token.charAt(0), 0);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; node.left = build(input);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; node.right = build(input);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return node;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; }</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>vampgirl13</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239557.html</guid>
		</item>
		<item>
			<title>Private access problems</title>
			<link>http://www.daniweb.com/forums/thread239552.html</link>
			<pubDate>Wed, 18 Nov 2009 20:47:36 GMT</pubDate>
			<description><![CDATA[Why is this an illegal start on an expression? public Account consolidate(Account accnt1, Account accnt2) 
In my if statement It says name has private access in account. What does that mean and how do i fix it?  
if((accnt1.name).equals(accnt2.name)) 
 
  <div class="codeblock"> <div...]]></description>
			<content:encoded><![CDATA[<div>Why is this an illegal start on an expression? public Account consolidate(Account accnt1, Account accnt2)<br />
In my if statement It says name has private access in account. What does that mean and how do i fix it? <br />
if((accnt1.name).equals(accnt2.name))<br />
<br />
 <pre style="margin:20px; line-height:13px">//***********************************************************<br />
// TestConsolidation<br />
// A simple program to test the numAccts method of the<br />
// Account class.<br />
//***********************************************************<br />
import java.util.Scanner;<br />
<br />
public class TestConsolidation<br />
{<br />
&nbsp; &nbsp; public static void main(String[] args)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; //Account consolidate- the sum of acct1 and acct2<br />
&nbsp; public static Account consolidate(Account accnt1, Account accnt2)<br />
&nbsp; {<br />
&nbsp; &nbsp; &nbsp; Account newAccount = null;<br />
&nbsp; &nbsp; &nbsp; if((accnt1.name).equals(accnt2.name))<br />
&nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(accnt1.acctNum!=accnt2.acctNum)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String Name = accnt2.name;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double balances = accnt1.balance + accnt2.balance;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Account accountSum;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //int accountSum;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //accountSum.balance = account1.getBalance() + account2.getBalance();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Consolidate acct1 and acct2 like newAccount = (name, balance of 2 accts, acctnum(random));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; accnt1.close();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; accnt2.close();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; numAccounts++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }}<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; return newAccount;<br />
<br />
&nbsp; }<br />
<br />
&nbsp; &nbsp; }<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>COKEDUDE</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239552.html</guid>
		</item>
		<item>
			<title>Duplicate Elimination</title>
			<link>http://www.daniweb.com/forums/thread239535.html</link>
			<pubDate>Wed, 18 Nov 2009 19:22:07 GMT</pubDate>
			<description>hi every body i have a problem whit the condition to check if the element is duplicate element or not  
this is the problem  
 
Duplicate Elimination 
Use a one-dimensional array to solve the following problem: Write an application that inputs 10 integers. As each number is read, display it only if...</description>
			<content:encoded><![CDATA[<div>hi every body i have a problem whit the condition to check if the element is duplicate element or not <br />
this is the problem <br />
<br />
Duplicate Elimination<br />
Use a one-dimensional array to solve the following problem: Write an application that inputs 10 integers. As each number is read, display it only if it is not a duplicate of a number already read. Use the smallest possible array to solve this problem. Display the complete set of unique values input after the user inputs all values. <br />
<br />
Sample Output:<br />
<br />
Enter 10 integers:<br />
<br />
12 33 67 9 10 6 6 34 10 19 <br />
<br />
<br />
Unique Values:<br />
<br />
12      33      67     9     10     6     34    19 <br />
<span style="color:Red">note the question ask to reprint the array but without any repeating numbe</span>r<br />
<br />
<br />
<br />
this is my code <br />
<br />
 <pre style="margin:20px; line-height:13px">import java.util.Scanner;<br />
<br />
public class duplicate <br />
{<br />
<br />
&nbsp; &nbsp; public static void main(String[] args)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; Scanner input = new Scanner(System.in);<br />
&nbsp; &nbsp; &nbsp; &nbsp; int[] array = new int[10];<br />
&nbsp; &nbsp; &nbsp; &nbsp; int[] barray = new int[10];<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot; Enter 10 integers: &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; int i ;<br />
&nbsp; &nbsp; &nbsp; &nbsp; for(i=0;i&lt;array.length;i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; array[i]= input.nextInt();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; barray[i] = array[i];<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; for(i=0;i&lt;array.length;i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.printf(&quot;\t %d &quot;,array[i]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;\n Unique values are: &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for ( i = 0; i &lt; array.length; i++ )<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; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ( array[ i ] == barray[ i ] )<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; &nbsp; System.out.printf(&quot;\t %d&quot;,array[i]);<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; <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; }<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>tootaa</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239535.html</guid>
		</item>
		<item>
			<title>Advice needed!</title>
			<link>http://www.daniweb.com/forums/thread239533.html</link>
			<pubDate>Wed, 18 Nov 2009 19:20:39 GMT</pubDate>
			<description><![CDATA[I want to write a program to conduct a binary search and return all the occurrences of a number to the user. I succeeded in coming up with a binary search method but I don't know how to make return all the occurrences of the number. Here is my code 
  <div class="codeblock"> <div class="spaced">...]]></description>
			<content:encoded><![CDATA[<div>I want to write a program to conduct a binary search and return all the occurrences of a number to the user. I succeeded in coming up with a binary search method but I don't know how to make return all the occurrences of the number. Here is my code<br />
 <pre style="margin:20px; line-height:13px">/*<br />
&nbsp; &nbsp; &nbsp; &nbsp;  *A method which searches for the position of a number<br />
&nbsp; &nbsp; &nbsp; &nbsp;  *specified by the user<br />
&nbsp; &nbsp; &nbsp; &nbsp;  *@param target, the number the user is looking for<br />
&nbsp; &nbsp; &nbsp; &nbsp;  *@return the position(s) in which the number is found<br />
&nbsp; &nbsp; &nbsp; &nbsp; */<br />
&nbsp; &nbsp; &nbsp; &nbsp; int binarySearch(int target)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int left = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int right = userArray.length - 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while (left &lt;= right)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int midPoint = (left + right)/2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (userArray[midPoint] == target)<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; for (int i = 0; i &lt;= userArray.length; 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; &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; &nbsp; &nbsp; return (midPoint + 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; else if (userArray[midPoint] &lt; target)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; left += 1;<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; &nbsp; &nbsp; &nbsp; &nbsp; right -= 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return -1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>theStruggler</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239533.html</guid>
		</item>
		<item>
			<title>Conn Stmt</title>
			<link>http://www.daniweb.com/forums/thread239532.html</link>
			<pubDate>Wed, 18 Nov 2009 19:10:57 GMT</pubDate>
			<description>Hi , 
Can any one tell me differences between Statement ,Prepared statement,CallableStatement and when to use which (Clear Idea)</description>
			<content:encoded><![CDATA[<div>Hi ,<br />
Can any one tell me differences between Statement ,Prepared statement,CallableStatement and when to use which (Clear Idea)</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>Rajashree24</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239532.html</guid>
		</item>
		<item>
			<title>Custom cell renderer rendering before all results returned from query</title>
			<link>http://www.daniweb.com/forums/thread239531.html</link>
			<pubDate>Wed, 18 Nov 2009 19:08:58 GMT</pubDate>
			<description><![CDATA[Hi all, 
UDATE: 
Let's not hastily rush into this. I may have found my problem. BTW, my result set is populated with all of the required data. 
 
I have a custom renderer which renders table cell values from a query. The result data is populated into a 2 dimensional array. Then it is rendered to...]]></description>
			<content:encoded><![CDATA[<div>Hi all,<br />
UDATE:<br />
Let's not hastily rush into this. I may have found my problem. BTW, my result set is populated with all of the required data.<br />
<br />
I have a custom renderer which renders table cell values from a query. The result data is populated into a 2 dimensional array. Then it is rendered to fit into a Jtable and accompanying Frame. My application calls this class for 3 different tables. One has lately started throwing exceptions from getClass an override from AbsractTableModel:<br />
 <pre style="margin:20px; line-height:13px"><br />
&nbsp; &nbsp; &nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; &nbsp; &nbsp; public Class getColumnClass(int c) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return getValueAt(0, c).getClass();<br />
&nbsp; &nbsp; &nbsp;  //Exception thrown here<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; public Object getValueAt(int row, int col) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return data[row][col];<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp;  //Because a null was populated here.</pre><br />
This leads me to believe that my jdbc connection isn't returning data fast enough to populate the data[][] object. Will step-through-debug to pinpoint the issue. The table will recover from the exception and display 3 or 4 values from one row. Many rows may be returned. Other days it works fine. Other queries call the same overriden table model, renderer, and data[][] object, without issue. Those queries only contain a handful of data however. The query that bombs actually isn't very top-heavy. It will return only a handful of records as well. <br />
<br />
Also, I can run oracle sql developer from my desktop (the same location as the application) and return accurate results from the same query.<br />
<br />
Let me know what code you will need to see in addition to this. There's a lot of it so I didn't want to introduce too much noise to this problem. Thanks!</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/thread239531.html</guid>
		</item>
		<item>
			<title><![CDATA[Client catching Web Service User Exceptions [Java 6.0.17]]]></title>
			<link>http://www.daniweb.com/forums/thread239516.html</link>
			<pubDate>Wed, 18 Nov 2009 17:47:18 GMT</pubDate>
			<description><![CDATA[I am trying to send an EXCEPTION from a Web Server to a Client using JAX-WS ... 
When the exception is thrown by the server the client does catch it ... but the contents are not the expected message... 
  
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px">...]]></description>
			<content:encoded><![CDATA[<div>I am trying to send an EXCEPTION from a Web Server to a Client using JAX-WS ...<br />
When the exception is thrown by the server the client does catch it ... but the contents are not the expected message...<br />
 <br />
 <pre style="margin:20px; line-height:13px">[Server.java]<br />
package pck;<br />
<br />
@WebService()<br />
public class Server<br />
{<br />
&nbsp; &nbsp; @WebMethod()<br />
&nbsp; &nbsp; public function() throws UserException<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; throw new UserException(“Something”);<br />
&nbsp; &nbsp; }<br />
}<br />
&nbsp;<br />
[Exception.java]<br />
import javax.xml.ws.WebFault;<br />
&nbsp;<br />
@WebFault()<br />
public class UserException<br />
&nbsp; &nbsp; &nbsp; &nbsp; extends Exception<br />
{<br />
&nbsp; &nbsp; private String ErrMessage;<br />
&nbsp;<br />
&nbsp; &nbsp; public UserException(String message)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; this.ErrMessage = message;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; public String ErrorMessage()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; return this.ErrMessage;<br />
&nbsp; &nbsp; }<br />
}<br />
&nbsp;<br />
[Client.java]<br />
public class Client<br />
{<br />
&nbsp; &nbsp; public static void main(String[] args) throws Exception<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; try<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; Server.function();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; catch (UserException ex)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;User Exception: &quot; + ex.ErrorMessage());<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
}</pre><br />
<br />
Now, as I mentioned, when the exception is thrown by the server the client does catch it, but ex.ErrorMessage() returns the string “pck.UserException” instead of “Something” which it was created with in the Server... any clues as to why?<br />
<br />
Also, when I run my WebService I keep getting the following messages in the output:<br />
    com.sun.xml.internal.ws.model.RuntimeModeler getExceptionBeanClass<br />
    INFO: Dynamically creating exception bean Class pck.jaxws.UserExceptionBean<br />
<br />
Any clues or help would be much appreciated.<br />
Thanks,</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>Shaitan00</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239516.html</guid>
		</item>
		<item>
			<title>JAVA Simple System</title>
			<link>http://www.daniweb.com/forums/thread239508.html</link>
			<pubDate>Wed, 18 Nov 2009 17:06:34 GMT</pubDate>
			<description>I would like to know a list of systems (standalone) that can be made using JAVA. 
For example payroll system, billing system etc. 
Please state some simple systems that requires basics of OOP and few swing codes. 
 
 
Thank YOU :)</description>
			<content:encoded><![CDATA[<div>I would like to know a list of systems (standalone) that can be made using JAVA.<br />
For example payroll system, billing system etc.<br />
Please state some simple systems that requires basics of OOP and few swing codes.<br />
<br />
<br />
Thank YOU :)</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>rukshilag</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239508.html</guid>
		</item>
		<item>
			<title>I am trying to create a menu system and to change two constant values</title>
			<link>http://www.daniweb.com/forums/thread239492.html</link>
			<pubDate>Wed, 18 Nov 2009 16:10:52 GMT</pubDate>
			<description>Hello I am a fairly new to Java, below I have created a program for calculating the distance between two cites that is inputed by the user.  For the second part of my program I need to have a menu system and the constant SPEED value to change according to the type of road that is selected by the...</description>
			<content:encoded><![CDATA[<div>Hello I am a fairly new to Java, below I have created a program for calculating the distance between two cites that is inputed by the user.  For the second part of my program I need to have a menu system and the constant SPEED value to change according to the type of road that is selected by the user before hand in the menu system. <br />
So I figure I need to the change the constant Speed value depending on what the user has selected before hand, I understand that I need to use some sort of 'switch' and methods to cut the code down (which I don't quite get), Also how would I get the program work again without restarting from the beginning, would this be done by a boolean value? Is there a book you recommend reading or a similar piece of code I could look through to get an idea where to start. It took me a while just to do this which I understantd is pretty basic so any help would be appreciated.<br />
<br />
 import java.math.*;<br />
 public class TravelPrograms {<br />
 	public static final double SPEED = 50;<br />
 	public static void main(String[] args) {<br />
 		<br />
 		//local variables <br />
 		String city1;<br />
 		String city2;<br />
 		int hours;<br />
 		int mins;<br />
 		int distance;<br />
 		double timeInMins = 0;<br />
 		int timeInHours;<br />
 		<br />
 		// prints out user prompt <br />
 		System.out.println (&quot;Welcome to Isfandyar Ali Travel Calculator&quot; + &quot;\n&quot;);<br />
 		<br />
 		System.out.println (&quot;=====================================================&quot;+ &quot;\n&quot;);<br />
 		 		<br />
 		System.out.print (&quot;Please enter the name of the first city: &quot;);<br />
 		city1 = UserInput.readString();<br />
 		System.out.println(); // insert blank line<br />
 		<br />
  		System.out.print (&quot;Please enter the name of the second city: &quot;);<br />
 		city2 = UserInput.readString();<br />
 <br />
 		System.out.println(); // insert blank line<br />
  		System.out.print (&quot;please enter the distance in miles: &quot;);<br />
 		distance = UserInput.readInt();<br />
 	<br />
 		System.out.println (&quot;============================Result========================&quot;+ &quot;\n&quot;);<br />
  		<br />
 		//Error message recieved if the distance is negative<br />
 		if (distance &lt; 1) {<br />
 			System.out.println (&quot;Error. distance must be a positive nmumber&quot;);<br />
 		}<br />
	 	else {<br />
	 	<br />
<br />
			timeInMins = (distance/SPEED*60);<br />
	 		timeInHours = (int)(timeInMins/60);<br />
			timeInMins = timeInMins -(timeInHours *60);<br />
			timeInMins = Math.round(timeInMins);<br />
			mins = (int) timeInMins;<br />
			hours = (int) timeInHours;<br />
	 		<br />
		System.out.println(&quot;The time required to travel &quot; + distance+&quot; miles&quot;+&quot; between &quot; + city1+ &quot;and &quot; + city2 +&quot; is &quot; + hours+&quot; hours and &quot;+mins+&quot; minutes&quot;+ &quot;\n&quot;);     <br />
	 	}	<br />
		System.out.println (&quot;====================================================&quot;+ &quot;\n&quot;);   <br />
		System.out.println (&quot;Please enter C to continue or any other character to quit: q&quot;+ &quot;\n&quot;);<br />
		System.out.print (&quot;Thank you for using Travel program&quot;);				<br />
			<br />
 	} //end of method<br />
 	<br />
 } // end of class</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>Izzywizz</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239492.html</guid>
		</item>
		<item>
			<title>Need Help with assignment</title>
			<link>http://www.daniweb.com/forums/thread239483.html</link>
			<pubDate>Wed, 18 Nov 2009 15:28:49 GMT</pubDate>
			<description>hej I need to Construct a loan account for a small company this is the info that is givin 
 
* You can borrow a maximum of 1,000,000 kr  
 
• There shall be no redemption. The entire loan amount + accrued interest payable in one sum at the end of the loan  
 
• There is a choice of three...</description>
			<content:encoded><![CDATA[<div>hej I need to Construct a loan account for a small company this is the info that is givin<br />
<br />
* You can borrow a maximum of 1,000,000 kr <br />
<br />
• There shall be no redemption. The entire loan amount + accrued interest payable in one sum at the end of the loan <br />
<br />
• There is a choice of three maturities: <br />
<br />
o SHORT_TERM: 1 year <br />
o MIDDLE_TERM: 3 years <br />
o LONG_TERM: 5 years <br />
<br />
• The interest rate is fixed at loan creation on the basis of the discount rate <br />
(see <a rel="nofollow" class="t" href="http://da.wikipedia.org/wiki/Diskontoen" target="_blank">http://da.wikipedia.org/wiki/Diskontoen</a>) following these rules: <br />
<br />
o Corporate Customers: discount rate + 4% per year <br />
<br />
o Private Clients: discount rate + 5% per year. Moreover, calculated a fee of 1000 kr in the creation <br />
• Accrued interest once a year <br />
<br />
The Assignment must have.<br />
<br />
• LoanConstants.java: a public interface with the definitions of constant values for SHORT_TERM, MIDDLE_TERM and LONG_TERM, as well as lending its name and the maximum loan amount. <br />
There need not necessarily be the method signatures in the interface. <br />
<br />
• Loan.java: An abstract class that implements LoanConstants interface. <br />
o A loan includes: loan number, customer name, amount, interest rate, maturity and date of creation (Hint: new Date () creates an object of type java.util.Date with the current date and time) <br />
<br />
o Construct must have parameters for these fields, except interest rate, which may have a mutator method (setter) <br />
<br />
o If attempting created loans larger than the maximum lånegrænse, the loan must be created with the maximum lånegrænse <br />
<br />
o If attempting created loans with other maturities than the three defined, the loan must be created as SHORT_TERM <br />
<br />
o The class must declare an abstract method for calculating the total amount payable on the loan expired <br />
<br />
o The class must contain a toString () method, which prints the relevant data on a loan, including the total amount payable on the loan's maturity. See example at the end of the document <br />
<br />
• BusinessLoan.java: Extender Loan. In the constructor set the interest rate to 4% above the discount rate <br />
<br />
• PersonalLoan.java: Extender Loan. The constructor sets the interest rate to 5% above the discount rate. <br />
<br />
• LoanDriver.java: Driver class whose main () method created a list (eg ArrayList &lt;Loan&gt;) of loans. There must be prompt for input of the current discount rate, after which a loop to prompt the creation of a number of loans of the two types which are stored in the list. When the user does not want to make more loans, all the established loan prints, including the total debt of a loan's maturity.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>carepanther</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239483.html</guid>
		</item>
		<item>
			<title>java.net.SocketException:</title>
			<link>http://www.daniweb.com/forums/thread239473.html</link>
			<pubDate>Wed, 18 Nov 2009 14:43:49 GMT</pubDate>
			<description><![CDATA[I'm a student, now i'm developing a pc application using  which require to access the net  for sending SMSes.My code uses http connection to way2sms site for this.I could send SMSes from it when the code is opened in JCreator.But when using Eclipse it shows an error "java.net.SocketException:...]]></description>
			<content:encoded><![CDATA[<div>I'm a student, now i'm developing a pc application using  which require to access the net  for sending SMSes.My code uses http connection to way2sms site for this.I could send SMSes from it when the code is opened in JCreator.But when using Eclipse it shows an error &quot;java.net.SocketException: Permission denied: connect&quot; ,this is also the case when i'm using the code's jar file. Any could help me plzzz</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>Sreerajmnr</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239473.html</guid>
		</item>
		<item>
			<title>Java Stack</title>
			<link>http://www.daniweb.com/forums/thread239450.html</link>
			<pubDate>Wed, 18 Nov 2009 13:23:42 GMT</pubDate>
			<description><![CDATA[import java.util.*; 
public class MainAssignment3 
{ 
  public static void main(String[]args)  
  { 
   int Max =0; 
   int Value =0; 
 
   LinkedList<Integer>Input=new LinkedList<Integer>(); 
   LinkedList<Integer>Temp=new LinkedList<Integer>();]]></description>
			<content:encoded><![CDATA[<div>import java.util.*;<br />
public class MainAssignment3<br />
{<br />
  public static void main(String[]args) <br />
  {<br />
   int Max =0;<br />
   int Value =0;<br />
<br />
   LinkedList&lt;Integer&gt;Input=new LinkedList&lt;Integer&gt;();<br />
   LinkedList&lt;Integer&gt;Temp=new LinkedList&lt;Integer&gt;();<br />
   LinkedList&lt;Integer&gt;OutPut=new LinkedList&lt;Integer&gt;();<br />
<br />
   Input.addLast(90);<br />
   Input.addLast(21);<br />
   Input.addLast(33);<br />
   Input.addLast(80);<br />
   Input.addLast(67);<br />
<br />
   System.out.println(&quot;The Input Stack is : &quot; + Input);<br />
     <br />
   while(!Input.isEmpty())<br />
   {<br />
     Max = (Integer)Input.removeLast();<br />
     Value = (Integer)Input.removeLast();<br />
     <br />
      System.out.println(&quot;MAx: &quot; +Max);<br />
       System.out.println(&quot;Value: &quot; +Value);<br />
   <br />
     if (Value &lt; Max)<br />
     {<br />
      Temp.addLast(Max);<br />
      Max=Value;<br />
   <br />
     } else {<br />
      Temp.addLast(Value);<br />
     }<br />
<br />
<br />
     Input = Temp;<br />
     OutPut.addLast(Max);<br />
     Temp.clear();<br />
     System.out.println(OutPut);<br />
     <br />
   }<br />
 }<br />
}<br />
<br />
Input Stack should is [90, 21, 33, 80, 67]<br />
OutPut Stack Should is [21, 33, 67, 80 ,90]<br />
But i Only Get [67]<br />
any solution help ?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>ShuiYinDeng</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239450.html</guid>
		</item>
		<item>
			<title>Problem with prime numbers...</title>
			<link>http://www.daniweb.com/forums/thread239448.html</link>
			<pubDate>Wed, 18 Nov 2009 13:18:26 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">import java.util.Scanner;<br />
<br />
public class primenumbertest {<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; public boolean isPrime(int num){<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; int x;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; Scanner input = new Scanner(System.in);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; System.out.print(&quot;Enter a number to find out if it's prime or not&nbsp; (greater than 1): &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp;  num = input.nextInt();<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; if (num == 2) return true;<br />
&nbsp; &nbsp;  <br />
&nbsp; &nbsp; // check for divisible by all even number<br />
&nbsp; &nbsp; if (num % 2 == 0) return false;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; // check for odd number only<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int i = 3; i &lt; num; i=i+2){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (num % i == 0) return false;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return true;&nbsp; // all test pass..number is prime<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}</pre><br />
Beginner to Java. Getting the error, java.lang.NoSuchMethodError: main... Exception in thread &quot;main&quot;<br />
<br />
A way to fix this?<br />
<br />
Thanks!</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>GTJava</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239448.html</guid>
		</item>
		<item>
			<title>Threading</title>
			<link>http://www.daniweb.com/forums/thread239444.html</link>
			<pubDate>Wed, 18 Nov 2009 12:50:43 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">&nbsp; &nbsp; &nbsp; &nbsp; for(Iterator it2 = tries.iterator();it2.hasNext();)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; tobedeleted2 = (FpiRightTree) it2.next();&nbsp; <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; tobedeleted2.setIndex(f);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; f = f+1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }</pre><br />
I want to that in thread function.can someone give me help in creating thread?<br />
<br />
Tries is global. so in all threads it will be shared. i want to call thread.<br />
to do a for loop from 1 to 3000 and another for loop from 3001 to 6000<br />
<br />
is it worth it do threading for this? I want to speed it up.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>hajjo</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239444.html</guid>
		</item>
		<item>
			<title>Is anything equivalent to PeekMessage in Java?</title>
			<link>http://www.daniweb.com/forums/thread239434.html</link>
			<pubDate>Wed, 18 Nov 2009 11:42:00 GMT</pubDate>
			<description>On firing an event at a keyReleased or actionPerformed(button click).This event fires continuosly whenever I click.Say,for 10 clicks, 10 events are in queue.I want to clear remaining 9 events while first processing. 
 
-thanks</description>
			<content:encoded><![CDATA[<div>On firing an event at a keyReleased or actionPerformed(button click).This event fires continuosly whenever I click.Say,for 10 clicks, 10 events are in queue.I want to clear remaining 9 events while first processing.<br />
<br />
-thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>ramjeev</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239434.html</guid>
		</item>
		<item>
			<title><![CDATA[Syntax error on token ";", { expected after this token]]></title>
			<link>http://www.daniweb.com/forums/thread239427.html</link>
			<pubDate>Wed, 18 Nov 2009 11:08:07 GMT</pubDate>
			<description><![CDATA[why do i get this syntax error at the line shown below  
 
  <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...]]></description>
			<content:encoded><![CDATA[<div>why do i get this syntax error at the line shown below <br />
<br />
 <pre style="margin:20px; line-height:13px">package org.temp2.cod1;<br />
import java.security.*;<br />
import javax.crypto.*;<br />
import javax.crypto.spec.*;<br />
import java.io.*;<br />
<br />
public class Code1 {<br />
<br />
<br />
&nbsp; &nbsp; byte[] plaintext = new byte[32];&nbsp;  // &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt; syntax error<br />
&nbsp; &nbsp; for (int i = 0; i &lt; 32; i++) {<br />
&nbsp; &nbsp; &nbsp; plaintext[i] = (byte) (i % 16);<br />
&nbsp; &nbsp; }<br />
<br />
<br />
<br />
&nbsp; &nbsp; byte[] key = new byte[16];<br />
&nbsp; &nbsp; SecureRandom r = new SecureRandom();<br />
&nbsp; &nbsp; r.nextBytes(key);<br />
<br />
<br />
//byte[] key = ;//... secret sequence of bytes<br />
&nbsp; &nbsp; //byte[] dataToSend =&nbsp; ; //...<br />
<br />
&nbsp; &nbsp; Cipher c = Cipher.getInstance(&quot;AES&quot;);<br />
&nbsp; &nbsp; SecretKeySpec k =&nbsp; new SecretKeySpec(key, &quot;AES&quot;);<br />
&nbsp; &nbsp; c.init(Cipher.ENCRYPT_MODE, k);<br />
&nbsp; &nbsp; byte[] encryptedData = c.doFinal(plaintext);<br />
}<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>silverkid</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239427.html</guid>
		</item>
		<item>
			<title>Problem with Layouts and JTable refresh</title>
			<link>http://www.daniweb.com/forums/thread239423.html</link>
			<pubDate>Wed, 18 Nov 2009 10:53:00 GMT</pubDate>
			<description>I have got a problem with the layouts. I am creating a Grouplayout for my JLabels / Buttons etc in a window .. Then I am adding a Jtable using the JFileChooser for which I am specifying GridBagLayout and then adding the layout to Jframe again after JFilechooser creates a JTable calling the Table...</description>
			<content:encoded><![CDATA[<div>I have got a problem with the layouts. I am creating a Grouplayout for my JLabels / Buttons etc in a window .. Then I am adding a Jtable using the JFileChooser for which I am specifying GridBagLayout and then adding the layout to Jframe again after JFilechooser creates a JTable calling the Table creation function. Also one more problem is that for once the JfileChooser creates the JTable fine but when the I choose another file with file chooser the First JTable doesn't refresh and the second JTable just distorts the format. How do I refresh the JTable after I select the other file ?<br />
<br />
All formats work fine the way I am doing now but when I click to maximize the window the whole JTable Layout is gone or lost somewhere ! Sometimes something mistereous like JTable appears when I click on the Window.  <br />
<br />
I have a separate GroupLayout for the rest of the JButtons /  JLabels / Jcomboboxes... in my window which I add to the Jframe (fr) here. I create a GroupLayout like below for the rest of stuff like this:-<br />
 <pre style="margin:20px; line-height:13px">javax.swing.GroupLayout layout = new javax.swing.GroupLayout(panel); // rest of the stuff in my window except Jtable.</pre> I just keep a space in my window to accomodate JTable and then set the layout using GridBagLayout in my JFileChooser code.<br />
<br />
Then I add separate GridBagLayout for my JTable.<br />
<br />
Here is my JFileChooser code where I am creating a layout for my JTable.<br />
<br />
 <pre style="margin:20px; line-height:13px">&nbsp; &nbsp; jButton.addActionListener(<br />
&nbsp; &nbsp; &nbsp; &nbsp;  new ActionListener() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  public void actionPerformed(ActionEvent e) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  JFileChooser fileChooser = new JFileChooser(&quot;.&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  int status = fileChooser.showOpenDialog(fr);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if (status == JFileChooser.APPROVE_OPTION) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; File file = fileChooser.getSelectedFile();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; constructTable(file);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //JTable table = new JTable();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; scroll = new JScrollPane(getTable());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //setScrollPane(scroll);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  fr.setLayout(new GridBagLayout());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GridBagConstraints c = new GridBagConstraints();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; boolean shouldFill = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (shouldFill) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //natural height, maximum width<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; c.fill = GridBagConstraints.HORIZONTAL;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; c.fill = GridBagConstraints.HORIZONTAL;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; c.ipady = -305;&nbsp; &nbsp; &nbsp; //make this component tall<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; c.weightx = 0.0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; c.gridwidth = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; c.gridx = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; c.gridy = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fr.add(scroll, c);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //fr.add(scroll);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //fr.setSize(400,200);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fr.setVisible(true);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fr.pack();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //SwingUtilities.updateComponentTreeUI(scroll);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  } else if (status == JFileChooser.CANCEL_OPTION) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  System.out.println(&quot;canceled&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp;  );</pre><br />
I know the problem is happening because I am mixing the GridBaglayout with the GroupLayout. The problem is that I am not able to figure out I can create a layout for my JTable which I create using JFile Chooser ?<br />
<br />
Is there any way I can deal with this problem so that my layouts work even if I minimize or maximize my windows<br />
<br />
Thanks in advance</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/thread239423.html</guid>
		</item>
		<item>
			<title>MIDlet-servlet communication</title>
			<link>http://www.daniweb.com/forums/thread239419.html</link>
			<pubDate>Wed, 18 Nov 2009 10:35:55 GMT</pubDate>
			<description><![CDATA[Please help me with code.  
I have create WebApplication/HelloServlet and Midlet using netbean 6.7 
 
When i access Servlet using IE is see "Hello World!" 
 
But when i access the same from emulator calling it in Midlet.  
 
i see following code on my emulator screen. Is this the correct output?]]></description>
			<content:encoded><![CDATA[<div>Please help me with code. <br />
I have create WebApplication/HelloServlet and Midlet using netbean 6.7<br />
<br />
When i access Servlet using IE is see &quot;Hello World!&quot;<br />
<br />
But when i access the same from emulator calling it in Midlet. <br />
<br />
i see following code on my emulator screen. Is this the correct output?<br />
<br />
 <pre style="margin:20px; line-height:13px"> <br />
&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;<br />
&nbsp;  &quot;http://www.w3.org/TR/html4/loose.dtd&quot;&gt;<br />
&nbsp;<br />
&lt;html&gt;<br />
&nbsp; &nbsp; &lt;head&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot;&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;title&gt;JSP Page&lt;/title&gt;<br />
&nbsp; &nbsp; &lt;/head&gt;<br />
&nbsp; &nbsp; &lt;body&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;h1&gt;Hello World!&lt;/h1&gt;<br />
&nbsp; &nbsp; &lt;/body&gt;<br />
&lt;/html&gt;</pre><br />
My Serlvet code is <br />
 <pre style="margin:20px; line-height:13px"><br />
/*<br />
&nbsp;* To change this template, choose Tools | Templates<br />
&nbsp;* and open the template in the editor.<br />
&nbsp;*/<br />
<br />
package hcsales;<br />
<br />
import java.io.IOException;<br />
import java.io.PrintWriter;<br />
import javax.servlet.ServletException;<br />
import javax.servlet.http.HttpServlet;<br />
import javax.servlet.http.HttpServletRequest;<br />
import javax.servlet.http.HttpServletResponse;<br />
<br />
/**<br />
&nbsp;*<br />
&nbsp;* @author <br />
&nbsp;*/<br />
public class HelloServlet extends HttpServlet {<br />
&nbsp;  <br />
&nbsp; &nbsp; /** <br />
&nbsp; &nbsp;  * Processes requests for both HTTP &lt;code&gt;GET&lt;/code&gt; and &lt;code&gt;POST&lt;/code&gt; methods.<br />
&nbsp; &nbsp;  * @param request servlet request<br />
&nbsp; &nbsp;  * @param response servlet response<br />
&nbsp; &nbsp;  * @throws ServletException if a servlet-specific error occurs<br />
&nbsp; &nbsp;  * @throws IOException if an I/O error occurs<br />
&nbsp; &nbsp;  */<br />
&nbsp; &nbsp; protected void processRequest(HttpServletRequest request, HttpServletResponse response)<br />
&nbsp; &nbsp; throws ServletException, IOException {<br />
&nbsp; &nbsp; &nbsp; &nbsp; response.setContentType(&quot;text/html;charset=UTF-8&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; PrintWriter out = response.getWriter();<br />
&nbsp; &nbsp; &nbsp; &nbsp; try {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /* TODO output your page here<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; out.println(&quot;&lt;html&gt;&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; out.println(&quot;&lt;head&gt;&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; out.println(&quot;&lt;title&gt;Servlet HelloServlet&lt;/title&gt;&quot;);&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; out.println(&quot;&lt;/head&gt;&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; out.println(&quot;&lt;body&gt;&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; out.println(&quot;&lt;h1&gt;Servlet HelloServlet at &quot; + request.getContextPath () + &quot;&lt;/h1&gt;&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; out.println(&quot;&lt;/body&gt;&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; out.println(&quot;&lt;/html&gt;&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; */<br />
&nbsp; &nbsp; &nbsp; &nbsp; } finally { <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; out.close();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; } <br />
<br />
&nbsp; &nbsp; // &lt;editor-fold defaultstate=&quot;collapsed&quot; desc=&quot;HttpServlet methods. Click on the + sign on the left to edit the code.&quot;&gt;<br />
&nbsp; &nbsp; /** <br />
&nbsp; &nbsp;  * Handles the HTTP &lt;code&gt;GET&lt;/code&gt; method.<br />
&nbsp; &nbsp;  * @param request servlet request<br />
&nbsp; &nbsp;  * @param response servlet response<br />
&nbsp; &nbsp;  * @throws ServletException if a servlet-specific error occurs<br />
&nbsp; &nbsp;  * @throws IOException if an I/O error occurs<br />
&nbsp; &nbsp;  */<br />
&nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; protected void doGet(HttpServletRequest request, HttpServletResponse response)<br />
&nbsp; &nbsp; throws ServletException, IOException {<br />
&nbsp; &nbsp; &nbsp; &nbsp; processRequest(request, response);<br />
&nbsp; &nbsp; } <br />
<br />
&nbsp; &nbsp; /** <br />
&nbsp; &nbsp;  * Handles the HTTP &lt;code&gt;POST&lt;/code&gt; method.<br />
&nbsp; &nbsp;  * @param request servlet request<br />
&nbsp; &nbsp;  * @param response servlet response<br />
&nbsp; &nbsp;  * @throws ServletException if a servlet-specific error occurs<br />
&nbsp; &nbsp;  * @throws IOException if an I/O error occurs<br />
&nbsp; &nbsp;  */<br />
&nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; protected void doPost(HttpServletRequest request, HttpServletResponse response)<br />
&nbsp; &nbsp; throws ServletException, IOException {<br />
&nbsp; &nbsp; &nbsp; &nbsp; processRequest(request, response);<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; /** <br />
&nbsp; &nbsp;  * Returns a short description of the servlet.<br />
&nbsp; &nbsp;  * @return a String containing servlet description<br />
&nbsp; &nbsp;  */<br />
&nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; public String getServletInfo() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; return &quot;Short description&quot;;<br />
&nbsp; &nbsp; }// &lt;/editor-fold&gt;<br />
<br />
}</pre><br />
And the Midlet code is <br />
 <pre style="margin:20px; line-height:13px">*/<br />
import java.io.*;<br />
import javax.microedition.io.*;<br />
import javax.microedition.lcdui.*;<br />
import javax.microedition.midlet.*;<br />
<br />
/**<br />
&nbsp;* An example MIDlet to invoke a servlet.<br />
&nbsp;*/<br />
<br />
public class InvokeServletMidlet1 extends MIDlet {<br />
<br />
&nbsp;  private Display display;<br />
<br />
&nbsp;  String url = &quot;http://localhost:38877/HelloServlet/&quot;;<br />
<br />
<br />
&nbsp;  public InvokeServletMidlet1() {<br />
&nbsp; &nbsp; &nbsp; display = Display.getDisplay(this);<br />
&nbsp;  }<br />
<br />
&nbsp;  /**<br />
&nbsp; &nbsp; * Initialization. Invoked when we activate the MIDlet.<br />
&nbsp; &nbsp; */<br />
&nbsp;  public void startApp() {<br />
&nbsp; &nbsp; &nbsp; try {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  invokeServlet(url);<br />
&nbsp; &nbsp; &nbsp; } catch (IOException e) {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  System.out.println(&quot;IOException &quot; + e);<br />
&nbsp; &nbsp; &nbsp; &nbsp;  e.printStackTrace();<br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp;  }<br />
<br />
&nbsp;  /**<br />
&nbsp; &nbsp; * Pause, discontinue ....<br />
&nbsp; &nbsp; */<br />
&nbsp;  public void pauseApp() {<br />
&nbsp;  }<br />
<br />
&nbsp;  /**<br />
&nbsp; &nbsp; * Destroy must cleanup everything.<br />
&nbsp; &nbsp; */<br />
&nbsp;  public void destroyApp(boolean unconditional) {<br />
&nbsp;  }<br />
<br />
&nbsp;  /**<br />
&nbsp; &nbsp; * Retrieve a grade....<br />
&nbsp; &nbsp; */<br />
&nbsp;  void invokeServlet(String url) throws IOException {<br />
&nbsp; &nbsp; &nbsp; HttpConnection c = null;<br />
&nbsp; &nbsp; &nbsp; InputStream is = null;<br />
&nbsp; &nbsp; &nbsp; StringBuffer b = new StringBuffer();<br />
&nbsp; &nbsp; &nbsp; TextBox t = null;<br />
&nbsp; &nbsp; &nbsp; try {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  String message = &quot;Daniel+Agaba%21&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  c = (HttpConnection)Connector.open(url);<br />
&nbsp; &nbsp; &nbsp; &nbsp;  c.setRequestMethod(HttpConnection.GET);<br />
&nbsp; &nbsp; &nbsp; &nbsp;  String p= c.toString();<br />
&nbsp; &nbsp; &nbsp; &nbsp;  c.setRequestProperty(&quot;User-Agent&quot;,&quot;Profile/MIDP-1.0 Confirguration/CLDC-1.0&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp;  c.setRequestProperty(&quot;Content-Language&quot;, &quot;en-CA&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp;  is = c.openDataInputStream();<br />
&nbsp; &nbsp; &nbsp; &nbsp;  int ch;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  int s = is.read();<br />
&nbsp; &nbsp; &nbsp; &nbsp;  while ((ch = is.read()) != -1) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b.append((char) ch);<br />
&nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp;  t = new TextBox(&quot;First Servlet&quot;, b.toString(), 1024, 0);<br />
&nbsp; &nbsp; &nbsp; } finally {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  if(is!= null) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; is.close();<br />
&nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp;  if(c != null) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; c.close();<br />
&nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; display.setCurrent(t);<br />
&nbsp;  }<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>dippy78</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239419.html</guid>
		</item>
		<item>
			<title><![CDATA[Pls help me about changing font style of ToolTipText and Dialog's Text]]></title>
			<link>http://www.daniweb.com/forums/thread239408.html</link>
			<pubDate>Wed, 18 Nov 2009 09:42:03 GMT</pubDate>
			<description><![CDATA[Hello, 
         How can I change font style of ToolTipText and Dialog's text in java application program?Pls help me.Thank in advance.]]></description>
			<content:encoded><![CDATA[<div>Hello,<br />
         How can I change font style of ToolTipText and Dialog's text in java application program?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/thread239408.html</guid>
		</item>
		<item>
			<title><![CDATA[Incompatible Types "DivideByFive"]]></title>
			<link>http://www.daniweb.com/forums/thread239394.html</link>
			<pubDate>Wed, 18 Nov 2009 08:40:05 GMT</pubDate>
			<description><![CDATA[I am at my wits end with this code. 
I've been working on it for at least 2 weeks and the same error appears. 
The error, itself, is the incompatible types error. It appears underneath the division symbol. 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right;...]]></description>
			<content:encoded><![CDATA[<div>I am at my wits end with this code.<br />
I've been working on it for at least 2 weeks and the same error appears.<br />
The error, itself, is the incompatible types error. It appears underneath the division symbol.<br />
<br />
 <pre style="margin:20px; line-height:13px">// DivideByFive.java - This program determines if a number is divisible by 5 and prints<br />
// the result or the fact that the number is not divisible by five.<br />
// Input:&nbsp; Interactive.<br />
// Output:&nbsp; Result of division or message.<br />
<br />
import javax.swing.*;<br />
<br />
public class DivideByFive<br />
{<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; int number;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String numberString;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; numberString = JOptionPane.showInputDialog(&quot;Enter an integer: &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; number = Integer.parseInt(numberString);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Test number here. If divisible by 5, call divideByFive(), else print message.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (number / 5)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; divideByFive(number);<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; System.out.println(&quot;Sorry, &quot; + number + &quot; is not divisible by 5 &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; } // End of main() method.<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; // Write divideByFive() method here.<br />
&nbsp; &nbsp; &nbsp; &nbsp;  public static void divideByFive(int number)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(number + &quot; is divisible by 5 &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
<br />
} // End of DivideByFive class.</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>Jay V.</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239394.html</guid>
		</item>
		<item>
			<title>Sequential search problem</title>
			<link>http://www.daniweb.com/forums/thread239317.html</link>
			<pubDate>Wed, 18 Nov 2009 01:27:20 GMT</pubDate>
			<description><![CDATA[The code not listed has an arraylist named unsorted size 1000, and another array named keys_Array, size 100. Every element from the keys_Array was picked from the unsorted, so they should always be found. 
 
Problem I'm having is that it doesn't print anything. It just reports a msg from the IDE 
...]]></description>
			<content:encoded><![CDATA[<div>The code not listed has an arraylist named unsorted size 1000, and another array named keys_Array, size 100. Every element from the keys_Array was picked from the unsorted, so they should always be found.<br />
<br />
Problem I'm having is that it doesn't print anything. It just reports a msg from the IDE<br />
<br />
 <pre style="margin:20px; line-height:13px">Java Result: 1<br />
BUILD SUCCESSFUL (total time: 2 seconds)</pre><br />
Its suppose to search for the element in the first key index, find it and report the position, then move to the second, ect ect until the last element.<br />
I realise it will be a poor looking output with 100x lines, but this is for testing.<br />
<br />
If you know what i'm doing wrong, tell me please!<br />
:)<br />
<br />
 <pre style="margin:20px; line-height:13px">&nbsp; &nbsp; &nbsp; &nbsp; for(int z = 0; z &lt; 100; z++){ // Search 100 times (same size as keys_Array<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int x=0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; boolean found = false;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Search for key_Array elements (100 of them) inside unsorted and report position<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // The elements have to be there, so the else part of the statement is really needed<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // But it helps me for testing.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while (!found &amp;&amp; x&lt;1000)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (unsorted.get(x)==keys_Array) // I'm almost positive this here <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; found=true;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // is wrong, with the keys_Array part,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  // I tried to make it// increment,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; x ++;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // but wasn't sure how.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (found)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Found in position &quot; + x);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;The number is not found&quot;);<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>meowbits</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239317.html</guid>
		</item>
		<item>
			<title>Temperature conversion from Celsius to Fahrenheit or vise versa</title>
			<link>http://www.daniweb.com/forums/thread239309.html</link>
			<pubDate>Tue, 17 Nov 2009 23:33:27 GMT</pubDate>
			<description><![CDATA[Hi everyone, 
 
I'm trying to write a code that converts the number that a user inputs to either Celsius or Fahrenheit simply by pressing a button. So far I was able to compile and run the program displaying the panel, buttons, and the text field but I'm not sure how to write the code that gets the...]]></description>
			<content:encoded><![CDATA[<div>Hi everyone,<br />
<br />
I'm trying to write a code that converts the number that a user inputs to either Celsius or Fahrenheit simply by pressing a button. So far I was able to compile and run the program displaying the panel, buttons, and the text field but I'm not sure how to write the code that gets the input and write the code to do the calculation and display it n the text field. Help me please.<br />
 <pre style="margin:20px; line-height:13px">import java.awt.*;<br />
import java.awt.event.ActionListener;<br />
import javax.swing.*;<br />
<br />
public class FtoCConversionTest{<br />
&nbsp; &nbsp; &nbsp; &nbsp; public static void main(String[] args){<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; Frame frame = new Frame();<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 Frame extends JFrame<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; public Frame()<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setTitle(&quot;Fehrenheit to Celsius converter&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Panel panel = new Panel();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; add(panel);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pack();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
class Panel extends JPanel<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; public Panel()<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setLayout(new BorderLayout());<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //add text field and locate it<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textField = new JTextField();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; add(textField, BorderLayout.CENTER);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //add JPanel<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; panel = new JPanel();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; panel.setLayout(new GridLayout(1,2));<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //add buttons and locate them<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; addButton(&quot;Convert to Celsius&quot;, command);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; addButton(&quot;Convert to Fehrenheit&quot;, command );<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; add(panel, BorderLayout.SOUTH);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; private void addButton(String lable, ActionListener listener){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JButton button = new JButton(lable);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; button.addActionListener(listener);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; panel.add(button);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; private JTextField textField;&nbsp;  <br />
&nbsp; &nbsp; private JPanel panel;<br />
&nbsp; &nbsp; private ActionListener command;<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/thread239309.html</guid>
		</item>
		<item>
			<title>Java Help Needed!</title>
			<link>http://www.daniweb.com/forums/thread239286.html</link>
			<pubDate>Tue, 17 Nov 2009 21:18:21 GMT</pubDate>
			<description><![CDATA[Hello, I need help with an assignment. I am lost and don't know where to get started. See attached. Thanks.]]></description>
			<content:encoded><![CDATA[<div>Hello, I need help with an assignment. I am lost and don't know where to get started. See attached. Thanks.</div>  <br /> <div style="padding:5px">     <fieldset class="fieldset"> <legend>Attached Files</legend> <table cellpadding="0" cellspacing="5" border="0"> <tr> <td><img class="inlineimg" src="http://www.daniweb.com/forums/images/attach/doc.gif" alt="File Type: doc" width="16" height="16" border="0" style="vertical-align:baseline" /></td> <td><a href="http://www.daniweb.com/forums/attachment.php?attachmentid=12608&amp;d=1258492602">javahw1.doc</a> (48.0 KB)</td> </tr> </table> </fieldset>  </div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>dabears84</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239286.html</guid>
		</item>
		<item>
			<title>java game</title>
			<link>http://www.daniweb.com/forums/thread239284.html</link>
			<pubDate>Tue, 17 Nov 2009 21:15:04 GMT</pubDate>
			<description>If i am writing a java game and it has multiple people playing together, is there a way to find out how many people are at the same table/room playing?</description>
			<content:encoded><![CDATA[<div>If i am writing a java game and it has multiple people playing together, is there a way to find out how many people are at the same table/room playing?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>candoc</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239284.html</guid>
		</item>
		<item>
			<title>format text</title>
			<link>http://www.daniweb.com/forums/thread239274.html</link>
			<pubDate>Tue, 17 Nov 2009 20:42:43 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"> public static void displayBoard(final char[][] theBoard) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; // note the final parameter - we won't change the board, just print it.<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; // Need to format the board display to look like this:<br />
&nbsp; &nbsp; &nbsp; &nbsp; //&nbsp; | |<br />
&nbsp; &nbsp; &nbsp; &nbsp; // -----<br />
&nbsp; &nbsp; &nbsp; &nbsp; //&nbsp; | |<br />
&nbsp; &nbsp; &nbsp; &nbsp; // -----<br />
&nbsp; &nbsp; &nbsp; &nbsp; //&nbsp; | |<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Welcome to a game of TicTacToe\nPlayer 1 will go first, and then Player 2 after that.&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; for (int row = 0; row &lt; board_size; row++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int col = 0; col &lt; board_size; col++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  System.out.print(theBoard[row][col]);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  // row always comes first in a 2d array<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;| |\n&nbsp; -----\n&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }</pre>this is my code. I need to format the board display to look like this:<br />
          | |<br />
         -----<br />
          | |<br />
         -----<br />
          | |<br />
System.out.println(&quot;| |\n  -----\n&quot;); makes the table, but is not correct because the Xs and Os just appear before the | | and not inside or to the right of the slots like they are supposed to.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>jnthn205</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239274.html</guid>
		</item>
		<item>
			<title>Randomly select elements from array</title>
			<link>http://www.daniweb.com/forums/thread239268.html</link>
			<pubDate>Tue, 17 Nov 2009 20:34:23 GMT</pubDate>
			<description><![CDATA[I'm trying to randomly select 100 values from an array of 1000. 
How do I do this? 
 
Also, after selection, how can I add these 100 values into a new array. 
 
Do I need to do something like this with a loop? 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right;...]]></description>
			<content:encoded><![CDATA[<div>I'm trying to randomly select 100 values from an array of 1000.<br />
How do I do this?<br />
<br />
Also, after selection, how can I add these 100 values into a new array.<br />
<br />
Do I need to do something like this with a loop?<br />
<br />
 <pre style="margin:20px; line-height:13px">for (x = 0; x &lt; 100; x++){<br />
&nbsp; &nbsp; smallArray = smallArray + (value1);<br />
};</pre><br />
Thanks!</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>meowbits</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239268.html</guid>
		</item>
		<item>
			<title>Source code</title>
			<link>http://www.daniweb.com/forums/thread239266.html</link>
			<pubDate>Tue, 17 Nov 2009 20:22:22 GMT</pubDate>
			<description>how do i use netbeans to compile and run java. it seems complicated 
or rather direct me to a site</description>
			<content:encoded><![CDATA[<div>how do i use netbeans to compile and run java. it seems complicated<br />
or rather direct me to a site</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>ifezuec</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239266.html</guid>
		</item>
		<item>
			<title>Print arraylist values in non binary</title>
			<link>http://www.daniweb.com/forums/thread239260.html</link>
			<pubDate>Tue, 17 Nov 2009 19:56:07 GMT</pubDate>
			<description><![CDATA[I'm trying to print the values but it just comes out as one string on binary numbers. 
 
What do I need to change? 
Thanks! 
 
  <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"...]]></description>
			<content:encoded><![CDATA[<div>I'm trying to print the values but it just comes out as one string on binary numbers.<br />
<br />
What do I need to change?<br />
Thanks!<br />
<br />
 <pre style="margin:20px; line-height:13px">import java.util.*;<br />
<br />
public class lab5 {<br />
<br />
&nbsp; &nbsp; public static void main(String[] args) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; Random random = new Random();<br />
&nbsp; &nbsp; &nbsp;  // int [] unsorted_array = new int [1000];<br />
&nbsp; &nbsp; &nbsp;  // int [] sorted_array = new int [1000];<br />
&nbsp; &nbsp; &nbsp; &nbsp; ArrayList unsorted = new ArrayList(),<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  sorted = new ArrayList();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; for(int count = 0; count &lt;= 1000; count++){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int rand = random.nextInt(10000)+1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(rand);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unsorted.add(rand);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sorted.add(rand);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; for( int i = 0; i&lt; 1000; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  System.out.print(unsorted.size());<br />
&nbsp; }</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>meowbits</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239260.html</guid>
		</item>
		<item>
			<title><![CDATA[interface java.util.List<Employee>]]></title>
			<link>http://www.daniweb.com/forums/thread239254.html</link>
			<pubDate>Tue, 17 Nov 2009 19:27:27 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">List result = q.list();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (result.isEmpty()){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;No Projects&quot;);<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; for(Object object : result){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Project p = (Project) object;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(p.getName()+&quot; worked on by &quot;+p.getEmployees().getName());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre><br />
<br />
<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 />   error :<br />
CompanyReports.java:303: cannot find symbol<br />
symbol  : method getName()<br />
location: interface java.util.List&lt;Employee&gt;<br />
				System.out.println(p.getName()+&quot; worked on by &quot;+p.getEmployees().getName());<br />
				                                                                ^<br />
1 error  <hr /> </td> </tr> </table> </div>Can anyone help what is my stupid mistake here? And how can I deal with it?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>sfar_furqan</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239254.html</guid>
		</item>
		<item>
			<title>Binary Tree</title>
			<link>http://www.daniweb.com/forums/thread239251.html</link>
			<pubDate>Tue, 17 Nov 2009 18:54:20 GMT</pubDate>
			<description><![CDATA[Hi guys, Im complete lost as to how to create a static Binary Tree object. 
 
My assignment states that I have to "Write a static method named ex1() that returns a BinaryTree object representing the expression (2 + 4) * 8" 
 
here is the code i have so far 
 
BinaryTree.java 
  <div...]]></description>
			<content:encoded><![CDATA[<div>Hi guys, Im complete lost as to how to create a static Binary Tree object.<br />
<br />
My assignment states that I have to &quot;Write a static method named ex1() that returns a BinaryTree object representing the expression (2 + 4) * 8&quot;<br />
<br />
here is the code i have so far<br />
<br />
BinaryTree.java<br />
 <pre style="margin:20px; line-height:13px">import java.io.*;<br />
<br />
/** Class for a binary tree that stores type E objects.<br />
*&nbsp;  @author Koffman and Wolfgang<br />
* */<br />
<br />
public class BinaryTree &lt; E &gt;<br />
&nbsp; &nbsp; implements Serializable {<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; private static final long serialVersionUID = 1L;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
<br />
&nbsp; // Data Field<br />
&nbsp; /** The root of the binary tree */<br />
&nbsp; protected Node &lt; E &gt; root;<br />
<br />
&nbsp; public BinaryTree() {<br />
&nbsp; &nbsp; root = null;<br />
&nbsp; }<br />
<br />
&nbsp; protected BinaryTree(Node &lt; E &gt; root) {<br />
&nbsp; &nbsp; this.root = root;<br />
&nbsp; }<br />
<br />
&nbsp; /** Constructs a new binary tree with data in its root,leftTree<br />
&nbsp; &nbsp; &nbsp; as its left subtree and rightTree as its right subtree.<br />
&nbsp;  */<br />
&nbsp; public BinaryTree(E data, BinaryTree &lt; E &gt; leftTree,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; BinaryTree &lt; E &gt; rightTree) {<br />
&nbsp; &nbsp; root = new Node &lt; E &gt; (data);<br />
&nbsp; &nbsp; if (leftTree != null) {<br />
&nbsp; &nbsp; &nbsp; root.left = leftTree.root;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; else {<br />
&nbsp; &nbsp; &nbsp; root.left = null;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; if (rightTree != null) {<br />
&nbsp; &nbsp; &nbsp; root.right = rightTree.root;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; else {<br />
&nbsp; &nbsp; &nbsp; root.right = null;<br />
&nbsp; &nbsp; }<br />
&nbsp; }<br />
<br />
&nbsp; /** Return the left subtree.<br />
&nbsp; &nbsp; &nbsp; @return The left subtree or null if either the root or<br />
&nbsp; &nbsp; &nbsp; the left subtree is null<br />
&nbsp;  */<br />
&nbsp; public BinaryTree &lt; E &gt; getLeftSubtree() {<br />
&nbsp; &nbsp; if (root != null &amp;&amp; root.left != null) {<br />
&nbsp; &nbsp; &nbsp; return new BinaryTree &lt; E &gt; (root.left);<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; else {<br />
&nbsp; &nbsp; &nbsp; return null;<br />
&nbsp; &nbsp; }<br />
&nbsp; }<br />
<br />
&nbsp; /** Return the right sub-tree<br />
&nbsp; &nbsp; &nbsp; &nbsp; @return the right sub-tree or<br />
&nbsp; &nbsp; &nbsp; &nbsp; null if either the root or the<br />
&nbsp; &nbsp; &nbsp; &nbsp; right subtree is null.<br />
&nbsp; &nbsp; */<br />
&nbsp; &nbsp; public BinaryTree&lt;E&gt; getRightSubtree() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (root != null &amp;&amp; root.right != null) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return new BinaryTree&lt;E&gt;(root.right);<br />
&nbsp; &nbsp; &nbsp; &nbsp; } else {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return null;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
<br />
<br />
/**** EXERCISE ****/<br />
<br />
&nbsp; /** Determine whether this tree is a leaf.<br />
&nbsp; &nbsp; &nbsp; @return true if the root has no children<br />
&nbsp;  */<br />
&nbsp; public boolean isLeaf() {<br />
&nbsp; &nbsp; return (root.left == null &amp;&amp; root.right == null);<br />
&nbsp; }<br />
<br />
&nbsp; public String toString() {<br />
&nbsp; &nbsp; StringBuilder sb = new StringBuilder();<br />
&nbsp; &nbsp; preOrderTraverse(root, 1, sb);<br />
&nbsp; &nbsp; return sb.toString();<br />
&nbsp; }<br />
<br />
&nbsp; /** Perform a preorder traversal.<br />
&nbsp; &nbsp; &nbsp; @param node The local root<br />
&nbsp; &nbsp; &nbsp; @param depth The depth<br />
&nbsp; &nbsp; &nbsp; @param sb The string buffer to save the output<br />
&nbsp;  */<br />
&nbsp; private void preOrderTraverse(Node &lt; E &gt; node, int depth,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; StringBuilder sb) {<br />
&nbsp; &nbsp; for (int i = 1; i &lt; depth; i++) {<br />
&nbsp; &nbsp; &nbsp; sb.append(&quot;&nbsp; &quot;);<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; if (node == null) {<br />
&nbsp; &nbsp; &nbsp; sb.append(&quot;null\n&quot;);<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; else {<br />
&nbsp; &nbsp; &nbsp; sb.append(node.toString());<br />
&nbsp; &nbsp; &nbsp; sb.append(&quot;\n&quot;);<br />
&nbsp; &nbsp; &nbsp; preOrderTraverse(node.left, depth + 1, sb);<br />
&nbsp; &nbsp; &nbsp; preOrderTraverse(node.right, depth + 1, sb);<br />
&nbsp; &nbsp; }<br />
&nbsp; }<br />
<br />
&nbsp; /** Method to read a binary tree.<br />
&nbsp; &nbsp; &nbsp; pre: The input consists of a preorder traversal<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  of the binary tree. The line &quot;null&quot; indicates a null tree.<br />
&nbsp; &nbsp; &nbsp; @param bR The input file<br />
&nbsp; &nbsp; &nbsp; @return The binary tree<br />
&nbsp; &nbsp; &nbsp; @throws IOException If there is an input error<br />
&nbsp;  */<br />
&nbsp; public static BinaryTree &lt; String &gt;<br />
&nbsp; &nbsp; &nbsp; readBinaryTree(BufferedReader bR) throws IOException {<br />
&nbsp; &nbsp; // Read a line and trim leading and trailing spaces.<br />
&nbsp; &nbsp; String data = bR.readLine().trim();<br />
&nbsp; &nbsp; if (data.equals(&quot;null&quot;)) {<br />
&nbsp; &nbsp; &nbsp; return null;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; else {<br />
&nbsp; &nbsp; &nbsp; BinaryTree &lt; String &gt; leftTree = readBinaryTree(bR);<br />
&nbsp; &nbsp; &nbsp; BinaryTree &lt; String &gt; rightTree = readBinaryTree(bR);<br />
&nbsp; &nbsp; &nbsp; return new BinaryTree &lt; String &gt; (data, leftTree, rightTree);<br />
&nbsp; &nbsp; }<br />
&nbsp; }<br />
&nbsp; <br />
&nbsp; public static BinaryTree ex1(){<br />
&nbsp; &nbsp; &nbsp; &nbsp; return null;<br />
&nbsp; }<br />
&nbsp; <br />
&nbsp; public static BinaryTree ex2(){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return null;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; }<br />
}</pre><br />
Node.java ( i removed the node class from binary tree because that is what my teacher wanted me to do &quot;The book defines the Node class within the Binarytree class. Move the Node class into its own public definition inside Node.java.  Add/remove import statements as needed.&quot;  <br />
did i do it the right way?<br />
<br />
 <pre style="margin:20px; line-height:13px">import java.io.*;<br />
<br />
import BinaryTree.Node;<br />
<br />
<br />
<br />
/** Class to encapsulate a tree node. */<br />
class Node &lt; E &gt;<br />
&nbsp; &nbsp; implements Serializable {<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; private static final long serialVersionUID = 1L;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; // Data Fields<br />
&nbsp; /** The information stored in this node. */<br />
&nbsp; protected E data;<br />
<br />
&nbsp; /** Reference to the left child. */<br />
&nbsp; protected Node &lt; E &gt; left;<br />
<br />
&nbsp; /** Reference to the right child. */<br />
&nbsp; protected Node &lt; E &gt; right;<br />
<br />
<br />
<br />
// Constructors<br />
&nbsp; &nbsp; /** Construct a node with given data and no children.<br />
&nbsp; &nbsp; &nbsp; &nbsp; @param data The data to store in this node<br />
&nbsp; &nbsp;  */<br />
&nbsp; &nbsp; public Node(E data) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; this.data = data;<br />
&nbsp; &nbsp; &nbsp; left = null;<br />
&nbsp; &nbsp; &nbsp; right = null;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; // Methods<br />
&nbsp; &nbsp; /** Return a string representation of the node.<br />
&nbsp; &nbsp; &nbsp; &nbsp; @return A string representation of the data fields<br />
&nbsp; &nbsp;  */<br />
&nbsp; &nbsp; public String toString() {<br />
&nbsp; &nbsp; &nbsp; return data.toString();<br />
&nbsp; &nbsp; }<br />
&nbsp; }</pre><br />
so my two questions are, did i create the Node.java correctly <br />
<br />
and how do i create the BinaryTree object called ex1() that returns the statement (2+4)*8<br />
<br />
Thank You</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>vcm</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239251.html</guid>
		</item>
		<item>
			<title><![CDATA[JList doesn't pass events to sub component]]></title>
			<link>http://www.daniweb.com/forums/thread239224.html</link>
			<pubDate>Tue, 17 Nov 2009 15:59:25 GMT</pubDate>
			<description><![CDATA[Hello All, it's been a while since I've had a question for you all. 
I'm trying to write a paint app, I've done so before, but this time I decided to add Layers, and I wanted a JList of the layers, I wrote a cell renderer, that not only renders the names of the layer, but a small scale image of the...]]></description>
			<content:encoded><![CDATA[<div>Hello All, it's been a while since I've had a question for you all.<br />
I'm trying to write a paint app, I've done so before, but this time I decided to add Layers, and I wanted a JList of the layers, I wrote a cell renderer, that not only renders the names of the layer, but a small scale image of the layer, but I also have two checkboxes on the component that gets returned, and the checkboxes don't change when clicked, is there a simple way to make the list pass events down to other components?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>sciwizeh</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239224.html</guid>
		</item>
		<item>
			<title>Coffee Machine (State Machine)</title>
			<link>http://www.daniweb.com/forums/thread239222.html</link>
			<pubDate>Tue, 17 Nov 2009 15:54:58 GMT</pubDate>
			<description>Hi,  
I need some help with a school project. This is what I have done so far: 
(Sorry about the wall of code) 
 
 
public abstract class State { 
 
    private double drinkPrice; 
    private double amountPutIn; 
    private String selection;</description>
			<content:encoded><![CDATA[<div>Hi, <br />
I need some help with a school project. This is what I have done so far:<br />
(Sorry about the wall of code)<br />
<br />
 <pre style="margin:20px; line-height:13px">public abstract class State {<br />
<br />
&nbsp; &nbsp; private double drinkPrice;<br />
&nbsp; &nbsp; private double amountPutIn;<br />
&nbsp; &nbsp; private String selection;<br />
<br />
<br />
&nbsp; &nbsp; public State() {<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public State(double drinkPrice, double amountPutIn, String selection) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; this.drinkPrice = drinkPrice;<br />
&nbsp; &nbsp; &nbsp; &nbsp; this.amountPutIn = amountPutIn;<br />
&nbsp; &nbsp; &nbsp; &nbsp; this.selection = selection;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public double getDrinkPrice(){<br />
&nbsp; &nbsp; &nbsp; &nbsp; return drinkPrice;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; public void setDrinkPrice(double drinkPrice){<br />
&nbsp; &nbsp; &nbsp; &nbsp; this.drinkPrice = drinkPrice;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public double getAmountPutIn() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; return amountPutIn;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public void setAmountPutIn(double amountPutIn) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; this.amountPutIn = amountPutIn;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public String getSelection(){<br />
&nbsp; &nbsp; &nbsp; &nbsp; return selection;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public void setSelection(String selection){<br />
&nbsp; &nbsp; &nbsp; &nbsp; this.selection = selection;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public abstract void makeSelection(String selection, CoffeeMachine coffeemachine);<br />
}</pre>This State class is fine I think for the moment.<br />
 <pre style="margin:20px; line-height:13px">public class SelectDrink extends State {<br />
<br />
&nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; public void makeSelection(String selection, CoffeeMachine coffeemachine) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (selection.equals(CoffeeMachine.COFFEE)){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; selection = super.setSelection();<br />
&nbsp; &nbsp; &nbsp; &nbsp; } else if (selection.equals(CoffeeMachine.CHOCOLATE)){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; selection = super.setSelection();<br />
&nbsp; &nbsp; &nbsp; &nbsp; } else {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; selection = super.setSelection();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
}</pre>I need help figuring out what to put inside the parentheses in  <pre style="margin:20px; line-height:13px">super.setSelection();</pre> <pre style="margin:20px; line-height:13px">public class CoffeeMachine {<br />
<br />
&nbsp; &nbsp; public static final String COFFEE = &quot;Coffee&quot;;<br />
&nbsp; &nbsp; public static final String CHOCOLATE = &quot;Chocolate&quot;;<br />
&nbsp; &nbsp; public static final String TEA = &quot;Tea&quot;;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; HashMap&lt;String, Integer&gt; drinkPrice = new HashMap&lt;String, Integer&gt;();<br />
<br />
&nbsp; &nbsp; public CoffeeMachine() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; drinkPrice.put(COFFEE, 20);<br />
&nbsp; &nbsp; &nbsp; &nbsp; drinkPrice.put(CHOCOLATE, 15);<br />
&nbsp; &nbsp; &nbsp; &nbsp; drinkPrice.put(TEA, 10);<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public int getPrice(String selection) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; return drinkPrice.get();<br />
&nbsp; &nbsp; }<br />
}</pre>And here I need help with the getPrice method. I need to get the value from the HashMap for any of the three coffee, chocolate and tea.<br />
<br />
I attached the handed out description of the project. The state diagram and the State Transition and Action table I made myself.<br />
<br />
I would greatly appreciate any help or pointers in the right direction.</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/png.gif" alt="File Type: png" width="16" height="16" border="0" style="vertical-align:baseline" /></td> <td><a href="http://www.daniweb.com/forums/attachment.php?attachmentid=12599&amp;d=1258472471" target="_blank">State_machine_diagram.png</a> (22.6 KB)</td> </tr><tr> <td><img class="inlineimg" src="http://www.daniweb.com/forums/images/attach/bmp.gif" alt="File Type: bmp" width="16" height="16" border="0" style="vertical-align:baseline" /></td> <td><a href="http://www.daniweb.com/forums/attachment.php?attachmentid=12602&amp;d=1258473003" target="_blank">StateTrans+Action.bmp</a> (341.7 KB)</td> </tr> </table> </fieldset>   <fieldset class="fieldset"> <legend>Attached Files</legend> <table cellpadding="0" cellspacing="5" border="0"> <tr> <td><img class="inlineimg" src="http://www.daniweb.com/forums/images/attach/pdf.gif" alt="File Type: pdf" width="16" height="16" border="0" style="vertical-align:baseline" /></td> <td><a href="http://www.daniweb.com/forums/attachment.php?attachmentid=12600&amp;d=1258472482">Assignment 2 Drinks Machine.pdf</a> (63.7 KB)</td> </tr> </table> </fieldset>  </div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>benregn</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239222.html</guid>
		</item>
		<item>
			<title>JFRAME to Applet?</title>
			<link>http://www.daniweb.com/forums/thread239221.html</link>
			<pubDate>Tue, 17 Nov 2009 15:52:29 GMT</pubDate>
			<description><![CDATA[Hi Everyone... I need to convert a JFRAME to an APPLET 
can I do that by simply extending the JApplet Class and replacing the  
main method with start ? I've tried this and my program will compile but wont run   
 
Here Is the Original Code 
  <div class="codeblock"> <div class="spaced"> <div...]]></description>
			<content:encoded><![CDATA[<div>Hi Everyone... I need to convert a JFRAME to an APPLET<br />
can I do that by simply extending the JApplet Class and replacing the <br />
main method with start ? I've tried this and my program will compile but wont run  <br />
<br />
Here Is the Original Code<br />
 <pre style="margin:20px; line-height:13px"><br />
import javax.swing.*;<br />
import java.awt.*;<br />
import java.awt.event.*;<br />
<br />
public class CardGameCH15 extends JFrame<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; public CardGameCH15()<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; super(&quot;Card Game&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setLayout(new BorderLayout());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setSize(500,200);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; add(new CardTable());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setVisible(true);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<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; new CardGameCH15();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; class CardTable extends JPanel implements ActionListener<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String card;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ImageIcon cardIcon;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JButton dealButton = new JButton(&quot;Deal 5&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CardDeck deck;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JLabel card1 = new JLabel(&quot;&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JLabel card2 = new JLabel(&quot;&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JLabel card3 = new JLabel(&quot;&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JLabel card4 = new JLabel(&quot;&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JLabel card5 = new JLabel(&quot;&quot;);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public CardTable()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setLayout(new FlowLayout());<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; deck = new CardDeck(1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dealHand();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; add(card1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; add(card2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; add(card3);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; add(card4);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; add(card5);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; add(dealButton);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dealButton.addActionListener(this);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void actionPerformed(ActionEvent e)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dealHand();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; private void dealHand()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String str;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if((str = deck.getCard()) != null)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; card1.setIcon(new ImageIcon(&quot;image/card/&quot; + str));<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; &nbsp; &nbsp; &nbsp; &nbsp; return;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if((str = deck.getCard()) != null)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; card2.setIcon(new ImageIcon(&quot;image/card/&quot; + str));<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; &nbsp; &nbsp; &nbsp; &nbsp; return;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if((str = deck.getCard()) != null)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; card3.setIcon(new ImageIcon(&quot;image/card/&quot; + str));<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; &nbsp; &nbsp; &nbsp; &nbsp; return;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if((str = deck.getCard()) != null)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; card4.setIcon(new ImageIcon(&quot;image/card/&quot; + str));<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; &nbsp; &nbsp; &nbsp; &nbsp; return;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if((str = deck.getCard()) != null)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; card5.setIcon(new ImageIcon(&quot;image/card/&quot; + str));<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; &nbsp; &nbsp; &nbsp; &nbsp; return;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}</pre><br />
and Here is my revision<br />
<br />
<br />
<br />
 <pre style="margin:20px; line-height:13px">import java.applet.Applet;<br />
import javax.swing.*;<br />
import java.awt.*;<br />
import java.awt.event.*;<br />
<br />
public class CardGameCH15 extends JApplet<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; public CardGameCH15()<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setLayout(new BorderLayout());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setSize(500,200);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; add(new CardTable());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setVisible(true);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; public void start()&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; new CardGameCH15();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; class CardTable extends JPanel implements ActionListener<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String card;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ImageIcon cardIcon;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JButton dealButton = new JButton(&quot;Deal 5&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CardDeck deck;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JLabel card1 = new JLabel(&quot;&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JLabel card2 = new JLabel(&quot;&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JLabel card3 = new JLabel(&quot;&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JLabel card4 = new JLabel(&quot;&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JLabel card5 = new JLabel(&quot;&quot;);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void init()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setLayout(new FlowLayout());<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; deck = new CardDeck(1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dealHand();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; add(card1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; add(card2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; add(card3);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; add(card4);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; add(card5);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; add(dealButton);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dealButton.addActionListener(this);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void actionPerformed(ActionEvent e)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dealHand();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; private void dealHand()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String str;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if((str = deck.getCard()) != null)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; card1.setIcon(new ImageIcon(&quot;image/card/&quot; + str));<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; &nbsp; &nbsp; &nbsp; &nbsp; return;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if((str = deck.getCard()) != null)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; card2.setIcon(new ImageIcon(&quot;image/card/&quot; + str));<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; &nbsp; &nbsp; &nbsp; &nbsp; return;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if((str = deck.getCard()) != null)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; card3.setIcon(new ImageIcon(&quot;image/card/&quot; + str));<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; &nbsp; &nbsp; &nbsp; &nbsp; return;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if((str = deck.getCard()) != null)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; card4.setIcon(new ImageIcon(&quot;image/card/&quot; + str));<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; &nbsp; &nbsp; &nbsp; &nbsp; return;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if((str = deck.getCard()) != null)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; card5.setIcon(new ImageIcon(&quot;image/card/&quot; + str));<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; &nbsp; &nbsp; &nbsp; &nbsp; return;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}</pre><br />
Any help would be greatly Appreciated</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/thread239221.html</guid>
		</item>
		<item>
			<title>print rectangle shape star in console</title>
			<link>http://www.daniweb.com/forums/thread239205.html</link>
			<pubDate>Tue, 17 Nov 2009 13:42:26 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">import java.util.Scanner;<br />
public class Draw {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; public static void main(String[] args) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Scanner input =&nbsp; new Scanner (System.in);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int width = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int height = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int select;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.print(&quot;Enter Width :&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; width = input.nextInt();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.print(&quot;Enter Height :&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; height = input.nextInt();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;=============================================&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  SELECTION&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  |&quot;);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;|===========================================|&quot;);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;| Option :&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;|&nbsp; &nbsp; &nbsp; &nbsp;  0: Exit&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  |&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;|&nbsp; &nbsp; &nbsp; &nbsp;  1: Empty Shape&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;|&nbsp; &nbsp; &nbsp; &nbsp;  2: Filled Shape&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  |&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;=============================================&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; select = input.nextInt();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; switch (select)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 0 :<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot; ...EXIT...&quot;);<br />
&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; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 1:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Filled Shape &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for(int i=1;i&lt;=height;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; for(int j=1;j&lt;=width;j++)<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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if((i==1 || i==height) || (j==1 || j==width))<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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.print(&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; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &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; &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; System.out.print(&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; &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; &nbsp; &nbsp; System.out.println();<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; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 2:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Filled Shape &quot;);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for(int i=1;i&lt;=height;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; for(int j=1;j&lt;=width;j++)<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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if((i==1 || i==height) || (j==1 || j==width))<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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.print(&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; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &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; &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; System.out.print(&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; &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; &nbsp; &nbsp; System.out.println();<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; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Width :&quot;+width+&quot; Height :&quot;+height);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>saadismail85</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239205.html</guid>
		</item>
		<item>
			<title>Constructor Overloading</title>
			<link>http://www.daniweb.com/forums/thread239192.html</link>
			<pubDate>Tue, 17 Nov 2009 12:19:24 GMT</pubDate>
			<description>Why must the use of the this keyword, or similarly the use of the super keyword in constructor chaining, be on the first line of an overloaded constructor? 
 
In other words, actual class construction cannot be split between constructors.  If re-direction must occur, it must be the first line of a...</description>
			<content:encoded><![CDATA[<div>Why must the use of the this keyword, or similarly the use of the super keyword in constructor chaining, be on the first line of an overloaded constructor?<br />
<br />
In other words, actual class construction cannot be split between constructors.  If re-direction must occur, it must be the first line of a constructor.  Why?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>mark185</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239192.html</guid>
		</item>
		<item>
			<title>java RMI: Exception, java.io.EOFException</title>
			<link>http://www.daniweb.com/forums/thread239188.html</link>
			<pubDate>Tue, 17 Nov 2009 11:58:05 GMT</pubDate>
			<description><![CDATA[Hi, 
 
I'm writing my first RMI application, it's an auction system. At the end of the auction period for a particular item the server sends a 'callback' to the winning client telling him that he's won. It works fine till here, but after that i get this exception. It shows on the client console,...]]></description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
I'm writing my first RMI application, it's an auction system. At the end of the auction period for a particular item the server sends a 'callback' to the winning client telling him that he's won. It works fine till here, but after that i get this exception. It shows on the client console, but i suspect it's coming from the server. Any clues what's going on here? Please let me know if you need to see the client or server code.<br />
<br />
I use java rmi client and server. <br />
This is the exception below:<br />
<br />
<img src="/cgi-bin/mimetex.cgi?java.rmi.UnmarshalException: Error unmarshaling return header; nested exception is: <br />
	java.io.EOFException<br />
	at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:209)<br />
	at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)<br />
	at das.auction.client.ClientDriver_Stub.notify(Unknown Source)<br />
	at das.auction.server.RemoteAuctionImpl.notifyWinnerInfo(RemoteAuctionImpl.java:220)<br />
	at das.auction.server.RemoteAuctionImpl$BidTimeReached.run(RemoteAuctionImpl.java:75)<br />
	at java.util.TimerThread.mainLoop(Timer.java:512)<br />
	at java.util.TimerThread.run(Timer.java:462)<br />
Caused by: java.io.EOFException<br />
	at java.io.DataInputStream.readByte(DataInputStream.java:250)<br />
	at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:195)<br />
	... 6 more<br />
" alt="java.rmi.UnmarshalException: Error unmarshaling return header; nested exception is: <br />
	java.io.EOFException<br />
	at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:209)<br />
	at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)<br />
	at das.auction.client.ClientDriver_Stub.notify(Unknown Source)<br />
	at das.auction.server.RemoteAuctionImpl.notifyWinnerInfo(RemoteAuctionImpl.java:220)<br />
	at das.auction.server.RemoteAuctionImpl$BidTimeReached.run(RemoteAuctionImpl.java:75)<br />
	at java.util.TimerThread.mainLoop(Timer.java:512)<br />
	at java.util.TimerThread.run(Timer.java:462)<br />
Caused by: java.io.EOFException<br />
	at java.io.DataInputStream.readByte(DataInputStream.java:250)<br />
	at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:195)<br />
	... 6 more<br />
" border="0" /><br />
<br />
This is code where i call client callback method in server. the stack comes from the catch block of this method.<br />
 <pre style="margin:20px; line-height:13px">public void notifyWinnerInfo(String itemCodeId,String userId,Integer maxBidVal)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try<br />
&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;update winner and notify clients&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Set&lt;Map.Entry&lt;Subscriber,UserInfo&gt;&gt; subsUserMapArray = subscriberList.entrySet();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Iterator it = subsUserMapArray.iterator();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Subscriber winner;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;# of elements in iterator &quot; + subsUserMapArray.size());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while(it.hasNext())<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;element found&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Map.Entry&lt;Subscriber,UserInfo&gt; m = (Map.Entry&lt;Subscriber,UserInfo&gt;)it.next();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; UserInfo uid = m.getValue();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Subscriber s = m.getKey();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(uid.getUID().equals(userId))<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; s.notify(itemCodeId,maxBidVal,Boolean.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<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; s.notify(itemCodeId,maxBidVal,Boolean.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; &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(Exception re)<br />
&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;UpdateUserBid&quot;); // This is where the stack comes from, i get this system.out<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; re.printStackTrace();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }</pre><br />
This is the client code for this callback<br />
<br />
 <pre style="margin:20px; line-height:13px">public void notify(String itemCodeId,Integer maxBidVal,Boolean winner)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.print((char)27 + &quot;&#91;2J&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;server notification: &quot; + &quot; ItemCodeId: &quot; + itemCodeId + &quot; maxBidVal: &quot; + maxBidVal + &quot; winner?: &quot; + winner);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(!winner)<br />
&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;Sorry, you were not the highest bidder&quot;);<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; System.out.println(&quot;Congrats !! you have won the bid for this item, Please see our website for payment options&quot;);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //sleep here for sometime then go to first screen again<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ClientStateMachine.nextItem = &quot;WELCOME&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ClientStateMachine.run();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }</pre><br />
as soon as i do anything on the first screen now, i get the stack.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>Agni</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239188.html</guid>
		</item>
		<item>
			<title>Java Overlap Layer</title>
			<link>http://www.daniweb.com/forums/thread239175.html</link>
			<pubDate>Tue, 17 Nov 2009 10:45:01 GMT</pubDate>
			<description><![CDATA[Hello 
 
I'm new to Java. I wanted to make a card game in which i want to overlap those cards. I just want to know how to overlap cards, like "solitaire" or "hearts" card games. Kindly help... 
I'll be grateful.]]></description>
			<content:encoded><![CDATA[<div><span style="color:Green">Hello<br />
<br />
I'm new to Java. I wanted to make a card game in which i want to overlap those cards. I just want to know how to overlap cards, like &quot;solitaire&quot; or &quot;hearts&quot; card games. Kindly help...<br />
I'll be grateful.</span></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>begforcode</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239175.html</guid>
		</item>
		<item>
			<title>Saving data From JTable to MySql</title>
			<link>http://www.daniweb.com/forums/thread239159.html</link>
			<pubDate>Tue, 17 Nov 2009 08:37:16 GMT</pubDate>
			<description><![CDATA[I have 2 buttons in my form. The first button to fill the JTable from .xls file and the second button to save the content of the table to database (MySql). I haven't figure out yet the way to save data from JTable to MySql. :confused: So, can anybody help me pliz? Thanx before.]]></description>
			<content:encoded><![CDATA[<div>I have 2 buttons in my form. The first button to fill the JTable from .xls file and the second button to save the content of the table to database (MySql). I haven't figure out yet the way to save data from JTable to MySql. :confused: So, can anybody help me pliz? Thanx before.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>wild_angel</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239159.html</guid>
		</item>
		<item>
			<title>Invoking a method with array in parameter</title>
			<link>http://www.daniweb.com/forums/thread239154.html</link>
			<pubDate>Tue, 17 Nov 2009 08:08:35 GMT</pubDate>
			<description><![CDATA[So basically my assignment is to write a few Java methods that contain arrays in the parameters, and then test each one using a main method within the same class. However, I can't figure out how to invoke the methods... I keep getting a compiler error that states "join(char[]) in Homework cannot be...]]></description>
			<content:encoded><![CDATA[<div>So basically my assignment is to write a few Java methods that contain arrays in the parameters, and then test each one using a main method within the same class. However, I can't figure out how to invoke the methods... I keep getting a compiler error that states &quot;join(char[]) in Homework cannot be applied to (char,char,char)&quot;. Here's one of the methods I'm working on - does anyone have any suggestions? I will greatly appreciate any help!<br />
<br />
 <pre style="margin:20px; line-height:13px"> <br />
public class Homework<br />
{<br />
&nbsp; &nbsp;  public static String join (char[]a)<br />
&nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String result = &quot;&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int i = 0; i &lt; a.length; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  result = result + &quot; &quot; + a[i];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } // end for<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return result;<br />
<br />
&nbsp; &nbsp;  } // end method<br />
<br />
&nbsp; &nbsp;  public static void main (String args [])<br />
&nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  System.out.println(&quot;join method test = &quot; + join('a', 'b', 'c'));<br />
&nbsp; &nbsp; &nbsp; } // end main<br />
} // end class</pre></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/thread239154.html</guid>
		</item>
		<item>
			<title>Impressive Java 6 JOGL/Java2D effects not supported by Mac?</title>
			<link>http://www.daniweb.com/forums/thread239153.html</link>
			<pubDate>Tue, 17 Nov 2009 08:08:27 GMT</pubDate>
			<description>Java has matured in terms of UI presentation.  
search project Aerith for examples on some of the neat things that can be done when mixing JOGL, Swing and Java2d. 
 
However, it seems these only work on windows. Mac is still strangely alienated from the Java revolution, cuz Steve still strangely...</description>
			<content:encoded><![CDATA[<div>Java has matured in terms of UI presentation. <br />
search project Aerith for examples on some of the neat things that can be done when mixing JOGL, Swing and Java2d.<br />
<br />
However, it seems these only work on windows. Mac is still strangely alienated from the Java revolution, cuz Steve still strangely insists that his boys be the ones to create their own JVM perhaps? These UI improvements have been around since 2006 and here we are now in 2009, with &quot;Java for Mac (java 6)&quot; not having JOGL/Java2D interoperability support.<br />
<br />
Has anyone tried playing around with JOGL on OSX? Did you try running the XTrans demo on the JOGL site? Did it work for you?<br />
<br />
Even trying to compile the source code for the Xtrans demo gives me this:<br />
<br />
 Error: XTDesktopPane requires new Java2D/JOGL support in Java SE 6</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>buffonomics</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239153.html</guid>
		</item>
		<item>
			<title>implementation of a sequence counter</title>
			<link>http://www.daniweb.com/forums/thread239151.html</link>
			<pubDate>Tue, 17 Nov 2009 08:04:57 GMT</pubDate>
			<description><![CDATA[Hey guys 
I am requesting u to help me with this programming assignement 
it is all about implementing a sequence counter given simple counter code 
For more information view the attachements  
Thanks   <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a...]]></description>
			<content:encoded><![CDATA[<div>Hey guys<br />
I am requesting u to help me with this programming assignement<br />
it is all about implementing a sequence counter given simple counter code<br />
For more information view the attachements <br />
Thanks  <pre style="margin:20px; line-height:13px"> /*<br />
&nbsp;* Copyright (c) 1997,98,99,2000 E.J.Dijkstra / R.Smedinga. All Rights Reserved.<br />
&nbsp;*<br />
&nbsp;* Permission to use, copy, modify, and distribute this software<br />
&nbsp;* and its documentation for NON-COMMERCIAL purposes and without<br />
&nbsp;* fee is hereby granted provided that this copyright notice<br />
&nbsp;* appears in all copies. <br />
&nbsp;*<br />
&nbsp;* This Java source code is part of a course on Object Oriented Techniques<br />
&nbsp;* developed by E.J.Dijkstra and R.Smedinga for PTS Software, Bussum.<br />
&nbsp;*/<br />
/*<br />
&nbsp;* @version 1.1 19980109<br />
&nbsp;* @author R.Smedinga@cs.rug.nl<br />
&nbsp;*/<br />
<br />
<br />
<br />
import java.lang.*;<br />
<br />
public class SequenceCounter extends Counter {<br />
<br />
&nbsp;  <br />
&nbsp;  public SequenceCounter (String[] aSequence) {<br />
&nbsp;  <br />
&nbsp;  }<br />
<br />
&nbsp;  public void increment () { <br />
<br />
&nbsp;  }<br />
<br />
&nbsp;  public void decrement () { <br />
<br />
&nbsp;  }<br />
<br />
&nbsp;  public void reset () { <br />
<br />
&nbsp;  }<br />
<br />
&nbsp;  public String valueAsString () { <br />
&nbsp; &nbsp; &nbsp; return &quot;??&quot;;<br />
&nbsp;  }<br />
}</pre></div>  <br /> <div style="padding:5px">     <fieldset class="fieldset"> <legend>Attached Files</legend> <table cellpadding="0" cellspacing="5" border="0"> <tr> <td><img class="inlineimg" src="http://www.daniweb.com/forums/images/attach/pdf.gif" alt="File Type: pdf" width="16" height="16" border="0" style="vertical-align:baseline" /></td> <td><a href="http://www.daniweb.com/forums/attachment.php?attachmentid=12588&amp;d=1258444768">05a_Assignment_III.pdf</a> (30.8 KB)</td> </tr><tr> <td><img class="inlineimg" src="http://www.daniweb.com/forums/images/attach/zip.gif" alt="File Type: zip" width="16" height="16" border="0" style="vertical-align:baseline" /></td> <td><a href="http://www.daniweb.com/forums/attachment.php?attachmentid=12589&amp;d=1258444785">05b_simpleCounter.zip</a> (5.4 KB)</td> </tr><tr> <td><img class="inlineimg" src="http://www.daniweb.com/forums/images/attach/zip.gif" alt="File Type: zip" width="16" height="16" border="0" style="vertical-align:baseline" /></td> <td><a href="http://www.daniweb.com/forums/attachment.php?attachmentid=12590&amp;d=1258444808">05c_counters.zip</a> (3.8 KB)</td> </tr> </table> </fieldset>  </div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>Bakudan</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239151.html</guid>
		</item>
		<item>
			<title>java socket...</title>
			<link>http://www.daniweb.com/forums/thread239145.html</link>
			<pubDate>Tue, 17 Nov 2009 07:38:58 GMT</pubDate>
			<description>java socket... 
 
 
    Hi! 
    How do establish TCP socket over firewall using java RMI.... 
    already i coded it but it has not been working if firewall(MS XP) IS ON...if it is OFF its fine...</description>
			<content:encoded><![CDATA[<div>java socket...<br />
<br />
<br />
    Hi!<br />
    How do establish TCP socket over firewall using java RMI....<br />
    already i coded it but it has not been working if firewall(MS XP) IS ON...if it is OFF its fine...</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>musthafa.aj</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239145.html</guid>
		</item>
		<item>
			<title>Help regarding Timers</title>
			<link>http://www.daniweb.com/forums/thread239139.html</link>
			<pubDate>Tue, 17 Nov 2009 07:11:36 GMT</pubDate>
			<description>I want to implement the following Task 
1) Read till end of file 
2) In each Line of the file there is a time mentioned. You need no call a method( code of which I have already written) 
3)Wait for the time mentioned in that line of file and then again read the next line of file 
 
I want to...</description>
			<content:encoded><![CDATA[<div>I want to implement the following Task<br />
1) Read till end of file<br />
2) In each Line of the file there is a time mentioned. You need no call a method( code of which I have already written)<br />
3)Wait for the time mentioned in that line of file and then again read the next line of file<br />
<br />
I want to implement this code. It will start when I press a start button and can be stopped in the middle if I press a stop button<br />
<br />
Also this time delay mentioned mentioned in the file is approximately 70 ms. I want to avoid using Thread.sleep() in an infinite loop<br />
<br />
Is there way a to use Timer class to implement the above code.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>gunjannigam</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239139.html</guid>
		</item>
		<item>
			<title>BinaryTreeNode removing node, null objects</title>
			<link>http://www.daniweb.com/forums/thread239101.html</link>
			<pubDate>Tue, 17 Nov 2009 03:47:23 GMT</pubDate>
			<description><![CDATA[Hey, 
 
Im implementing a binary tree in a project of mine and I'm currently writing a remove method. 
 
lets say my tree is this 
 
                    5 
                 / 
              4]]></description>
			<content:encoded><![CDATA[<div>Hey,<br />
<br />
Im implementing a binary tree in a project of mine and I'm currently writing a remove method.<br />
<br />
lets say my tree is this<br />
<br />
                    5<br />
                 /<br />
              4<br />
<br />
and lets say I want to remove 4.  My nodes attriubtes are the key, left and right children.  Initially, the left and right children are null.  So 4 has null left and right children and the right child of 5 is null.  I check if 4's left and right child are null, then set 5's left child to 4's right child. ie to be null.  So theoretically 5's left child is null.  However if I print leftchild is literally prints &quot;null&quot; opposed to being true null.<br />
<br />
Hopefully I explained this correctly.<br />
If write:<br />
if left child of 4 != null<br />
     print &quot;not null&quot;<br />
<br />
result will be nothing printed<br />
<br />
after I remove 4 and write:<br />
if left child of 5 != null<br />
      print &quot;not null&quot;<br />
<br />
not null be printed even though i set the right child of 4 to 5.<br />
Im not sure where &quot;null&quot; is coming from?!<br />
<br />
Thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>twerk</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239101.html</guid>
		</item>
		<item>
			<title>Tic Tac Toe game (fixing errors)</title>
			<link>http://www.daniweb.com/forums/thread239071.html</link>
			<pubDate>Tue, 17 Nov 2009 00:22:43 GMT</pubDate>
			<description><![CDATA[Hello. For an assignment we have been given the shell of a tic tac toe game in java. We are to fix a few things that is wrong with it. 
 
here is the main class: 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a...]]></description>
			<content:encoded><![CDATA[<div>Hello. For an assignment we have been given the shell of a tic tac toe game in java. We are to fix a few things that is wrong with it.<br />
<br />
here is the main class:<br />
 <pre style="margin:20px; line-height:13px"> public class TicTacToeGameJonathanSilverberg {<br />
<br />
&nbsp; &nbsp; public static final int board_size = 3;&nbsp; &nbsp; &nbsp;  // number of rows or columns in the board<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; public static void main(String[] args) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; char board[][] = new char[board_size][board_size];&nbsp; // the game board<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; TicTacToeGameJonathanSilverberg p1 = new TicTacToeGameJonathanSilverberg();&nbsp; // create the players<br />
&nbsp; &nbsp; &nbsp; &nbsp; TicTacToeGameJonathanSilverberg p2 = new TicTacToeGameJonathanSilverberg();<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; initBoard (board);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  // initialize the board to spaces and print it out<br />
&nbsp; &nbsp; &nbsp; &nbsp; displayBoard (board);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; char winner = findWinner(board);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; while (winner == ' ') {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p1.getMove(board, 'X');&nbsp;  // player one will be 'X', and will always go first<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; displayBoard (board);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; winner = findWinner(board);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (winner != ' ') {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (winner == 'T') {&nbsp; &nbsp;  System.out.println(&quot;Tie Game!&quot;);&nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else {&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;The Winner is: &quot; + winner);&nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p2.getMove(board, 'O');&nbsp;  // player two will be 'O', and always go second<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; displayBoard (board);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; winner = findWinner(board);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (winner != ' ') {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (winner == 'T') {&nbsp; &nbsp;  System.out.println(&quot;Tie Game!&quot;);&nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else {&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;The Winner is: &quot; + winner);&nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public static void initBoard(char[][] theBoard) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; // since this is pass by reference, initializing the Board here resets it in main<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; for (int row = 0; row &lt; board_size; row++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int col = 0; col &lt; board_size; col++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; theBoard[row][col] = ' ';&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  // row always comes first in a 2d array<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; public static void displayBoard(final char[][] theBoard) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; // note the final parameter - we won't change the board, just print it.<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; // Need to format the board display to look like this:<br />
&nbsp; &nbsp; &nbsp; &nbsp; //&nbsp; | |<br />
&nbsp; &nbsp; &nbsp; &nbsp; // -----<br />
&nbsp; &nbsp; &nbsp; &nbsp; //&nbsp; | |<br />
&nbsp; &nbsp; &nbsp; &nbsp; // -----<br />
&nbsp; &nbsp; &nbsp; &nbsp; //&nbsp; | |<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; for (int row = 0; row &lt; board_size; row++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int col = 0; col &lt; board_size; col++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.print(theBoard[row][col]);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  // row always comes first in a 2d array<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println();<br />
&nbsp; &nbsp; &nbsp; &nbsp; } <br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; public static char findWinner(final char[][] theBoard){<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; // this method should return 'X' if X is the winner<br />
&nbsp; &nbsp; &nbsp; &nbsp; // 'O' if O is the winner, a space (' ') if there is no winner,<br />
&nbsp; &nbsp; &nbsp; &nbsp; // or 'T' if there is a tie. For now it just returns a space no matter what.<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; return ' ';<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; }<br />
&nbsp;  <br />
}</pre><br />
And here is the other class:<br />
<br />
 <pre style="margin:20px; line-height:13px"> import java.util.Random;<br />
public class TicTacToePlayerJonathanSilverberg {<br />
<br />
&nbsp; &nbsp; public void getMove(char[][] theBoard, char myPiece) {<br />
&nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; // this method should update the game board to place 'myPiece' (X or O)<br />
&nbsp; &nbsp; &nbsp; &nbsp; // in a space on the board.<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; // As-is, this method just places an X or O randomly, without even considering<br />
&nbsp; &nbsp; &nbsp; &nbsp; // if the square is already taken.<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; Random myRand = new Random();<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; int myRow = myRand.nextInt(3);<br />
&nbsp; &nbsp; &nbsp; &nbsp; int myCol = myRand.nextInt(3);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; theBoard[myRow][myCol] = myPiece;&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
}</pre><br />
<br />
What I need to do..... <br />
1) for some reason when I try to have p1 and p2 get move such as p1.getMove. It is not finding the method get move from the other class.<br />
2) In the findWinner method. I need to make the variable winner public so it can be read from this method as well. When I try to put the variable winner in this method, it cannot refer back to it from the main class.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>jnthn205</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239071.html</guid>
		</item>
		<item>
			<title>Cash Register Program</title>
			<link>http://www.daniweb.com/forums/thread239066.html</link>
			<pubDate>Mon, 16 Nov 2009 23:34:12 GMT</pubDate>
			<description>Hello everyone i know very little of Java and need help with a project. If anyone could send some code or even help explain where i should start i would very much appreciate it. This is what the teacher gave us for the project outline on what the code should contain. 
o	*Store* 
o	   *Products* (3...</description>
			<content:encoded><![CDATA[<div>Hello everyone i know very little of Java and need help with a project. If anyone could send some code or even help explain where i should start i would very much appreciate it. This is what the teacher gave us for the project outline on what the code should contain.<br />
o	<span style="font-weight:bold">Store</span><br />
o	   <span style="font-weight:bold">Products</span> (3 classes)<br />
	     <span style="font-weight:bold"> Attributes</span><br />
•	         Price<br />
•	         Description<br />
•	         UPC<br />
•	         Inventory<br />
•	         Taxable(y/n)<br />
         <span style="font-weight:bold">   Methods</span><br />
•	         Purchase(qty)<br />
o	            Return price<br />
o	            Decrement inventory<br />
<span style="font-weight:bold">•	         Getprice<br />
•	         Getdescription<br />
•	         Getupc<br />
•	         Getquantity<br />
•	         getTaxStatus<br />
o	   CashRegister (Shopping Cart)</span><br />
	      Static TAX_RATE=1.06<br />
	      Static Class<br />
	     <span style="font-weight:bold"> Methods</span><br />
•	         calculateTotal<br />
•	         enter payment (dollar/cents)<br />
•	         give change <br />
o	<span style="font-weight:bold">Currency</span><br />
	   Static variables of currency and coin<br />
o	<span style="font-weight:bold">Main Class</span><br />
	   Add items<br />
	   Enter purchase<br />
	   Enter payment</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>00musdan</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239066.html</guid>
		</item>
		<item>
			<title>beginner help with java!! student class</title>
			<link>http://www.daniweb.com/forums/thread239064.html</link>
			<pubDate>Mon, 16 Nov 2009 23:19:13 GMT</pubDate>
			<description>hi ya! really hope u can help! ive taken on a computer course that is meant to teach me the basics of computing, and while i can understad databases and html, for some reason they have given us object orientated programming and i havent a clue!! ive spend alot of time trying to figure this out and...</description>
			<content:encoded><![CDATA[<div>hi ya! really hope u can help! ive taken on a computer course that is meant to teach me the basics of computing, and while i can understad databases and html, for some reason they have given us object orientated programming and i havent a clue!! ive spend alot of time trying to figure this out and ive no idea! if someone could have a look and point me in the right direction it would be really appreciated. also could u tell me if this is too advanced for a beginners course or if i am just not very good at it lol!<br />
<br />
here goes....<br />
A teacher wants a program to help keep track of marks for students a decides on a Student class for his program as follows:<ul><li>each student should have a name, registration number, 3 module codes and 3 module marks</li>
<li>the class constructor assigns values, passed as parameters, to the name, registration number and module marks. the module codes are set by a single method setCodes</li>
<li>the class has 'access' methods getName that returns the student name, getAverage that returns the average mark of the students 3 marks and getHighMark that returns the highest mark of a student.</li>
<li>the class has a set method to update the module marks. the toString method outputs full details of each student including the average mark and highest mark.</li>
</ul><br />
Now write an application  class UseStudent which<ul><li>declares and creates an instance of Student class. then test each method specified in part a.</li>
<li>declare and creates an array called studentArray containing 5 instances of student class. using iteration statements to instantiate with values (name, registration number and 3 marks) input from keyboard. after that, determines how many students obtain an average mark above 60 and prints out the answer</li>
</ul><br />
i hope someone can help!!!!</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>littleladyclair</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239064.html</guid>
		</item>
		<item>
			<title>Displaying the contents of an array</title>
			<link>http://www.daniweb.com/forums/thread239060.html</link>
			<pubDate>Mon, 16 Nov 2009 22:53:05 GMT</pubDate>
			<description><![CDATA[I am having a little problem getting the data out of my array.  It's probably something simple that I am missing but here is my code.  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a...]]></description>
			<content:encoded><![CDATA[<div>I am having a little problem getting the data out of my array.  It's probably something simple that I am missing but here is my code. <pre style="margin:20px; line-height:13px">public class Search Sort {<br />
<br />
&nbsp; &nbsp; static Scanner cons = new Scanner(System.in);<br />
&nbsp; &nbsp; public static void main(String[] args) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; String[] mov = new String[3];<br />
&nbsp; &nbsp; &nbsp; &nbsp; for(int i = 0;i &lt; mov.length;i++){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;please Enter the name of the Movie&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; mov[i] = cons.nextLine();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <br />
}<br />
}</pre><br />
I want it to take all 3 movies in and then output them in list order so I can sort and then search through them.  Help?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>nstern2</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239060.html</guid>
		</item>
		<item>
			<title>Finding Successor in a Binary Seach Tree</title>
			<link>http://www.daniweb.com/forums/thread239048.html</link>
			<pubDate>Mon, 16 Nov 2009 21:40:56 GMT</pubDate>
			<description><![CDATA[Hi! For my assignment, I was required to implement an ordered dictionary using a binary search tree. I have most of it done, but I'm stuck on a this one problem. 
 
My program needs to print the word from the dictionary that alphabetically follows the specified word (aka the successor). What throws...]]></description>
			<content:encoded><![CDATA[<div>Hi! For my assignment, I was required to implement an ordered dictionary using a binary search tree. I have most of it done, but I'm stuck on a this one problem.<br />
<br />
My program needs to print the word from the dictionary that alphabetically follows the specified word (aka the successor). What throws me off is that the specified word doesn't actually have to be contained in the dictionary (it doesn't have to be stored in the binary search tree).<br />
<br />
So, if I'm in interpreting the problem correctly, I would need to find the word in my BST that is the closest match to the specified word. And then finding the successor for that word.  I'm just not too sure  on how to go about doing that.<br />
<br />
Here's my code for finding the successor, assuming the specified word is located in the binary search tree:<br />
<br />
 <pre style="margin:20px; line-height:13px">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; private BinaryTreeNode&lt;DictEntry&gt; successor(BinaryTreeNode&lt;DictEntry&gt; tempNode)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (tempNode.getRightChild() != null)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return findMin(tempNode.getRightChild());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; BinaryTreeNode&lt;DictEntry&gt; parent = tempNode.getParent();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while (parent != null &amp;&amp; tempNode == parent.getRightChild())<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tempNode = parent;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; parent = parent.getParent();<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; &nbsp; &nbsp; return parent;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; public String successor(String word)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; current = find(root, word);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; BinaryTreeNode&lt;DictEntry&gt; successor = successor(current);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (successor == null)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return &quot;&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return successor.getNode().word();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }</pre><br />
And here's my find method:<br />
 <pre style="margin:20px; line-height:13px">&nbsp; &nbsp; &nbsp; &nbsp; private BinaryTreeNode&lt;DictEntry&gt; find(BinaryTreeNode&lt;DictEntry&gt; tempNode, String word)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(tempNode.getNode().word().compareTo(word) == 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return tempNode;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if(word.compareTo(tempNode.getNode().word()) &lt; 0 &amp;&amp; tempNode.getLeftChild() != null)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return find(tempNode.getLeftChild(), word);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if(word.compareTo(tempNode.getNode().word()) &gt; 0 &amp;&amp; tempNode.getRightChild() != null)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return find(tempNode.getRightChild(), word);<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 null;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }</pre><br />
I hope this all makes sense.<br />
<br />
If anyone can help point me in the right direction, I would really appreciate it.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>Karenai</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239048.html</guid>
		</item>
		<item>
			<title>EventListener on Choice Menu</title>
			<link>http://www.daniweb.com/forums/thread239029.html</link>
			<pubDate>Mon, 16 Nov 2009 20:25:30 GMT</pubDate>
			<description>Could anyone pls help out with the logic of  codes that uses Choice menu. 
 
The choice buttons were created with its items(3 in this case) 
 
I have another sets of 9 buttons in an array 
 
Each button,when pressed gets a corresponding value from an array of integers defined elsewhere 
 
The ...</description>
			<content:encoded><![CDATA[<div>Could anyone pls help out with the logic of  codes that uses Choice menu.<br />
<br />
The choice buttons were created with its items(3 in this case)<br />
<br />
I have another sets of 9 buttons in an array<br />
<br />
Each button,when pressed gets a corresponding value from an array of integers defined elsewhere<br />
<br />
The  obtained value assigned to a particular button shows up in seperate textfield<br />
<br />
The challenge I am faced with now is this:<br />
The array of buttons must be able to  listen to each of the selection of the choice menu, such that each item selected causes the button to pick from different sets of arrays of values when pressed (I already have three arrays of vaules)<br />
<br />
I'll quite appreciate if anyone could help out with this<br />
Thanks.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>bobinson</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239029.html</guid>
		</item>
		<item>
			<title>J2ME Traversing Help</title>
			<link>http://www.daniweb.com/forums/thread238972.html</link>
			<pubDate>Mon, 16 Nov 2009 16:44:10 GMT</pubDate>
			<description><![CDATA[Hello, 
 
This is my first post so I hope this is clear and in the correct place. 
 
I am having trouble dealing with the traverse method of Custom Item in J2me.  
 
What I want to do is have two custom items, one is "start game", the other "instructions" as menu options. If the user presses OK...]]></description>
			<content:encoded><![CDATA[<div>Hello,<br />
<br />
This is my first post so I hope this is clear and in the correct place.<br />
<br />
I am having trouble dealing with the traverse method of Custom Item in J2me. <br />
<br />
What I want to do is have two custom items, one is &quot;start game&quot;, the other &quot;instructions&quot; as menu options. If the user presses OK depending on the highlighted custom item, the user will be directed to the relevant Form.<br />
<br />
The problem is, that when I change focus to one and select OK, and then return back to the main form, the while loop doesn't execute, meaning I can't change the focus selection. I also think a while loop is poor coding practise, so any other alternative would be grealty helpful. <br />
<br />
I hope this makes sense. <br />
<br />
Thanks<br />
LaChavvy<br />
<br />
Below is the main class code:<br />
<br />
MIDLET<br />
 <pre style="margin:20px; line-height:13px">package gamePackage;<br />
<br />
import javax.microedition.rms.*;<br />
import javax.microedition.midlet.*;<br />
import javax.microedition.lcdui.*;<br />
<br />
public class Main extends MIDlet implements CommandListener<br />
{<br />
&nbsp; &nbsp; private Display display;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; //Setup Forms<br />
&nbsp; &nbsp; private Form mainMenu;<br />
&nbsp; &nbsp; private Form gameSetup;<br />
&nbsp; &nbsp; private Form instructions;<br />
&nbsp; &nbsp; private Form rollDice;<br />
<br />
&nbsp; &nbsp; //Instantiate mainMenu Variables<br />
&nbsp; &nbsp; private int selection;<br />
&nbsp; &nbsp; private mainMenuCustomItem instructionCI;<br />
&nbsp; &nbsp; private mainMenuCustomItem startGameCI;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; //Instantiate gameSetup Variables<br />
&nbsp; &nbsp; private String gamerTag;<br />
&nbsp; &nbsp; private String masterPhone;<br />
<br />
&nbsp; &nbsp; //Instantiate rollDice Variables<br />
<br />
&nbsp; &nbsp; //Setup Main Menu Form<br />
&nbsp; &nbsp; public Main()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; //Default menu selection is 1<br />
&nbsp; &nbsp; &nbsp; &nbsp; display = Display.getDisplay(this);<br />
&nbsp; &nbsp; &nbsp; &nbsp; mainMenu = new Form(&quot;Snakes and Ladders : Menu&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; startGameCI = new mainMenuCustomItem(&quot;Start Game&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; instructionCI = new mainMenuCustomItem(&quot;Instructions&quot;);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; mainMenu.append(startGameCI);<br />
&nbsp; &nbsp; &nbsp; &nbsp; mainMenu.append(instructionCI);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; mainMenu.addCommand(new Command(&quot;Exit&quot;, Command.EXIT, 0));<br />
&nbsp; &nbsp; &nbsp; &nbsp; mainMenu.addCommand(new Command(&quot;Select&quot;, Command.OK, 0));<br />
&nbsp; &nbsp; &nbsp; &nbsp; mainMenu.setCommandListener(this);<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; //Display Main Menu<br />
&nbsp; &nbsp; public void startApp()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; display.setCurrent(mainMenu);<br />
&nbsp; &nbsp; &nbsp; &nbsp; checkTraversing();<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; public void checkTraversing()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; startGameCI.setSelection(1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; while(display.getCurrent() == mainMenu)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; selection = startGameCI.getSelection();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(selection);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public void pauseApp()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public void destroyApp(boolean unconditional)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; public void commandAction(Command c, Displayable s)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; //Menu EXIT<br />
&nbsp; &nbsp; &nbsp; &nbsp; if((s.getTitle().equals(&quot;Snakes and Ladders : Menu&quot;)) &amp;&amp; (c.getCommandType() == Command.EXIT))<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; notifyDestroyed();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; //Menu OK -- GAME SETUP<br />
&nbsp; &nbsp; &nbsp; &nbsp; if((s.getTitle().equals(&quot;Snakes and Ladders : Menu&quot;)) &amp;&amp; (c.getCommandType() == Command.OK) &amp;&amp; (selection == 1))<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; displayGameSetup();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; display.setCurrent(gameSetup);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(display.getCurrent());<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; //Menu OK -- INSTRUCTIONS<br />
&nbsp; &nbsp; &nbsp; &nbsp; if((s.getTitle().equals(&quot;Snakes and Ladders : Menu&quot;)) &amp;&amp; (c.getCommandType() == Command.OK) &amp;&amp; (selection == 2))<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; displayInstructions();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; display.setCurrent(instructions);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(display.getCurrent());<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; //Game Setup EXIT<br />
&nbsp; &nbsp; &nbsp; &nbsp; if((s.getTitle().equals(&quot;Snakes and Ladders : Game Setup&quot;) &amp;&amp; (c.getCommandType() == Command.EXIT)))<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; display.setCurrent(mainMenu);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; checkTraversing();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(display.getCurrent());<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; //Instructions EXIT<br />
&nbsp; &nbsp; &nbsp; &nbsp; if((s.getTitle().equals(&quot;Snakes and Ladders : Instructions&quot;) &amp;&amp; (c.getCommandType() == Command.EXIT)))<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; display.setCurrent(mainMenu);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; checkTraversing();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(display.getCurrent());<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; public void displayGameSetup()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; gameSetup = new Form(&quot;Snakes and Ladders : Game Setup&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; gameSetup.addCommand(new Command(&quot;Exit&quot;, Command.EXIT, 0));<br />
&nbsp; &nbsp; &nbsp; &nbsp; gameSetup.addCommand(new Command(&quot;Select&quot;, Command.OK, 0));<br />
&nbsp; &nbsp; &nbsp; &nbsp; gameSetup.setCommandListener(this);<br />
<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; public void displayInstructions()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; instructions = new Form(&quot;Snakes and Ladders : Instructions&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; instructions.addCommand(new Command(&quot;Exit&quot;, Command.EXIT, 0));<br />
&nbsp; &nbsp; &nbsp; &nbsp; instructions.addCommand(new Command(&quot;Select&quot;, Command.OK, 0));<br />
&nbsp; &nbsp; &nbsp; &nbsp; instructions.setCommandListener(this);<br />
&nbsp; &nbsp; }<br />
}</pre><br />
MAINSTARTGAME CUSTOM ITEM CODE<br />
 <pre style="margin:20px; line-height:13px">package gamePackage;<br />
<br />
import javax.microedition.lcdui.*;<br />
<br />
public class mainStartGame extends CustomItem {<br />
<br />
&nbsp; &nbsp;  private boolean in; //is the item in focus?<br />
&nbsp; &nbsp;  int selectedOption = 1;<br />
<br />
&nbsp; &nbsp; public mainStartGame(String title) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; super(title);<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public int getMinContentWidth() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; return 200;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public int getMinContentHeight() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; return 6;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public int getPrefContentWidth(int width) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; return getMinContentWidth();<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public int getPrefContentHeight(int height) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; return getMinContentHeight();<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; public int getSelection()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; return selectedOption;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; public void setSelection(int input)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; selectedOption = input;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public boolean traverse(int dir, int viewportWidth, int viewportHeight, int[] visRect_inout)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (!in)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; in = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; switch (dir)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case Canvas.UP:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; selectedOption = 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case Canvas.DOWN:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; selectedOption = 2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return false;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; repaint();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; return true;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; public void traverseOut()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; in = false;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; public void paint(Graphics g, int w, int h)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; }<br />
}</pre><br />
The other custom item code is the exact same with different custom item name - mainInstructions.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>LaChavvy</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread238972.html</guid>
		</item>
		<item>
			<title>Multiple Selection Box</title>
			<link>http://www.daniweb.com/forums/thread238971.html</link>
			<pubDate>Mon, 16 Nov 2009 16:39:15 GMT</pubDate>
			<description>Hi, 
 
I am making a application , i have to make a small list of users from a big list of users. I am using ArrayList in Java but now getting result.  
 
To be more precise I have List1 with 10 users and i am making list2 of 3 users from List1. 
 
Please give a sample code with GUI if you have.</description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
I am making a application , i have to make a small list of users from a big list of users. I am using ArrayList in Java but now getting result. <br />
<br />
To be more precise I have List1 with 10 users and i am making list2 of 3 users from List1.<br />
<br />
Please give a sample code with GUI if you have.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>pinku2008</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread238971.html</guid>
		</item>
		<item>
			<title>URGENT: need help with strings and getParameter</title>
			<link>http://www.daniweb.com/forums/thread238957.html</link>
			<pubDate>Mon, 16 Nov 2009 15:34:35 GMT</pubDate>
			<description>I have a servlet that gets a parameter that tells it which operation to carry out. 
 
in the servlet, i have if statements that check if the parameter is a certain number (1,2,3).  I use getParameter to get the parameter as a string but somehow it does not go into the if statements.  What am I...</description>
			<content:encoded><![CDATA[<div>I have a servlet that gets a parameter that tells it which operation to carry out.<br />
<br />
in the servlet, i have if statements that check if the parameter is a certain number (1,2,3).  I use getParameter to get the parameter as a string but somehow it does not go into the if statements.  What am I doing wrong?  Thanks.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>glendavis</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread238957.html</guid>
		</item>
		<item>
			<title>Challenges</title>
			<link>http://www.daniweb.com/forums/thread238954.html</link>
			<pubDate>Mon, 16 Nov 2009 15:24:19 GMT</pubDate>
			<description>wrtie a class with a static method: 
word count 
arrayToString 
most Frequent 
replaceSubstring 
(for example) it will work like  
count the word then tell me which word use frequent and if i change the word it will change the line with that.</description>
			<content:encoded><![CDATA[<div>wrtie a class with a static method:<br />
word count<br />
arrayToString<br />
most Frequent<br />
replaceSubstring<br />
(for example) it will work like <br />
count the word then tell me which word use frequent and if i change the word it will change the line with that.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>heroherohero</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread238954.html</guid>
		</item>
		<item>
			<title>case example</title>
			<link>http://www.daniweb.com/forums/thread238946.html</link>
			<pubDate>Mon, 16 Nov 2009 14:30:36 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">public class Getnumbers {<br />
&nbsp; &nbsp; &nbsp; &nbsp; private int num1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; private int num2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; public int getNum1() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return num1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; public void setNum1(int num1) {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.num1 = num1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; public int getNum2() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return num2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; public void setNum2(int num2) {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; this.num2 = num2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
}</pre><br />
 <pre style="margin:20px; line-height:13px">import java.util.Scanner;<br />
public class Case {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; public static&nbsp; void display1 ()<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Enter First Number &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; public static&nbsp; void display2 ()<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Enter Second Number &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<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; Getnumbers&nbsp; num1 = new Getnumbers();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Getnumbers&nbsp; num2 = new Getnumbers();<br />
&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; <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int result = 0 ;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int op ;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; char operation = '+';<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; boolean x=true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while (x==true)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;=============================================&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MENU SELECTION DEMO&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |&quot;);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;|===========================================|&quot;);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;| Option :&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;|&nbsp; &nbsp; &nbsp; &nbsp;  0: Exit&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  |&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;|&nbsp; &nbsp; &nbsp; &nbsp;  1: Add&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;|&nbsp; &nbsp; &nbsp; &nbsp;  2: Sub&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;|&nbsp; &nbsp; &nbsp; &nbsp;  3: Mult&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  |&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;|&nbsp; &nbsp; &nbsp; &nbsp;  4: Div&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;=============================================&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; op =input.nextInt();<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; switch(op)<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; case (0):<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;EXIT...&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.exit(0);&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; operation ='+';<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; display1();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; num1.setNum1(input.nextInt());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; display2();&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; num2.setNum2(input.nextInt());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; result = num1.getNum1()+ num2.getNum2() ;&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<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; case (2):<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; operation ='-';<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; display1();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; num1.setNum1(input.nextInt());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; display2();&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; num2.setNum2(input.nextInt());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; result = num1.getNum1()- num2.getNum2() ;&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<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; case (3):<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; operation = '*';<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; display1();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; num1.setNum1(input.nextInt());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; display2();&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; num2.setNum2(input.nextInt());&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; result = num1.getNum1()* num2.getNum2() ;&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; break;<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; case (4):<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; operation = '/';<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; display1();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; num1.setNum1(input.nextInt());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; display2();&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; num2.setNum2(input.nextInt());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; result =&nbsp; num1.getNum1()/num2.getNum2() ;&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; System.out.println(&quot; operation is :\&quot;&quot; +operation+&quot;\&quot;\tthe Result = &quot; + result);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>saadismail85</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread238946.html</guid>
		</item>
		<item>
			<title>Gap Sort</title>
			<link>http://www.daniweb.com/forums/thread238940.html</link>
			<pubDate>Mon, 16 Nov 2009 14:21:04 GMT</pubDate>
			<description><![CDATA[Hey, I tweaked my code a bit to fix some obvious problems but I'm still having problems trying to implement a gap sort which is a bubble sort that instead of comparing neighboring elements to sort a list, it compares elements 'i' positions apart. Can anyone please help me? 
Thanks for reading and...]]></description>
			<content:encoded><![CDATA[<div>Hey, I tweaked my code a bit to fix some obvious problems but I'm still having problems trying to implement a gap sort which is a bubble sort that instead of comparing neighboring elements to sort a list, it compares elements 'i' positions apart. Can anyone please help me?<br />
Thanks for reading and here is my code:<br />
 <pre style="margin:20px; line-height:13px">&nbsp;  public static &lt;T extends Comparable&lt;? super T&gt;&gt; void gapSort (T[] data, int i)<br />
&nbsp;  {<br />
&nbsp; &nbsp; &nbsp; int position, scan;<br />
&nbsp; &nbsp; &nbsp; T temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; if(i &gt; 0)<br />
&nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (position = data.length - 1; position &gt;= 0; position--)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (scan = 0; scan &lt;= position - 1; scan++)<br />
&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;  if (i &gt; scan)<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; &nbsp; &nbsp;  if (data[scan].compareTo(data[scan+i]) &gt; 0)<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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  /** Swap the values */<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  temp = data[scan];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  data[scan] = data[scan + i];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  data[scan + i] = temp;<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; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &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; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if (data[scan].compareTo(data[scan-i]) &lt; 0)<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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  temp = data[scan];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  data[scan] = data[scan - i];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  data[scan - i] = temp;<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; &nbsp; &nbsp; &nbsp; &nbsp;  } <br />
&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; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &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>laidback7</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread238940.html</guid>
		</item>
		<item>
			<title>Display numbers between input and specified number using for loop</title>
			<link>http://www.daniweb.com/forums/thread238939.html</link>
			<pubDate>Mon, 16 Nov 2009 14:18:22 GMT</pubDate>
			<description>Hi, I am kind of stuck on how to display numbers between an inputted number and a specifed number, for example 10 and 5, how would I go about doing this? 
 
can anyone help me please?</description>
			<content:encoded><![CDATA[<div>Hi, I am kind of stuck on how to display numbers between an inputted number and a specifed number, for example 10 and 5, how would I go about doing this?<br />
<br />
can anyone help me please?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>jakal121</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread238939.html</guid>
		</item>
		<item>
			<title>Iterating through a TreeMap - Can this be done?</title>
			<link>http://www.daniweb.com/forums/thread238933.html</link>
			<pubDate>Mon, 16 Nov 2009 14:02:03 GMT</pubDate>
			<description><![CDATA[I need to iterate through a TreeMap.  
 
I won't be able to use another collection instead of a TreeMap, I am merely changing some code in someone else's program. Is it at all possible to do this? 
 
I'm thinking:   <div class="codeblock"> <div class="spaced"> <div style="float:right;...]]></description>
			<content:encoded><![CDATA[<div>I need to iterate through a TreeMap. <br />
<br />
I won't be able to use another collection instead of a TreeMap, I am merely changing some code in someone else's program. Is it at all possible to do this?<br />
<br />
I'm thinking:  <pre style="margin:20px; line-height:13px">while (Treemap.hasNext())</pre><br />
or something similar. Is this possible in Java?</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/thread238933.html</guid>
		</item>
		<item>
			<title><![CDATA[java.exe doesn't work]]></title>
			<link>http://www.daniweb.com/forums/thread238932.html</link>
			<pubDate>Mon, 16 Nov 2009 13:59:48 GMT</pubDate>
			<description><![CDATA[I'm a first time Java programmer and I'm having trouble compiling/running code.  I installed jdk and I'm using windows XP MCE.   I can get javac.exe to create a .class file but when I try running it with java.exe I get an error 
 
Please help.  Thanks! 
 
...]]></description>
			<content:encoded><![CDATA[<div>I'm a first time Java programmer and I'm having trouble compiling/running code.  I installed jdk and I'm using windows XP MCE.   I can get javac.exe to create a .class file but when I try running it with java.exe I get an error<br />
<br />
Please help.  Thanks!<br />
<br />
<br />
<a rel="nofollow" class="t" href="http://img121.imageshack.us/img121/6788/javanowork.jpg" target="_blank">http://img121.imageshack.us/img121/6788/javanowork.jpg</a></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>hallwayantics</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread238932.html</guid>
		</item>
		<item>
			<title>finding the majority</title>
			<link>http://www.daniweb.com/forums/thread238931.html</link>
			<pubDate>Mon, 16 Nov 2009 13:55:32 GMT</pubDate>
			<description>hi am stuck im trying to figure out how i can find the majority of numbers say in a list with the time complexity of O(n) 
 
say i have a given list of n elements finding all elements on the list that occur more then n/4 time. 
 
how would i do this and how would it look in java code 
 
please can...</description>
			<content:encoded><![CDATA[<div>hi am stuck im trying to figure out how i can find the majority of numbers say in a list with the time complexity of O(n)<br />
<br />
say i have a given list of n elements finding all elements on the list that occur more then n/4 time.<br />
<br />
how would i do this and how would it look in java code<br />
<br />
please can any one help</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>ronny22</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread238931.html</guid>
		</item>
		<item>
			<title>Loading File in JTable Runtime Exception</title>
			<link>http://www.daniweb.com/forums/thread238912.html</link>
			<pubDate>Mon, 16 Nov 2009 12:23:02 GMT</pubDate>
			<description>Hi, 
 
I am trying to develop an application that has got a Jbutton and allows to search a file and then loads selected line of that file in the JTable. I am able to do that when I hard code it inside the code but when I try to let the user do it by adding FileChooser I am able getting runtime...</description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
I am trying to develop an application that has got a Jbutton and allows to search a file and then loads selected line of that file in the JTable. I am able to do that when I hard code it inside the code but when I try to let the user do it by adding FileChooser I am able getting runtime error like this:-<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 Testing.TableCreator$1.actionPerformed(TableCreator.java:69)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at java.awt.Component.processMouseEvent(Component.java:6041)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at java.awt.Component.processEvent(Component.java:5806)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at java.awt.Container.processEvent(Container.java:2058)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at java.awt.Component.dispatchEventImpl(Component.java:4413)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at java.awt.Container.dispatchEventImpl(Container.java:2116)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at java.awt.Component.dispatchEvent(Component.java:4243)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at java.awt.Container.dispatchEventImpl(Container.java:2102)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at java.awt.Window.dispatchEventImpl(Window.java:2440)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at java.awt.Component.dispatchEvent(Component.java:4243)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)</pre><br />
Here is the line the error report is referring to :-<br />
 <pre style="margin:20px; line-height:13px">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; File file = fc.getSelectedFile();</pre><br />
Can somebody guide me where am I making mistakes ?<br />
Here is my code below:-<br />
 <pre style="margin:20px; line-height:13px">public class TableCreator {<br />
&nbsp; &nbsp;  public static JFrame fr = new JFrame(&quot;Item Menu&quot;);<br />
&nbsp; &nbsp;  Container c = new JPanel();<br />
&nbsp; &nbsp;  public JFileChooser fc;<br />
&nbsp; &nbsp;  public JTable table;<br />
&nbsp; public TableCreator() {<br />
&nbsp; &nbsp; JLabel jLabel1= new JLabel(&quot;Item Name&quot;);<br />
&nbsp; &nbsp; JLabel jLabel4= new JLabel(&quot;File Name&quot;);<br />
<br />
&nbsp; &nbsp; JLabel jLabel7 = new javax.swing.JLabel();<br />
&nbsp; &nbsp; JButton jButton3 = new javax.swing.JButton();<br />
&nbsp; &nbsp; jLabel7.setText(&quot;List :&quot;);<br />
&nbsp; &nbsp; jButton3.setText(&quot;Browse&quot;);<br />
<br />
&nbsp; &nbsp; //jButton3.addMouseListener(new FileOpenMouseListener());<br />
&nbsp; &nbsp; jButton3.addActionListener(<br />
&nbsp; &nbsp; &nbsp; &nbsp;  new ActionListener() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  public void actionPerformed(ActionEvent e) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  JFileChooser fileChooser = new JFileChooser(&quot;.&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  int status = fileChooser.showOpenDialog(c);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if (status == JFileChooser.APPROVE_OPTION) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; File file = fc.getSelectedFile();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; constructTable(file);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JScrollPane scroll = new JScrollPane(table);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; c.add(scroll);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //c.pack();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  } else if (status == JFileChooser.CANCEL_OPTION) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  System.out.println(&quot;canceled&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp;  );<br />
<br />
&nbsp; &nbsp; &nbsp; // Check Boxes start here<br />
&nbsp; &nbsp; &nbsp; JCheckBox checkFixed = new JCheckBox(&quot;Pepsi&quot;);<br />
&nbsp; &nbsp; &nbsp; JCheckBox dontFix = new JCheckBox(&quot;Coke&quot;);<br />
<br />
&nbsp; &nbsp; &nbsp; checkFixed.addActionListener(<br />
&nbsp; &nbsp; &nbsp; &nbsp; new ActionListener() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void actionPerformed(ActionEvent e) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  System.out.println(&quot;coke&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; );<br />
<br />
&nbsp; &nbsp; &nbsp; dontFix.addActionListener(<br />
&nbsp; &nbsp; &nbsp; &nbsp; new ActionListener() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void actionPerformed(ActionEvent e) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  System.out.println(&quot;pepsi&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; );<br />
&nbsp; &nbsp; &nbsp; // Check Boxes End here<br />
<br />
&nbsp; &nbsp; &nbsp; // Text Fields start here<br />
&nbsp; &nbsp; JTextField jTextField1 = new JTextField();<br />
&nbsp; &nbsp; JTextField jTextField2 = new JTextField();<br />
&nbsp; &nbsp; jTextField1.setText(&quot;Item Name&quot;);<br />
<br />
&nbsp; &nbsp; System.out.println(jTextField1.getText()); // get filename for C / C++ program<br />
&nbsp; &nbsp; System.out.println(jTextField2.getText());<br />
<br />
&nbsp; &nbsp; jTextField1.addActionListener(new java.awt.event.ActionListener() {<br />
&nbsp; &nbsp; &nbsp; public void actionPerformed(ActionEvent e) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;action&quot;);<br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; });<br />
&nbsp; &nbsp; jTextField2.addActionListener(new java.awt.event.ActionListener() {<br />
&nbsp; &nbsp; &nbsp; public void actionPerformed(ActionEvent e) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;action&quot;);<br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; });<br />
&nbsp; &nbsp;  // Text Fields end here<br />
<br />
&nbsp; &nbsp;  // define ScrollPane, Buttons and Mouse Listners<br />
&nbsp; &nbsp; JScrollPane scroll = new JScrollPane(table);<br />
&nbsp; &nbsp; JButton button1 = new JButton(&quot;Order&quot;);<br />
&nbsp; &nbsp; JButton button2 = new JButton(&quot;No Thanks&quot;);<br />
&nbsp; &nbsp; button1.addActionListener(new java.awt.event.ActionListener() {<br />
&nbsp; &nbsp; &nbsp; public void actionPerformed(ActionEvent e) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;call order program&quot;);<br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; });<br />
&nbsp; &nbsp; button2.addActionListener(new java.awt.event.ActionListener() {<br />
&nbsp; &nbsp; &nbsp; public void actionPerformed(ActionEvent e) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.exit(0);<br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; });<br />
<br />
&nbsp; &nbsp; JPanel three = new JPanel();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; javax.swing.GroupLayout layout = new javax.swing.GroupLayout(three);<br />
&nbsp; &nbsp; &nbsp; &nbsp; three.setLayout(layout);<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; layout.setHorizontalGroup(<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addGroup(layout.createSequentialGroup()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addGap(21, 21, 21)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //.addComponent(jLabel2)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addComponent(jLabel1))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addGap(24, 24, 24)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //.addComponent(comboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addContainerGap(498, Short.MAX_VALUE)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addComponent(button1)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addComponent(button2)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addGap(30, 30, 30))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addGroup(layout.createSequentialGroup()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addContainerGap()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addComponent(scroll, javax.swing.GroupLayout.DEFAULT_SIZE, 629, Short.MAX_VALUE)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addContainerGap())<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addGroup(layout.createSequentialGroup()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addGap(23, 23, 23)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //.addComponent(jLabel5)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addGroup(layout.createSequentialGroup()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addGroup(layout.createSequentialGroup()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //.addComponent(jLabel3)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addComponent(jLabel4))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addGap(27, 27, 27))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addGroup(layout.createSequentialGroup()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //.addComponent(jLabel6)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addComponent(jLabel7))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addComponent(jButton3)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //.addComponent(comboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addComponent(dontFix)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addComponent(checkFixed))))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addContainerGap(370, Short.MAX_VALUE))<br />
&nbsp; &nbsp; &nbsp; &nbsp; );<br />
&nbsp; &nbsp; &nbsp; &nbsp; layout.setVerticalGroup(<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addGroup(layout.createSequentialGroup()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addGap(31, 31, 31)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addComponent(jLabel1)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //.addComponent(jLabel2)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //.addComponent(comboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; )<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addGap(33, 33, 33)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //.addComponent(jLabel5)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //.addComponent(comboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //.addComponent(jLabel3)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; )<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addComponent(jButton3)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addComponent(jLabel4))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addGroup(layout.createSequentialGroup()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addGap(18, 18, 18)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addComponent(dontFix)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addComponent(checkFixed))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addGroup(layout.createSequentialGroup()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addComponent(jLabel7)))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addGap(1, 1, 1)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //.addComponent(jLabel6)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addGap(18, 18, 18)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addComponent(scroll, javax.swing.GroupLayout.PREFERRED_SIZE, 359, javax.swing.GroupLayout.PREFERRED_SIZE)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addComponent(button2)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addComponent(button1))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))<br />
&nbsp; &nbsp; &nbsp; &nbsp; );<br />
<br />
&nbsp; &nbsp; c.add(three);<br />
&nbsp; &nbsp; fr.add(c);<br />
<br />
&nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; private void constructTable(File file) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; final DefaultTableModel dm = new DefaultTableModel();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  try {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Scanner scan = new Scanner(file);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if (scan.hasNextLine()) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; final String line = scan.nextLine();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String col0 = &quot;Field#&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String col1 = &quot;Field Name&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; final String col2 = &quot;Menu&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; final String col3 = &quot;Item&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  dm.addColumn(col0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  dm.addColumn(col1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  dm.addColumn(col2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  dm.addColumn(col3);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String arr[] = line.split(&quot;\t&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  for(int i=0; i&lt;arr.length;i++){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  dm.insertRow(i,new Object[]{i+1,arr[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; System.out.println(arr[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;  TableColumn column0 =&nbsp; table.getColumnModel().getColumn(0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; column0.setPreferredWidth(1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TableColumn column1 =&nbsp; table.getColumnModel().getColumn(1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; column1.setPreferredWidth(160);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TableColumn column2 =&nbsp; table.getColumnModel().getColumn(2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; column2.setPreferredWidth(240);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TableColumn column3 =&nbsp; table.getColumnModel().getColumn(3);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; column3.setPreferredWidth(1);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; table = new JTable(dm);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; table.setPreferredScrollableViewportSize(new Dimension(800,400));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; table.setFillsViewportHeight(true);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String[] answer = { &quot;Item&quot;};<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String[] keyword = {&quot;Detail&quot;};<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; int count = dm.getRowCount();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; table.getColumn(col2).setCellRenderer(new RadioButtonRenderer(answer));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; table.getColumn(col2).setCellEditor(new RadioButtonEditor(new RadioButtonPanel(answer)));<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; table.getColumn(col3).setCellRenderer(new CheckBoxRenderer(keyword));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; table.getColumn(col3).setCellEditor(new CheckBoxEditor(new CheckBoxPanel(keyword)));<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; } catch (FileNotFoundException ev) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ev.printStackTrace();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; // Cell base<br />
&nbsp; class RadioButtonPanel extends JPanel {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; private JRadioButton[] buttons;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; private JRadioButton noSelectionButton;<br />
<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 JRadioButton[str.length];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ButtonGroup verticalGroup = new ButtonGroup();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ButtonGroup horizontalGroup = 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; verticalGroup.add(noSelectionButton);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; horizontalGroup.add(noSelectionButton);<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 JRadioButton(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; verticalGroup.add(buttons[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; for (int j = 0; j &lt; buttons.length; j++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; buttons[j] = new JRadioButton(str[j]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; buttons[j].setFocusPainted(false);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; horizontalGroup.add(buttons[j]);<br />
&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; &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; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<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; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<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 />
<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 />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public JRadioButton[] 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 />
<br />
class CheckBoxPanel 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 />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CheckBoxPanel(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; 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; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<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; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<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; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<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 />
<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 />
<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 />
<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 />
<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 />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; class CheckBoxRenderer extends CheckBoxPanel implements TableCellRenderer {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CheckBoxRenderer(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 />
<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 />
<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 />
<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 />
<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 />
<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 />
<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 />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; class CheckBoxEditor extends AbstractCellEditor implements TableCellEditor, ActionListener {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; private CheckBoxPanel theRadioButtonPanel;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public CheckBoxEditor(CheckBoxPanel 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 />
<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 />
<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 />
<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 />
<br />
&nbsp; public static void main(String[] args) {<br />
&nbsp; &nbsp; &nbsp; TableCreator wow = new TableCreator();<br />
&nbsp; &nbsp; &nbsp; TableCreator.fr.addWindowListener(new WindowAdapter() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; &nbsp; public void windowClosing(WindowEvent e) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.exit(0);<br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; });<br />
&nbsp; &nbsp; TableCreator.fr.pack();<br />
&nbsp; &nbsp; TableCreator.fr.setVisible(true);<br />
<br />
&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/thread238912.html</guid>
		</item>
		<item>
			<title>Problem while reading a file</title>
			<link>http://www.daniweb.com/forums/thread238911.html</link>
			<pubDate>Mon, 16 Nov 2009 12:22:36 GMT</pubDate>
			<description><![CDATA[I am trying to read from a text file which of size 1 MB, and contains 5000 lines of data. 
Following is the code of class which I am using to read from the file 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a...]]></description>
			<content:encoded><![CDATA[<div>I am trying to read from a text file which of size 1 MB, and contains 5000 lines of data.<br />
Following is the code of class which I am using to read from the file<br />
 <pre style="margin:20px; line-height:13px">public class PlayFile extends Timer implements ActionListener{<br />
&nbsp; &nbsp; File filename;<br />
&nbsp; &nbsp; BufferedReader out;<br />
&nbsp; &nbsp; //float frameid,prev_frameid;<br />
&nbsp; &nbsp; public PlayFile(File file, int interval)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; super(interval,null);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; FileInputStream fstream = null;<br />
&nbsp; &nbsp; &nbsp; &nbsp; try {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; filename = file;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fstream = new FileInputStream(file);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DataInputStream in = new DataInputStream(fstream);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; out = new BufferedReader(new InputStreamReader(in));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.addActionListener(this);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; out.readLine();<br />
&nbsp; &nbsp; &nbsp; &nbsp; } catch (Exception ex) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ex.printStackTrace();<br />
&nbsp; &nbsp; &nbsp; &nbsp; } finally {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fstream.close();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } catch (IOException ex) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ex.printStackTrace();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
public void actionPerformed(ActionEvent e)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; try {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(out.ready())<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String br = out.readLine();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String[] inputfile = new String[69];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for(int i = 0;i&lt;69;i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inputfile[i]= br.split(&quot;\t&quot;)[i];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for(int i = 0;i&lt;69;i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  System.out.print(inputfile[i]+&quot; &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //playData(inputfile);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.stop();<br />
&nbsp; &nbsp; &nbsp; &nbsp; } catch (IOException ex) {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ex.printStackTrace();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
<br />
&nbsp; &nbsp; }<br />
<br />
<br />
}</pre>It reads 25 lines of data and after that it starts giveing the following exception.<br />
 <pre style="margin:20px; line-height:13px">java.io.IOException: Read error<br />
&nbsp; &nbsp; &nbsp; &nbsp; at java.io.FileInputStream.readBytes(Native Method)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at java.io.FileInputStream.read(FileInputStream.java:199)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at java.io.DataInputStream.read(DataInputStream.java:132)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:264)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:306)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:158)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at java.io.InputStreamReader.read(InputStreamReader.java:167)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at java.io.BufferedReader.fill(BufferedReader.java:136)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at java.io.BufferedReader.readLine(BufferedReader.java:299)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at java.io.BufferedReader.readLine(BufferedReader.java:362)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at dynamicgraph.GPlot$PlayFile.actionPerformed(GPlot.java:817)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at javax.swing.Timer.fireActionPerformed(Timer.java:271)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at javax.swing.Timer$DoPostEvent.run(Timer.java:201)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)<br />
&nbsp; &nbsp; &nbsp; &nbsp; at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)</pre>The only line no indiacted for my program in the  error is <br />
 <pre style="margin:20px; line-height:13px">dynamicgraph.GPlot$PlayFile.actionPerformed(GPlot.java:817)</pre>and this line contains the readLine() method to read the file. I am not able to guess the reason why does it stop reading after 25 lines</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>gunjannigam</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread238911.html</guid>
		</item>
		<item>
			<title>Student Grade ...min ..max..average</title>
			<link>http://www.daniweb.com/forums/thread238898.html</link>
			<pubDate>Mon, 16 Nov 2009 11:56:36 GMT</pubDate>
			<description><![CDATA[*mmm....  i  think  its  good * 
  <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>...]]></description>
			<content:encoded><![CDATA[<div><span style="font-weight:bold"><span style="color:Red">mmm....  i  think  its  good </span></span><br />
 <pre style="margin:20px; line-height:13px">import java.util.Scanner;<br />
public class Studentgrade {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; public static void main(String[] args) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int num_of_student ;<br />
&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; System.out.println(&quot;Enter the&nbsp; number of Student :&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; num_of_student = input.nextInt();<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; &nbsp; &nbsp; String []name = new String [num_of_student] ;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int array[] = new int [num_of_student];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String upAvg =&quot;&quot; ;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String dwnAvg =&quot;&quot; ;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String exellent = &quot;Exellent :&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String veryGgood =&quot;Very Good :&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String good=&quot;Good :&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String pass =&quot;Pass :&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String fail = &quot;Fail :&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int sum=0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int avg;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int min = array[0]=100;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int max = array[0]=0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String maxi = null;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String mini =null ;<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; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for ( int j = 0; j&lt; array.length; 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; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Enter Student Name :&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; name[j]=input.next();<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; System.out.println(&quot;Enter Student Grade :&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; array[j]=input.nextInt();<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; sum=sum+array[j];<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; if (array[j] &gt; max) <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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; max = array[j];<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; maxi=name[j];<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; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (array[j] &lt; min)<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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; min = array[j];<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; mini= name[j];<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; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; avg= sum/array.length ;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int j=0 ; j&lt;array.length ; 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; &nbsp; &nbsp; &nbsp; &nbsp; switch (array[j]/10)<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; &nbsp; &nbsp; &nbsp; &nbsp; case 100:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exellent += &quot;\n&quot;+ name[j] + &quot;\t&quot; +array[j]+&quot;\n&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; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; veryGgood += &quot;\n&quot; + name[j] + &quot;\t&quot; +array[j] +&quot;\n&quot;;&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; break ;&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; case 7 :<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; good += &quot;\n&quot; + name[j] + &quot;\t&quot; +array[j] +&quot;\n&quot;;&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; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 5:<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; pass += &quot;\n&quot; + name[j] + &quot;\t&quot; +array[j] +&quot;\n&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; break;<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; default:<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; fail +=&quot;\n&quot; + name[j] + &quot;\t&quot; +array[j] +&quot;\n&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; break;<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; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(array[j]&gt;avg)<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; upAvg += name[j] +&quot;\t&quot;+ array[j]+&quot;\n&quot;;&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; &nbsp; &nbsp; else if (array[j]&lt;avg)<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; dwnAvg += name[j] +&quot;\t&quot;+ array[j]+&quot;\n&quot;;&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; <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; //System.out.println(&quot;value=\t&quot;+ array[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; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot; result = :&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(exellent +&quot;\n&quot;+ veryGgood +&quot;\n&quot;+ good +&quot;\n&quot;+ pass +&quot;\n&quot;+fail);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Maximum Grade = &quot;+ max +&quot;\t&quot; +maxi);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Minimum Grade = &quot;+ min +&quot;\t&quot;+mini);<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;avg =&quot; +avg);<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; System.out.println(&quot;ubove avg\n&quot;+upAvg +&quot;\n&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;under avg\n&quot;+dwnAvg+&quot;\n&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>saadismail85</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread238898.html</guid>
		</item>
		<item>
			<title>A Question?</title>
			<link>http://www.daniweb.com/forums/thread238878.html</link>
			<pubDate>Mon, 16 Nov 2009 09:56:59 GMT</pubDate>
			<description>Develop an application that allows a student to open an account. 
The account maybe savings account or current account. 
The student has to submit his or her name,faculty,course,year of study,university,telephone contact and e-mail address. 
The student can withdraw,deposit and perform balance...</description>
			<content:encoded><![CDATA[<div>Develop an application that allows a student to open an account.<br />
The account maybe savings account or current account.<br />
The student has to submit his or her name,faculty,course,year of study,university,telephone contact and e-mail address.<br />
The student can withdraw,deposit and perform balance enquiries with the account.<br />
If the student has opened a savings account he or she is recquired to submit a physical address as well.<br />
For a current account, the student submits his or her date of birth and is also issued with a checkbook.<br />
<br />
Please help me Dani!</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>pinykifoi</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread238878.html</guid>
		</item>
		<item>
			<title>Dam..average</title>
			<link>http://www.daniweb.com/forums/thread238872.html</link>
			<pubDate>Mon, 16 Nov 2009 09:05:39 GMT</pubDate>
			<description><![CDATA[Please look at the code below and follow with my questions: 
 
import java.util.Scanner; 
 
public class CaseGrade { 
 
	public static void main(String[] args) { 
		Scanner input =  new Scanner (System.in); 
		String name = null ; 
		int grade = 0;]]></description>
			<content:encoded><![CDATA[<div>Please look at the code below and follow with my questions:<br />
<br />
import java.util.Scanner;<br />
<br />
public class CaseGrade {<br />
<br />
	public static void main(String[] args) {<br />
		Scanner input =  new Scanner (System.in);<br />
		String name = null ;<br />
		int grade = 0;<br />
		String exellent = &quot;Exellent :&quot;;<br />
		String veryGgood =&quot;Very Good :&quot;;<br />
		String good=&quot;Good :&quot;;<br />
		String pass =&quot;Pass :&quot;;<br />
		String fail = &quot;Fail :&quot;;<br />
		String maxi = null;<br />
		String mini =null ;<br />
		String upAvg =&quot;&quot; ;<br />
		String dwnAvg =&quot;&quot; ;<br />
<br />
	<br />
		int max = 0;<br />
		int min = 100;<br />
		int sum = 0;<br />
		int avg  ;<br />
		int counter =0;<br />
		<br />
		boolean repeat ;<br />
		<br />
		while (repeat =true)<br />
		{<br />
			System.out.println(&quot;Enter Name : &quot;);<br />
			name =  input.next();<br />
			System.out.println(&quot;Enter Grade : &quot;);<br />
			grade = input.nextInt();<br />
	<br />
			switch (grade/10)<br />
				{<br />
				case 100:<br />
				case 9 :<br />
					exellent += &quot;\n&quot;+ name + &quot;\t&quot; +grade+&quot;\n&quot;;<br />
					break;<br />
				case 8 :<br />
					veryGgood += &quot;\n&quot; + name + &quot;\t&quot; +grade +&quot;\n&quot;;	<br />
					break ;		<br />
				case 7 :<br />
					good += &quot;\n&quot; + name + &quot;\t&quot; +grade +&quot;\n&quot;;	<br />
					break;<br />
				case 6:<br />
				case 5:<br />
					pass += &quot;\n&quot; + name + &quot;\t&quot; +grade +&quot;\n&quot;;<br />
					break;<br />
					default:<br />
						fail +=&quot;\n&quot; + name + &quot;\t&quot; +grade +&quot;\n&quot;;<br />
					break;<br />
				}<br />
			<br />
				sum = sum + grade;<br />
				counter = counter + 1;<br />
			<br />
				if (grade &gt; max) <br />
				{<br />
					max = grade;<br />
					maxi=name;<br />
				}<br />
			<br />
				if (grade &lt; min)<br />
				{<br />
					min = grade;<br />
					mini= name;<br />
				}<br />
<br />
				<br />
				if (grade == -1 )<br />
				{	<br />
					//avg= (sum+1) /(counter-1);<br />
					avg= sum /counter;<br />
<br />
					if (grade &gt;=avg)<br />
					{<br />
						upAvg += name+&quot;\n&quot;;<br />
					}<br />
					if(grade&lt;avg)<br />
					{<br />
						dwnAvg += name +&quot;\n&quot;;<br />
					}<br />
		<br />
	<br />
					System.out.println(&quot; result = :&quot;);<br />
					System.out.println(exellent +&quot;\n&quot;+ veryGgood +&quot;\n&quot;+ good +&quot;\n&quot;+ pass +&quot;\n&quot;+fail);<br />
					System.out.println(&quot;maximum = &quot;+ max +&quot;\t&quot; +maxi);<br />
					System.out.println(&quot;minimum = &quot;+ min +&quot;\t&quot;+mini);<br />
					System.out.println(&quot;\tAverage = &quot; +avg);<br />
					<br />
					System.out.println(&quot;counter : &quot;+counter);<br />
					System.out.println(&quot;sum :&quot;+sum);<br />
					System.out.println(&quot;ubove avg\n&quot;+upAvg +&quot;\n&quot;);<br />
					System.out.println(&quot;under avg\n&quot;+dwnAvg+&quot;\n&quot;);<br />
					System.exit(0);<br />
				}<br />
				<br />
			}<br />
				<br />
			<br />
	<br />
	<br />
	}<br />
<br />
}<br />
 <br />
i need to Print the names with the highest average and less than the average</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>saadismail85</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread238872.html</guid>
		</item>
		<item>
			<title>Minor ArrayList issue with adding to index</title>
			<link>http://www.daniweb.com/forums/thread238865.html</link>
			<pubDate>Mon, 16 Nov 2009 08:21:06 GMT</pubDate>
			<description><![CDATA[So I'm using an ArrayList (to create a hash table structure) like so: 
 
  <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"...]]></description>
			<content:encoded><![CDATA[<div>So I'm using an ArrayList (to create a hash table structure) like so:<br />
<br />
 <pre style="margin:20px; line-height:13px">protected ArrayList bucketArray;</pre><br />
Later in the constructor, it initializes it as:<br />
<br />
 <pre style="margin:20px; line-height:13px">bucketArray = new ArrayList(500);</pre><br />
When I use it and try to insert a Node from a linked list in like this:<br />
<br />
 <pre style="margin:20px; line-height:13px">bucketArray.add(357, nodeToBeInserted);</pre><br />
it gives me the error:<br />
<br />
 <pre style="margin:20px; line-height:13px">Exception in thread &quot;main&quot; java.lang.IndexOutOfBoundsException: Index: 347, Size: 0</pre><br />
Shouldn't the size be set as 500 such that I can insert at any given location? If I change it to just add without a location, it'll append to the ArrayList perfectly fine but not in the order I need for a hash table obviously. Any suggestions in what I can do to resolve this?<br />
<br />
Thanks for the help!</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/thread238865.html</guid>
		</item>
		<item>
			<title>java midlet</title>
			<link>http://www.daniweb.com/forums/thread238855.html</link>
			<pubDate>Mon, 16 Nov 2009 07:19:29 GMT</pubDate>
			<description>can somebody help me to produce a java midlet that randomly generates arithmetic problems for the user and records the time that it takes to answer ten correctly using single digit numbers and operands +,- or *, when a problem is answered correctly or incorrectly, a new problem is produced</description>
			<content:encoded><![CDATA[<div>can somebody help me to produce a java midlet that randomly generates arithmetic problems for the user and records the time that it takes to answer ten correctly using single digit numbers and operands +,- or *, when a problem is answered correctly or incorrectly, a new problem is produced</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>toluyinka2004</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread238855.html</guid>
		</item>
	</channel>
</rss>
