<?xml version="1.0" encoding="utf-8"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>DaniWeb IT Discussion Community - Java</title>
		<link>http://www.daniweb.com/forums/</link>
		<description><![CDATA[Our Java forum is the place for Q&A-style discussions related to this popular OOP-based language. Note there is also a JSP forum within our Web Development category.]]></description>
		<language>en-US</language>
		<lastBuildDate>Sat, 28 Nov 2009 03:05:41 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>counting specific character in txt with java</title>
			<link>http://www.daniweb.com/forums/thread241937.html</link>
			<pubDate>Sat, 28 Nov 2009 02:45:24 GMT</pubDate>
			<description><![CDATA[i need help to count lines, paragraphs and articles ("a","an","the") in txt file with java. here is what i've got know: 
import java.io.*; 
import java.util.*; 
public class Main 
{ 
 public static void main ( String[] args ) throws FileNotFoundException, IOException  
 { 
  
   String line=" "; 
 ...]]></description>
			<content:encoded><![CDATA[<div>i need help to count lines, paragraphs and articles (&quot;a&quot;,&quot;an&quot;,&quot;the&quot;) in txt file with java. here is what i've got know:<br />
import java.io.*;<br />
import java.util.*;<br />
public class Main<br />
{<br />
 public static void main ( String[] args ) throws FileNotFoundException, IOException <br />
 {<br />
 <br />
   String line=&quot; &quot;;<br />
  char t=9; <br />
  String s=&quot;&quot;+t; <br />
  int lines = 0;<br />
  int para=0;<br />
 Scanner scan =new Scanner (new File (&quot;G:/data.txt&quot;));<br />
   <br />
 while (scan.hasNext())<br />
 {<br />
    line = scan.nextLine();<br />
    if (line.contains(s)) <br />
    {<br />
       para++;<br />
    }<br />
    if (line!=null)<br />
        <br />
        <br />
     lines++;<br />
  <br />
 }<br />
   System.out.println(&quot;the nnumber of paragraphs is:&quot;+para);<br />
System.out.println(&quot;The number of lines is:&quot;+lines);<br />
   <br />
 }<br />
}</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>the_Famous</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241937.html</guid>
		</item>
		<item>
			<title>Java compiler</title>
			<link>http://www.daniweb.com/forums/thread241890.html</link>
			<pubDate>Fri, 27 Nov 2009 22:22:42 GMT</pubDate>
			<description>I use netbeans but was wondering if anyone knew how to add a Java compiler to visual studio 2008?</description>
			<content:encoded><![CDATA[<div>I use netbeans but was wondering if anyone knew how to add a Java compiler to visual studio 2008?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>firstPerson</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241890.html</guid>
		</item>
		<item>
			<title>Illeal argument Exception</title>
			<link>http://www.daniweb.com/forums/thread241839.html</link>
			<pubDate>Fri, 27 Nov 2009 16:42:56 GMT</pubDate>
			<description><![CDATA[public class Average 
{ 
	private double [] Score; 
	int index; 
 
	public Average(double [] s) 
	{ 
		Score = new double[s.length];]]></description>
			<content:encoded><![CDATA[<div>public class Average<br />
{<br />
	private double [] Score;<br />
	int index;<br />
<br />
	public Average(double [] s)<br />
	{<br />
		Score = new double[s.length];<br />
<br />
<br />
<br />
		for(index=0; index&lt;s.length; index++)<br />
		{<br />
<br />
			if(Score[index]&gt;100 &amp;&amp; Score[index]&lt;0)<br />
			  Score[index]=s[index];<br />
		 }<br />
<br />
<br />
	  }<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
	public double getAverage()<br />
	{<br />
		double total=0.0;<br />
		double average = 0.0;<br />
		for(double value: Score)<br />
		total+=value;<br />
		 average= Score.length/total;<br />
		 return average;<br />
<br />
	}<br />
}<br />
<br />
the actual assingment is to write an IllegalArgumentException method inoder to prevent the program from accepting negative or score grater than 100</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>nlanka</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241839.html</guid>
		</item>
		<item>
			<title>how do you export to an uknown location?</title>
			<link>http://www.daniweb.com/forums/thread241792.html</link>
			<pubDate>Fri, 27 Nov 2009 12:54:44 GMT</pubDate>
			<description>im using a JFileChooser to find a file from anywhere on the system and load it but i also need to be able to export the data within my program to an unknown location, how would i go about doing that?? is it simular to the JFileChooser?  
any help would be great thanks guys</description>
			<content:encoded><![CDATA[<div>im using a JFileChooser to find a file from anywhere on the system and load it but i also need to be able to export the data within my program to an unknown location, how would i go about doing that?? is it simular to the JFileChooser? <br />
any help would be great thanks guys</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>hanntaa</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241792.html</guid>
		</item>
		<item>
			<title>Need code for eNFA to NFA conversion</title>
			<link>http://www.daniweb.com/forums/thread241761.html</link>
			<pubDate>Fri, 27 Nov 2009 10:14:46 GMT</pubDate>
			<description>I need a java code or algorithm for converting eNFAs to NFAs. 
This is our project for our automata theory class and our prof said that it would be alright to get codes from other people as long as we fully understood how the program works. 
Please help me and thank you for reading my post!</description>
			<content:encoded><![CDATA[<div>I need a java code or algorithm for converting eNFAs to NFAs.<br />
This is our project for our automata theory class and our prof said that it would be alright to get codes from other people as long as we fully understood how the program works.<br />
Please help me and thank you for reading my post!</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>silveram</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241761.html</guid>
		</item>
		<item>
			<title>regarding final semester project</title>
			<link>http://www.daniweb.com/forums/thread241716.html</link>
			<pubDate>Fri, 27 Nov 2009 03:52:15 GMT</pubDate>
			<description>i am doing MCA ..i have to do  my final semester project and i had chosed my language as java with Ajax .. so suggest me project with ur idea  
 
 
 
regards 
 
Karthik</description>
			<content:encoded><![CDATA[<div>i am doing MCA ..i have to do  my final semester project and i had chosed my language as java with Ajax .. so suggest me project with ur idea <br />
<br />
<br />
<br />
regards<br />
<br />
Karthik</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>karthik bhaskar</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241716.html</guid>
		</item>
		<item>
			<title>Java Help!!</title>
			<link>http://www.daniweb.com/forums/thread241669.html</link>
			<pubDate>Thu, 26 Nov 2009 22:14:18 GMT</pubDate>
			<description><![CDATA[Hey. 
I have been trying to do a drafts board, but i am having major problems with adding the pieces. Heres my Board. Any Suggestions?? 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a...]]></description>
			<content:encoded><![CDATA[<div>Hey.<br />
I have been trying to do a drafts board, but i am having major problems with adding the pieces. Heres my Board. Any Suggestions??<br />
<br />
 <pre style="margin:20px; line-height:13px">import java.awt.*;<br />
import javax.swing.*;<br />
<br />
public class Board<br />
{<br />
<br />
&nbsp; &nbsp; protected JPanel[][] squares;<br />
&nbsp; &nbsp; protected JFrame boardFrame;<br />
&nbsp; &nbsp; protected Container container;<br />
&nbsp; &nbsp; public void paint (Graphics g) { }<br />
<br />
<br />
<br />
<br />
&nbsp; &nbsp; public Board()<br />
&nbsp; &nbsp; {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; boardFrame = new JFrame(&quot;MyDraughts&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; container = boardFrame.getContentPane();<br />
&nbsp; &nbsp; &nbsp; &nbsp; container.setLayout(new GridLayout(8,8));<br />
&nbsp; &nbsp; &nbsp; &nbsp; create_squares();<br />
&nbsp; &nbsp; &nbsp; &nbsp; boardFrame.setSize(400,450);<br />
&nbsp; &nbsp; &nbsp; &nbsp; boardFrame.setVisible(true);<br />
&nbsp; &nbsp; }<br />
<br />
<br />
&nbsp; &nbsp; private void create_squares()<br />
&nbsp; &nbsp; {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; squares = new JPanel[8][8];<br />
&nbsp; &nbsp; &nbsp; &nbsp; for(int i=0;i&lt;8;i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for(int j=0;j&lt;8;j++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JPanel p = new JPanel();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.setBackground(setColor(i,j));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; squares[i][j]=p;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; container.add(p);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; private Color setColor(int x, int y)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; if((x+y)%2 == 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return Color.WHITE;<br />
&nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return Color.BLACK;<br />
&nbsp; &nbsp; }<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>Xav123</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241669.html</guid>
		</item>
		<item>
			<title>Loop with String concatenation</title>
			<link>http://www.daniweb.com/forums/thread241633.html</link>
			<pubDate>Thu, 26 Nov 2009 18:55:53 GMT</pubDate>
			<description><![CDATA[How can I get this output by running a for loop 
the logic is that after the multiples of 2, "This" will b printed, after the multiples of 3, "Is" will b printed and after the multiples of 5, "Java" will b printed. 
pls help with code 
 
1 
2 This 
3 Is 
4 This 
5 Java 
6 This Is]]></description>
			<content:encoded><![CDATA[<div>How can I get this output by running a for loop<br />
the logic is that after the multiples of 2, &quot;This&quot; will b printed, after the multiples of 3, &quot;Is&quot; will b printed and after the multiples of 5, &quot;Java&quot; will b printed.<br />
pls help with code<br />
<br />
1<br />
2 This<br />
3 Is<br />
4 This<br />
5 Java<br />
6 This Is<br />
7<br />
8 This<br />
9 Is<br />
10 This Java<br />
11<br />
12 This Is<br />
13<br />
14 This<br />
15 Is Java<br />
16 This<br />
17<br />
18 This Is<br />
19<br />
20 This Java</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>subhankar02dey</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241633.html</guid>
		</item>
		<item>
			<title>How can my LAN-Chat work over INTERNET?</title>
			<link>http://www.daniweb.com/forums/thread241614.html</link>
			<pubDate>Thu, 26 Nov 2009 15:31:36 GMT</pubDate>
			<description><![CDATA[I develop a chat (server and client) using Sockets. It's working on *LAN* but when I try to connect the client to the server using my public IP address it says it cannot connect to that address. My address is public - a friend pinged my address successfully. You find everywhere examples and code...]]></description>
			<content:encoded><![CDATA[<div>I develop a chat (server and client) using <span style="font-style:italic">Sockets</span>. It's working on <span style="font-weight:bold">LAN</span> but when I try to connect the client to the server using my public IP address it says it cannot connect to that address. My address is public - a friend pinged my address successfully. You find everywhere examples and code for chat applications - but only over local network.<br />
What's the problem? <span style="font-weight:bold">How can my chat work over the Internet?</span> (I can post code if necesarry).<br />
Please help me. I need this so much!</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>Clawsy</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241614.html</guid>
		</item>
		<item>
			<title>Formatting a string</title>
			<link>http://www.daniweb.com/forums/thread241606.html</link>
			<pubDate>Thu, 26 Nov 2009 15:02:51 GMT</pubDate>
			<description><![CDATA[Ok what I have currently is the blelow code in a for loop and this works fine it just doesn't format the text. 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox"...]]></description>
			<content:encoded><![CDATA[<div>Ok what I have currently is the blelow code in a for loop and this works fine it just doesn't format the text.<br />
 <pre style="margin:20px; line-height:13px"> outString = outString + &quot;&nbsp; &quot; + i + &quot;&nbsp; &nbsp; &nbsp; &nbsp;  &quot; + numArray[i] + &quot;\n&quot;;</pre><br />
I am trying to format the text of i to right justify 6 spaces and numArray 16. i is an int and numArray[i] is a double.<br />
<br />
my attempst at this are...<br />
 <pre style="margin:20px; line-height:13px">outString = String.format(outString,%6d,%16f,i,numArray[i],&quot;\n&quot;)</pre>and<br />
 <pre style="margin:20px; line-height:13px">outString = outString+String.format(%6d,%16f,i,numArray[i])+&quot;\n&quot;;</pre><br />
Any help or direction would be greatly appreciated.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>Afupi</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241606.html</guid>
		</item>
		<item>
			<title>Main Methods</title>
			<link>http://www.daniweb.com/forums/thread241572.html</link>
			<pubDate>Thu, 26 Nov 2009 13:04:43 GMT</pubDate>
			<description>I am a beginner to java and i find it very difficult. can someone please help and tell me how you identify a main method in an application 
and also how do i make a jbutton call a certain method and output it to a text field? 
please explain with examples. 
thank you. it is much help</description>
			<content:encoded><![CDATA[<div>I am a beginner to java and i find it very difficult. can someone please help and tell me how you identify a main method in an application<br />
and also how do i make a jbutton call a certain method and output it to a text field?<br />
please explain with examples.<br />
thank you. it is much help</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/thread241572.html</guid>
		</item>
		<item>
			<title>Event Queue in java</title>
			<link>http://www.daniweb.com/forums/thread241569.html</link>
			<pubDate>Thu, 26 Nov 2009 13:02:13 GMT</pubDate>
			<description>Hai Friends, 
 
       Iam using swing application in my project with short cut keys to perform some action, it takes few seconds to process(retrieve data from server to  client) ,when i press the shortcut key for three times means the action is performing  thrice, i want to perform single...</description>
			<content:encoded><![CDATA[<div>Hai Friends,<br />
<br />
       Iam using swing application in my project with short cut keys to perform some action, it takes few seconds to process(retrieve data from server to  client) ,when i press the shortcut key for three times means the action is performing  thrice, i want to perform single action.is there any event queue process? how can i avoid this. please help me for this problem.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>gitech</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241569.html</guid>
		</item>
		<item>
			<title>problem with making exe file</title>
			<link>http://www.daniweb.com/forums/thread241508.html</link>
			<pubDate>Thu, 26 Nov 2009 08:21:02 GMT</pubDate>
			<description><![CDATA[dear friends, 
 
I am working on small project for that i am making a setup from install creator and launch 4j after creating a jar file. But in that step   .exe file  is needed . pls help me to create a .exe file.  
thanks & regards  
shashikant]]></description>
			<content:encoded><![CDATA[<div>dear friends,<br />
<br />
I am working on small project for that i am making a setup from install creator and launch 4j after creating a jar file. But in that step   .exe file  is needed . pls help me to create a .exe file. <br />
thanks &amp; regards <br />
shashikant</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>shashikant.v</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241508.html</guid>
		</item>
		<item>
			<title>need help drwing grahpics</title>
			<link>http://www.daniweb.com/forums/thread241466.html</link>
			<pubDate>Thu, 26 Nov 2009 05:28:39 GMT</pubDate>
			<description>these are all my codes and im trying to make shapoes in myshapetesrer2.these are the directions i have to follow but i dont kn ow if i did tem right any help? 
 
Write an abstract class: ColoredShape 
A ColoredShape has a position (x and y coordinates that are integers) and a color (of type Color)....</description>
			<content:encoded><![CDATA[<div>these are all my codes and im trying to make shapoes in myshapetesrer2.these are the directions i have to follow but i dont kn ow if i did tem right any help?<br />
<br />
Write an abstract class: ColoredShape<br />
A ColoredShape has a position (x and y coordinates that are integers) and a color (of type Color). The constructor should have these parameters in this order. The class will also have an boolean attribute filled which is initially false. The class will have method and mutator methods for the four attributes. The accessor attribute for filled will be called isFilled. The x and y coordinates represent the upper left corner of the bounding box of the shape.<br />
<br />
The class will have a toString method that produces a String containing all of the attributes of the ColoredShape, all on one line. You can use the toString method of Color to describe the color. <br />
<br />
The class will have 2 abstract methods:<br />
public abstract void draw(Graphics g);<br />
public abstract boolean inside(int x, int y);<br />
<br />
Write a class called ColoredRectangle that extends ColoredShape. The constructor of ColoredRectangle will have the same parameters as the constructor for ColoredShape followed by two additional integer parameters, width and height. The class should have accessor and mutator methods for these extra attributes.<br />
<br />
Override the toString method as appropriate.<br />
<br />
Since ColoredRectangle is not abstract, you must implement methods draw and inside. For now, inside will just return false. The draw method will draw the rectangle with the appropriate color with its upper left corner given by its x and y coordinates. If the filled attribute is set, the rectangle will be drawn as filled using fillRect. Otherwise, draw the rectangle with drawRect. <br />
<br />
Write a test program called ShapeTester2 to test your ColoredRectangle class. It should create a ShapeFrame with title bar similar to the one in part 1, but it should say Part 2. Create a few rectangles of various sizes and colors, some filled, some not. Add them to the ShapeFrame with a 1 second delay between each add. After adding a shape, and before the delay, add a message to the ShapeFrame describing the shape you are adding. You can use the toString to describe the shape. Test all of the public methods of ColoredRectangle that you have written, including the ones inherited form ColoredShape. Use the addMessage method to display the results. Lastly, output a message indicating that Part 2 tests have been completed. <br />
<br />
 <pre style="margin:20px; line-height:13px">package graphics;<br />
<br />
import java.awt.*;<br />
import javax.swing.*;<br />
<br />
<br />
public class ShapeTester2 {<br />
<br />
&nbsp; &nbsp; public static void main(String[] args) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; ShapeFrame ColoredRectangle = new ShapeFrame(&quot;Shapes Part 2 by Matthew Gamble&quot;,600,200);<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; ColoredRectangle.addMessage(&quot;Part 2 Completed&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; ColoredRectangle.delay(1000);<br />
&nbsp; &nbsp; &nbsp; &nbsp; ColoredRectangle.addMessage(&quot;\nPart 2 tester is done&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; ColoredRectangle.draw();<br />
&nbsp; &nbsp; }<br />
}</pre><br />
 <pre style="margin:20px; line-height:13px">package graphics;<br />
<br />
import java.awt.*;<br />
<br />
public class ColoredRectangle extends ColoredShape{<br />
<br />
&nbsp; &nbsp; private int width;<br />
&nbsp; &nbsp; &nbsp; &nbsp; private int height;<br />
&nbsp; &nbsp; private Graphics2D graphics; <br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; public&nbsp; ColoredRectangle(int x1,int y1,String color1,int wid,int hei){<br />
&nbsp; &nbsp; &nbsp; &nbsp; super(x1,y1,color1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; width = wid;<br />
&nbsp; &nbsp; &nbsp; &nbsp; height = hei;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; public int getWidth() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; return width;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; public int getHeight() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; return height;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; public void setWidth(int width) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; this.width = width;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; public void setHeight(int height) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; this.height = height;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; public void draw(Graphics g) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; graphics.drawRect(10, 10, 100, 100);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; public boolean inside(int x, int y) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; return false;<br />
&nbsp; &nbsp; }<br />
<br />
public String toString(){<br />
&nbsp; &nbsp; return &quot;The x cooridinates are&quot; + x + &quot;The y cooridinates are&quot; + y + <br />
&nbsp; &nbsp; &quot;The color is &quot;+color+&quot;,the width is&quot;+width+&quot;the height is&quot;+height;<br />
}<br />
<br />
}</pre><br />
 <pre style="margin:20px; line-height:13px">package graphics;<br />
<br />
import java.awt.Graphics;<br />
<br />
public abstract class ColoredShape {<br />
&nbsp; &nbsp; protected int x;<br />
&nbsp; &nbsp; protected int y;<br />
&nbsp; &nbsp; protected String color;<br />
&nbsp; &nbsp; private boolean filled;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; public ColoredShape(int x1,int y1,String color1){<br />
&nbsp; &nbsp; &nbsp; &nbsp; x = x1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; y = y1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; color= color1;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public boolean isFilled() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; return filled;<br />
&nbsp; &nbsp; }<br />
<br />
<br />
<br />
&nbsp; &nbsp; public int getX() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; return x;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public int getY() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; return y;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public String getColor() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; return color;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public void setX(int x) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; this.x = x;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public void setY(int y) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; this.y = y;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public void setColor(String color) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; this.color = color;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public void setFilled(boolean filled) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; this.filled = filled;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public abstract void draw(Graphics g);<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; public abstract boolean inside(int x, int y);<br />
<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; public String toString(){<br />
&nbsp; &nbsp; &nbsp; &nbsp; return &quot;The x cooridinates are&quot; + x + &quot;The y cooridinates are&quot; + y + <br />
&nbsp; &nbsp; &nbsp; &nbsp; &quot;The color is &quot;+color;<br />
&nbsp; &nbsp; }&nbsp; &nbsp; <br />
}</pre><br />
<br />
 <pre style="margin:20px; line-height:13px">package graphics;<br />
<br />
<br />
<br />
import java.awt.Color;<br />
import java.awt.Dimension;<br />
import java.awt.EventQueue;<br />
import java.awt.Graphics;<br />
import java.awt.Rectangle;<br />
import java.util.ArrayList;<br />
<br />
import javax.swing.BoxLayout;<br />
import javax.swing.JFrame;<br />
import javax.swing.JPanel;<br />
import javax.swing.JScrollBar;<br />
import javax.swing.JScrollPane;<br />
import javax.swing.JTextArea;<br />
<br />
@SuppressWarnings(&quot;serial&quot;)<br />
public class ShapeFrame extends JFrame {<br />
<br />
&nbsp;  private ArrayList&lt;ColoredShape&gt; shapes;<br />
&nbsp;  private ShapePanel shapePanel;<br />
&nbsp;  private JTextArea textArea;<br />
&nbsp;  private JScrollPane scrollPane;<br />
&nbsp;  private Color background = Color.lightGray;<br />
<br />
&nbsp;  public ShapeFrame(String title, int width, int height) {<br />
&nbsp; &nbsp; &nbsp; super(title);<br />
&nbsp; &nbsp; &nbsp; try {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);<br />
&nbsp; &nbsp; &nbsp; } catch (Exception e) {}<br />
&nbsp; &nbsp; &nbsp; shapePanel = new ShapePanel(width, height);<br />
&nbsp; &nbsp; &nbsp; JPanel mainPanel = new JPanel();<br />
&nbsp; &nbsp; &nbsp; mainPanel.setLayout(new BoxLayout(mainPanel,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; BoxLayout.Y_AXIS));<br />
&nbsp; &nbsp; &nbsp; mainPanel.add(shapePanel);<br />
&nbsp; &nbsp; &nbsp; textArea = new JTextArea(10, 20);<br />
&nbsp; &nbsp; &nbsp; textArea.setEditable(false);<br />
&nbsp; &nbsp; &nbsp; scrollPane = new JScrollPane(textArea);<br />
&nbsp; &nbsp; &nbsp; mainPanel.add(scrollPane);<br />
&nbsp; &nbsp; &nbsp; getContentPane().add(mainPanel);<br />
&nbsp; &nbsp; &nbsp; pack();<br />
&nbsp; &nbsp; &nbsp; shapes = new ArrayList&lt;ColoredShape&gt;();<br />
&nbsp; &nbsp; &nbsp; setVisible(true);<br />
&nbsp;  }<br />
<br />
&nbsp;  public void addMessage(String s) {<br />
&nbsp; &nbsp; &nbsp; textArea.append(s);<br />
&nbsp; &nbsp; &nbsp; EventQueue.invokeLater(new Runnable() {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  public void run() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; scrollToBottom();<br />
&nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; });<br />
&nbsp;  }<br />
<br />
&nbsp;  public synchronized void addShape(ColoredShape x) {<br />
&nbsp; &nbsp; &nbsp; shapes.add(x);<br />
&nbsp; &nbsp; &nbsp; shapePanel.repaint();<br />
&nbsp;  }<br />
&nbsp;  <br />
&nbsp;  public synchronized ColoredShape[] getAllShapes() {<br />
&nbsp; &nbsp; &nbsp; ColoredShape[] shapesArray&nbsp; = new ColoredShape[shapes.size()];<br />
&nbsp; &nbsp; &nbsp; for (int i=0;i&lt;shapes.size();i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp;  shapesArray[i] = shapes.get(i);<br />
&nbsp; &nbsp; &nbsp; return shapesArray;<br />
&nbsp;  }<br />
<br />
&nbsp;  public synchronized void clear() {<br />
&nbsp; &nbsp; &nbsp; shapes.clear();<br />
&nbsp; &nbsp; &nbsp; shapePanel.repaint();<br />
&nbsp;  }<br />
<br />
&nbsp;  public void delay(int n) {<br />
&nbsp; &nbsp; &nbsp; try {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  Thread.sleep(n);<br />
&nbsp; &nbsp; &nbsp; } catch (InterruptedException e) {<br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp;  }<br />
&nbsp;  <br />
&nbsp;  public int getGraphicsWidth() {<br />
&nbsp; &nbsp; &nbsp; return shapePanel.getBounds().width;<br />
&nbsp;  }<br />
&nbsp;  <br />
&nbsp;  public int getGraphicsHeight() {<br />
&nbsp; &nbsp; &nbsp; return shapePanel.getBounds().height;<br />
&nbsp;  }<br />
<br />
&nbsp;  public void refresh() {<br />
&nbsp; &nbsp; &nbsp; shapePanel.repaint();<br />
&nbsp;  }<br />
<br />
&nbsp;  private void scrollToBottom() {<br />
&nbsp; &nbsp; &nbsp; JScrollBar sb = scrollPane.getVerticalScrollBar();<br />
&nbsp; &nbsp; &nbsp; if (sb == null)<br />
&nbsp; &nbsp; &nbsp; &nbsp;  return;<br />
&nbsp; &nbsp; &nbsp; sb.setValue(sb.getMaximum());<br />
&nbsp;  }<br />
&nbsp;  <br />
&nbsp;  private synchronized void drawAllShapes(Graphics g) {<br />
&nbsp; &nbsp; &nbsp; for (int i = 0; i &lt; shapes.size(); i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; shapes.get(i).draw(g);<br />
&nbsp;  }<br />
<br />
&nbsp;  private class ShapePanel extends JPanel {<br />
<br />
&nbsp; &nbsp; &nbsp; private Dimension preferredSize;<br />
<br />
&nbsp; &nbsp; &nbsp; public ShapePanel(int width, int height) {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  preferredSize = new Dimension(width, height);<br />
&nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; public Dimension getPreferredSize() {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  return preferredSize;<br />
&nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; public void paintComponent(Graphics g) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Number of shapes: &quot; + shapes.size());<br />
&nbsp; &nbsp; &nbsp; &nbsp;  g.setColor(background);<br />
&nbsp; &nbsp; &nbsp; &nbsp;  Rectangle bounds = getBounds();<br />
&nbsp; &nbsp; &nbsp; &nbsp;  g.fillRect(0, 0, bounds.width, bounds.height);<br />
&nbsp; &nbsp; &nbsp; &nbsp;  drawAllShapes(g);<br />
&nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp;  }<br />
<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>bkafroboy69</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241466.html</guid>
		</item>
		<item>
			<title>Sorting Arrays by Enum</title>
			<link>http://www.daniweb.com/forums/thread241406.html</link>
			<pubDate>Thu, 26 Nov 2009 00:08:57 GMT</pubDate>
			<description><![CDATA[I need to make a sorting algorithm. 
 
The program takes an input file that stores the information into an array: the array has student's name and a personality type. 
 
The personality types are: enum values 
 
Realistic  
Artistic 
Social 
Conventional]]></description>
			<content:encoded><![CDATA[<div>I need to make a sorting algorithm.<br />
<br />
The program takes an input file that stores the information into an array: the array has student's name and a personality type.<br />
<br />
The personality types are: enum values<br />
<br />
Realistic <br />
Artistic<br />
Social<br />
Conventional<br />
<br />
Then once it takes an array, it sould divide the main array into 4 arrays with the personality types.<br />
<br />
So the new array have all the same personality types and the students name.<br />
<br />
Then I need it to divide the 4 arrays by a number. Then number can change at any time.<br />
<br />
So it looks something like this<br />
<br />
Mary Realistic <br />
Lisa Artistic<br />
Bill Artistic <br />
Jake Realistic <br />
Loren Conventional <br />
Mike Social <br />
Jessica Conventional<br />
Rick Realistic <br />
Karen Artistic<br />
Lily Social <br />
John Social <br />
<br />
<br />
divides into four arrays <br />
<br />
Array 1<br />
Mary Realistic <br />
Jake Realistic <br />
Rick Realistic <br />
<br />
Array 2<br />
Lisa Artistic<br />
Bill Artistic<br />
Karen Artistic <br />
<br />
Array 3<br />
Lily Social <br />
John Social <br />
Mike Social <br />
<br />
Array 4<br />
Loren Conventional <br />
Jessica Conventional<br />
<br />
Then they select they want a group with 2 people<br />
<br />
<br />
group 1<br />
Mary, Jake<br />
<br />
group 2<br />
lisa, Bill<br />
<br />
group3<br />
lily, john<br />
<br />
group4<br />
loren, jessica<br />
<br />
That leaves Rick, Karen, Mike.<br />
so it places<br />
<br />
group 5<br />
Rick and Karen<br />
<br />
and then place Mike in the first group with Mary and jake<br />
<br />
so it would be <br />
<br />
group 1<br />
Mary, Jake, Mike<br />
<br />
group 2<br />
lisa, Bill<br />
<br />
group3<br />
lily, john<br />
<br />
group4<br />
loren, jessica<br />
<br />
group 5<br />
Rick and Karen<br />
<br />
<br />
I know the problem is a little long, but any help is very well appreciated.<br />
<br />
Thank You</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>sahity1a@yahoo.</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241406.html</guid>
		</item>
		<item>
			<title>another repaint() problem, this time with loops</title>
			<link>http://www.daniweb.com/forums/thread241390.html</link>
			<pubDate>Wed, 25 Nov 2009 21:54:13 GMT</pubDate>
			<description>this is a small example that, i hope reflects the larger project that i am working on. 
i am making a board game that uses a combination of mouse listener and jbutton action listener for the player to move. when it is time for the computer to take its turn, however, i cannot seem to get the program...</description>
			<content:encoded><![CDATA[<div>this is a small example that, i hope reflects the larger project that i am working on.<br />
i am making a board game that uses a combination of mouse listener and jbutton action listener for the player to move. when it is time for the computer to take its turn, however, i cannot seem to get the program to update the graphics in between moves. it will do so when the computer has done all of its moves and kicks control back to the player. i am not sure if it is the adding of jbuttons to my jframe that is causing it to repaint or not, but in this small example, it still repaints after the loop is complete even though there is no altering of the jframe or any of the components in it.<br />
<br />
i have tried using revalidate() as well and it does not seem to have any effect on it.<br />
<br />
here is the code, any insight would be greatly appreciated.<br />
thank you<br />
 <pre style="margin:20px; line-height:13px">import javax.swing.*;<br />
import java.awt.*;<br />
import java.io.*;<br />
import java.awt.event.*;<br />
import java.util.*;<br />
<br />
public class testTwo extends JPanel{<br />
&nbsp; <br />
&nbsp; Image ladyBug;<br />
&nbsp; Image iLB;<br />
&nbsp; cmonDoIt testPanel;<br />
&nbsp; JScrollPane testScroll;<br />
&nbsp; JFrame gameFrameTwo;<br />
&nbsp; <br />
&nbsp; <br />
&nbsp; public static void gameFrameTwo(){<br />
&nbsp; &nbsp; JFrame gameFrameTwo = new JFrame(&quot;test&quot;);<br />
&nbsp; &nbsp; gameFrameTwo.setPreferredSize(new Dimension(400, 400));<br />
&nbsp; &nbsp; gameFrameTwo.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);<br />
&nbsp; &nbsp; gameFrameTwo.setResizable(false);<br />
&nbsp; &nbsp; testTwo content = new testTwo();<br />
&nbsp; &nbsp; content.setOpaque(true);<br />
&nbsp; &nbsp; gameFrameTwo.setContentPane(content);<br />
&nbsp; &nbsp; gameFrameTwo.pack();<br />
&nbsp; &nbsp; gameFrameTwo.setVisible(true);<br />
&nbsp; }<br />
&nbsp; <br />
&nbsp; public testTwo(){<br />
&nbsp; &nbsp; testPanel = new cmonDoIt();<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; add(testPanel);<br />
&nbsp; &nbsp; testPanel.addMouseListener(testPanel);<br />
&nbsp; }<br />
&nbsp; <br />
&nbsp; public static void main(String[] args) {&nbsp; <br />
&nbsp; &nbsp; javax.swing.SwingUtilities.invokeLater(new Runnable() {<br />
&nbsp; &nbsp; &nbsp; public void run() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; gameFrameTwo(); <br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; });<br />
&nbsp; }<br />
&nbsp; <br />
&nbsp; <br />
&nbsp; class cmonDoIt extends JPanel implements MouseListener{<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; Image currentView = Toolkit.getDefaultToolkit().getImage(&quot;images/LadyBug.GIF&quot;);<br />
&nbsp; &nbsp; Image yellow = Toolkit.getDefaultToolkit().getImage(&quot;images/yellow.GIF&quot;);<br />
&nbsp; &nbsp; boolean showYellow = true;<br />
&nbsp; &nbsp; int yellowX = 100;<br />
&nbsp; &nbsp; int yellowY = 100;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; public cmonDoIt(){<br />
<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; public Dimension getPreferredSize() {<br />
&nbsp; &nbsp; &nbsp; return new Dimension(600,600);<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; public void paintComponent(Graphics g) {<br />
&nbsp; &nbsp; &nbsp; super.paintComponent(g);<br />
<br />
&nbsp; &nbsp; &nbsp; g.drawImage(currentView, 0, 0, this);<br />
&nbsp; &nbsp; &nbsp; g.drawImage(yellow, yellowX, yellowY, this);<br />
<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; public void mousePressed(MouseEvent e) { }<br />
&nbsp; &nbsp; public void mouseClicked(MouseEvent e) { <br />
<br />
&nbsp; &nbsp; &nbsp; int x = e.getX();<br />
&nbsp; &nbsp; &nbsp; int y = e.getY();<br />
<br />
&nbsp; &nbsp; &nbsp; wander();<br />
&nbsp; &nbsp; &nbsp; showYellow = true;<br />
<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; public void mouseEntered(MouseEvent e) { }<br />
&nbsp; &nbsp; public void mouseExited(MouseEvent e) {<br />
<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; public void mouseReleased(MouseEvent e) { }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; public void drawStuff(Graphics g, Image img, int x, int y){<br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; g.drawImage(img, x, y, this);<br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; }<br />
&nbsp;<br />
&nbsp; &nbsp; public void wander(){<br />
&nbsp; &nbsp; &nbsp; Random generator = new Random();<br />
&nbsp; &nbsp; &nbsp; int randomInt;<br />
&nbsp; &nbsp; &nbsp; for(int i = 0; i &lt; 10; i++){<br />
&nbsp; &nbsp; &nbsp; &nbsp; randomInt = generator.nextInt(8);<br />
&nbsp; &nbsp; &nbsp; &nbsp; switch(randomInt){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 0:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(yellowY &gt; 20){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; yellowY -= 40;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 1:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(yellowY &gt; 20){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; yellowY -= 40;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(yellowX &lt; 380){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; yellowX += 40;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 2:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(yellowX &lt; 380){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; yellowX += 40;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 3:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(yellowY &lt; 380){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; yellowY += 40;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(yellowX &lt; 380){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; yellowX += 40;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 4:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(yellowY &lt; 380){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; yellowY += 40;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 5:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(yellowY &lt; 380){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; yellowY += 40;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(yellowX &gt; 100){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; yellowX -= 40;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 6:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(yellowX &gt; 100){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; yellowX -= 40;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 7:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(yellowY &gt; 20){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; yellowY -= 40;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(yellowX &gt; 100){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; yellowX -= 40;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; default:<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;X: &quot; + yellowX + &quot;, Y: &quot; + yellowY);<br />
&nbsp; &nbsp; &nbsp; &nbsp; revalidate();<br />
&nbsp; &nbsp; &nbsp; &nbsp; repaint();&nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; Wait.halfSec();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; }&nbsp;  <br />
&nbsp; }<br />
}<br />
}</pre><br />
i know its working because the println but no dice on the graphics update.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>aBenjamin</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241390.html</guid>
		</item>
		<item>
			<title>Help with File Manager Program</title>
			<link>http://www.daniweb.com/forums/thread241386.html</link>
			<pubDate>Wed, 25 Nov 2009 21:13:22 GMT</pubDate>
			<description>Fellow Java Coders, 
I recently got a project to do for my coursework in university which requires that me and my group members simulate a file manager similar to windows explorer but I guess not as complex.  Here is a synopsis of what is required: 
 
The members of this group were required to...</description>
			<content:encoded><![CDATA[<div>Fellow Java Coders,<br />
I recently got a project to do for my coursework in university which requires that me and my group members simulate a file manager similar to windows explorer but I guess not as complex.  Here is a synopsis of what is required:<br />
<br />
The members of this group were required to develop a Windows Program task manager written with a Java Graphical user Interface to view all system resources on our local machine.  The user interface is expected to be event driven.  It was outlined that simple Java iconic object type to create or import images as a part of the simulated interface.  It is also expected to feature a creatively designed user interface following good Human Computer Interface guidelines.<br />
Relevant permissions are to be assigned to users of the OS resources by way of an access control list.  The permissions are expected to be such that you can grant r-w-x, r-w and r access to users.<br />
<br />
A resource can become sharable from a multithreaded pool based on the access provided, that is, system resources could reside on a server and a java Web Client is utilised to communicate with the thread pool of objects from that Web server.<br />
<br />
The program is also expected to dump all web client-server connectivity sessions, file reads and updates to a log table which the option to write the same data to an index file is also available.  Users should be able to read from the log tables when called within the Java Application, either from the database or from the file.  Permission to add or remove a log file is based on permission granted from within the access control list.<br />
Any user with r-w-x privilege has mutual exclusive rights to the resource.  Other users will be assigned access based on priority.<br />
<br />
Here is what we have done so far but we have run into a number of problems (we created it in a project called Feather with 3 files; a table in access is also needed and a database connection called FeatherSource needs to be setup; to see the theme you also have to setup quaqua in project settings which is a .jar file...I will attach these files):<br />
<br />
 <pre style="margin:20px; line-height:13px">//Feather.java<br />
package Feather;<br />
<br />
//importing predifined methods/packages<br />
import javax.swing.*;<br />
import java.awt.event.*;<br />
import java.awt.*;<br />
import java.awt.Graphics;<br />
import java.sql.*;<br />
<br />
<br />
//Feather class <br />
public class Feather extends JFrame<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //label for username text field<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; private JLabel lblUName = new JLabel(&quot;Username&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //text field for username<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; private JTextField txtUName = new JTextField(20);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //label for password text field<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; private JLabel lblPWord = new JLabel (&quot;Password&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //password field for password<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; private JPasswordField pwfPWord = new JPasswordField(20);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //button for logging in<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; private JButton btnLogin = new JButton (&quot;Login&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //button for cancelling log in<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; private JButton btnCancel = new JButton (&quot;Cancel&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; private Image image;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //variables to store username and password<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; private String UserName, Password;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; private Connection featherConnect;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; private Statement featherStatement;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //no-argument constructor to setup GUI<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public Feather()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; super(&quot;Feather&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Container container = getContentPane();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; container.setLayout(new FlowLayout());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //adds label for username field to container<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; container.add(lblUName);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //adds text box for username field to container<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; container.add(txtUName);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //adds label for password field to container<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; container.add(lblPWord);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //adds text box for password field to container<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; container.add(pwfPWord);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Login Button<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; btnLogin = new JButton(&quot;Login&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //adds Login Button to container<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; container.add(btnLogin);<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; //Cancel Button<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; btnCancel = new JButton(&quot;Cancel&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //adds Cancel Button to container<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; container.add(btnCancel);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ActionHandler handler = new ActionHandler();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; btnLogin.addActionListener(handler);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pwfPWord.addActionListener(handler);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; btnCancel.addActionListener(<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; new ActionListener()<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; public void actionPerformed(ActionEvent event)<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; System.exit(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; }<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; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setSize(300, 300);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setVisible(true);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; con();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; private class ActionHandler implements ActionListener<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void actionPerformed(ActionEvent buttonEvent)<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; if(buttonEvent.getSource() == btnLogin)<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; try<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; featherStatement = featherConnect.createStatement();<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; String query = &quot;SELECT User, Pword,Permissions FROM MyTable&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; ResultSet result = featherStatement.executeQuery(query);<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; &nbsp; &nbsp; &nbsp; &nbsp; while (result.next())<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //print the columns of the row that was retrieved<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; UserName = result.getString(1);<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; Password = result.getString(2);<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; String perm = result.getString(3);<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; if ((txtUName.getText().equals(UserName))&amp;&amp;(pwfPWord.getText().equals(Password)))<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; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setVisible(false);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FeatherFileManager ffm = new FeatherFileManager(UserName, perm);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ffm.setSize(500,200);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ffm.setVisible(true);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ffm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);<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; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &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; catch (SQLException sqle)<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; sqle.printStackTrace();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void con()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /*the url specifiying the database to which this program connects using the JBDC to <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  connect to a Microsoft ODBC database */<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  String url = &quot;jdbc:odbc:FeatherSource&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  String userName = &quot;&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  String password = &quot;&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //Load the driver to allow connection to the database<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  try<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Class.forName(&quot;sun.jdbc.odbc.JdbcOdbcDriver&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  featherConnect = DriverManager.getConnection(url, userName, password);<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;  catch(ClassNotFoundException buttonEvent)<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;Failed to load JDBC/ODBC Driver&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  buttonEvent.printStackTrace();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  System.exit(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;  catch(SQLException sqle)<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.err.println(&quot;Unable to connect&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  sqle.printStackTrace();<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; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public static void main(String[] args) <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  System.setProperty(&quot;Quaqua.tabLayoutPolicy&quot;,&quot;wrap&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try <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; UIManager.setLookAndFeel(&quot;ch.randelshofer.quaqua.QuaquaLookAndFeel&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; catch (Exception e) <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Feather ft = new Feather();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
}</pre><br />
 <pre style="margin:20px; line-height:13px">//FeatherFileManager.java<br />
package Feather;<br />
<br />
//importing predifined methods/packages<br />
import javax.swing.*;<br />
import java.awt.event.*;<br />
import java.awt.*;<br />
import javax.swing.tree.*;<br />
import java.io.*;<br />
import javax.swing.JComponent.*;<br />
import java.awt.Container.*;<br />
import java.awt.Component.*;<br />
import java.sql.*;<br />
import java.io.File;<br />
import java.net.*;<br />
import javax.swing.table.DefaultTableModel;<br />
import javax.swing.table.TableCellRenderer;<br />
import javax.swing.table.TableColumn;<br />
import javax.swing.filechooser.*;<br />
import java.net.URI;<br />
import java.net.URISyntaxException;<br />
<br />
<br />
<br />
//FeatherFileManager class<br />
public class FeatherFileManager extends JFrame<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; private TableColumn column;<br />
&nbsp; &nbsp; &nbsp; &nbsp; private JTable featherTable;<br />
&nbsp; &nbsp; &nbsp; &nbsp; private DefaultTableModel ftmodel;<br />
&nbsp; &nbsp; &nbsp; &nbsp; String permission;<br />
&nbsp; &nbsp; &nbsp; &nbsp; Connection featherConnect;<br />
&nbsp; &nbsp; &nbsp; &nbsp; Statement featherStatement;&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; String UN;<br />
&nbsp; &nbsp; &nbsp; &nbsp; private String filePath;<br />
&nbsp; &nbsp; &nbsp; &nbsp; Socket socket = null;<br />
//&nbsp; &nbsp; &nbsp; &nbsp; private ToolPanel toolPanel;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; //constructor to set-up GUI<br />
&nbsp; &nbsp; &nbsp; &nbsp; public FeatherFileManager(String UserName,String permtype)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; super(&quot;Feather File Manager : &quot; + UserName + &quot; (&quot;+permtype+&quot;)&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; UN = UserName;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //File Menu<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JMenu fileMenu = new JMenu(&quot;File&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fileMenu.setMnemonic('F');<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Exit Menu Item on File Menu<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JMenuItem exitItem = new JMenuItem(&quot;Exit&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exitItem.setMnemonic('x');<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //ActionListener for Exit Menu Item<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exitItem.addActionListener(<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; new ActionListener()<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; public void actionPerformed(ActionEvent event)<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.exit(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; }<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; //Menu Bar<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JMenuBar menuBar = new JMenuBar();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setJMenuBar(menuBar);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; menuBar.add(fileMenu);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Connect Menu<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JMenu connectMenu = new JMenu(&quot;Connect&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; connectMenu.setMnemonic('N');<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; menuBar.add(connectMenu);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Edit Menu<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JMenu editMenu = new JMenu(&quot;Edit&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; editMenu.setMnemonic('E');<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; menuBar.add(editMenu);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //View Menu<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JMenu viewMenu = new JMenu(&quot;View&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; viewMenu.setMnemonic('W');<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; menuBar.add(viewMenu);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Help Menu<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JMenu helpMenu = new JMenu(&quot;Help&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; helpMenu.setMnemonic('H');<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; menuBar.add(helpMenu);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Logout Menu Item on File Menu<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JMenuItem logoutItem = new JMenuItem (&quot;Log Out&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; logoutItem.setMnemonic('L');<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Action Listener for Logout Menu Item<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; logoutItem.addActionListener(<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; new ActionListener()<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; public void actionPerformed(ActionEvent event)<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; setVisible(false);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Feather ft = new Feather();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ft.setSize(300,300);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ft.setVisible(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; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; );<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JMenuItem openItem = new JMenuItem (&quot;Open&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; openItem.setMnemonic('O');<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fileMenu.add(openItem);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fileMenu.add(logoutItem);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fileMenu.add(exitItem);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Add server menu item<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JMenuItem serverItem = new JMenuItem (&quot;Connect as Server&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; serverItem.setMnemonic('S');<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; //Adds client menu item<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JMenuItem clientItem = new JMenuItem (&quot;Connect as Client&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; serverItem.setMnemonic('C');<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; connectMenu.add(serverItem);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; connectMenu.add(clientItem);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Creates Scroll Pane for tree and table<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JScrollPane viewPermissions,viewTree;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Declares featherTree as type Tree<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JTree featherTree;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DefaultTreeModel featherTreeModel;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DefaultMutableTreeNode featherFolder = new DefaultMutableTreeNode(&quot;Feather&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Creates tree with root featherFolder<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; featherTree=new JTree(featherFolder);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; featherTree.addMouseListener(<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; new MouseAdapter()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void mouseClicked(MouseEvent g)<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; setDirectory(&quot;e:\\Feather\\Feather\\Root\\&quot;);<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; );<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Maps root to root folder of the file system<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; listAllFiles(&quot;e:\\Feather\\Feather\\Root\\&quot;, featherFolder,true);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; viewTree= new JScrollPane(featherTree);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ftmodel= new DefaultTableModel();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Declares feather table as type JTable<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; featherTable= new JTable(ftmodel)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public Class getColumnClass(int column)<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; return getValueAt(0, column).getClass();<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; public boolean isCellEditable(int rowIndex, int colIndex)<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; return false;<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; public Class getRowClass(int row)<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; return getValueAt(0, row).getClass();<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; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ftmodel.addColumn(&quot;&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ftmodel.addColumn(&quot;Name&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ftmodel.addColumn(&quot;Type&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; column = featherTable.getColumnModel().getColumn(0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; column.setMaxWidth(30);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; column = featherTable.getColumnModel().getColumn(2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; column.setPreferredWidth(10);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; column.setWidth(10);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setDirectory(&quot;e:\\Feather\\Feather\\Root\\&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; featherTable.addMouseListener(<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; new MouseAdapter()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int row_int;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void mouseClicked(MouseEvent e)<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; int r=featherTable.rowAtPoint(e.getPoint());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String ffolder = (String) (ftmodel.getValueAt(r, 2));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (ffolder == &quot;Folder&quot;)<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; filePath +=(String)&nbsp; (ftmodel.getValueAt(r, 1)) + '\\';<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setDirectory(filePath);<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; 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; String fileName = (String)(ftmodel.getValueAt(r,1));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fileName = fileName + &quot;.&quot; +(String) (ftmodel.getValueAt(r,2));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String ffp = filePath + fileName;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; File file = new File(ffp);<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; if(true)<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; fileName = (String) (ftmodel.getValueAt(r,1));<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; fileName = '&quot;'+fileName + '&quot;'+(String) (ftmodel.getValueAt(r,2));<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; ffp=filePath +fileName;<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; file= new File(ffp);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Runtime frun = Runtime.getRuntime();<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; frun.exec(&quot;cmd /c start &quot; + file);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; catch(Throwable f)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<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; //JOptionPane.showMessageDialog(null,&quot;Table in: &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<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; viewPermissions=new JScrollPane(featherTable);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; getContentPane().add(viewPermissions, BorderLayout.CENTER);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Sets the size of scroll panes viewTree and view Permissions&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; viewTree.setMinimumSize(new Dimension(250, 500));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; viewPermissions.setMinimumSize(new Dimension(200, 500));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; viewTree.setPreferredSize(new Dimension(250, 500));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; viewPermissions.setPreferredSize(new Dimension(200, 500));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Adds scroll panes viewTree and view Permissions to Split pane<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JSplitPane featherPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, viewTree, viewPermissions);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; getContentPane().add(featherPane, BorderLayout.CENTER);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Connects to the database and allows the User to open a file based on the permissions they have<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; con();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; openItem.addActionListener(<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; new ActionListener()<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; public void actionPerformed(ActionEvent event)<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; try<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; featherStatement = featherConnect.createStatement();<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; String query = &quot;SELECT User,Pword, Permissions FROM MyTable&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; ResultSet result = featherStatement.executeQuery(query);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while (result.next())<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String Username = result.getString(1);<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; String pw= result.getString(2);<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; permission = result.getString(3);<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; <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; if ((UN).equals(Username)&amp;&amp;permission.equals(&quot;admin&quot;)||permission.equals(&quot;admim&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; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; featherfilelock();<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; }<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; else<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; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; featherfileunlock();<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; }<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; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; catch (SQLException sqle)<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; sqle.printStackTrace();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<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; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; );<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; //recursive function to create nodes for the tree<br />
&nbsp; &nbsp; &nbsp; &nbsp; public static void listAllFiles(String directory, DefaultMutableTreeNode parent, Boolean recursive)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; File [] children = new File(directory).listFiles();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int i = 0; i &lt; children.length; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DefaultMutableTreeNode node = new DefaultMutableTreeNode(children[i].getName());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (children[i].isDirectory()&amp;&amp; recursive)<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; parent.add(node);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; listAllFiles(children[i].getPath(),node,recursive);<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 (!children[i].isDirectory())<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; parent.add(node);<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; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &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 void con()<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /*the url specifiying the database to which this program connects using the JBDC to <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  connect to a Microsoft ODBC database */<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  String url = &quot;jdbc:odbc:FeatherSource&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  String userName = &quot;&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  String password = &quot;&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //Load the driver to allow connection to the database<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  try<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Class.forName(&quot;sun.jdbc.odbc.JdbcOdbcDriver&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  featherConnect = DriverManager.getConnection(url, userName, password);<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;  catch(ClassNotFoundException buttonEvent)<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;Failed to load JDBC/ODBC Driver&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  buttonEvent.printStackTrace();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  System.exit(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;  catch(SQLException sqle)<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.err.println(&quot;Unable to connect&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  sqle.printStackTrace();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; public void featherfilelock()<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null,&quot;Please select a file&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fileopen();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; public static void featherfileunlock()<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //JOptionPane.showMessageDialog(null,&quot;You are not athorized for veiwing&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; //Method to Open a file<br />
&nbsp; &nbsp; &nbsp; &nbsp; private void fileopen()<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JFileChooser filechoose = new JFileChooser(&quot;C:\\users\\kimani\\desktop\\feather\\feather\\Root\\&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; filechoose.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int result = filechoose.showOpenDialog( this );<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ( result == JFileChooser.CANCEL_OPTION)<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; JOptionPane.showMessageDialog(null,&quot;Goodbye&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Opens a file<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ( result == JFileChooser.APPROVE_OPTION)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //This try block checks to see if a file can be open <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Allow files that needs a different application to run in to be opened in the respective application<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Runtime featherRun = Runtime.getRuntime();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; featherRun.exec(&quot;cmd /c start &quot; + filechoose.getSelectedFile());<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; catch(Throwable e)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; File fileName = filechoose.getSelectedFile();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if((fileName== null) || (fileName.getName().equals(&quot;&quot;)))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(this, &quot;Invalid File Name&quot;,&quot;Invalid File Name&quot;,JOptionPane.ERROR_MESSAGE);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //System.exit(1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; // This is a recursive function list all the files in the directory and shows it in the table<br />
&nbsp; &nbsp; &nbsp; &nbsp; public void setDirectory(String dir)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; filePath = dir;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ftmodel.setNumRows(0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; File ftfolder = new File(dir);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(ftfolder.listFiles() != null)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; File[] listOfFiles =ftfolder.listFiles();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int z=0; z&lt; listOfFiles.length;z++)<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; if(listOfFiles[z].isFile()&amp;&amp; !listOfFiles[z].isHidden())<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String fileName=listOfFiles[z].getName();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int dotPos = fileName.lastIndexOf(&quot;.&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String fileType = fileName.substring(dotPos);<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; //String fileType = fileName.substring(0, fileName.lastIndexOf(&quot;.&quot;)+1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fileName = fileName.substring(0,fileName.lastIndexOf(&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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Icon featherIcon = null;<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; try<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; File ftfile= File.createTempFile(&quot;icon&quot;, &quot;.&quot; +fileType);<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; FileSystemView view = FileSystemView.getFileSystemView();<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; featherIcon= view.getSystemIcon(ftfile);<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; ftfile.delete();<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; catch(IOException e)<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; e.printStackTrace();<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; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Object row[] ={featherIcon, fileName, fileType.toUpperCase()};<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; ftmodel.addRow(row);<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; //This lists the files if they are directories<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if(listOfFiles[z].isDirectory())<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; Icon icon= new ImageIcon(&quot;..\\icon.png&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Object row[] = {icon, listOfFiles[z].getName(), &quot;Folder&quot;};<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ftmodel.addRow(row);<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; <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; <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; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &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; <br />
<br />
}</pre><br />
 <pre style="margin:20px; line-height:13px">// Unrolled and not inlined version with 2 readers and 2 writers<br />
// No data structure used for readers and writers to work with<br />
// Specific notification locks are used to improve performance<br />
<br />
class RWnotif {<br />
&nbsp; static Controller ctl;<br />
<br />
&nbsp; public static void main (String argv[]) {<br />
&nbsp; &nbsp; ctl = new Controller();<br />
<br />
&nbsp; &nbsp; &nbsp; new Reader1(ctl).start();<br />
&nbsp; &nbsp; &nbsp; new Reader2(ctl).start();<br />
&nbsp; &nbsp; &nbsp; new Writer1(ctl).start();<br />
&nbsp; &nbsp; &nbsp; new Writer2(ctl).start();<br />
&nbsp; }<br />
}<br />
<br />
<br />
final class Reader1 extends Thread {<br />
&nbsp; protected Controller ctl;<br />
<br />
&nbsp; public Reader1(Controller c) { ctl = c;}<br />
<br />
&nbsp; public void run()<br />
&nbsp; {<br />
&nbsp; &nbsp; while (true) {<br />
&nbsp; &nbsp; &nbsp; ctl.startRead();<br />
&nbsp; &nbsp; &nbsp; System.out.println(&quot;reader reading:&quot;);<br />
&nbsp; &nbsp; &nbsp; System.out.println(&quot;done reading&quot;);<br />
&nbsp; &nbsp; &nbsp; ctl.stopRead();<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; } // end public void run()<br />
}<br />
final class Reader2 extends Thread {<br />
&nbsp; protected Controller ctl;<br />
<br />
&nbsp; public Reader2(Controller c) { ctl = c;}<br />
<br />
&nbsp; public void run()<br />
&nbsp; {<br />
&nbsp; &nbsp; while (true) {<br />
&nbsp; &nbsp; &nbsp; ctl.startRead();<br />
&nbsp; &nbsp; &nbsp; System.out.println(&quot;reader reading:&quot;);<br />
&nbsp; &nbsp; &nbsp; System.out.println(&quot;done reading&quot;);<br />
&nbsp; &nbsp; &nbsp; ctl.stopRead();<br />
&nbsp; &nbsp; }<br />
&nbsp; } // end public void run()<br />
}<br />
<br />
final class Writer1 extends Thread {<br />
&nbsp; protected Controller ctl;<br />
<br />
&nbsp; public Writer1(Controller c) { ctl = c;}&nbsp; <br />
<br />
&nbsp; public void run()&nbsp; <br />
&nbsp; {&nbsp; <br />
&nbsp; &nbsp; while (true) {<br />
&nbsp; &nbsp; &nbsp; ctl.startWrite();<br />
&nbsp; &nbsp; &nbsp; System.out.println(&quot;writer writing:&quot;);<br />
&nbsp; &nbsp; &nbsp; System.out.println(&quot;done writing&quot;);<br />
&nbsp; &nbsp; &nbsp; ctl.stopWrite();<br />
&nbsp; &nbsp; }<br />
&nbsp; } // end public void run()<br />
}<br />
<br />
final class Writer2 extends Thread {<br />
&nbsp; protected Controller ctl;<br />
&nbsp; &nbsp; <br />
&nbsp; public Writer2(Controller c) { ctl = c;}<br />
<br />
&nbsp; public void run()<br />
&nbsp; {<br />
&nbsp; &nbsp; while (true) {<br />
&nbsp; &nbsp; &nbsp; ctl.startWrite();<br />
&nbsp; &nbsp; &nbsp; System.out.println(&quot;writer writing:&quot;);<br />
&nbsp; &nbsp; &nbsp; System.out.println(&quot;done writing&quot;);<br />
&nbsp; &nbsp; &nbsp; ctl.stopWrite();<br />
&nbsp; &nbsp; }<br />
&nbsp; } // end public void run()<br />
}<br />
<br />
<br />
class Controller<br />
{<br />
&nbsp; &nbsp; private int nr = 0;<br />
&nbsp; &nbsp; private int nw = 0;<br />
&nbsp; &nbsp; private Object or = new Object();<br />
&nbsp; &nbsp; private Object ow =&nbsp; new Object();<br />
&nbsp;  <br />
&nbsp; &nbsp; public void startRead()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; synchronized(or)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while(!checkRead())<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try{or.wait();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }catch(InterruptedException e){}<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; private synchronized boolean checkRead()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(nw == 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nr++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; else return false;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public void stopRead()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; synchronized(this){nr--;}<br />
&nbsp; &nbsp; &nbsp; &nbsp; synchronized(ow){ow.notify();}<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public void startWrite()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; synchronized(ow)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while(!checkWrite())<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try{ow.wait();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }catch(InterruptedException e) {}<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; private synchronized boolean checkWrite()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; if((nw == 0) &amp;&amp; (nr == 0))<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nw++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; else return false;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public void stopWrite()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; synchronized(this){nw--;}<br />
&nbsp; &nbsp; &nbsp; &nbsp; synchronized(or){or.notifyAll();}<br />
&nbsp; &nbsp; &nbsp; &nbsp; synchronized(ow){ow.notify();}<br />
&nbsp; &nbsp; }<br />
}</pre><br />
If anyone can help sort out the bugs, which include:<br />
<br />
+ We can't seem to get pics in the background even though the code seems to have no visible syntax or logic errors.<br />
+ Changing the directories of each of the nodes in the tree is buggy.<br />
+ Locking of files is also a problem.<br />
<br />
I know this may be wordy and lengthy but I wanted to make sure that any one who can help understands what we are trying to accomplish...any HELP would be appreciated whether CODE SNIPPETS or by other means... THANK YOU to all those who take the time to read this.  p.s. It is due this Friday.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>tabooxchanz</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241386.html</guid>
		</item>
		<item>
			<title>java swing question</title>
			<link>http://www.daniweb.com/forums/thread241374.html</link>
			<pubDate>Wed, 25 Nov 2009 19:49:53 GMT</pubDate>
			<description><![CDATA[Hi, i've started making a simple breakout game with java swing.  This is just for fun and to learn more about java and swing.  I got a frame and a panel and a mouse listener.  I draw a paddle on the screen and it moves as the mouse moves.  I also print out on motion the x value of the mouse. 
 
I...]]></description>
			<content:encoded><![CDATA[<div>Hi, i've started making a simple breakout game with java swing.  This is just for fun and to learn more about java and swing.  I got a frame and a panel and a mouse listener.  I draw a paddle on the screen and it moves as the mouse moves.  I also print out on motion the x value of the mouse.<br />
<br />
I want a timer to move the ball.  My timer is in the frame class and it works.  right now its called every second and increments a variable z. with system.out.println, i can see z incrementing.<br />
<br />
The problem is i'm tring to print out z in the drawing function on the screen ( same place x is printing) and it is allways 0.  z is a variable on the frame object and panel object. in the frame class where the timer is i do panel.setz(z);.<br />
<br />
i think i have two copies of my panel. breakoutpanel panel; is a class variable in the frame.   in the constructor i do <br />
<br />
panel=new breakoutpanel();<br />
frame.add(panel);<br />
<br />
the constructor is called twice.  when i comment out frame.add(panel) its called once.  so i guess my actual panel is a copy of my panel variable, and once i do frame.add(panel); i need to talk to that panel and my code with panel.setz(z); is communication with the panel i started with and coppied.  How would i do this?<br />
<br />
Mike</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>adams161</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241374.html</guid>
		</item>
		<item>
			<title>Network - transfer byte array back to image problem</title>
			<link>http://www.daniweb.com/forums/thread241367.html</link>
			<pubDate>Wed, 25 Nov 2009 19:16:49 GMT</pubDate>
			<description><![CDATA[Hi, 
 
I first convert the image on the server application in bytes: 
  <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>Hi,<br />
<br />
I first convert the image on the server application in bytes:<br />
 <pre style="margin:20px; line-height:13px">//server<br />
&nbsp;public void sendImage(File file) throws IOException {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ByteArrayOutputStream baos=new ByteArrayOutputStream(1000);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; BufferedImage img=ImageIO.read(new File(file.getAbsolutePath()));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ImageIO.write(img, &quot;jpg&quot;, baos);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; baos.flush();<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; os.write(baos.toByteArray());// this is a &quot;new DataOutputStream(clientSocket.getOutputStream());&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Done! Length is:&quot;+baos.toByteArray().length);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; baos.close();<br />
}</pre><br />
Then my application freezes when trying to  convert the bytes array back to image.<br />
 <pre style="margin:20px; line-height:13px">//client<br />
public void receiveImage() throws IOException<br />
&nbsp;  {<br />
<br />
byte[] bytearray = new byte[4096];<br />
is.readFully(bytearray);// &quot;new DataInputStream(clientSocket.getInputStream());&quot; here my app freezes. and i don't knwo array length. <br />
BufferedImage imag=ImageIO.read(new ByteArrayInputStream(bytearray));<br />
ImageIO.write(imag, &quot;jpg&quot;, new File(&quot;abc.jpg&quot;));<br />
<br />
this.setLayout(new FlowLayout());<br />
this.add(new ImagePanel(imag));<br />
this.validate();<br />
&nbsp;  }</pre>I probabily done something wrong...  Is this a good aproach to transfer images fast? <br />
Can someone help please?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>Clawsy</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241367.html</guid>
		</item>
		<item>
			<title>Illegal Start of Expression</title>
			<link>http://www.daniweb.com/forums/thread241357.html</link>
			<pubDate>Wed, 25 Nov 2009 18:28:49 GMT</pubDate>
			<description><![CDATA[Hi, i'm learning java and I don't know why I'm getting this error.  
New Error on line 11 - "Cannot find symbol" 
  <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>Hi, i'm learning java and I don't know why I'm getting this error. <br />
New Error on line 11 - &quot;Cannot find symbol&quot;<br />
 <pre style="margin:20px; line-height:13px"> int first, second;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int first, second;<br />
&nbsp; &nbsp; &nbsp; &nbsp; double firstcube, secondcube, power = 3, num = 3, pow;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; Scanner scan = new Scanner(System.in);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Enter First Number: &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; first = scan.nextInt();<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Enter Second number: &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; second = scan.nextInt();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; firstcube = pow (num, power);</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>anevins</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241357.html</guid>
		</item>
		<item>
			<title>Basic Math Tutoring Program</title>
			<link>http://www.daniweb.com/forums/thread241346.html</link>
			<pubDate>Wed, 25 Nov 2009 17:36:44 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 MathTutor {<br />
&nbsp; &nbsp; Scanner input = new Scanner(System.in);<br />
&nbsp; &nbsp; &nbsp; &nbsp; int numQuestions;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int choice;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int numCorrect;<br />
&nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; public MathTutor (){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; numQuestions = choice = numCorrect = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp;  public int getNumQuestions(){&nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.print(&quot;How many questions? &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; numQuestions = input.nextInt();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (numQuestions &lt; 1)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Invalid - must ask at least 1 question&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }return numQuestions;}<br />
&nbsp; &nbsp; &nbsp; &nbsp; public int getQuestionType(){ while (choice &lt; 1 || choice &gt; 4)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Please select the type of questions you would like&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;1) Addition&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;2) Subtraction&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;3) Multiplication&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;4) Division&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.print(&quot;Type: &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; choice = input.nextInt();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (choice &lt; 1 || choice &gt; 4)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Choice must be in the range 1-4&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }return choice;}<br />
<br />
&nbsp; &nbsp; public void askQuestions() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; for (int i = 0; i &lt; numQuestions; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int num1 = genRandomNum(1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int num2 = genRandomNum(1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int sign = choice;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (sign == 5)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sign = (int)(Math.random() * 4 + 1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; switch(sign)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 1: addition(num1, num2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 2: subtraction(num1, num2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 3: multiplication(num1, num2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 4: division(num1, num2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; default: System.out.println(&quot;Error&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.exit(1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public int genRandomNum(int difficulty) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (difficulty == 1)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return (int)(Math.random() * 10);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return (int)(Math.random() * 100);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
&nbsp;  <br />
&nbsp; &nbsp; public void addition(int num1, int num2) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.print(&quot;What is &quot; + num1 + &quot; + &quot; + num2 + &quot;? &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; int answer = input.nextInt();<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (num1 + num2 == answer)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Correct&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; numCorrect++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Incorrect -&gt; &quot; + num1 + &quot; + &quot; + num2 + &quot; = &quot; + num1+num2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
&nbsp;  <br />
&nbsp; &nbsp; public void subtraction(int num1, int num2) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.print(&quot;What is &quot; + num1 + &quot; - &quot; + num2 + &quot;? &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; int answer = input.nextInt();<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (num1 - num2 == answer)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Correct&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; numCorrect++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Incorrect -&gt; &quot; + num1 + &quot; - &quot; + num2 + &quot; = &quot; + num1+num2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
&nbsp;  <br />
&nbsp; &nbsp; public void multiplication(int num1, int num2) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.print(&quot;What is &quot; + num1 + &quot; * &quot; + num2 + &quot;? &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; int answer = input.nextInt();<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (num1 * num2 == answer)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Correct&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; numCorrect++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Incorrect -&gt; &quot; + num1 + &quot; * &quot; + num2 + &quot; = &quot; + num1+num2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
&nbsp;  <br />
&nbsp; &nbsp; public void division(int num1, int num2) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; boolean quotientCorrect = false;<br />
&nbsp; &nbsp; &nbsp; &nbsp; boolean remainderCorrect = false;<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.print(&quot;What is the quotient of &quot; + num1 + &quot; / &quot; + num2 + &quot;? &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; int answer = input.nextInt();<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.print(&quot;What is the remainder of &quot; + num1 + &quot; / &quot; + num2 + &quot;? &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; int remainder = input.nextInt();<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (num1 / num2 == answer)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; quotientCorrect = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (num1 % num2 == remainder)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; remainderCorrect = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (quotientCorrect &amp;&amp; remainderCorrect)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Correct&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; numCorrect++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Incorrect -&gt; &quot; + num1 + &quot; / &quot; + num2 + &quot; = &quot; + num1/num2 + &quot;r&quot; + num1%num2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public void printReport(long totalTime) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Number of correct responses: &quot; + numCorrect + &quot;/&quot; + numQuestions);<br />
&nbsp; &nbsp; &nbsp; &nbsp; double percent = numCorrect/numQuestions;<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Your percentage: &quot; + percent + &quot;%&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Total time taken: &quot; + totalTime/1000 + &quot;s&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Average time per question: &quot; + (totalTime/numQuestions)/1000 + &quot;s&quot;);<br />
&nbsp; &nbsp; }<br />
}</pre><br />
This is what I have so far.... I think. Here's my assignment:<br />
<br />
<br />
<br />
<br />
Create a Java class that will help elementary school students learn basic arithmetic operations (addition, subtraction, multiplication, and division). The class will contain a menu that allows the user to choose the operation. It will then use a Random object to produce two positive one-digit integers. It will then prompt the user with a question, such as<br />
<br />
How much is 6 plus 4?<br />
<br />
The student will input the answer. Another method will verify if the answer is correct. Use another Random object to generate a number in the range of 1-4. If the student's answer is correct, the random number will be used to indicate which message to display from a String array of correct responses:<br />
<br />
Very good!<br />
Excellent!<br />
Nice work!<br />
Keep up the good work!<br />
<br />
If the student's answer is incorrect use the random number to indicate which element of the incorrect responses String array to display:<br />
<br />
No. Please try again.<br />
Wrong. Try once more.<br />
Don't give up!<br />
No. Keep trying.<br />
<br />
For each operation that the student selects, they are to answer 10 questions. The program should monitor the students's performance for that particular math operation and display the percentage that the user answered correctly. If the percentage is lower than 75%, display &quot;Please ask your teacher for extra help with __________.&quot;<br />
<br />
Allow the user to return to the menu after finishing an operation, so they can choose to try another math operation or quit the program.<br />
<br />
Note: this assignment contains two classes: The arithmetic program and a client.<br />
<br />
<br />
I'm in the middle of getting the grading program/set amount of questions/varied correct and incorrect responses added to the program. My main issue is... No matter what I do in my client, I can't seem to get this to run.... Horribly enough, at this stage of sleep depravation, I'm not even making sense of why this program would want to be separated into client/main file, or even how to make a client for something that doesn't even need anything set/inputted except for the number of questions you want the student to do. Can anyone give me a push in the right direction?<br />
<br />
Thanks<br />
~Will</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>LucarioWill</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241346.html</guid>
		</item>
		<item>
			<title>Help with Constructors in Java</title>
			<link>http://www.daniweb.com/forums/thread241319.html</link>
			<pubDate>Wed, 25 Nov 2009 15:57:49 GMT</pubDate>
			<description><![CDATA[---Quote--- 
 I'm having a problem with constructor. I get an error  an error "invalid method declaration; return type required" on line 75 ..here is line 75   TypeOfStudent(int minAge, int maxAge, String name) ..and I've posted my whole code below 
---End Quote--- 
  <div class="codeblock"> <div...]]></description>
			<content:encoded><![CDATA[<div><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 />   I'm having a problem with constructor. I get an error  an error &quot;invalid method declaration; return type required&quot; on line 75 ..here is line 75   TypeOfStudent(int minAge, int maxAge, String name) ..and I've posted my whole code below  <hr /> </td> </tr> </table> </div> <pre style="margin:20px; line-height:13px">import java.util.*;<br />
<br />
public class Student <br />
{<br />
&nbsp; private String name;<br />
&nbsp; private int age;<br />
&nbsp; <br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; public Student(String newName, int newAge) <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setName (newName);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setAge(newAge);<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; public void setName (String newName)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; name = newName;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; public String getName ()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return name;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; public void setAge (int newAge)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (newAge &gt; 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; age = newAge;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println (&quot;Age cannot be zero or less.&quot;);&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; public int getAge ()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return age;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; public String fullString ()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return (&quot;\nName of Student:&quot; + name+ &quot;\nAge of Student:&quot; +age+ &quot;Years.&quot;);<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <br />
&nbsp;<br />
<br />
<br />
&nbsp;  public String TypeOfStudent() <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; for(TypeOfStudent t : TypeOfStudent.values()) <br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(age &gt;= t.getMinAge() &amp;&amp; age &lt;= t.getMaxAge())<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return t.getName();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
<br />
<br />
&nbsp;  public enum TypeOfStudent <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {PRESCHOOL(0, 4), KINDERGARTEN(5, 5), ELEMENTARY_SCHOOL(6, 10), MIDDLE_SCHOOL(11, 13), HIGH_SCHOOL(14, 17), COLLEGE(18, 99)}<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; private final int minAge, maxAge;<br />
&nbsp; &nbsp; private final String name;<br />
&nbsp; &nbsp; <br />
&nbsp;  <br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp;  <br />
&nbsp; &nbsp;  TypeOfStudent(int minAge, int maxAge, String name)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; this.minAge = minAge;<br />
&nbsp; &nbsp; &nbsp; &nbsp; this.maxAge = maxAge;<br />
&nbsp; &nbsp; &nbsp; &nbsp; this.name = name;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; public int getMinAge() <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; return minAge;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; public int getMaxAge() <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; return maxAge;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; public String getName() <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; return name;<br />
&nbsp; &nbsp; &nbsp;  }<br />
&nbsp;}<br />
}</pre><br />
<br />
<br />
<br />
<br />
 <pre style="margin:20px; line-height:13px">public class StudentClient<br />
{<br />
&nbsp; public static void main( String [] args )<br />
&nbsp; {<br />
&nbsp; &nbsp; Student student1 = new Student(&quot;Bob&quot;, 15);<br />
&nbsp; &nbsp; Student student2 = new Student(&quot;Jan&quot;, 13);<br />
&nbsp; &nbsp; System.out.println(&quot;Name: &quot; + student1.getName());<br />
&nbsp; &nbsp; System.out.println(&quot;Age: &quot; + student1.getAge());<br />
&nbsp; &nbsp; System.out.println(&quot;Type of Student: &quot; + student1.typeOfStudent());&nbsp; &nbsp; <br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; System.out.println(&quot;\n&quot; + student2.fullString());<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Type of Student: &quot; + student2.typeOfStudent());<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; student1.setName(&quot;Ted&quot;);<br />
&nbsp; &nbsp; student1.setAge(35);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;\n&quot; + student1.fullString());<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Type of Student: &quot; + student1.typeOfStudent());&nbsp; &nbsp; &nbsp;  <br />
&nbsp; } //ends main<br />
<br />
&nbsp;<br />
<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>doobiez</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241319.html</guid>
		</item>
		<item>
			<title>NetBeans GUI Java Tic Tac Toe</title>
			<link>http://www.daniweb.com/forums/thread241317.html</link>
			<pubDate>Wed, 25 Nov 2009 15:50:01 GMT</pubDate>
			<description><![CDATA[I'm having problems generating CPU turn; preferably with AI, and also draw between player and CPU. 
 
 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox"...]]></description>
			<content:encoded><![CDATA[<div>I'm having problems generating CPU turn; preferably with AI, and also draw between player and CPU.<br />
<br />
<br />
<br />
 <pre style="margin:20px; line-height:13px">&nbsp; &nbsp; &nbsp; jButton1.setEnabled(false);<br />
&nbsp; &nbsp; &nbsp; &nbsp; boolean Userturn = true;<br />
&nbsp; &nbsp; &nbsp;  JLabel[] label = new JLabel[9];<br />
&nbsp; &nbsp; &nbsp;  label [0] = jLabel1;<br />
&nbsp; &nbsp; label [1] = jLabel2;<br />
&nbsp; &nbsp; label [2] = jLabel3;<br />
&nbsp; &nbsp; label [3] = jLabel4;<br />
&nbsp; &nbsp; label [4] = jLabel5;<br />
&nbsp; &nbsp; label [5] = jLabel6;<br />
&nbsp; &nbsp; label [6] = jLabel7;<br />
&nbsp; &nbsp; label [7] = jLabel8;<br />
&nbsp; &nbsp; label [8] = jLabel9;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  char [] Board = {<br />
&nbsp; &nbsp; &nbsp; &nbsp; '1', '2', '3',<br />
&nbsp; &nbsp; &nbsp; &nbsp; '4', '5', '6',<br />
&nbsp; &nbsp; &nbsp; &nbsp; '7', '8', '9'<br />
&nbsp; &nbsp; };<br />
Random generator = new Random();<br />
int CPU = generator.nextInt(9);<br />
<br />
<br />
&nbsp;  String xuser;<br />
&nbsp;  int iuser;<br />
&nbsp;  for (int x = 0; x &lt; Board.length; x++) {<br />
&nbsp;  if(Userturn){<br />
&nbsp; xuser = JOptionPane.showInputDialog(&quot;Enter a number between 1-9&quot;);<br />
&nbsp; iuser = Integer.parseInt(xuser);<br />
&nbsp; label [iuser -1] .setText (&quot;O&quot;);<br />
&nbsp; Board[iuser -1] = 'O';<br />
<br />
<br />
&nbsp; if(Board [0] == 'O' &amp;&amp; Board[1] == 'O' &amp;&amp; Board[2] == 'O'){<br />
&nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, &quot;You Win!&quot;);<br />
&nbsp; &nbsp; &nbsp; break;<br />
&nbsp; }<br />
&nbsp; if(Board [0] == 'X' &amp;&amp; Board[1] == 'X' &amp;&amp; Board[2] == 'X'){<br />
&nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, &quot;You Lose!&quot;);<br />
&nbsp; &nbsp; &nbsp; break;<br />
&nbsp; }<br />
&nbsp;  if(Board [3] == 'O' &amp;&amp; Board[4] == 'O' &amp;&amp; Board[5] == 'O'){<br />
&nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, &quot;You Win!&quot;);<br />
&nbsp; &nbsp; &nbsp; break;<br />
&nbsp;  }<br />
&nbsp; if(Board [3] == 'X' &amp;&amp; Board[4] == 'X' &amp;&amp; Board[5] == 'X'){<br />
&nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, &quot;You Lose!&quot;);<br />
&nbsp; &nbsp; &nbsp; break;<br />
&nbsp; }<br />
&nbsp; if(Board [6] == 'O' &amp;&amp; Board[7] == 'O' &amp;&amp; Board[8] == 'O'){<br />
&nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, &quot;You Win!&quot;);<br />
&nbsp; &nbsp; &nbsp; break;<br />
&nbsp; }<br />
&nbsp; if(Board [6] == 'X' &amp;&amp; Board[7] == 'X' &amp;&amp; Board[8] == 'X'){<br />
&nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, &quot;You Lose!&quot;);<br />
&nbsp; &nbsp; &nbsp; break;<br />
&nbsp; }<br />
&nbsp; if(Board [0] == 'O' &amp;&amp; Board[3] == 'O' &amp;&amp; Board[6] == 'O'){<br />
&nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, &quot;You Win!&quot;);<br />
&nbsp; &nbsp; &nbsp; break;<br />
&nbsp; }<br />
&nbsp; if(Board [0] == 'X' &amp;&amp; Board[3] == 'X' &amp;&amp; Board[6] == 'X'){<br />
&nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, &quot;You Lose!&quot;);<br />
&nbsp; &nbsp; &nbsp; break;<br />
&nbsp; }<br />
&nbsp; if(Board [1] == 'O' &amp;&amp; Board[4] == 'O' &amp;&amp; Board[7] == 'O'){<br />
&nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, &quot;You Win!&quot;);<br />
&nbsp; &nbsp; &nbsp; break;<br />
&nbsp; }<br />
&nbsp; if(Board [1] == 'X' &amp;&amp; Board[4] == 'X' &amp;&amp; Board[7] == 'X'){<br />
&nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, &quot;You Lose!&quot;);<br />
&nbsp; &nbsp; &nbsp; break;<br />
&nbsp; }<br />
&nbsp; if(Board [2] == 'O' &amp;&amp; Board[5] == 'O' &amp;&amp; Board[8] == 'O'){<br />
&nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, &quot;You Win!&quot;);<br />
&nbsp; &nbsp; &nbsp; break;<br />
&nbsp; }<br />
&nbsp;  if(Board [2] == 'X' &amp;&amp; Board[5] == 'X' &amp;&amp; Board[8] == 'X'){<br />
&nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, &quot;You Lose!&quot;);<br />
&nbsp; &nbsp; &nbsp; break;<br />
&nbsp;  }<br />
&nbsp;  if(Board [0] == 'O' &amp;&amp; Board[4] == 'O' &amp;&amp; Board[8] == 'O'){<br />
&nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, &quot;You Win!&quot;);<br />
&nbsp; &nbsp; &nbsp; break;<br />
&nbsp;  }<br />
&nbsp;  if(Board [0] == 'X' &amp;&amp; Board[4] == 'X' &amp;&amp; Board[8] == 'X'){<br />
&nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, &quot;You Lose!&quot;);<br />
&nbsp; &nbsp; &nbsp; break;<br />
&nbsp;  }<br />
&nbsp;  if(Board [2] == 'O' &amp;&amp; Board[4] == 'O' &amp;&amp; Board[6] == 'O'){<br />
&nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, &quot;You Win!&quot;);<br />
&nbsp; &nbsp; &nbsp; break;<br />
&nbsp;  }<br />
&nbsp; if(Board [2] == 'X' &amp;&amp; Board[4] == 'X' &amp;&amp; Board[6] == 'X'){<br />
&nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, &quot;You Lose!&quot;);<br />
&nbsp; &nbsp; &nbsp; break;<br />
<br />
<br />
<br />
&nbsp; }<br />
&nbsp; Userturn = false;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }else{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Userturn = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; }</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>NewbieProgram</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241317.html</guid>
		</item>
		<item>
			<title>Reading and passing each line from a text file</title>
			<link>http://www.daniweb.com/forums/thread241311.html</link>
			<pubDate>Wed, 25 Nov 2009 15:18:35 GMT</pubDate>
			<description><![CDATA[Hey guys, basically what i'm trying to do is take each line from two text files and store them into two variables, salt and original. I then want to pass these 2 variables to a different method called:  
crypt(String salt, String original) 
How would I go about doing this? 
 
Many thanks 
 
  <div...]]></description>
			<content:encoded><![CDATA[<div>Hey guys, basically what i'm trying to do is take each line from two text files and store them into two variables, salt and original. I then want to pass these 2 variables to a different method called: <br />
crypt(String salt, String original)<br />
How would I go about doing this?<br />
<br />
Many thanks<br />
<br />
 <pre style="margin:20px; line-height:13px">public static void main(String[] args)<br />
&nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; String salt = new String();<br />
&nbsp; &nbsp; &nbsp; &nbsp; String original = new String();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; try{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Open the file that is the first <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FileReader wordlist = new FileReader(&quot;/home/cougar/students/u335122/Desktop/Crypt/wordlist.txt&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FileReader password = new FileReader(&quot;/home/cougar/students/u335122/Desktop/Crypt/salt.txt&quot;);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; BufferedReader bufRead = new BufferedReader(wordlist);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; BufferedReader bufRead2 = new BufferedReader(password);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int count = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int count1 = 0;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; original = bufRead.readLine();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; salt = bufRead2.readLine();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //count++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //count1++;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Read through file one line at time. Print line<br />
&nbsp; &nbsp; &nbsp; &nbsp;  while (original != null){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(original);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; original = bufRead.readLine();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  // count++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;  while (salt != null){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(salt);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; salt = bufRead2.readLine();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  // count1++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bufRead.close();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bufRead2.close();<br />
&nbsp; &nbsp; &nbsp; &nbsp; } catch (Exception e) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Error: &quot; + e.getMessage());<br />
&nbsp; &nbsp; &nbsp; &nbsp; } <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp;  System.out.println<br />
&nbsp; &nbsp; &nbsp; &nbsp;  (<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;[&quot; + salt + &quot;] [&quot; + original + &quot;] =&gt; [&quot; +<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JCrypt.crypt(salt, original) + &quot;]&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  );<br />
&nbsp;  }</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>nonshatter</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241311.html</guid>
		</item>
		<item>
			<title>a problem in binary search tree ..</title>
			<link>http://www.daniweb.com/forums/thread241303.html</link>
			<pubDate>Wed, 25 Nov 2009 14:46:37 GMT</pubDate>
			<description>after deleting 2 ,55 and 21 ..am getting only in in-order how do i make other 2 oders 
package com.eyc.roughworks.binarysearchtree; 
 
import java.lang.*; 
import java.io.*; 
 
public class pBSTRemoveNode { 
 
	public pBSTRemoveNode left, right; 
	public Comparable data;</description>
			<content:encoded><![CDATA[<div>after deleting 2 ,55 and 21 ..am getting only in in-order how do i make other 2 oders<br />
package com.eyc.roughworks.binarysearchtree;<br />
<br />
import java.lang.*;<br />
import java.io.*;<br />
<br />
public class pBSTRemoveNode {<br />
<br />
	public pBSTRemoveNode left, right;<br />
	public Comparable data;<br />
<br />
	public static pBSTRemoveNode tree_AddNumber(pBSTRemoveNode r, Comparable n) {<br />
		if (r == null) {<br />
			r = new pBSTRemoveNode();<br />
			r.left = r.right = null;<br />
			r.data = n;<br />
		} else if (r.data.compareTo(n) &lt; 0)<br />
			r.right = tree_AddNumber(r.right, n);<br />
		else if (r.data.compareTo(n) &gt; 0)<br />
			r.left = tree_AddNumber(r.left, n);<br />
		return r;<br />
	}<br />
<br />
	public static pBSTRemoveNode tree_removeNumber(pBSTRemoveNode r, Comparable n) {<br />
		if (r != null) {<br />
			if (r.data.compareTo(n) &lt; 0) {<br />
				r.right = tree_removeNumber(r.right, n);<br />
			} else if (r.data.compareTo(n) &gt; 0) {<br />
				r.left = tree_removeNumber(r.left, n);<br />
			} else {<br />
				if (r.left == null &amp;&amp; r.right == null) {<br />
					r = null;<br />
				} else if (r.left != null &amp;&amp; r.right == null) {<br />
					r = r.left;<br />
				} else if (r.right != null &amp;&amp; r.left == null) {<br />
					r = r.right;<br />
				} else {<br />
					if (r.right.left == null) {<br />
						r.right.left = r.left;<br />
						r = r.right;<br />
					} else {<br />
						pBSTRemoveNode q, p = r.right;<br />
						while (p.left.left != null)<br />
							p = p.left;<br />
						q = p.left;<br />
						p.left = q.right;<br />
						q.left = r.left;<br />
						q.right = r.right;<br />
						r = q;<br />
					}<br />
				}<br />
			}<br />
		}<br />
		return r;<br />
	}<br />
<br />
	public static void tree_InOrderPrint(pBSTRemoveNode r) {<br />
		if (r != null) {<br />
			tree_InOrderPrint(r.left);<br />
			System.out.print(&quot; &quot; + r.data);<br />
			tree_InOrderPrint(r.right);<br />
		}<br />
	}<br />
<br />
	public static void main(String[] args) {<br />
		pBSTRemoveNode tree = null;<br />
		int[] numbers = { 21, 3, 4, 55, 6, 3, 44, 7, 9, 4, 2, 3, 11, 56, 7, 54, 67, 87, 54, 67, 87, 45, 66, 77, 42, 21 };<br />
		System.out.print(&quot;inserting: &quot;);<br />
		for (int i = 0; i &lt; numbers.length; i++) {<br />
			Integer n = new Integer(numbers[i]);<br />
			System.out.print(&quot; &quot; + n);<br />
			tree = tree_AddNumber(tree, n);<br />
		}<br />
		System.out.print(&quot;\ntree: &quot;);<br />
		tree_InOrderPrint(tree);<br />
//		int j = 6;<br />
		int j = 0;<br />
		int num = 2;<br />
		deleteNode(tree, numbers, j, num);<br />
		<br />
		num = 56;<br />
		deleteNode(tree, numbers, j, num);<br />
		<br />
		num = 21;<br />
		<br />
		deleteNode(tree, numbers, j, num);<br />
		<br />
<br />
	}<br />
<br />
	private static void deleteNode(pBSTRemoveNode tree, int[] numbers, int j, int num) {<br />
		for(int i = 0;i&lt;numbers.length;i++){<br />
			if(numbers[i]==num){<br />
				j = i;<br />
			}<br />
		}<br />
		<br />
		{<br />
			Integer n = new Integer(numbers[j]);<br />
			System.out.print(&quot;\nremove: &quot; + n + &quot; tree: &quot;);<br />
			tree = tree_removeNumber(tree, n);<br />
			tree_InOrderPrint(tree);<br />
		}<br />
		System.out.println(&quot;\ndone ;-)&quot;);<br />
	}<br />
}</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>jeby</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241303.html</guid>
		</item>
		<item>
			<title>Change this into a while-loop.</title>
			<link>http://www.daniweb.com/forums/thread241298.html</link>
			<pubDate>Wed, 25 Nov 2009 14:15:09 GMT</pubDate>
			<description><![CDATA[a do-while loop!!! sorry 
 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox" title="Help with Code Tags" target="_blank">Help with Code Tags</a> </div> <div>...]]></description>
			<content:encoded><![CDATA[<div>a do-while loop!!! sorry<br />
<br />
<br />
 <pre style="margin:20px; line-height:13px"><br />
import java.io.*;<br />
import java.util.*;<br />
<br />
public class guessing<br />
{<br />
&nbsp; &nbsp; <br />
public static void main (String args[])<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int answer = 22;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.print(&quot;Enter your guess, if you are correct you will be a winner&nbsp; &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Scanner guessReader = new Scanner(System.in);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int Input = guessReader.nextInt();<br />
{&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (Input&lt; 1 || Input &gt; 100)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.print(&quot;your guess should be between 1 and 100!&nbsp; &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if (Input &gt; answer)// creates the too high<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.print(&quot;your guess too high! &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if (Input &lt; answer) //creates too low<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.print(&quot;your guess too low! &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.print(&quot;You are a winner!!&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
&nbsp; &nbsp; }<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>dorotalp91</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241298.html</guid>
		</item>
		<item>
			<title>image manipulation</title>
			<link>http://www.daniweb.com/forums/thread241288.html</link>
			<pubDate>Wed, 25 Nov 2009 13:29:48 GMT</pubDate>
			<description>hi frenz! can anyone plz help me out?! how to implement image manipulation tools of photoshop in java?! how i must start plz help!!??</description>
			<content:encoded><![CDATA[<div>hi frenz! can anyone plz help me out?! how to implement image manipulation tools of photoshop in java?! how i must start plz help!!??</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>vandhana v</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241288.html</guid>
		</item>
		<item>
			<title>web service access database problem</title>
			<link>http://www.daniweb.com/forums/thread241284.html</link>
			<pubDate>Wed, 25 Nov 2009 13:20:55 GMT</pubDate>
			<description><![CDATA[Hello, I created a web service to access oracle database. This is my code: 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox" title="Help with Code Tags"...]]></description>
			<content:encoded><![CDATA[<div>Hello, I created a web service to access oracle database. This is my code:<br />
<br />
 <pre style="margin:20px; line-height:13px">package mypack;<br />
<br />
import java.util.List;<br />
import javax.jws.WebService;<br />
import javax.jws.WebMethod;<br />
import javax.jws.WebParam;<br />
import java.sql.*;<br />
import java.util.ArrayList;<br />
<br />
@WebService()<br />
public class AutoRepairWS {<br />
<br />
<br />
&nbsp; &nbsp; @WebMethod<br />
&nbsp; &nbsp; public List getCustomerId(@WebParam(name = &quot;Cust_Id&quot;) String Cust_Id){<br />
&nbsp; &nbsp; &nbsp; &nbsp; String user = &quot;****&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; String password = &quot;****&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; String url = &quot;jdbc:oracle:thin:***:1521:xe&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; String OracleDriver = &quot;oracle.jdbc.OracleDriver&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; Connection conn = null;<br />
&nbsp; &nbsp; &nbsp; &nbsp; PreparedStatement pstmt = null;<br />
&nbsp; &nbsp; &nbsp; &nbsp; ResultSet rs = null;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; List value = new ArrayList();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; try{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; conn = DriverManager.getConnection(url, user, password);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pstmt = conn.prepareStatement(&quot;select Cust_fname from Customers where Cust_Id = '&quot; + Cust_Id + &quot; '&quot;);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pstmt.setString(1, Cust_Id);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rs = pstmt.executeQuery();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while(rs.next()){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value.add(rs.getString(&quot;Cust_fname&quot;));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }catch(SQLException e){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; e.printStackTrace();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; return value;<br />
&nbsp; &nbsp; }<br />
}</pre><br />
The problem is that it's supposed to return the value of Cust_fname,  but i'm getting following message when I test web service:<br />
<br />
java.util.List : &quot;[]&quot;<br />
<br />
Can you help to make my program! Thanks in advance!</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>timaquerra</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241284.html</guid>
		</item>
		<item>
			<title>Help me with ArrayList</title>
			<link>http://www.daniweb.com/forums/thread241275.html</link>
			<pubDate>Wed, 25 Nov 2009 12:23:23 GMT</pubDate>
			<description><![CDATA[Hi, 
I have done this code to learn ArrayList. I keep getting errors. Basically I want to accumulate names in list and when user types 'n' at prompt, it prints out names. What is wrong? 
package mtangoo; 
 
import java.util.ArrayList; 
import java.util.Scanner; 
 
public class MainClass { 
   ...]]></description>
			<content:encoded><![CDATA[<div>Hi,<br />
I have done this code to learn ArrayList. I keep getting errors. Basically I want to accumulate names in list and when user types 'n' at prompt, it prints out names. What is wrong?<br />
 <pre style="margin:20px; line-height:13px">package mtangoo;<br />
<br />
import java.util.ArrayList;<br />
import java.util.Scanner;<br />
<br />
public class MainClass {<br />
&nbsp; &nbsp; public static void main(String args&#91;&#93;){<br />
&nbsp; &nbsp; &nbsp; &nbsp; Listed jobject = new Listed();<br />
<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; Listed lst = new Listed();<br />
}<br />
<br />
class Listed{<br />
&nbsp; &nbsp; Scanner getValues = new Scanner(System.in);<br />
&nbsp; &nbsp; ArrayList&lt;String&gt; peopleList = new ArrayList&lt;String&gt;();<br />
&nbsp; &nbsp; //looping<br />
&nbsp; &nbsp; while (true){<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Please Enter the Name:&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; String name = getValues.nextLine();<br />
&nbsp; &nbsp; &nbsp; &nbsp; peopleList.add(name);<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Continue? y/n&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(getValues.nextLine()==&quot;n&quot;){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }//endif<br />
&nbsp; &nbsp; &nbsp; &nbsp; else{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; continue;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; //loop finished<br />
&nbsp; &nbsp; &nbsp; &nbsp; for(int i = 0; i&lt;peopleList.size();i++){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(peopleList.get(i));<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>evstevemd</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241275.html</guid>
		</item>
		<item>
			<title>Exception</title>
			<link>http://www.daniweb.com/forums/thread241274.html</link>
			<pubDate>Wed, 25 Nov 2009 12:23:16 GMT</pubDate>
			<description><![CDATA[hi all, 
this s my first thread... 
 
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 3 
	at calculator1$nextListener.mouseClicked(calculator1.java:1048) 
	at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:212) 
	at...]]></description>
			<content:encoded><![CDATA[<div>hi all,<br />
this s my first thread...<br />
<br />
Exception in thread &quot;AWT-EventQueue-0&quot; java.lang.ArrayIndexOutOfBoundsException: 3<br />
	at calculator1$nextListener.mouseClicked(calculator1.java:1048)<br />
	at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:212)<br />
	at java.awt.Component.processMouseEvent(Component.java:5520)<br />
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)<br />
	at java.awt.Component.processEvent(Component.java:5282)<br />
	at java.awt.Container.processEvent(Container.java:1966)<br />
	at java.awt.Component.dispatchEventImpl(Component.java:3984)<br />
	at java.awt.Container.dispatchEventImpl(Container.java:2024)<br />
	at java.awt.Component.dispatchEvent(Component.java:3819)<br />
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)<br />
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3901)<br />
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)<br />
	at java.awt.Container.dispatchEventImpl(Container.java:2010)<br />
	at java.awt.Window.dispatchEventImpl(Window.java:1791)<br />
	at java.awt.Component.dispatchEvent(Component.java:3819)<br />
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)<br />
	at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)<br />
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)<br />
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)<br />
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)<br />
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)<br />
<br />
can any one help me what that means... am new to java</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>Ambislm</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241274.html</guid>
		</item>
		<item>
			<title>double????</title>
			<link>http://www.daniweb.com/forums/thread241251.html</link>
			<pubDate>Wed, 25 Nov 2009 10:45:32 GMT</pubDate>
			<description><![CDATA[hi  
 how are u all 
 
this is my program  
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox" title="Help with Code Tags" target="_blank">Help with Code Tags</a>...]]></description>
			<content:encoded><![CDATA[<div>hi <br />
 how are u all<br />
<br />
this is my program <br />
 <pre style="margin:20px; line-height:13px">import javax.swing.*;<br />
public class Qustion2 {&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp;  public static void main (String args[]){&nbsp; <br />
<br />
&nbsp; &nbsp; double x =2/3;<br />
&nbsp; &nbsp; double y = (3*x*x)-(8*x)+4;<br />
&nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null,&quot;At x= &quot; + x +&quot; the value is &quot; + y);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }</pre>   <br />
     Mathematically when i  substitute x =2/3<br />
    <br />
      i get result equal zero but here i didn't get it<br />
<br />
      any body tell me why ?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>girl.java</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241251.html</guid>
		</item>
		<item>
			<title>Error in program</title>
			<link>http://www.daniweb.com/forums/thread241236.html</link>
			<pubDate>Wed, 25 Nov 2009 08:58:00 GMT</pubDate>
			<description><![CDATA[Hello... 
 
I try to do like this.. 
 
But I still ther are some errors...... I don't know how I solve them 
 
Could healp me.. please 
 
This is my code]]></description>
			<content:encoded><![CDATA[<div>Hello...<br />
<br />
I try to do like this..<br />
<br />
But I still ther are some errors...... I don't know how I solve them<br />
<br />
Could healp me.. please<br />
<br />
This is my code<br />
<br />
 <pre style="margin:20px; line-height:13px"><br />
<br />
import javax.swing.JApplet;<br />
import java.awt.Color;<br />
import java.awt.Graphics;<br />
import java.io.IOException;<br />
import java.io.*;<br />
import java.util.Scanner;<br />
import java.awt.*;<br />
import java.io.FileNotFoundException;<br />
<br />
public class colok__ extends JApplet {<br />
&nbsp;  String Colors;&nbsp; &nbsp; <br />
&nbsp;  String Font1;&nbsp; &nbsp; <br />
&nbsp;  String arm;&nbsp; &nbsp;  <br />
&nbsp;  String ticks ; <br />
&nbsp;  String txts;&nbsp; <br />
&nbsp;  String Time; <br />
&nbsp;  String str=&quot; Time now is :&nbsp; &quot;;&nbsp; <br />
&nbsp;  int hr=0;<br />
&nbsp;  int min=0;<br />
&nbsp;  int sec=0;<br />
&nbsp;  String brid;<br />
&nbsp;  int sX = 5, sY = 10 ;<br />
&nbsp;  <br />
&nbsp;  <br />
&nbsp;  public void ree()<br />
&nbsp;  {<br />
&nbsp; &nbsp; &nbsp;  try <br />
&nbsp;{<br />
<br />
setSize(800,800);&nbsp; &nbsp; <br />
<br />
&nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp;  File inputFile = new File(&quot;t.txt&quot;);&nbsp; <br />
Scanner scan =new Scanner(inputFile);&nbsp; &nbsp; <br />
<br />
while(scan.hasNext()){&nbsp;  <br />
&nbsp; &nbsp; &nbsp; scan.next();&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; scan.next();&nbsp; &nbsp; &nbsp; &nbsp;  <br />
Colors = scan.next();&nbsp; &nbsp;  <br />
<br />
&nbsp; scan.next();&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; scan.next();&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; Font1 = scan.next();&nbsp; <br />
&nbsp;<br />
&nbsp;scan.next();&nbsp; &nbsp; <br />
&nbsp;scan.next();&nbsp; &nbsp; <br />
&nbsp;scan.next();&nbsp; &nbsp; <br />
arm = scan.next(); <br />
<br />
scan.next();&nbsp;  <br />
&nbsp;scan.next();&nbsp;  //read the secand word<br />
&nbsp;scan.next();&nbsp;  //read the therd word<br />
ticks =scan.next(); //read the coler of the arm frome the fill<br />
<br />
//Top text: Welcome to clock animation<br />
&nbsp;scan.next();&nbsp; //read the first word<br />
&nbsp;scan.next();&nbsp; //read the secand word<br />
txts= scan.nextLine();&nbsp; //read unteil end line<br />
<br />
//Initial time: 06 50 00 PM<br />
scan.next();&nbsp; //read the first word<br />
scan.next();&nbsp; //read the first word<br />
Time= scan.nextLine();&nbsp; <br />
scan.next();<br />
scan.next();<br />
hr=scan.nextInt();<br />
min=scan.nextInt();<br />
sec=scan.nextInt();<br />
brid=scan.next();<br />
<br />
}<br />
}<br />
&nbsp; &nbsp;  // thro FileNotFoundException if file has error..<br />
&nbsp; &nbsp;  catch( FileNotFoundException e){<br />
&nbsp; &nbsp; &nbsp; &nbsp;  e.printStackTrace();<br />
&nbsp; &nbsp;  }<br />
<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp;  }&nbsp;  <br />
<br />
<br />
&nbsp; &nbsp; public void paint(Graphics g)<br />
&nbsp; &nbsp; {&nbsp; &nbsp; &nbsp;  <br />
&nbsp;super.paint(g);&nbsp;  <br />
g.setColor(colors(Font1));&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
Font formts =new Font(&quot;&quot;,Font.BOLD,12 );// formate the font<br />
g.setFont(formts);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; g.drawString(txts, 335, 80);&nbsp; &nbsp; &nbsp; <br />
g.drawString(str+Time, 350,230);&nbsp; &nbsp; <br />
<br />
<br />
<br />
&nbsp; &nbsp; g.setColor(colors(ticks));&nbsp; <br />
for ticks ;<br />
// drow the ticks<br />
&nbsp;  g.fillRect(sX+330,sY+ 145,20,8 );<br />
&nbsp;  g.fillRect(sX+420,sY+ 150,20,8 );<br />
&nbsp;  g.fillRect(sX+380,sY+ 90,8,20 );<br />
&nbsp;  g.fillRect(sX+380,sY+ 185,8,15 );<br />
<br />
<br />
g.setColor(colors(arm));//call fincatin coler and take the coker for arm ;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; arms(2*Math.PI*sec/60, sX/2,g);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; arms(2*Math.PI*min/60, sY/3,g);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; arms(2*Math.PI*hr/12, sY*2/4,g);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp;if (sec == 60 ){<br />
<br />
&nbsp; &nbsp;  min++;<br />
<br />
&nbsp; &nbsp; &nbsp;  }<br />
<br />
&nbsp; &nbsp; &nbsp;  if (min == 60){<br />
&nbsp; &nbsp; &nbsp;  hr++;<br />
&nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (hr == 12){<br />
&nbsp;if(brid==(&quot;am&quot;))<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  brid = &quot;pm&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  else<br />
brid = &quot;am&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp;  sec++;<br />
&nbsp;  try<br />
&nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Thread.sleep( (int)(&nbsp; 1000 ) );<br />
&nbsp;}<br />
&nbsp; &nbsp; &nbsp; &nbsp;  catch ( InterruptedException e )<br />
&nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp;}<br />
&nbsp; &nbsp; &nbsp;  repaint();<br />
<br />
}&nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp;  <br />
// fincation coled colerto set the coler for applat;s wiil used<br />
&nbsp; &nbsp; Color colors (String a)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (a.equalsIgnoreCase(&quot;green&quot;))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return Color.GREEN;<br />
&nbsp; if (a.equalsIgnoreCase(&quot;Black&quot;))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return Color.BLACK;<br />
&nbsp; if (a.equalsIgnoreCase(&quot;blue&quot;))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return Color.BLUE;<br />
&nbsp; &nbsp; &nbsp; if (a.equalsIgnoreCase(&quot;cyan&quot;))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return Color.GRAY;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (a.equalsIgnoreCase(&quot;Drk_Gery&quot;))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return Color.DARK_GRAY;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (a.equalsIgnoreCase(&quot;gray&quot;))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return Color.GRAY;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (a.equalsIgnoreCase(&quot;light_gry&quot;))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return Color.LIGHT_GRAY;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (a.equalsIgnoreCase(&quot;magenta&quot;))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return Color.MAGENTA;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (a.equalsIgnoreCase(&quot;orange&quot;))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return Color.ORANGE;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (a.equalsIgnoreCase(&quot;pink&quot;))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return Color.PINK;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (a.equalsIgnoreCase(&quot;red&quot;))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return Color.RED;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (a.equalsIgnoreCase(&quot;whit&quot;))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return Color.WHITE;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return Color.yellow;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; public void arms(double angle , int radius , Graphics g){<br />
<br />
&nbsp; &nbsp; angle =angle - 0.5 *Math.PI;<br />
&nbsp; &nbsp; int x = (int)(radius * Math.cos(angle));<br />
&nbsp; &nbsp; int y = (int)(radius * Math.sin(angle));<br />
<br />
&nbsp; &nbsp; g.drawLine(150+radius/2, 150+radius/2,150+ radius/2 + x,150+radius/2 +y);<br />
<br />
}<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>sheehab</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241236.html</guid>
		</item>
		<item>
			<title>PLEASE HELP. The right way for chatting over Internet</title>
			<link>http://www.daniweb.com/forums/thread241218.html</link>
			<pubDate>Wed, 25 Nov 2009 08:35:57 GMT</pubDate>
			<description><![CDATA[Hello, 
 
I'm trying to develop a chat application over internet. First I want to send just strings... later files. I want to have a client that is a java applet that connects to the server - a java desktop application. I waould like to send files later over applet and server application. *Is this...]]></description>
			<content:encoded><![CDATA[<div>Hello,<br />
<br />
I'm trying to develop a chat application <span style="font-style:italic">over internet</span>. First I want to send just strings... later files. I want to have a client that is a java applet that connects to the server - a java desktop application. I waould like to send files later over applet and server application. <span style="font-weight:bold">Is this possible or the applet could be limited?</span> I use Socket connection for tha application. <span style="font-weight:bold">Is this the right approach?</span><br />
I struggled a lot trying to send string data between to computers on the internet but I could not. I only can comunicate on LAN between to desktop applications. With the applet I have problems connecting to desktop appplication.<br />
<br />
So can someone give ma hints? An example? Advices? What I am trying to do, overall, is to control my computer (which has the desktop application installed) <span style="font-weight:bold">over internet</span> (with the applet client).<br />
<br />
Thanks you. I need your advices.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>Clawsy</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241218.html</guid>
		</item>
		<item>
			<title>Creating and running Java .ini files</title>
			<link>http://www.daniweb.com/forums/thread241213.html</link>
			<pubDate>Wed, 25 Nov 2009 08:05:22 GMT</pubDate>
			<description><![CDATA[Hi there 
 
Iam busy creating an .ini file for an application, but it is throwing a null pointer exception the whole time and can't seem to figure out what the problem is. 
 
Why would it throw such an error and what does it mean? 
 
Could you please help me? 
Will appreciate it... 
 
Here is the...]]></description>
			<content:encoded><![CDATA[<div>Hi there<br />
<br />
Iam busy creating an .ini file for an application, but it is throwing a null pointer exception the whole time and can't seem to figure out what the problem is.<br />
<br />
Why would it throw such an error and what does it mean?<br />
<br />
Could you please help me?<br />
Will appreciate it...<br />
<br />
Here is the code for the .ini file InteractiveScreen.ini:<br />
<br />
 <pre style="margin:20px; line-height:13px">;@InteractiveScreen<br />
;<br />
;This interactive screen shows the general information on SmartVillage and Neotel.<br />
;Smart Village<br />
;<br />
;Set page properties<br />
&#91;PortalPage&#93;<br />
OnShow=focus:buttonInformation<br />
Type=com.mca.portal.PortalPage<br />
;<br />
;Places the logo onto the screen<br />
;<br />
;Create the complex logo image<br />
&#91;iconLogo1&#93;<br />
Graphic=Normal, images/smartVillage.jpg<br />
Location=50, 50<br />
Size=150, 150<br />
Type=org.havi.ui.HStaticIcon<br />
;<br />
;Places text content on to the screen<br />
;<br />
;Set the page header<br />
&#91;textHeader1&#93;<br />
Text=Smart Village<br />
Type=org.havi.ui.HStaticText<br />
;<br />
;Set the page text content<br />
&#91;textContent1&#93;<br />
Text=Smart Village™ is South Africa’s leading, next generation network and infrastructure solutions provider.<br />
Location=50, 60<br />
Size=90, 90<br />
Type=org.havi.ui.HStaticText<br />
;<br />
;Set the page text content<br />
&#91;textContent2&#93;<br />
Text=By utilising state-of-the-art fibre optic networks, Smart Village is able to deliver fully integrated multimedia,telecommunication and security solutions to residential, commercial and hospitality developments.<br />
Location=50, 61<br />
Size=90, 90<br />
Type=org.havi.ui.HStaticText<br />
;<br />
;Set the page text content<br />
&#91;textContent3&#93;<br />
Text=Our competitive advantage draws its strength from the diversity and technical capabilities of our networks, which guarantees a solid base for our core and value added service offerings.<br />
Location=50, 62<br />
Size=90, 90<br />
Type=org.havi.ui.HStaticText<br />
;<br />
;Set the page text content<br />
&#91;textContent4&#93;<br />
Text=From humble beginnings in 2004, the company has grown from a small start-up venture, into South Africa’s premier multi-play service provider.<br />
Location=50, 63<br />
Size=90, 90<br />
Type=org.havi.ui.HStaticText<br />
;<br />
;Set the page text content<br />
&#91;textContent5&#93;<br />
Text=Smart Village has a very strong national footprint, with over a thousand homes and businesses already connected.<br />
Location=50, 64<br />
Size=90, 90<br />
Type=org.havi.ui.HStaticText<br />
;<br />
;Set the page text content<br />
&#91;textContent6&#93;<br />
Text=Having already secured a significant portion of the market, accelerated growth is expected as Multichoice has acquired a controlling stake in Smart Village to broaden its core DStv offerings, by using Smart Village's next generation networks.<br />
Location=50, 65<br />
Size=90, 90<br />
Type=org.havi.ui.HStaticText<br />
;<br />
;Set the page text content<br />
&#91;textContent7&#93;<br />
Text=By providing a totally unique turnkey solution, Smart Village enables clients to deal with a single provider for multimedia, telecommunication, data and security services.<br />
Location=50, 66<br />
Size=90, 90<br />
Type=org.havi.ui.HStaticText<br />
;<br />
;Set the page text content<br />
&#91;textContent8&#93;<br />
Text=Smart Village also offers all the necessary service, maintenance and support that clients require, ensuring complete and total peace of mind.<br />
Location=50, 67<br />
Size=90, 90<br />
Type=org.havi.ui.HStaticText<br />
;<br />
;Contact details<br />
;<br />
;Set the page text content<br />
&#91;textContent9&#93;<br />
Text=Smart Village Head Office<br />
Location=50, 68<br />
Size=90, 90<br />
Type=org.havi.ui.HStaticText<br />
;<br />
;Set the page text content<br />
&#91;textContent10&#93;<br />
Text=Tel : +27 (0) 12 679 3400<br />
Location=50, 69<br />
Size=90, 90<br />
Type=org.havi.ui.HStaticText<br />
;<br />
;Set the page text content<br />
&#91;textContent11&#93;<br />
Text=Fax : +27 (0) 12 679 3401<br />
Location=50, 70<br />
Size=90, 90<br />
Type=org.havi.ui.HStaticText<br />
;<br />
;Set the page text content<br />
&#91;textContent12&#93;<br />
Text=Post Box : ////////throws an error right here!!!!!!!!!!!!!!<br />
Location=50, 71<br />
Size=90, 90<br />
Type=org.havi.ui.HStaticText<br />
;<br />
;Set the page text content<br />
&#91;textContent13&#93;<br />
Text=Postnet Suite 422<br />
Location=50, 72<br />
Size=90, 90<br />
Type=org.havi.ui.HStaticText<br />
;<br />
;Set the page text content<br />
&#91;textContent14&#93;<br />
Text=Privatebag x 108<br />
Location=50, 73<br />
Size=90, 90<br />
Type=org.havi.ui.HStaticText<br />
;<br />
;Set the page text content<br />
&#91;textContent15&#93;<br />
Text=Centurion<br />
Location=50, 74<br />
Size=90, 90<br />
Type=org.havi.ui.HStaticText<br />
;<br />
;Set the page text content<br />
&#91;textContent16&#93;<br />
Text=0046<br />
Location=50, 75<br />
Size=90, 90<br />
Type=otg.havi.ui.HStaticText<br />
;<br />
;Set the page text content<br />
&#91;textContent17&#93;<br />
Text=Physical Address :<br />
Location=50, 76<br />
Size=90, 90<br />
Type=org.havi.ui.HStaticText<br />
;<br />
;Set the page text content<br />
&#91;textContent18&#93;<br />
Text=Centurion Gate Complex<br />
Location=50, 77<br />
Size=90, 90<br />
Type=org.havi.ui.HStaticText<br />
;<br />
;Set the page text content<br />
&#91;textContent19&#93;<br />
Text=2nd Floor<br />
Location=50, 78<br />
Size=90, 90<br />
Type=org.havi.ui.HStaticText<br />
;<br />
;Set the page text content<br />
&#91;textContent20&#93;<br />
Text=Cnr John Vorster &amp; Akkerboom Street<br />
Location=50, 79<br />
Size=90, 90<br />
Type=org.havi.ui.HStaticText<br />
;<br />
;Set the page text content<br />
&#91;textContent21&#93;<br />
Text=Centurion<br />
Location=50, 80<br />
Size=90, 90<br />
Type=org.havi.ui.HStaticText<br />
;</pre><br />
Here is the code that gets the text content from the .ini file and places it on the page<br />
<br />
 <pre style="margin:20px; line-height:13px">private void SetHStaticText(HStaticText component, String name, ArrayList&lt;Property&gt; propertyList)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; //gets the text content from the .ini file<br />
&nbsp; &nbsp; &nbsp; &nbsp; //places the text content on the page<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (component == null)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; component = new HStaticText();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; component.setName(name);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _owner.AddComponent(component);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; // Set base class properties first<br />
&nbsp; &nbsp; &nbsp; &nbsp; SetHVisible((HVisible)component, name, propertyList);<br />
<br />
&nbsp; &nbsp; }</pre><br />
Thanx<br />
Camzie</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>Camzie</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241213.html</guid>
		</item>
		<item>
			<title>Image panel not loading my image...</title>
			<link>http://www.daniweb.com/forums/thread241202.html</link>
			<pubDate>Wed, 25 Nov 2009 06:53:53 GMT</pubDate>
			<description><![CDATA[Please someone help me... why image panel not showing that image in the frame: 
  <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>Please someone help me... why image panel not showing that image in the frame:<br />
 <pre style="margin:20px; line-height:13px">//image panel class<br />
import java.awt.*;<br />
import java.awt.image.BufferedImage;<br />
import javax.swing.*;<br />
<br />
public class ImagePanel extends JPanel {<br />
<br />
&nbsp; &nbsp; private BufferedImage&nbsp; img;<br />
<br />
<br />
<br />
&nbsp; &nbsp; public ImagePanel(BufferedImage img) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; this.img = img;<br />
&nbsp; &nbsp; &nbsp; &nbsp; Dimension size = new Dimension(500,500);<br />
&nbsp; &nbsp; &nbsp; &nbsp; setPreferredSize(size);<br />
&nbsp; &nbsp; &nbsp; &nbsp; setMinimumSize(size);<br />
&nbsp; &nbsp; &nbsp; &nbsp; setMaximumSize(size);<br />
&nbsp; &nbsp; &nbsp; &nbsp; setSize(size);<br />
&nbsp; &nbsp; &nbsp; &nbsp; setLayout(null);<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; public void paintComponent(Graphics g) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; g.drawImage(img,0,0,null);<br />
&nbsp; &nbsp; }<br />
<br />
}<br />
<br />
<br />
<br />
<br />
//the code for adding the ImagePanel to the frame<br />
try {<br />
&nbsp; &nbsp; this.image = ImageIO.read(chatClient.class.getResource(&quot;abc.JPG&quot;));<br />
} catch (IOException e) {<br />
&nbsp; &nbsp; e.printStackTrace();<br />
}<br />
<br />
this.setLayout(new FlowLayout());//!!!!!!!!!!!<br />
this.add(new ImagePanel(image));<br />
this.validate();</pre>Another problem si if I try this in ImagePanel class:<br />
 <pre style="margin:20px; line-height:13px">//gives null pointer exception:<br />
&nbsp;  Dimension size = new Dimension(img.getWidth(),img.getHeight());</pre>It simply does nothing... really annoying. There's no big deal but I just can't see the bug.<br />
Thanks.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>Clawsy</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241202.html</guid>
		</item>
		<item>
			<title>Friends database program.</title>
			<link>http://www.daniweb.com/forums/thread241194.html</link>
			<pubDate>Wed, 25 Nov 2009 06:06:09 GMT</pubDate>
			<description><![CDATA[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...]]></description>
			<content:encoded><![CDATA[<div>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. When The program runs it displays the menu, where add a friend(prompts the user to enter a name) and then delete, search(removes a friend off the list) and stuff...<br />
<br />
<span style="font-weight:bold">The program is not done yet.... and I think I should seperate this into two files. can someone help me correct this, like the methods and constructors so that at least it compiles. ...</span><br />
<br />
 <pre style="margin:20px; line-height:13px">import java.util.Scanner; <br />
import java.util.Math;<br />
import java.util.ArrayList; <br />
<br />
public class FriendsMain { <br />
&nbsp; public static void main(String[] args) { <br />
&nbsp; &nbsp; String friend; <br />
&nbsp; &nbsp; String lastName; <br />
&nbsp; &nbsp; String firstName; <br />
&nbsp; &nbsp; String telephone;<br />
&nbsp; &nbsp; String email; <br />
&nbsp; &nbsp; Scanner input = new Scanner(System.in); <br />
&nbsp; &nbsp; ArrayList = new ArrayList(); <br />
&nbsp; &nbsp; <br />
&nbsp;  <br />
&nbsp; &nbsp; do { <br />
&nbsp; &nbsp; &nbsp; System.out.println(&quot;\n1. Add a friend. &quot;); <br />
&nbsp; &nbsp; &nbsp; System.out.println(&quot;2. Display friends by last name. &quot;); <br />
&nbsp; &nbsp; &nbsp; System.out.println(&quot;3. Display friends by first name. &quot;);&nbsp; <br />
&nbsp; &nbsp; &nbsp; System.out.println(&quot;4. Find a friend&quot;); <br />
&nbsp; &nbsp; &nbsp; System.out.println(&quot;5. Delete a friend&quot;); <br />
&nbsp; &nbsp; &nbsp; System.out.println(&quot;6. Quit&quot;); <br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; choice = input.nextInt(); <br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; if (choice == 1) { <br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Enter a friend by their first name&quot;); <br />
&nbsp; &nbsp; &nbsp; &nbsp; firstName = input.nextLine(); <br />
&nbsp; &nbsp; &nbsp; &nbsp; friendList.add(firstName); <br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Enter a friend by their last name: &quot;); <br />
&nbsp; &nbsp; &nbsp; &nbsp; lastName = input.nextLine(); <br />
&nbsp; &nbsp; &nbsp; &nbsp; friendList.add(lastName); <br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Enter their telephone number: &quot;); <br />
&nbsp; &nbsp; &nbsp; &nbsp; telephone = input.nextLine(); <br />
&nbsp; &nbsp; &nbsp; &nbsp; telephoneList.add(telephone); <br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Enter their email address: &quot;); <br />
&nbsp; &nbsp; &nbsp; &nbsp; email = input.nextLine(); <br />
&nbsp; &nbsp; &nbsp; &nbsp; emailList.add(email); <br />
&nbsp; &nbsp; &nbsp; } else if ( choice == 2) { <br />
&nbsp; &nbsp; &nbsp; &nbsp; friendList.remove(lastName); <br />
&nbsp; &nbsp; &nbsp; } else if (choice == 3) { <br />
&nbsp; &nbsp; &nbsp; &nbsp; displayArray(friendList); <br />
&nbsp; &nbsp; &nbsp; } else if ( choice == 4) { <br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot; Enter a friend to search for: &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; searchName = input.nextInt(); <br />
&nbsp; &nbsp; &nbsp; } else if ( choice == 5) { <br />
&nbsp; &nbsp; &nbsp; &nbsp; friendList.remove(friend); <br />
&nbsp; &nbsp; &nbsp; } while (!= 6) <br />
&nbsp; &nbsp; } <br />
&nbsp; } <br />
}</pre><br />
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/thread241194.html</guid>
		</item>
		<item>
			<title>Scrabble Program</title>
			<link>http://www.daniweb.com/forums/thread241193.html</link>
			<pubDate>Wed, 25 Nov 2009 05:55:40 GMT</pubDate>
			<description><![CDATA[The board game scrabble works by assigning points to wooden tiles arranged in cells on a board. It's described here:http://en.wikipedia.org/wiki/Scrabble. We'll simplify this considerably, and consider the following question. We begin with the letter-scoring scheme from Scrabble: a = 1, b = 3, c =...]]></description>
			<content:encoded><![CDATA[<div>The board game scrabble works by assigning points to wooden tiles arranged in cells on a board. It's described here:<a rel="nofollow" class="t" href="http://en.wikipedia.org/wiki/Scrabble" target="_blank">http://en.wikipedia.org/wiki/Scrabble</a>. We'll simplify this considerably, and consider the following question. We begin with the letter-scoring scheme from Scrabble: a = 1, b = 3, c = 3, d = 2, ..., z = 10. Given a text file - a novel for example, what is the highest-(or a highest-) scoring line in the the file? In keeping with the Scrabble style, we'll add double and triple letter scores: any letter that falls at a line (String) position that's evenly divisible by 4 will have its score doubled; and any letter that falls at a line (String) position that's evenly divisible by 9 will have its score tripled. A letter at a position that's evenly divisible by 4 and 9 will have its score doubled, not tripled. All non-letters (e.g., space, comma, etc.) have score 0.<br />
<br />
Example: the line &quot;now is the time&quot; has a Scrabble score (by our rules) of 29. (Verify this with pencil and paper. Note that &quot;n&quot; is at position 0, which is a double letter score.)<br />
<br />
Your solution should include two files: A driver called LineScrabbleDriver, and a file called LineScrabble.java which does the heavy lifting for the application. The LineScrabble file should extend Echo, in the standard way we've indicated (it could also extend the LineReader class).<br />
<br />
(Echo Class)<br />
 <pre style="margin:20px; line-height:13px">import java.util.Scanner;<br />
import java.io.*;<br />
<br />
public class Echo{<br />
String fileName; // external file name<br />
Scanner scan; // Scanner object for reading from external file<br />
<br />
public Echo(String f) throws IOException<br />
{<br />
fileName = f;<br />
scan = new Scanner(new FileReader(fileName));<br />
}<br />
<br />
public void readLines(){ // reads lines, hands each to processLine<br />
while(scan.hasNext()){<br />
processLine(scan.nextLine());<br />
}<br />
scan.close();<br />
}<br />
<br />
public void processLine(String line){ // does the real processing work<br />
System.out.println(line);<br />
}<br />
}</pre><br />
(LineReader Class)<br />
 <pre style="margin:20px; line-height:13px">import java.util.Scanner;<br />
import java.io.*;<br />
<br />
public abstract class LineReader{<br />
String fileName; // external file name<br />
Scanner scan; // Scanner object for reading from external file<br />
<br />
public LineReader(String f) throws IOException<br />
{<br />
fileName = f;<br />
scan = new Scanner(new FileReader(fileName));<br />
}<br />
public void readLines(){ // reads lines, hands each to processLine<br />
while(scan.hasNext()){<br />
processLine(scan.nextLine());<br />
}<br />
scan.close();<br />
}<br />
public abstract void processLine(String line);<br />
}</pre><br />
Output: Program should report the (or a) highest scoring line in the input file, along with the score for that line.<br />
<br />
Tips:<br />
<br />
Here is a list from a to z of the letter scores from Scrabble:<br />
<br />
{1,3,3,2,1,4,2,4,1,8,5,1,3,1,1,3,10,1,… Notice that this list is in proper format for copying and pasting directly into your program as an int array.<br />
<br />
It's far easier to convert lines of text to lowercase before processing.<br />
<br />
You MUST use a try-catch harness in driver class.<br />
<br />
You MUST comment every method with a one line description of the job that method does, and your description must be placed just below the method header line.<br />
<br />
Two sample files are provided below, sampletext.txt is silly but useful, and HeartOfDarkness.txt is the Conrad novella.<br />
<br />
Some sample output:<br />
<br />
enter file name<br />
<br />
sampletext.txt<br />
<br />
winner:<br />
<br />
and aid. their. party?<br />
<br />
winning score: 40<br />
<br />
-------------------------------<br />
<br />
enter file name<br />
<br />
HeartOfDarkness.txt<br />
<br />
winner:<br />
<br />
plenty time. i can manage. you take kurtz away quick--quick--i tell<br />
<br />
winning score: 192<br />
<br />
(HeartOfDarkness.txt)<br />
<a rel="nofollow" class="t" href="http://twiki-edlab.cs.umass.edu/pub/Moll121/AssignSix/HeartOfDarkness.txt" target="_blank">http://twiki-edlab.cs.umass.edu/pub/...OfDarkness.txt</a><br />
(sample.txt)<br />
<a rel="nofollow" class="t" href="http://twiki-edlab.cs.umass.edu/pub/Moll121/AssignSix/sampletext.txt" target="_blank">http://twiki-edlab.cs.umass.edu/pub/...sampletext.txt</a></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>lacompsr</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241193.html</guid>
		</item>
		<item>
			<title>Help, Arrange 5 numbers from highest to lowest</title>
			<link>http://www.daniweb.com/forums/thread241188.html</link>
			<pubDate>Wed, 25 Nov 2009 05:34:30 GMT</pubDate>
			<description><![CDATA[Hello, 
i'm a new member here in this forum.. 
and i think lot of programmers may help me here.. 
i'm a newbie also in java programming.. 
 
my teacher wants us to make a program that accepts 5 integers and then arrange it from highest to lowest.. 
i have an idea how to do it but it is on a hard...]]></description>
			<content:encoded><![CDATA[<div>Hello,<br />
i'm a new member here in this forum..<br />
and i think lot of programmers may help me here..<br />
i'm a newbie also in java programming..<br />
<br />
my teacher wants us to make a program that accepts 5 integers and then arrange it from highest to lowest..<br />
i have an idea how to do it but it is on a hard way.. my teacher wants us to do it in a short way.. i dont have much idea in doing it on that way.. (because my logic is POOR..T-T)<br />
but i tried my best i try to figure out last night until now i cant get it.. here's my code..<br />
<br />
 <pre style="margin:20px; line-height:13px">/**<br />
&nbsp;* @(#)highest.java<br />
&nbsp;*<br />
&nbsp;* highest application<br />
&nbsp;*<br />
&nbsp;* @o0sample0o<br />
&nbsp;* @version 1.00 2009/11/24<br />
&nbsp;*/<br />
&nbsp;import javax.swing.JOptionPane;<br />
import javax.swing.JTextArea;<br />
import javax.swing.JScrollPane;<br />
<br />
public class highest {<br />
&nbsp; &nbsp; public static void main(String[] args) {<br />
&nbsp; &nbsp; JTextArea myTextArea = new JTextArea(5,10);<br />
&nbsp; &nbsp; JScrollPane myScrollBar = new JScrollPane(myTextArea);<br />
&nbsp; &nbsp; int number[],&nbsp; first=0, second=0, third=0,fourth=0,fifth=0;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; for( int x=1;x&lt;=5;x++)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  number[x] = Integer.parseInt(JOptionPane.showInputDialog(&quot;Enter Number&quot;+x+&quot;: &quot;));<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; if(number[1]&gt;first)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; first=number[1];<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; else if(number[2]&gt;second)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; second=number[2];<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; else if(number[3]&gt;third)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; third=number[3];<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; else if(number[4]&gt;fourth)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fourth=number[4];<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; else<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fifth=number[5];<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; myTextArea.setText(&quot;The 1st largest is: &quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; +first+&quot;\nThe 2nd largest is: &quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; +second+&quot;\nThe 3rdnd largest is: &quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; +third+&quot;\nThe 4th largest is: &quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; +fourth+&quot;\nThe 5th largest is: &quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; +fifth);<br />
&nbsp; &nbsp;  <br />
&nbsp; &nbsp; JOptionPane.showMessageDialog(null, myScrollBar);<br />
&nbsp; &nbsp; System.exit(0);<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; }</pre><br />
oh.. and one more question..<br />
i try to use an one dimensional array..<br />
i there anyway to execute it here in java? i have small knowledge in c++.. so i think the syntax here in java have lot different on c++?<br />
thanks for reading my problem..<br />
Thanks DANIWEB!:)</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>o0sample0o</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241188.html</guid>
		</item>
		<item>
			<title>Restricting Sprite location</title>
			<link>http://www.daniweb.com/forums/thread241187.html</link>
			<pubDate>Wed, 25 Nov 2009 05:21:26 GMT</pubDate>
			<description><![CDATA[Hello, 
 
I am currently making a game in my Java programming course 
 
My game is similar to Guitar Hero where the sprites will come down 4 different lines. 
 
What I am trying to do is make them come down those lines at random 
 
So far, I have made them come down in random locations, but can't...]]></description>
			<content:encoded><![CDATA[<div>Hello,<br />
<br />
I am currently making a game in my Java programming course<br />
<br />
My game is similar to Guitar Hero where the sprites will come down 4 different lines.<br />
<br />
What I am trying to do is make them come down those lines at random<br />
<br />
So far, I have made them come down in random locations, but can't restrict them, could anyone please help me?<br />
<br />
I set up the code to be:<br />
<br />
 <pre style="margin:20px; line-height:13px">sprite.setLocation(randomDouble(), 0.00);</pre><br />
the lines are located:<br />
0.1, 0.1<br />
0.35, 0.1<br />
0.65, 0.1<br />
0.9, 0.1<br />
<br />
Should I make separate sprites and restrict them to these locations and try to control the time in which they fall down the lines?<br />
<br />
Thanks again!</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>MSoul</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241187.html</guid>
		</item>
		<item>
			<title>Searching a Text File</title>
			<link>http://www.daniweb.com/forums/thread241183.html</link>
			<pubDate>Wed, 25 Nov 2009 05:05:05 GMT</pubDate>
			<description>I have file with a list of names in it and next to the names is a series of digits. The digits represent its level of popularity per every 10 years. 
 
The program I have asks the user to input the file path, then it asks for the user to input a name.  The program needs to search the file for the...</description>
			<content:encoded><![CDATA[<div>I have file with a list of names in it and next to the names is a series of digits. The digits represent its level of popularity per every 10 years.<br />
<br />
The program I have asks the user to input the file path, then it asks for the user to input a name.  The program needs to search the file for the name that was entered. Once the name has been located it needs to print out the name and the numbers on separate lines.<br />
<br />
Ex.<br />
file has:<br />
Laura 0 0 1 143 443 100 3 43 12 555 0 0<br />
Lisa 900 1 200 22 4 1 1 45 89 0 0 2<br />
<br />
User Input:<br />
Enter Name: Lisa<br />
Name found - Lisa<br />
1900: 900<br />
1910: 1<br />
1920: 200<br />
1930: 22<br />
1940: 4<br />
etc, etc.<br />
<br />
I can get it to read the file, but it prints the entire file. I need it to just read out the name that was entered (if it exists) and the stats with it.<br />
<br />
Here is my code (I have also included the txt file):<br />
<br />
What are the best changes to make? I am new to doing this in any code language.<br />
<br />
 <pre style="margin:20px; line-height:13px">package babynames;<br />
<br />
import java.util.*;<br />
import java.io.*;<br />
<br />
public class BabyNames<br />
{<br />
&nbsp; &nbsp; public static void main(String[] args)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; Scanner userInput = new Scanner(System.in);<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.print(&quot;Enter file path: &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; File file = new File(userInput.nextLine());<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; Scanner userInput2 = new Scanner(System.in);<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.print(&quot;Enter name: &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; String name = userInput2.nextLine();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; StringBuffer contents = new StringBuffer();<br />
&nbsp; &nbsp; &nbsp; &nbsp; BufferedReader reader = null;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; try<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; reader = new BufferedReader(new FileReader(file));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String text = null;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while ((text = reader.readLine()) != null)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; contents.append(text).append(System.getProperty(&quot;line.separator&quot;));<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; catch(FileNotFoundException e)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; e.printStackTrace();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; catch(IOException e)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; e.printStackTrace();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; finally<br />
&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; if(reader != null)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; reader.close();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; catch(IOException e)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; e.printStackTrace();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(contents.toString());<br />
<br />
&nbsp; &nbsp; }//close main<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/txt.gif" alt="File Type: txt" width="16" height="16" border="0" style="vertical-align:baseline" /></td> <td><a href="http://www.daniweb.com/forums/attachment.php?attachmentid=12700&amp;d=1259125806">names.txt</a> (168.0 KB)</td> </tr> </table> </fieldset>  </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/thread241183.html</guid>
		</item>
		<item>
			<title>What is wrong with this program? (for-loops/factorials/BLUEJ)</title>
			<link>http://www.daniweb.com/forums/thread241174.html</link>
			<pubDate>Wed, 25 Nov 2009 04:35:08 GMT</pubDate>
			<description>This program is supposed to ask the user to input a number and the print will read out the factorial.  This code is wrong how do I fix it? Maybe not add much just jumbled up variables? Help! This was given to me created in BLUE J software 
 
i know the reader should equal the number  
and for...</description>
			<content:encoded><![CDATA[<div>This program is supposed to ask the user to input a number and the print will read out the factorial.  This code is wrong how do I fix it? Maybe not add much just jumbled up variables? Help! This was given to me created in BLUE J software<br />
<br />
i know the reader should equal the number <br />
and for (x=number, x&lt;=1;x++) but im not sure.. <br />
<br />
 <pre style="margin:20px; line-height:13px">import java.io.*;<br />
import java.util.*;<br />
class Problem3<br />
{<br />
public static void main(String args[])<br />
{<br />
Scanner aReader = new Scanner(System.in);<br />
System.out.print(&quot;Enter an integer you want to find the factorial for &quot;);<br />
int a = aReader.nextInt();<br />
<br />
int fact=1;<br />
<br />
for (inti=1;1&lt;=a;i++)<br />
fact=fact*i;<br />
{<br />
System.out.println(fact);<br />
}<br />
}<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>dorotalp91</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241174.html</guid>
		</item>
		<item>
			<title>need help to correct java code</title>
			<link>http://www.daniweb.com/forums/thread241166.html</link>
			<pubDate>Wed, 25 Nov 2009 04:13:30 GMT</pubDate>
			<description><![CDATA[hi everyone 
 this is my code. 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox" title="Help with Code Tags" target="_blank">Help with Code Tags</a> </div> <div>...]]></description>
			<content:encoded><![CDATA[<div>hi everyone<br />
 this is my code.<br />
 <pre style="margin:20px; line-height:13px">public class Qustion3B{<br />
&nbsp;<br />
public static void main (String args[]){<br />
<br />
&nbsp;double sinx = Math.sin(0.5236);<br />
&nbsp;double cosx = Math.cos(0.5236);<br />
<br />
sinx = Math.pow(0.5236,2);<br />
cosx = Math.pow(0.5236,2);<br />
double sum=sinx+cosx;<br />
<br />
System.out.println(&quot;sine: &quot; + sinx+&quot;cosine: &quot; + cosx +&quot;sum: &quot; + sum );<br />
}<br />
}</pre><br />
<br />
it continue to show me that i have mistake in (pow.,) but i can't see it.<br />
:(<br />
please help me</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>girl.java</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241166.html</guid>
		</item>
		<item>
			<title><![CDATA[[Quick Help]Implementing a timer in a for loop, or just making the loop wait a sec?]]></title>
			<link>http://www.daniweb.com/forums/thread241153.html</link>
			<pubDate>Wed, 25 Nov 2009 03:19:25 GMT</pubDate>
			<description><![CDATA[Hey I want to simulate a knight moving in my Knight Tour Gui,  
 
this is the display code, the moves are stored in the arraylist moves. 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a...]]></description>
			<content:encoded><![CDATA[<div>Hey I want to simulate a knight moving in my Knight Tour Gui, <br />
<br />
this is the display code, the moves are stored in the arraylist moves.<br />
<br />
 <pre style="margin:20px; line-height:13px">public void display()<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for(int i = 0; i &lt; moves.size(); i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Gets the correct button<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JButton button = square.get(moves.indexOf(i+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; button.setText(&quot;&quot; + i);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }</pre><br />
<br />
I had something like this, but wasnt implementing the timer correctly I think because it didnt work.<br />
<br />
Any help on this or other ways to do it<br />
<br />
 <pre style="margin:20px; line-height:13px">public void display()<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; timer = new Timer(2000, new ActionListener() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void actionPerformed(ActionEvent evt) {<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; }});<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for(int i = 0; i &lt; moves.size(); i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Gets the correct button<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JButton button = square.get(moves.indexOf(i+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; timer.setDelay(1500);<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; button.setText(&quot;&quot; + i);<br />
&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>.11</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241153.html</guid>
		</item>
		<item>
			<title>Creating an array of objects</title>
			<link>http://www.daniweb.com/forums/thread241137.html</link>
			<pubDate>Wed, 25 Nov 2009 01:37:14 GMT</pubDate>
			<description>Hello there, 
 
 
I am working on an assignment for school and I am having a hard time understanding the concept of an array of objects.  I am required to create an array of Music objects so that I can search through them via a binary search and make changes as stipulated by reading a .txt file.  
...</description>
			<content:encoded><![CDATA[<div>Hello there,<br />
<br />
<br />
I am working on an assignment for school and I am having a hard time understanding the concept of an array of objects.  I am required to create an array of Music objects so that I can search through them via a binary search and make changes as stipulated by reading a .txt file. <br />
<br />
My problem is, I do not think I understand Object arrays properly. I can not seem to populate the array from the Music class. Do I populate in the instanceOf if block? Does it matter? I have two test populations of the array under the music instance of RockSong block and on trying to System.out.println() the output for accuracy I just get a null result. Any shove in the right direction would be most appreciated. Thank you.<br />
<br />
 <pre style="margin:20px; line-height:13px"><br />
<br />
public class Main<br />
{<br />
&nbsp; &nbsp; private TextFileReader listenFile;<br />
&nbsp; &nbsp; private ListenFile currentRecord, nextRecord;<br />
&nbsp; &nbsp; private Music music;<br />
<br />
&nbsp; &nbsp; String listenDate = &quot;&quot;;<br />
&nbsp; &nbsp; String listenName = &quot;&quot;;<br />
&nbsp; &nbsp; String musicType =&quot;&quot;;<br />
&nbsp; &nbsp; String rockGroup = &quot;&quot;;<br />
&nbsp; &nbsp; String musicName = &quot;&quot;;<br />
&nbsp; &nbsp; Calendar date;<br />
&nbsp; &nbsp; Calendar closeDate;<br />
&nbsp; &nbsp; Date df;<br />
<br />
&nbsp;  public static void main (String args[])<br />
&nbsp;  {<br />
&nbsp; &nbsp; (new Main()).DisplayFile();<br />
&nbsp;  }<br />
<br />
&nbsp;  private void DisplayFile()<br />
&nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp;  int count =0;<br />
<br />
<br />
&nbsp; &nbsp;  ObjectInputStream inFile = null;<br />
&nbsp; &nbsp;  try<br />
&nbsp; &nbsp;  { inFile = new ObjectInputStream (new FileInputStream(&quot;music.dat&quot;));}<br />
&nbsp; &nbsp;  catch (IOException ioex) { System.out.println (&quot;ERROR Opening&quot;); System.exit(1); }<br />
<br />
&nbsp; &nbsp;  try<br />
&nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  while (true)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Music music = (Music)inFile.readObject();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Music[] musicArray= new Music[300];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if (music instanceof RockSong){<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  musicArray[0].name = music.name;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  muiscArray[1].timesPlayed = music.timesPlayed;<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; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if (music instanceof ClassicalPiece){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if (music instanceof Musical){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; closeDate = (((Musical)music).close);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (closeDate == null) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ((Musical)music).close=Calendar.getInstance();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(musicArray[count]);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; count++;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp;  catch (EOFException eofex) { System.out.println (&quot;\nDONE&quot;);}<br />
&nbsp; &nbsp;  catch (IOException ioex) { System.out.println (&quot;ERROR Reading&quot;); System.exit(1); }<br />
&nbsp; &nbsp;  catch (ClassNotFoundException cnfex) { System.out.println (&quot;ERROR class&quot;); System.exit(1); }<br />
<br />
&nbsp;  }</pre><br />
And here are my classes:<br />
<br />
 <pre style="margin:20px; line-height:13px">class Music implements Serializable<br />
{<br />
&nbsp; &nbsp;  String name;<br />
&nbsp; &nbsp;  int timesPlayed;<br />
&nbsp; &nbsp;  Calendar lastTime;<br />
}<br />
<br />
class RockSong extends Music<br />
{<br />
&nbsp; &nbsp;  String group;<br />
}<br />
<br />
class ClassicalPiece extends Music<br />
{<br />
&nbsp; &nbsp;  String composer;<br />
&nbsp; &nbsp;  String type;<br />
}<br />
<br />
class Musical extends Music<br />
{<br />
&nbsp; &nbsp;  Calendar open;<br />
&nbsp; &nbsp;  Calendar close;<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>nobodycool</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241137.html</guid>
		</item>
		<item>
			<title>Help with absolute positioning</title>
			<link>http://www.daniweb.com/forums/thread241124.html</link>
			<pubDate>Wed, 25 Nov 2009 00:08:46 GMT</pubDate>
			<description>Hi 
i came across a problem with for my GUI project.  
for my class project i am designing an appointment calendar. for the layout i am using absolute positioning. so when i run my login class, some times the frame pops-up to a weird default Java frame (not re sizable) there is nothing one can do...</description>
			<content:encoded><![CDATA[<div>Hi<br />
i came across a problem with for my GUI project. <br />
for my class project i am designing an appointment calendar. for the layout i am using absolute positioning. so when i run my login class, some times the frame pops-up to a weird default Java frame (not re sizable) there is nothing one can do except close it and run it again. and it decides to pop-up weird randomly i don't notice a pattern.<br />
not sure if the problem is with the absolute positioning layout or something else. will really appreciate if any one can help <br />
Thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>sufi8</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241124.html</guid>
		</item>
		<item>
			<title>Making an extendable program?</title>
			<link>http://www.daniweb.com/forums/thread241122.html</link>
			<pubDate>Tue, 24 Nov 2009 23:27:01 GMT</pubDate>
			<description><![CDATA[Hello all, 
  As you may know by now, from my previous posts recently, I am working on a Paint application.  My question, then, surprisingly does not involve Graphics or Swing. 
   
  So my question is this:  I would like to be able to have a directory such as "APP_HOME\tools" or something similar,...]]></description>
			<content:encoded><![CDATA[<div>Hello all,<br />
  As you may know by now, from my previous posts recently, I am working on a Paint application.  My question, then, surprisingly does not involve Graphics or Swing.<br />
  <br />
  So my question is this:  I would like to be able to have a directory such as &quot;APP_HOME\tools&quot; or something similar, and I would like to have in it some .class files, that the program doesn't necessarily know anything about, perhaps except a known implemented interface, that will be loaded on start of application.<br />
<br />
  Can anyone give me a suggestion? Perhaps an overview of how a program like NetBeans or BlueJ handles plugins? Any information would be welcome.</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/thread241122.html</guid>
		</item>
		<item>
			<title>Button Arrays. Please Help</title>
			<link>http://www.daniweb.com/forums/thread241070.html</link>
			<pubDate>Tue, 24 Nov 2009 18:28:43 GMT</pubDate>
			<description><![CDATA[I'm trying to create an array of two radio buttons.  
but with the code i have right now it just wont show up on my jframe. 
Can anyone tell me what I might be doing wrong? Help please.. 
Here is a snippet of my code .....I'm only working on the gui part right now, so htas why i have not used the...]]></description>
			<content:encoded><![CDATA[<div>I'm trying to create an array of two radio buttons. <br />
but with the code i have right now it just wont show up on my jframe.<br />
Can anyone tell me what I might be doing wrong? Help please..<br />
Here is a snippet of my code .....I'm only working on the gui part right now, so htas why i have not used the listeners yet. but i just need to get the radio buttons to show up on the frame. <br />
<br />
 <pre style="margin:20px; line-height:13px">int howMany;<br />
&nbsp; &nbsp; &nbsp; &nbsp; String[] optStrings = {&quot;Exempt&quot;,&quot;Tax Rate&quot;, &quot; &quot;};<br />
&nbsp; &nbsp; &nbsp; &nbsp; ButtonGroup grpOperator = new ButtonGroup();<br />
&nbsp; &nbsp; &nbsp; &nbsp; JRadioButton[] optSelections = new JRadioButton[3];<br />
<br />
JPanel pnlDesc = new JPanel();<br />
<br />
public HudsonHillsProjectJKSample()<br />
{<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; for (int i = 0; i &lt; howMany; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; optSelections[i] = new JRadioButton(optStrings[i]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; optSelections[i].addItemListener(this);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; grpOperator.add(optSelections[i]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pnlDesc.add(optSelections[i]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp;  add (pnlDesc, BorderLayout. WEST );<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; public static void main (String[] arg)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; HudsonHillsProjectJKSample&nbsp; f = new HudsonHillsProjectJKSample ();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  f.setTitle(&quot;Hudson Hills&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  f.setSize(560,410);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  f.setLocation(375,200);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  f.setVisible(true);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; }//End MAIN<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>jko2326</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241070.html</guid>
		</item>
		<item>
			<title>DataTree issue</title>
			<link>http://www.daniweb.com/forums/thread241061.html</link>
			<pubDate>Tue, 24 Nov 2009 17:27:01 GMT</pubDate>
			<description><![CDATA[I was wondering if someone can help me, I have this snippet of code that I know is giving me an issue but cannot figure why: 
 
  <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 was wondering if someone can help me, I have this snippet of code that I know is giving me an issue but cannot figure why:<br />
<br />
 <pre style="margin:20px; line-height:13px">public D put (K key, D data){<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; DataTreeNode&lt;K,D&gt; dtn = insert(key);<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(key.equals(dtn.key())) <span style="font-weight:bold">return dtn.data();</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; else return null;<br />
&nbsp;  }</pre><br />
I know I want the <span style="font-weight:bold">return dtn.data(); </span> save dtn.data() in a temp variable then update the data using dtn.setData(data)<br />
now return the old saved value of dtn.data but my temp variables are not working. Can anyone help me?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>Alpdog14</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241061.html</guid>
		</item>
		<item>
			<title>java program for dfa</title>
			<link>http://www.daniweb.com/forums/thread241051.html</link>
			<pubDate>Tue, 24 Nov 2009 16:49:52 GMT</pubDate>
			<description><![CDATA[how to write a program in java for regular expression as 
 
• [0 − 9]*(a|b)+[x − z]?b 
• a+(a|b)*c(c?b|ca+)* 
 
please help me in coding ,i will waiting  
 
thanks]]></description>
			<content:encoded><![CDATA[<div>how to write a program in java for regular expression as<br />
<br />
• [0 − 9]*(a|b)+[x − z]?b<br />
• a+(a|b)*c(c?b|ca+)*<br />
<br />
please help me in coding ,i will waiting <br />
<br />
thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>arifihsan</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241051.html</guid>
		</item>
		<item>
			<title>MIDlet - using socket and databases</title>
			<link>http://www.daniweb.com/forums/thread241050.html</link>
			<pubDate>Tue, 24 Nov 2009 16:45:40 GMT</pubDate>
			<description><![CDATA[I'm starting to learn MIDlet and I need a little help with a project. I have a MIDlet which would be a client. This client has to connect to a database - it will send some information to it and also receive an answer back. I have to use Socket for the connection. My problem is that the Server won't...]]></description>
			<content:encoded><![CDATA[<div>I'm starting to learn MIDlet and I need a little help with a project. I have a MIDlet which would be a client. This client has to connect to a database - it will send some information to it and also receive an answer back. I have to use Socket for the connection. My problem is that the Server won't see the Client connected even though I use the same port. <br />
So here is the code for the server:<br />
 <pre style="margin:20px; line-height:13px">public class Server {<br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; public static void main(String[] args) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while(true){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ServerSocket ss=new ServerSocket(5000);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Server started...&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Socket s=ss.accept();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; s.getReceiveBufferSize();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Client connected&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; BufferedReader in=new BufferedReader(new InputStreamReader(s.getInputStream()));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String mesaj=&quot;&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while(!mesaj.equals(&quot;end&quot;)){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mesaj=in.readLine();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(mesaj);<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; }catch(Exception e){e.printStackTrace();}<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
}</pre><br />
The Client:<br />
 <pre style="margin:20px; line-height:13px">public class Client extends MIDlet implements CommandListener,Runnable{<br />
&nbsp; &nbsp; private boolean isPaused;<br />
&nbsp; &nbsp; private static Display display;<br />
&nbsp; &nbsp; private Form f;<br />
&nbsp; &nbsp; private StringItem si;<br />
&nbsp; &nbsp; private TextField tf1;<br />
&nbsp; &nbsp; private TextField tf2;<br />
&nbsp; &nbsp; private boolean stop;<br />
&nbsp; &nbsp; private Command sendCommand = new Command(&quot;Send&quot;, Command.ITEM, 0);<br />
&nbsp; &nbsp; private Command exitCommand = new Command(&quot;Exit&quot;, Command.EXIT, 0);<br />
&nbsp; &nbsp; InputStream is;<br />
&nbsp; &nbsp; OutputStream os;<br />
&nbsp; &nbsp; SocketConnection sc;<br />
<br />
&nbsp; &nbsp; private Client client;<br />
&nbsp; &nbsp; //Sender sender;<br />
<br />
&nbsp; &nbsp; public Client(){<br />
&nbsp; &nbsp; &nbsp; &nbsp; display = Display.getDisplay(this);<br />
&nbsp; &nbsp; &nbsp; &nbsp; f = new Form(&quot;Socket Client&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; si = new StringItem(&quot;Comanda:&quot;, &quot; &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; tf1 = new TextField(&quot;Nr zbor:&quot;, &quot;&quot;, 30, TextField.ANY);<br />
&nbsp; &nbsp; &nbsp; &nbsp; tf2 = new TextField(&quot;Nr bilete:&quot;,&quot;&quot;,30,TextField.ANY);<br />
&nbsp; &nbsp; &nbsp; &nbsp; f.append(si);<br />
&nbsp; &nbsp; &nbsp; &nbsp; f.append(tf1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; f.append(tf2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; f.addCommand(exitCommand);<br />
&nbsp; &nbsp; &nbsp; &nbsp; f.addCommand(sendCommand);<br />
&nbsp; &nbsp; &nbsp; &nbsp; f.setCommandListener(this);<br />
&nbsp; &nbsp; &nbsp; &nbsp; display.setCurrent(f);<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public void start() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; Thread t = new Thread(this);<br />
&nbsp; &nbsp; &nbsp; &nbsp; t.start();<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public void run() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; try {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sc = (SocketConnection)Connector.open(&quot;socket://localhost:5000&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; si.setText(&quot;Connected to server&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; is = sc.openInputStream();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; os = sc.openOutputStream();</pre><br />
I didn't put the rest of the code cause it's long and the connection is the only problem I have. I need the server to recognize the client. Don't tell me to use Http or what else there is cause it's school assignment and I have to use sockets. <br />
<br />
Thanks in advance!</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>laura_v</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241050.html</guid>
		</item>
		<item>
			<title>can you help me?</title>
			<link>http://www.daniweb.com/forums/thread241059.html</link>
			<pubDate>Tue, 24 Nov 2009 16:39:14 GMT</pubDate>
			<description><![CDATA[I want creat thread but I dont know...  <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>I want creat thread but I dont know... <pre style="margin:20px; line-height:13px">import java.util.*;<br />
import javax.swing.*;<br />
import java.awt.*;<br />
import java.awt.event.*;<br />
//------------------------------------------------------------------------------------------------<br />
public class MyApp extends JFrame {<br />
// Data<br />
static boolean stopped = true; // Is the counting stopped? (True or False) --&gt; shared variable<br />
static JTextField number;<br />
//------------------------------------------------------------------------------------------------<br />
// Constructor<br />
public MyApp()<br />
{<br />
// set the GUI<br />
super( &quot;CAP 332 - Assignment 6: Learning Java Threads&quot; );<br />
// create the 2 buttons<br />
// 1) The start button<br />
JButton startButton = new JButton(&quot;Start&quot;);<br />
startButton.addActionListener(new StartButtonHandler());<br />
startButton.setToolTipText(&quot;Click here to start counting.&quot;);<br />
// 2) The stop button<br />
JButton stopButton = new JButton(&quot;Stop&quot;);<br />
stopButton.addActionListener(new StopButtonHandler());<br />
stopButton.setToolTipText(&quot;Click here to stop counting.&quot;);<br />
// create the text field<br />
number = new JTextField(20);<br />
number.setEditable(false);<br />
number.setText(&quot;0&quot;);<br />
// create the panels<br />
JPanel row1Panel = new JPanel();<br />
JPanel row2Panel = new JPanel();<br />
// create the first row<br />
row1Panel.add(number);<br />
// create the second row<br />
row2Panel.setLayout(new GridLayout(1,2)); // Grid layout with 1 row and 2 columns for the 2<br />
buttons<br />
row2Panel.add(startButton);<br />
row2Panel.add(stopButton);<br />
// create a split panel to include the 2 row panels<br />
JSplitPane allPanel = new JSplitPane( JSplitPane.VERTICAL_SPLIT, row1Panel, row2Panel );<br />
allPanel.setOneTouchExpandable( false );<br />
allPanel.setDividerLocation( 50 );<br />
// add this panel to the content pane<br />
getContentPane().add(allPanel);<br />
setSize(500,150);<br />
setVisible( true );<br />
}// end constructor<br />
//------------------------------------------------------------------------------------------------<br />
// main method<br />
public static void main (String[] args)<br />
{<br />
MyApp app = new MyApp ();<br />
app.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );<br />
}// end main<br />
//------------------------------------------------------------------------------------------------<br />
//-----------------------------------------------------------------------<br />
//-----------------------------------------------------------------------<br />
// PRIVATE CLASSES<br />
//-----------------------------------------------------------------------<br />
//-----------------------------------------------------------------------<br />
private class StartButtonHandler implements ActionListener{<br />
public void actionPerformed(ActionEvent e)<br />
{<br />
stopped = false;<br />
long counter = 1;<br />
while (! stopped)<br />
{<br />
number.setText(&quot;&quot;+counter);<br />
counter ++;<br />
}// end while<br />
}// end method<br />
}// end class StartButtonHandler<br />
//-----------------------------------------------------------------------<br />
//-----------------------------------------------------------------------<br />
private class StopButtonHandler implements ActionListener{<br />
public void actionPerformed(ActionEvent e)<br />
{<br />
stopped = true;<br />
}// end method<br />
}// end class StopButtonHandler<br />
//-----------------------------------------------------------------------<br />
//-----------------------------------------------------------------------<br />
} // end class</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>SORelena</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241059.html</guid>
		</item>
		<item>
			<title>Multiple Process Programming with Java</title>
			<link>http://www.daniweb.com/forums/thread241034.html</link>
			<pubDate>Tue, 24 Nov 2009 15:11:45 GMT</pubDate>
			<description>Hello All, 
I need to make parallel processing with Java. I know there are threads but i need to examine a distributed-like system. I will implement the MST algorithim and with a distributed syncronizer I will merge those sepereted nodes with rounds to find best and minimum spanning tree. This...</description>
			<content:encoded><![CDATA[<div>Hello All,<br />
I need to make parallel processing with Java. I know there are threads but i need to examine a distributed-like system. I will implement the MST algorithim and with a distributed syncronizer I will merge those sepereted nodes with rounds to find best and minimum spanning tree. This distributed syncronizer will work on different machines each of them connected with their neighbours with a wireless network.<br />
<br />
For examining this system, my processes work like nodes in my wireless network area and those will make connections with each other. <br />
<br />
For that purpose I should use processes. But I cannot find how to fork these processes, how to kill them, how to wait for them to return to parents.<br />
<br />
Please, I need to make this project before next monday.<br />
Thank you, anyway.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>noktasizvirgul</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241034.html</guid>
		</item>
		<item>
			<title>NPE Error..</title>
			<link>http://www.daniweb.com/forums/thread241033.html</link>
			<pubDate>Tue, 24 Nov 2009 15:07:29 GMT</pubDate>
			<description>`1</description>
			<content:encoded><![CDATA[<div>`1</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>nitrogen33</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241033.html</guid>
		</item>
		<item>
			<title>How should the function can be done? Help pls~</title>
			<link>http://www.daniweb.com/forums/thread241019.html</link>
			<pubDate>Tue, 24 Nov 2009 14:24:49 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 javax.swing.JOptionPane;<br />
import java.text.*;<br />
<br />
public class casestudy<br />
{<br />
&nbsp; public static void main(String[] args)<br />
&nbsp; {<br />
&nbsp; &nbsp; JOptionPane.showInputDialog(null, &quot;Program Application&quot;, &quot;Choose a Program&quot;,<br />
&nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.QUESTION_MESSAGE, null, new Object[]<br />
&nbsp; &nbsp; &nbsp; &nbsp; { &quot;Bubble Sorting&quot;,&quot;Balloon Sorting&quot;, &quot;Insertion&quot;,&quot;Exit&quot; },&quot;casestudy&quot;);<br />
<br />
<br />
&nbsp; &nbsp; switch(casestudy)<br />
&nbsp; &nbsp; {case 1:<br />
&nbsp; &nbsp; {String stno,ndno,rdno,thno,fthno,sthno,vthno,ethno,nthno,tthno;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stno = JOptionPane.showInputDialog(null, &quot;Input 1st number:&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ndno = JOptionPane.showInputDialog(null, &quot;Input 2nd number:&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rdno = JOptionPane.showInputDialog(null, &quot;Input 3rd number:&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; thno = JOptionPane.showInputDialog(null, &quot;Input 4th number:&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fthno = JOptionPane.showInputDialog(null, &quot;Input 5th number:&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sthno = JOptionPane.showInputDialog(null, &quot;Input 6th number:&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vthno = JOptionPane.showInputDialog(null, &quot;Input 7th number:&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ethno = JOptionPane.showInputDialog(null, &quot;Input 8th number:&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nthno = JOptionPane.showInputDialog(null, &quot;Input 9th number:&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tthno = JOptionPane.showInputDialog(null, &quot;Input 10th number:&quot;);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int i;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int array[] = {Integer.parseInt(stno),Integer.parseInt(ndno),Integer.parseInt(rdno),Integer.parseInt(thno),Integer.parseInt(fthno),Integer.parseInt(sthno),Integer.parseInt(vthno),Integer.parseInt(ethno),Integer.parseInt(nthno),Integer.parseInt(tthno)};<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  for(i = 0; i &lt; array.length; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null,&quot;Values Before the sort: \n&quot;+array[i]+&quot; &quot;,&quot;Input&quot;,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.INFORMATION_MESSAGE);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bubble_srt(array, array.length);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  for(i = 0; i &lt;array.length; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null,&quot;Values after the sort: \n&quot;+array[i]+&quot; &quot;,&quot;Result&quot;,JOptionPane.INFORMATION_MESSAGE);<br />
<br />
}<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;  public static void bubble_srt( int a[], int n)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int i, p,t=0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for(i = 0; i &lt; n; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for(p = 1; p &lt; (n-i); p++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(a[p-1] &gt; a[p])<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; t = a[p-1];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; a[p-1]=a[p];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; a[p]=t;<br />
&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 />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}<br />
&nbsp; &nbsp;  case 2:<br />
&nbsp; &nbsp;  System.out.println(&quot;wla pa&quot;);<br />
&nbsp; &nbsp;  case 3:<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int t;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, &quot;\tThis program will accept 5 inputs from you.&quot;, &quot;\tInsertion&quot;, JOptionPane.INFORMATION_MESSAGE);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String stno,ndno,rdno,thno,fthno;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stno = JOptionPane.showInputDialog(null, &quot;Input 1st number:&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ndno = JOptionPane.showInputDialog(null, &quot;Input 2nd number:&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rdno = JOptionPane.showInputDialog(null, &quot;Input 3rd number:&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; thno = JOptionPane.showInputDialog(null, &quot;Input 4th number:&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fthno = JOptionPane.showInputDialog(null, &quot;Input 5th number:&quot;);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int array[] = {Integer.parseInt(stno),Integer.parseInt(ndno),Integer.parseInt(rdno),Integer.parseInt(thno),Integer.parseInt(fthno)};<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for(t = 0; t &lt; array.length; t++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, array[t]+&quot;&nbsp; &quot;, &quot;Values before sorting.&quot;, JOptionPane.INFORMATION_MESSAGE);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int i = 1; i &lt; 5; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int j = i;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int B = array[i];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while ((j &gt; 5) &amp;&amp; (array[j-1] &gt; B))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; array[j] = array[j-1];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; j--;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; array[j] = B;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for(t = 0; t &lt; 5; t++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, array[t]+&quot;&nbsp; &quot;, &quot;Values after sorting.&quot;, JOptionPane.INFORMATION_MESSAGE);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
<br />
&nbsp; }<br />
}</pre><br />
<br />
<br />
<br />
<br />
=====&gt;this function &quot;public static void bubble_srt( int a[], int n)&quot;<br />
<br />
is this right?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>eechan03</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread241019.html</guid>
		</item>
		<item>
			<title>java project help, reading in from a file and adding data to JTable</title>
			<link>http://www.daniweb.com/forums/thread240992.html</link>
			<pubDate>Tue, 24 Nov 2009 13:09:13 GMT</pubDate>
			<description>Hey guys iv got this project to make an address book that has all kinds of functions and iv got them all working apart from one bit, it needs to be able to read a file when it opens as well as import other data from other files. 
 
The data comes in the following format: 
Tony Hancock 
01202719029...</description>
			<content:encoded><![CDATA[<div>Hey guys iv got this project to make an address book that has all kinds of functions and iv got them all working apart from one bit, it needs to be able to read a file when it opens as well as import other data from other files.<br />
<br />
The data comes in the following format:<br />
Tony Hancock<br />
01202719029<br />
07676101393<br />
1 Charminster Road, Bournemouth, Dorset, BH8 8UE<br />
Auberon Waugh<br />
01823810098<br />
None<br />
Combe Florey House, Combe Florey, Somerset, TA4 3JD<br />
<br />
so name, home number, mobile number and then address.<br />
<br />
i have been trying to bufferedread the file in and then add the details to an arrayList which i then need to set up a loop to catch the first index which would be the name then link that to the Jtable name section (textFirstName and textLastName) somehow, then repeat that for another 3 index's till index 3 and start again, BUT how do i do that???? <br />
<br />
any help would be great guys, im so close to finishing and got very little time left.<br />
<br />
Thanks<br />
<br />
heres my code so far:<br />
 <pre style="margin:20px; line-height:13px">public class Q3 implements ActionListener<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  JFrame addressBook;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  JFrame contacts;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  JList theList;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  DefaultTableModel tableModel;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  JLabel labFirstName, labLastName, labAddress, labPhone, labMob, searchTitle;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  JTextField textFirstName, textLastName, textAddress, textPhone, textMob, contactsTextArea;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  JButton buttonSave, buttonDelete, buttonImport, buttonSearch, buttonExit, buttonReset;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  String name, address, allContacts;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  int phone, mob;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  int recordNumber;&nbsp; &nbsp; &nbsp; &nbsp;  // used to naviagate using &gt;&gt; and &lt;&lt; buttons <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Container container1, container2;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  JPanel panel1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  JMenuBar menu_bar;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  JMenu file;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  JMenuItem exit;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  JMenuItem open;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  JScrollPane scroller;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  JTable table;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ArrayList&lt;contact&gt; people = new ArrayList&lt;contact&gt;();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  TableRowSorter &lt;DefaultTableModel&gt; sorter;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  public static void main(String args[]) throws Exception<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; new Q3();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  public Q3() throws Exception<br />
&nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  name&nbsp; &nbsp; = &quot;&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  address = &quot;&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  phone&nbsp;  = -1 ;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Stores 0 to indicate no Phone Number<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  mob = -1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  recordNumber = -1;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  createGUI();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  createContactsFrame();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  createTable();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  readFromFile();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  public void createTable()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  tableModel = new DefaultTableModel();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  table = new JTable (tableModel);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  tableModel.addColumn(&quot;Name&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  tableModel.addColumn(&quot;Address&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  tableModel.addColumn(&quot;Home Number&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  tableModel.addColumn(&quot;Mobile Number&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  table.setAutoCreateRowSorter(true);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  table.setVisible(true);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  tableModel.addRow(new Object[] <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {&quot;Mary Robinson&quot;, &quot;85 Brick Road&quot;, &quot;0123481244&quot;, &quot;07813538241&quot;});<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  tableModel.addRow(new Object[]<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {&quot;Alison Jones&quot;, &quot;17 Lemar Street&quot;, &quot;02084579121&quot;, &quot;07753985712&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; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  table.setPreferredScrollableViewportSize(new Dimension(500, 100));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  table.setFillsViewportHeight(true);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  scroller = new JScrollPane(table);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  panel1.add(scroller);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  sorter = new TableRowSorter &lt;DefaultTableModel&gt;(tableModel);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  table.setRowSorter(sorter);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  public void createContactsFrame()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //set frame characteristics<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  contacts = new JFrame(&quot;Contacts&quot;);&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  contacts.setSize(525,300);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  contacts.setVisible(true);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  contacts.setResizable(false);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  contacts.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //set panel to hold components&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  panel1 = new JPanel();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  contacts.getContentPane().add(panel1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  panel1.setBackground(Color.BLACK);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  menu_bar = new JMenuBar();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  contacts.setJMenuBar(menu_bar);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  file = new JMenu (&quot;File&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  menu_bar.add(file);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  exit = new JMenuItem (&quot;Exit&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  file.add(exit);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  exit.addActionListener(this);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  open = new JMenuItem (&quot;Open&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  file.add(open);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  open.addActionListener(this);<br />
&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;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; public void createGUI()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  /*Create a frame, get its contentpane and set layout*/<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  addressBook = new JFrame(&quot;Address Book&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  addressBook.setSize(300,300);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  addressBook.setResizable(false);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  addressBook.setVisible(true);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  addressBook.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);<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;  container1 = addressBook.getContentPane();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  container1.setLayout(new GridBagLayout());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  container1.setBackground(Color.black);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  container1.setSize(300, 300);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  menu_bar = new JMenuBar();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  addressBook.setJMenuBar(menu_bar);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  file = new JMenu (&quot;File&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  menu_bar.add(file);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  exit = new JMenuItem (&quot;Exit&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  file.add(exit);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  exit.addActionListener(this);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //Arrange components on contentPane and set Action Listeners to each JButton<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  arrangeComponents();&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  addressBook.setVisible(true);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  public void arrangeComponents()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  labFirstName = new JLabel(&quot;First Name&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  labFirstName.setForeground(Color.white);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  labLastName = new JLabel(&quot;Last Name&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  labLastName.setForeground(Color.white);<br />
&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;  labAddress = new JLabel(&quot;Address&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  labAddress.setForeground(Color.white);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  labPhone = new JLabel(&quot;Home Number&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  labPhone.setForeground(Color.white);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  labMob = new JLabel(&quot;Mobile Number&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  labMob.setForeground(Color.white);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  textFirstName&nbsp; &nbsp; = new JTextField(20);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  textLastName = new JTextField(20);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  textAddress = new JTextField(20);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  textPhone&nbsp;  = new JTextField(20);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  textMob&nbsp;  = new JTextField(20);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  buttonSave&nbsp;  = new JButton(&quot;Save&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  buttonDelete = new JButton(&quot;Delete&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  buttonSearch = new JButton(&quot;Search&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  buttonImport = new JButton(&quot;Import&quot;);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  buttonReset = new JButton(&quot;Reset&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  buttonExit&nbsp; &nbsp; = new JButton(&quot;Exit&quot;);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  /*add all initialized components to the container*/<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  GridBagConstraints gridBagConstraintsx01 = new GridBagConstraints();<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx01.gridx = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx01.gridy = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx01.insets = new Insets(5,5,5,5); <br />
&nbsp; &nbsp; &nbsp; &nbsp; container1.add(labFirstName, gridBagConstraintsx01);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; GridBagConstraints gridBagConstraintsx02 = new GridBagConstraints();<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx02.gridx = 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx02.insets = new Insets(5,5,5,5); <br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx02.gridy = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx02.gridwidth = 2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx02.fill = GridBagConstraints.BOTH;<br />
&nbsp; &nbsp; &nbsp; &nbsp; container1.add(textFirstName, gridBagConstraintsx02);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; GridBagConstraints gridBagConstraintsx03 = new GridBagConstraints();<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx03.gridx = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx03.insets = new Insets(5,5,5,5); <br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx03.gridy = 2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; container1.add(labAddress, gridBagConstraintsx03);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; GridBagConstraints gridBagConstraintsx04 = new GridBagConstraints();<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx04.gridx = 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx04.insets = new Insets(5,5,5,5); <br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx04.gridy = 2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx04.gridwidth = 2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx04.fill = GridBagConstraints.BOTH;<br />
&nbsp; &nbsp; &nbsp; &nbsp; container1.add(textAddress, gridBagConstraintsx04);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; GridBagConstraints gridBagConstraintsx05 = new GridBagConstraints();<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx05.gridx = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx05.insets = new Insets(5,5,5,5); <br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx05.gridy = 3;<br />
&nbsp; &nbsp; &nbsp; &nbsp; container1.add(labPhone, gridBagConstraintsx05);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; GridBagConstraints gridBagConstraintsx06 = new GridBagConstraints();<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx06.gridx = 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx06.gridy = 3;<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx06.insets = new Insets(5,5,5,5); <br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx06.gridwidth = 2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx06.fill = GridBagConstraints.BOTH;<br />
&nbsp; &nbsp; &nbsp; &nbsp; container1.add(textPhone, gridBagConstraintsx06);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; GridBagConstraints gridBagConstraintsx07 = new GridBagConstraints();<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx07.gridx = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx07.insets = new Insets(5,5,5,5); <br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx07.gridy = 4;<br />
&nbsp; &nbsp; &nbsp; &nbsp; container1.add(labMob, gridBagConstraintsx07);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; GridBagConstraints gridBagConstraintsx08 = new GridBagConstraints();<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx08.gridx = 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx08.gridy = 4;<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx08.gridwidth = 2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx08.insets = new Insets(5,5,5,5); <br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx08.fill = GridBagConstraints.BOTH;<br />
&nbsp; &nbsp; &nbsp; &nbsp; container1.add(textMob, gridBagConstraintsx08);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; GridBagConstraints gridBagConstraintsx15 = new GridBagConstraints();<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx15.gridx = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx15.gridy = 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx15.insets = new Insets(5,5,5,5); <br />
&nbsp; &nbsp; &nbsp; &nbsp; container1.add(labLastName, gridBagConstraintsx15);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; GridBagConstraints gridBagConstraintsx12 = new GridBagConstraints();<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx12.gridx = 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx12.gridy = 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx12.insets = new Insets(5,5,5,5); <br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx12.gridwidth = 2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx12.fill = GridBagConstraints.BOTH;<br />
&nbsp; &nbsp; &nbsp; &nbsp; container1.add(textLastName, gridBagConstraintsx12);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; GridBagConstraints gridBagConstraintsx09 = new GridBagConstraints();<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx09.gridx = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx09.gridy = 5;<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx09.insets = new Insets(5,5,5,5); <br />
&nbsp; &nbsp; &nbsp; &nbsp; container1.add(buttonSave, gridBagConstraintsx09);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; GridBagConstraints gridBagConstraintsx10 = new GridBagConstraints();<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx10.gridx = 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx10.gridy = 5;<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx10.insets = new Insets(5,5,5,5); <br />
&nbsp; &nbsp; &nbsp; &nbsp; container1.add(buttonDelete, gridBagConstraintsx10);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; GridBagConstraints gridBagConstraintsx11 = new GridBagConstraints();<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx11.gridx = 2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx11.gridy = 5;<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx11.insets = new Insets(5,5,5,5); <br />
&nbsp; &nbsp; &nbsp; &nbsp; container1.add(buttonImport, gridBagConstraintsx11);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; GridBagConstraints gridBagConstraintsx13 = new GridBagConstraints();<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx13.gridx = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx13.gridy = 6;<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx13.insets = new Insets(5,5,5,5); <br />
&nbsp; &nbsp; &nbsp; &nbsp; container1.add(buttonSearch, gridBagConstraintsx13);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; GridBagConstraints gridBagConstraintsx14 = new GridBagConstraints();<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx14.gridx = 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx14.gridy = 6;<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx14.insets = new Insets(5,5,5,5); <br />
&nbsp; &nbsp; &nbsp; &nbsp; container1.add(buttonReset, gridBagConstraintsx14);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; GridBagConstraints gridBagConstraintsx16 = new GridBagConstraints();<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx16.gridx = 2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx16.gridy = 6;<br />
&nbsp; &nbsp; &nbsp; &nbsp; gridBagConstraintsx16.insets = new Insets(5,5,5,5); <br />
&nbsp; &nbsp; &nbsp; &nbsp; container1.add(buttonExit, gridBagConstraintsx16);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; buttonExit.addActionListener(this);<br />
&nbsp; &nbsp; &nbsp; &nbsp; buttonSave.addActionListener(this);<br />
&nbsp; &nbsp; &nbsp; &nbsp; buttonDelete.addActionListener(this);<br />
&nbsp; &nbsp; &nbsp; &nbsp; buttonSearch.addActionListener(this);<br />
&nbsp; &nbsp; &nbsp; &nbsp; buttonReset.addActionListener(this);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  public void saveToFile()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  FileWriter output;<br />
&nbsp; &nbsp; &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; output = new FileWriter(new File( &quot;contactFile.txt&quot; ) );<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //output.writeObject(people);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int i = 0; i &lt; people.size(); 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; contact c = people.get(i);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; output.write(c.getFirstName() + &quot; &quot; + c.getLastName() + &quot;\n&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; output.write(c.getHomeNumber() + &quot;\n&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; output.write(c.getMobileNumber() + &quot;\n&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; output.write(c.getAddress() + &quot;\n&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; output.close();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; catch (IOException ioException)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.err.println( &quot;Error.&quot; );<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; public void readFromFile () throws Exception<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  // open file with bufferedreader<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  // while ()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //&nbsp;  check <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  // counter....... number of lines per contact is 4, name,home number, mobile number, address.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ArrayList&lt;String&gt; fileRead = new ArrayList&lt;String&gt;();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  try <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  String lineread = &quot;&quot;;<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; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  BufferedReader bufferedReadIn = new BufferedReader(new FileReader(&quot;H:\\Copy of address book//a.txt&quot;));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while ((lineread = bufferedReadIn.readLine()) != null)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fileRead.add(lineread);<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(fileRead.get(3));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int fileRead = 0; fileRead &lt;=3; fileRead++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(fileRead);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //contact a = new contact(textFirstName.getText(), textLastName.getText(),textPhone.getText(), textMob.getText(), textAddress.getText());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //people.add(a);<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; &nbsp; &nbsp; &nbsp;  //this.tableModel.addRow(new Object[]{a.getFirstName() + &quot; &quot; + a.getLastName(),a.getAddress(),<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; a.getHomeNumber(), a.getMobileNumber()});<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 />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bufferedReadIn.close();<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; catch (IOException ex)<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;error&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; public void actionPerformed (ActionEvent e)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if (e.getSource() == buttonExit)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  System.exit(0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  else if (e.getActionCommand().equals(&quot;Exit&quot;))<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; &nbsp; &nbsp; &nbsp;  System.exit(0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  else if (e.getSource() == buttonSave)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  contact c = new contact(textFirstName.getText(), textLastName.getText(),textPhone.getText(), textMob.getText(), textAddress.getText());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  people.add(c);<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; &nbsp; &nbsp; &nbsp;  this.tableModel.addRow(new Object[]{c.getFirstName() + &quot; &quot; + c.getLastName(),c.getAddress(),<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  c.getHomeNumber(), c.getMobileNumber()});<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  saveToFile();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  else if (e.getSource() == buttonDelete)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  tableModel.removeRow(table.getSelectedRow());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  } <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  else if(e.getSource() == buttonSearch)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  String text = textFirstName.getText() + textLastName.getText() + textAddress.getText() + textPhone.getText() + textMob.getText();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if (text.length() == 0)<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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  sorter.setRowFilter(null);<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; &nbsp; &nbsp; &nbsp;  else<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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  sorter.setRowFilter(RowFilter.regexFilter(text));<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; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  else if (e.getActionCommand().equals(&quot;Open&quot;))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  JFileChooser chooser = new JFileChooser();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if (chooser.showOpenDialog(container1) == JFileChooser.APPROVE_OPTION)<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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  try<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  BufferedReader file_in = new BufferedReader(<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;  new FileReader (chooser.getSelectedFile()));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  while (true)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String line = file_in.readLine();<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; if(line == null)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 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; <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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.people.toArray();<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; &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;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  catch (FileNotFoundException fnfe)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &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;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  catch (IOException ioe)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &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;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  else if (e.getSource() == buttonReset)<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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  this.textFirstName.setText(&quot;&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  this.textLastName.setText(&quot;&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  this.textAddress.setText(&quot;&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  this.textPhone.setText(&quot;&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  this.textMob.setText(&quot;&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp;}</pre><br />
 <pre style="margin:20px; line-height:13px"><br />
public class contact <br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; String firstName;<br />
&nbsp; &nbsp; &nbsp; &nbsp; String lastName;<br />
&nbsp; &nbsp; &nbsp; &nbsp; String homeNumber;<br />
&nbsp; &nbsp; &nbsp; &nbsp; String mobileNumber;<br />
&nbsp; &nbsp; &nbsp; &nbsp; String address;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; public contact (){}<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; public contact (String fn, String ln, String hn, String mn, String a)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; firstName = fn;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lastName = ln;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; homeNumber = hn;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mobileNumber = mn;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; address = a;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; public String getFirstName() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return firstName;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; public void setFirstName(String firstName) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.firstName = firstName;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; public String getLastName() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return lastName;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; public void setLastName(String lastName) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.lastName = lastName;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; public String getHomeNumber() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return homeNumber;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; public void setHomeNumber(String homeNumber) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.homeNumber = homeNumber;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; public String getMobileNumber() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return mobileNumber;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; public void setMobileNumber(String mobileNumber) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.mobileNumber = mobileNumber;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; public String getAddress() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return address;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; public void setAddress(String address) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.address = address;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>hanntaa</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240992.html</guid>
		</item>
		<item>
			<title>Help about Letter repitition(in java)</title>
			<link>http://www.daniweb.com/forums/thread240955.html</link>
			<pubDate>Tue, 24 Nov 2009 10:33:43 GMT</pubDate>
			<description>Hi gud evening to all!! :) 
Can someone help me with regards to my exercisE? 
I really need to finish my exercise.. 
 
The problem is this.. 
I am going to determine how many times does the  letter occurs in a sentence including spaces and  periods... 
 
For example: 
Sentence: 
We are welcome to...</description>
			<content:encoded><![CDATA[<div>Hi gud evening to all!! :)<br />
Can someone help me with regards to my exercisE?<br />
I really need to finish my exercise..<br />
<br />
The problem is this..<br />
I am going to determine how many times does the  letter occurs in a sentence including spaces and  periods...<br />
<br />
For example:<br />
Sentence:<br />
We are welcome to come.<br />
<br />
So.. output may be like this,<br />
w=2<br />
e=5<br />
a=1<br />
r=1<br />
l=1<br />
c=2<br />
o=3<br />
m=2<br />
t=1<br />
spaces=4<br />
period=1<br />
<br />
<br />
pls i really need your help... i have my code here... it's not working..<br />
thanks for the repsz.....</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>lightner86</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240955.html</guid>
		</item>
		<item>
			<title>Having trouble installing java error 25099 please help</title>
			<link>http://www.daniweb.com/forums/thread240919.html</link>
			<pubDate>Tue, 24 Nov 2009 07:25:31 GMT</pubDate>
			<description><![CDATA[installing java on my firefox explorer get right to the end of the installation and it gives me an error message saying "error 25099. unzipping core files failed"  doesnt allow me to do please help as my name says im a big noob when it comes to pc shit.]]></description>
			<content:encoded><![CDATA[<div>installing java on my firefox explorer get right to the end of the installation and it gives me an error message saying &quot;error 25099. unzipping core files failed&quot;  doesnt allow me to do please help as my name says im a big noob when it comes to pc shit.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>big noob</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240919.html</guid>
		</item>
		<item>
			<title>how to stop/exit the mediabox</title>
			<link>http://www.daniweb.com/forums/thread240908.html</link>
			<pubDate>Tue, 24 Nov 2009 06:31:41 GMT</pubDate>
			<description>hi  
may i know how to exit the mediabox? 
for example i create a group inside that is the mediabox 
but when i click the close button(custom button) it will go to the other group 
and thus exit the mediabox. 
current situation is that when i click the close button, 
it will continue playing. or it...</description>
			<content:encoded><![CDATA[<div>hi <br />
may i know how to exit the mediabox?<br />
for example i create a group inside that is the mediabox<br />
but when i click the close button(custom button) it will go to the other group<br />
and thus exit the mediabox.<br />
current situation is that when i click the close button,<br />
it will continue playing. or it will pause when i code it mediabox.paused();<br />
<br />
this is my code<br />
<br />
 <pre style="margin:20px; line-height:13px">var btnCloseDetail: CustomButton = CustomButton {<br />
btnNormal:&quot;{_DIR_}closedetail.png&quot;<br />
fitWidth: 78<br />
x: (Screen.primary.visualBounds.width - 80) as Integer;<br />
y: (Screen.primary.visualBounds.width - (Screen.primary.visualBounds.width - 30)) as Integer;<br />
visible:false<br />
<br />
onMousePressed: function(e: MouseEvent) {<br />
detailWind.opacity = 0;<br />
exitAppsBtn.visible=true;<br />
btnCloseDetail.visible = false;<br />
<br />
mediaBox.pause();<br />
delete mediaBox from detailPage.content;<br />
<br />
navBtnGrp.disable = false;<br />
detailWindTransition.play();<br />
pageNode = Constant.RESULT_PAGE;<br />
}<br />
}<br />
<br />
var mediaBox:MediaBox;<br />
function playVideo(){<br />
delete detailPage.content;<br />
insert btnCloseDetail into detailPage.content;<br />
<br />
<br />
var media = &quot;file:///C:/A.flv&quot;;<br />
mediaBox = MediaBox {<br />
// your media(video/audio) source and information<br />
// Only mediaSource is the required variable. All others are optional.<br />
mediaSource: media<br />
mediaTitle: &quot;Big Buck Bunny&quot;<br />
mediaDescription: &quot;A well-tempered rabbit finds his day...&quot;<br />
<br />
// controls the visibility of mediaTitle/mediaDescription<br />
showMediaInfo: true<br />
<br />
// the position and size of the media on screen<br />
translateX: 300<br />
translateY: 300<br />
width: 640<br />
height: 360<br />
<br />
// make the movie play as soon as it's loaded<br />
autoPlay: true<br />
<br />
// media controlbar height at the bottom of the media view<br />
mediaControlBarHeight: 25<br />
<br />
// some examples of function variables to interact with outside<br />
onEndOfMedia: function() {<br />
<br />
}<br />
onMouseClicked: function(me) {<br />
}<br />
}<br />
insert mediaBox into detailPage.content;<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>xclaim</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240908.html</guid>
		</item>
		<item>
			<title>Database driven Web services</title>
			<link>http://www.daniweb.com/forums/thread240895.html</link>
			<pubDate>Tue, 24 Nov 2009 05:24:27 GMT</pubDate>
			<description>Hi guys, 
 
Im looking for some tutorial which could illustrate development of database driven web services. I tried to search some through google, however no success so far. 
 
Thanks in advance!</description>
			<content:encoded><![CDATA[<div>Hi guys,<br />
<br />
Im looking for some tutorial which could illustrate development of database driven web services. I tried to search some through google, however no success so far.<br />
<br />
Thanks in advance!</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>timaquerra</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240895.html</guid>
		</item>
		<item>
			<title>execution time</title>
			<link>http://www.daniweb.com/forums/thread240892.html</link>
			<pubDate>Tue, 24 Nov 2009 04:55:15 GMT</pubDate>
			<description>Cud u pls pls help in writing a java code to find execution time of application programs like word???</description>
			<content:encoded><![CDATA[<div>Cud u pls pls help in writing a java code to find execution time of application programs like word???</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>proj</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240892.html</guid>
		</item>
		<item>
			<title>help me with the codes for uploading images</title>
			<link>http://www.daniweb.com/forums/thread240916.html</link>
			<pubDate>Tue, 24 Nov 2009 04:40:50 GMT</pubDate>
			<description>can any1 pls help me with the codes for uploading images to my java prog.. and codes for DB connectivity with MS access... its nt connecting.... i need it asap..!!!</description>
			<content:encoded><![CDATA[<div>can any1 pls help me with the codes for uploading images to my java prog.. and codes for DB connectivity with MS access... its nt connecting.... i need it asap..!!!</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>student_cs</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240916.html</guid>
		</item>
		<item>
			<title>How to get the active window</title>
			<link>http://www.daniweb.com/forums/thread240888.html</link>
			<pubDate>Tue, 24 Nov 2009 04:27:50 GMT</pubDate>
			<description>Hi, 
I launched my swing application.before it launched I opend a note pad.When my application got launched it is having textfiled which is blinking.but when we type something it is typed into the notepad. 
 
i need to remove the curser when the application is not having the focus. 
 
But I didnt...</description>
			<content:encoded><![CDATA[<div>Hi,<br />
I launched my swing application.before it launched I opend a note pad.When my application got launched it is having textfiled which is blinking.but when we type something it is typed into the notepad.<br />
<br />
i need to remove the curser when the application is not having the focus.<br />
<br />
But I didnt find any java method to get the current focus owner which is out side JVM. In the above case swing application always return it self as the ActiveWindow.<br />
<br />
It will be great if any one suggest ant native method to get the active window in the OS.<br />
<br />
I find some methods like GetGUIThreadInfo and GetActiveWindow in C.But Iam total new to C.Can anyone give a code snippet get the active window in the OS.<br />
<br />
Thanks,<br />
Babeet Mathew</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>babeet</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240888.html</guid>
		</item>
		<item>
			<title>Write a formatted field to a file</title>
			<link>http://www.daniweb.com/forums/thread240885.html</link>
			<pubDate>Tue, 24 Nov 2009 04:12:12 GMT</pubDate>
			<description><![CDATA[Hey, 
 
I want to know whether it is possible to send a formatted string ie. 
 
System.out.printf("%2d%6d%23f...",a,b,c); 
to a .txt file so that when I view the .txt it will appear properly justified with spaces and tabs. 
 
Thanks]]></description>
			<content:encoded><![CDATA[<div>Hey,<br />
<br />
I want to know whether it is possible to send a formatted string ie.<br />
 <pre style="margin:20px; line-height:13px">System.out.printf(&quot;%2d%6d%23f...&quot;,a,b,c);</pre>to a .txt file so that when I view the .txt it will appear properly justified with spaces and tabs.<br />
<br />
Thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>kenji</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240885.html</guid>
		</item>
		<item>
			<title>Binary Search Help</title>
			<link>http://www.daniweb.com/forums/thread240881.html</link>
			<pubDate>Tue, 24 Nov 2009 03:50:01 GMT</pubDate>
			<description><![CDATA[Hi, I am trying to write a binary search. The main method randomly makes an array of 1 mil int's, and the binary search returns if an entered int is in the array, but I seem to be having trouble getting it to work, I've been working on it for a few hours now and any input would be greatly...]]></description>
			<content:encoded><![CDATA[<div>Hi, I am trying to write a binary search. The main method randomly makes an array of 1 mil int's, and the binary search returns if an entered int is in the array, but I seem to be having trouble getting it to work, I've been working on it for a few hours now and any input would be greatly appreciated.<br />
<br />
 <pre style="margin:20px; line-height:13px">package binarysearch;<br />
import java.util.Random;<br />
import java.util.Scanner;<br />
public class Search {<br />
&nbsp; &nbsp; public static void main(String&#91;&#93; args) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; int&#91;&#93; array = new int&#91;1000000&#93;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; array&#91;0&#93; = 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; Random randGen = new Random();<br />
&nbsp; &nbsp; &nbsp; &nbsp; for (int i = 1; i &lt; array.length; i++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; array&#91;i&#93; = array&#91;i - 1&#93; + randGen.nextInt(3) + 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; Scanner input = new Scanner (System.in);<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.print(&quot;Please enter a number to be checked: &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; int userinput = input.nextInt();<br />
&nbsp; &nbsp; &nbsp; &nbsp; inArray(array, userinput);<br />
//&nbsp; &nbsp; &nbsp; &nbsp; for (int j = 0; j &lt; array.length; j++) {<br />
//&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(array&#91;j&#93;);<br />
//&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (inArray(array, userinput) != -1) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(userinput + &quot; is in the array!&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(userinput + &quot; was found in spot &quot; + inArray(array, userinput));<br />
&nbsp; &nbsp; &nbsp; &nbsp; } else {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(userinput + &quot; is not in the array!&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public static int /*boolean*/ inArray(int&#91;&#93; array, int userinput) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; int count = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int low = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int high = array.length - 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; boolean check = false;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int mid = (low + high) / 2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; while (true) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (check = true) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; count++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (high &lt; low || low &gt; high) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; check = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; count++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (array&#91;mid&#93; == userinput) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; check = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; count++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (array&#91;mid&#93; &gt; userinput) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; high = mid;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; count++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (array&#91;mid&#93; &lt; userinput) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; low = mid;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; count++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
//&nbsp; &nbsp; &nbsp; &nbsp; }<br />
//&nbsp; &nbsp; &nbsp; &nbsp; return true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (check == true) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return count;<br />
&nbsp; &nbsp; &nbsp; &nbsp; } else {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return -1;<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>gabec94</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240881.html</guid>
		</item>
		<item>
			<title>Mouse Click control</title>
			<link>http://www.daniweb.com/forums/thread240880.html</link>
			<pubDate>Tue, 24 Nov 2009 03:36:41 GMT</pubDate>
			<description>I want to control the number of clicks in my button group which is inside DefaultTableModel of JTable. Like only one click for a certain Radiobutton. 
 
Suppose I have 3 radio buttons in a button group: 
 
1) A 
2) B 
3) C 
 
If a user clicks A he can select it only once by one click. For Second or...</description>
			<content:encoded><![CDATA[<div>I want to control the number of clicks in my button group which is inside DefaultTableModel of JTable. Like only one click for a certain Radiobutton.<br />
<br />
Suppose I have 3 radio buttons in a button group:<br />
<br />
1) A<br />
2) B<br />
3) C<br />
<br />
If a user clicks A he can select it only once by one click. For Second or third click it gets blocked. Now the problem is that I am not able to use <br />
 <pre style="margin:20px; line-height:13px">e.getClickCount()</pre> method in my Button group Actionlistner.<br />
<br />
Here is my code.<br />
JTable MouseListner:-<br />
 <pre style="margin:20px; line-height:13px">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  jtable.addMouseListener(new MouseListener() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void mouseClicked(MouseEvent evt) {}<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void mouseEntered(MouseEvent evt) {}<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void mouseExited(MouseEvent evt) {}<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void mousePressed(MouseEvent e) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int selectRow,selectColumn;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Point p = e.getPoint();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; selectRow = getTable().rowAtPoint(new Point(e.getX(),e.getY()));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(e.getClickCount() == 1) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; row = selectRow+1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setRow(row);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if(e.getClickCount() &gt; 2) {System.out.println(&quot;NOT ALLOWED&quot;);}<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  public void mouseReleased(MouseEvent evt) {}<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; });</pre><br />
       For jButton ActionListner like this:-<br />
 <pre style="margin:20px; line-height:13px">&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; buttons[i].addActionListener(new java.awt.event.ActionListener() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if(e.getActionCommand().equals(&quot;myRadioButton&quot;)){<br />
&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(&quot;value&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if (e.getClickCount() == 1) {}<br />
&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(getRow());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  buttons[1].setEnabled(false);<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;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  });</pre><br />
Would appreciate any help :P<br />
<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/thread240880.html</guid>
		</item>
		<item>
			<title>Basic Exception Handling assistance</title>
			<link>http://www.daniweb.com/forums/thread240869.html</link>
			<pubDate>Tue, 24 Nov 2009 03:05:42 GMT</pubDate>
			<description><![CDATA[This is one of the two action listeners I have for two text fields. The exceptions to ensure the proper datatypes used is working. And the exception to make sure that int pos is within the array's range is working. The problem I am having is getting the out of bounds exception to work without...]]></description>
			<content:encoded><![CDATA[<div>This is one of the two action listeners I have for two text fields. The exceptions to ensure the proper datatypes used is working. And the exception to make sure that int pos is within the array's range is working. The problem I am having is getting the out of bounds exception to work without calling either of the other two catches. If any more info is required don't hesitate to ask. TY<br />
 <pre style="margin:20px; line-height:13px">&nbsp; class ActListener1 implements ActionListener {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; public void actionPerformed( ActionEvent e) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  int pos = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String strPos = input1.getText();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String strValue = input2.getText();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  try{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  pos = Integer.parseInt( strPos );<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }catch(Exception ex1){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  String output1 = &quot;Incorrect datatype entered for textfield 1\n&quot; +<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;Occured after pressing enter in the 1st textfield\n&quot; +<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;Enter appropriate datatype\n&quot; + ex1.toString();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, output1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (pos &lt; MIN_INDEX || pos &gt; MAX_INDEX) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; throw new Exception(&quot;Index out of bounds&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } catch (Exception ob) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String output2 = &quot;Index is out of bounds\n&quot; +<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;Exception occured after pressing enter in the first textfield\n&quot; +<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;Re-enter a selection in the range of &quot; + MIN_INDEX + &quot; - &quot; + MAX_INDEX;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ob.toString();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, output2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try{<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double value = Double.parseDouble( strValue );<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; numArray.insertNumberAtPos( value, pos );<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }catch(Exception ex2){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  String output2 = &quot;Incorrect datatype entered for textfield 2\n&quot; +<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;Occured after pressing enter in the 1st textfield\n&quot; +<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;Enter appropriate datatype\n&quot; + ex2.toString();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(null, output2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Display list and results<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TDisplay.setText(createListStr());<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>Afupi</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240869.html</guid>
		</item>
		<item>
			<title>int can not be dereferenced</title>
			<link>http://www.daniweb.com/forums/thread240834.html</link>
			<pubDate>Tue, 24 Nov 2009 00:17:23 GMT</pubDate>
			<description><![CDATA[Can someone please tell me why "int can not be dereferenced" here.  
contents += cart[i].toString() + "\n 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox"...]]></description>
			<content:encoded><![CDATA[<div>Can someone please tell me why &quot;int can not be dereferenced&quot; here. <br />
contents += cart[i].toString() + &quot;\n<br />
<br />
 <pre style="margin:20px; line-height:13px">// **********************************************************************<br />
//&nbsp;  ShoppingCart.java<br />
//<br />
//&nbsp;  Represents a shopping cart as an array of items<br />
// **********************************************************************<br />
<br />
import java.text.NumberFormat;<br />
<br />
public class ShoppingCart<br />
{<br />
&nbsp; &nbsp; private int itemCount;&nbsp; &nbsp; &nbsp; // total number of items in the cart<br />
&nbsp; &nbsp; private double totalPrice;&nbsp; // total price of items in the cart<br />
&nbsp; &nbsp; private int capacity;&nbsp; &nbsp; &nbsp;  // current cart capacity<br />
<br />
&nbsp; &nbsp; // -----------------------------------------------------------<br />
&nbsp; &nbsp; //&nbsp; Creates an empty shopping cart with a capacity of 5 items.<br />
&nbsp; &nbsp; // -----------------------------------------------------------<br />
&nbsp; &nbsp; public ShoppingCart()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; capacity = 5;<br />
&nbsp; &nbsp; &nbsp; &nbsp; itemCount = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; totalPrice = 0.0;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; // -------------------------------------------------------<br />
&nbsp; &nbsp; //&nbsp; Adds an item to the shopping cart.<br />
&nbsp; &nbsp; // -------------------------------------------------------<br />
&nbsp; &nbsp; public void addToCart(String itemName, double price, int quantity)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; // -------------------------------------------------------<br />
&nbsp; &nbsp; //&nbsp; Returns the contents of the cart together with<br />
&nbsp; &nbsp; //&nbsp; summary information.<br />
&nbsp; &nbsp; // -------------------------------------------------------<br />
&nbsp; &nbsp; public String toString()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; NumberFormat fmt = NumberFormat.getCurrencyInstance();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; String contents = &quot;\nShopping Cart\n&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; contents += &quot;\nItem\t\tUnit Price\tQuantity\tTotal\n&quot;;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; int[] cart = new int [capacity];<br />
&nbsp; &nbsp; &nbsp; &nbsp; for (int i = 0; i &lt; itemCount; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; contents += cart[i].toString() + &quot;\n<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; contents += &quot;\nTotal Price: &quot; + fmt.format(totalPrice);<br />
&nbsp; &nbsp; &nbsp; &nbsp; contents += &quot;\n&quot;;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; return contents;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; // ---------------------------------------------------------<br />
&nbsp; &nbsp; //&nbsp; Increases the capacity of the shopping cart by 3<br />
&nbsp; &nbsp; // ---------------------------------------------------------<br />
&nbsp; &nbsp; //Fill in the code for the increaseSize method. Your code should be<br />
&nbsp; &nbsp; //similar to that in Listing 7.8 of the text but instead of doubling the<br />
&nbsp; &nbsp; //size just increase it by 3 elements. <br />
&nbsp; &nbsp; private void increaseSize()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; int[] cart = new int [capacity + 3];<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>COKEDUDE</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240834.html</guid>
		</item>
		<item>
			<title>Password Verifier</title>
			<link>http://www.daniweb.com/forums/thread240767.html</link>
			<pubDate>Mon, 23 Nov 2009 18:27:22 GMT</pubDate>
			<description>Hi. I am new to Java and am trying to figure out a homework problem.  It is a password verifier with the following criteria: 
* at least 6 characters long 
* conatin at least one uppercase and one lowercase letter 
* should have at least one digit 
 
 
This is what I have so far - but am not sure...</description>
			<content:encoded><![CDATA[<div>Hi. I am new to Java and am trying to figure out a homework problem.  It is a password verifier with the following criteria:<ul><li>at least 6 characters long</li>
<li>conatin at least one uppercase and one lowercase letter</li>
<li>should have at least one digit</li>
</ul><br />
This is what I have so far - but am not sure how to loop from letter to letter in the user's input.<br />
<br />
 <pre style="margin:20px; line-height:13px">import java.util.Scanner;<br />
<br />
public class PasswordDemo<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; String input;&nbsp; // To hold input<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Create a Scanner object for keyboard input.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Scanner keyboard = new Scanner(System.in);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Get a password.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.print(&quot;Enter a password: &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; input = keyboard.nextLine();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Check the password.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!PasswordVerifier.isValid(input))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Invalid password.&quot;);<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;Valid password.&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}<br />
<br />
<br />
import java.util.Scanner;<br />
<br />
class PasswordVerifier<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; static String str;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; public static isValid(String str)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //I am not sure what to put here so that this method works right to return the value to the main method.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; private static boolean hasLength(String str)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; boolean goodSoFar = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; if (str.length() &gt;=6)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; goodSoFar = false;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;The password is not long enough.&nbsp; Try again.&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; return goodSoFar;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp;  private static boolean hasUpperCase(String str)<br />
&nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  boolean goodSoFar = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  int i = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  while (goodSoFar &amp;&amp; i &lt; 6)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if (!Character.isUpperCase(str.charAt(i)))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  goodSoFar = false;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  System.out.println(&quot;The password must have at least one UpperCase letter.&nbsp; Try again.&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  i++;<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 goodSoFar;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  private static boolean hasLowerCase(String str)<br />
&nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; boolean goodSoFar = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int i = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while (goodSoFar &amp;&amp; i &lt; 6)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!Character.isLowerCase(str.charAt(i)))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; goodSoFar = false;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;The password must have at least one lower case letter.&nbsp; Try again.&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i++;<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 goodSoFar;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  private static boolean hasDigit(String str)<br />
&nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  boolean goodSoFar = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  int i = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  while (goodSoFar &amp;&amp; i &lt; 6)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if (!Character.isDigit(str.charAt(i)))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  goodSoFar = false;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  System.out.println(&quot;The password must contain at least one number.&nbsp; Try again.&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  i++;<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 goodSoFar;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  }<br />
<br />
<br />
}</pre><br />
Any help would be appreciated.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>smachee</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240767.html</guid>
		</item>
		<item>
			<title>help with get and set methods</title>
			<link>http://www.daniweb.com/forums/thread240737.html</link>
			<pubDate>Mon, 23 Nov 2009 15:57:35 GMT</pubDate>
			<description>Hey everyone. I am supposed to create a program that finds the area of a triangle...this i can do fine. My only problem is i was told that i need to use a get and set method to calculate the area. I dont exactly know how to use a get and set method with an object...would anybody show me how to do...</description>
			<content:encoded><![CDATA[<div>Hey everyone. I am supposed to create a program that finds the area of a triangle...this i can do fine. My only problem is i was told that i need to use a get and set method to calculate the area. I dont exactly know how to use a get and set method with an object...would anybody show me how to do this or set me in the right direction? here is what i have, which works:<br />
<br />
Main class:<br />
 <pre style="margin:20px; line-height:13px"><br />
public class TriMain {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; public static void main(String[] args) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TriObj myTriObj = new TriObj();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; myTriObj.runIt();<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
}</pre><br />
<br />
Object:<br />
 <pre style="margin:20px; line-height:13px">import java.util.Scanner;<br />
public class TriObj {<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; public void runIt()<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<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; int base;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int height;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int area;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Enter base of triange: &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; base=input.nextInt();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Enter height of triange: &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; height=input.nextInt();<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; area=(base*height/2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;The area of the triangle is: &quot;+ area);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <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>shroomiin</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240737.html</guid>
		</item>
		<item>
			<title>for loop example to  print stars in console</title>
			<link>http://www.daniweb.com/forums/thread240731.html</link>
			<pubDate>Mon, 23 Nov 2009 15:15:05 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 />
&nbsp; &nbsp; &nbsp; &nbsp; <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;=============================================&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; <br />
&nbsp; &nbsp; &nbsp; &nbsp; }<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; boolean x = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while(x==true)<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;\nDraw\n0: Exit\n1:Quadrilateral \n2:Rectangle\n3:Triangle&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; int draw =input.nextInt();<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 (draw==0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot; ...EXIT...&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.exit(0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; switch (draw)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 1 :<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &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; select = input.nextInt();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.print(&quot;Enter Width :&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; width = input.nextInt();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; switch (select)<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 0 :<br />
&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; System.exit(0);<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; case 1 :<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;Empty Shape &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int i,j,k;<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(i=1;i&lt;=width;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; for(j=width-i;j&gt;=1;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; System.out.print(&quot; &quot;);<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; for(k=1;k&lt;=i;k++)<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(k==1||k==i)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.print(&quot;*&quot;+&quot; &quot;);<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; System.out.print(&quot; &quot;+&quot; &quot;);<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; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for(i=width-1;i&gt;=1;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; for(j=width-i;j&gt;=1;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; System.out.print(&quot; &quot;);<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; for(k=1;k&lt;=i;k++)<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(k==1||k==i)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.print(&quot;*&quot;+&quot; &quot;);<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; System.out.print(&quot; &quot;+&quot; &quot;);<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; &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;Width :&quot;+width);<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; &nbsp; <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; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for ( i = 1; i &lt;= width; i++) <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for ( j = width; j &gt;= i; j--)<br />
<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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (j == i) <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int d = 1; d &lt;= i; d++) <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; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 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; &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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <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; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<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;&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for ( i = width-1; i &gt;= 1; i--) <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for ( j = width; j &gt;= i; 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; &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(&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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (j == i) <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int d = 1; d &lt;= i; d++) <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; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 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; &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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &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; &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;Width :&quot;+width);<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; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&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; display1();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; select = input.nextInt();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.print(&quot;Enter Width :&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; width = input.nextInt();<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.print(&quot;Enter Height :&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; height = input.nextInt();<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; switch (select)<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 0 :<br />
&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; System.exit(0);<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; case 1:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Empty Shape &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &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; &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; 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; &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; &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; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <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; 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; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <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; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.print(&quot;&nbsp; &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &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; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Width :&quot;+width+&quot; Height :&quot;+height);<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; case 2:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &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; &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; &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; 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; &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; &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; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 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; &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; &nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 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; &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; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &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; &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;Width :&quot;+width+&quot; Height :&quot;+height);<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; <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; case 3:<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; display1();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; select = input.nextInt();<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; 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; System.out.println(&quot;Empty Shape &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int i,j,k;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for(i=1;i&lt;=width;i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for(j=width-i;j&gt;=1;j--)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.print(&quot; &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for(k=1;k&lt;=i;k++)<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(k==1 || k==i || i==width)<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;+&quot; &quot;);<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; &nbsp; &nbsp; &nbsp; &nbsp; System.out.print(&quot; &quot;+&quot; &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &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; 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 />
&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(i=1;i&lt;=width;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(j=width-i;j&gt;=1;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; &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; }<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; for(k=1;k&lt;=i;k++)<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; if(k==1 || k==i || i==width)<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; System.out.print(&quot;*&quot;+&quot; &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.print(&quot;*&quot;+&quot; &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<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; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &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; &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; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&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; &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/thread240731.html</guid>
		</item>
		<item>
			<title>Swing vs SWT</title>
			<link>http://www.daniweb.com/forums/thread240729.html</link>
			<pubDate>Mon, 23 Nov 2009 15:07:34 GMT</pubDate>
			<description><![CDATA[I'm new to Java, but will eventually want to use GUI for my Desktop applications. So as usual in any language, GUI toolkits are "debatable". In Python (My current "mother toungue")  We have PyQT vs PyGTK vs wxPython and it is a good debate. I would like to hear your opinion on Java Swing vs...]]></description>
			<content:encoded><![CDATA[<div>I'm new to Java, but will eventually want to use GUI for my Desktop applications. So as usual in any language, GUI toolkits are &quot;debatable&quot;. In Python (My current &quot;mother toungue&quot;)  We have PyQT vs PyGTK vs wxPython and it is a good debate. I would like to hear your opinion on Java Swing vs Standard Widgets Toolkit ;)<br />
<br />
Also, do I need to add anything to use Swing/SWT with eclipse or they are included in JDK/Eclipse?<br />
<br />
Here we go!</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>evstevemd</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240729.html</guid>
		</item>
		<item>
			<title>MDI Parent and child</title>
			<link>http://www.daniweb.com/forums/thread240719.html</link>
			<pubDate>Mon, 23 Nov 2009 14:37:48 GMT</pubDate>
			<description>Is it posible to  create an MDI Parent and child in Java as is done in VB. Net? If possible kindly help out....</description>
			<content:encoded><![CDATA[<div>Is it posible to  create an MDI Parent and child in Java as is done in VB. Net? If possible kindly help out....</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>JulzO</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240719.html</guid>
		</item>
		<item>
			<title>Dynamic array?</title>
			<link>http://www.daniweb.com/forums/thread240685.html</link>
			<pubDate>Mon, 23 Nov 2009 12:24:43 GMT</pubDate>
			<description>Hi everyone, 
 
I am new to java and I wrote a program that does the following (using Scanner): 
Name: 
Last Name: 
Age: 
(More? Y/N): 
 
When the user presses Y, he/she can add more information. Then in the end, I want to print something like: 
The participants are: Soni Smith (30), Alma Johnson...</description>
			<content:encoded><![CDATA[<div>Hi everyone,<br />
<br />
I am new to java and I wrote a program that does the following (using Scanner):<br />
Name:<br />
Last Name:<br />
Age:<br />
(More? Y/N):<br />
<br />
When the user presses Y, he/she can add more information. Then in the end, I want to print something like:<br />
The participants are: Soni Smith (30), Alma Johnson (24) ...<br />
So, I wrote a class called &quot;ParticipantList&quot; that sets the values to private variables, returns their values and so on. <br />
In the main class, I want to create an array (or list/vector) of the ParticipantList class to store multiple values:<br />
 <pre style="margin:20px; line-height:13px">...<br />
ParticipantList&#91;&#93; myArray = new ParticipantList&#91;5&#93;;<br />
String name, lastName;<br />
double age;<br />
<br />
int i = 0;<br />
char answer = 'Y';<br />
while (answer == 'Y')<br />
{<br />
&nbsp;  Scanner input = new Scanner(System.in);<br />
&nbsp;  System.out.print(&quot;Name: &quot;);<br />
&nbsp;  name = input.nextLine();<br />
&nbsp;  System.out.print(&quot;Last Name: &quot;);<br />
&nbsp;  lastName = input.nextLine();<br />
&nbsp;  System.out.print(&quot;Age: &quot;);<br />
&nbsp;  age = input.nextDouble();<br />
<br />
&nbsp;  myArray&#91;i&#93; = new ParticipantList(name, lastName, age);<br />
&nbsp;  i = i + 1;<br />
...<br />
}</pre><br />
But, what if the user types more than 5 names? 5 was the size of the Array. And what if the user types less than 5 names? In this case I get an error as well. So, how can I make it dynamic so that the array only ends when the user types 'N'? Can I create an ArrayList of my class ParticipantList? How should I declare it? <br />
 <br />
I thank you for any help you could give me!<br />
<br />
Regards,<br />
<br />
-mike</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>mmeclimate</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240685.html</guid>
		</item>
		<item>
			<title>How to read database properties in java</title>
			<link>http://www.daniweb.com/forums/thread240681.html</link>
			<pubDate>Mon, 23 Nov 2009 11:53:35 GMT</pubDate>
			<description>Hi, 
       i need to read the database connection properties,driver class, username and password in java code...How can i read that using some properties....</description>
			<content:encoded><![CDATA[<div>Hi,<br />
       i need to read the database connection properties,driver class, username and password in java code...How can i read that using some properties....</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>moyphus</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240681.html</guid>
		</item>
		<item>
			<title>Help with Swing</title>
			<link>http://www.daniweb.com/forums/thread240678.html</link>
			<pubDate>Mon, 23 Nov 2009 11:39:24 GMT</pubDate>
			<description><![CDATA[I am a beginner to java - my university course module requires me to do an assignment - that is choose a system and build one. 
i have chosen "Student Grading System" - this wont require a database. 
i need to just enter student marks and thereby determine that subject grade, and then once all...]]></description>
			<content:encoded><![CDATA[<div>I am a beginner to java - my university course module requires me to do an assignment - that is choose a system and build one.<br />
i have chosen &quot;Student Grading System&quot; - this wont require a database.<br />
i need to just enter student marks and thereby determine that subject grade, and then once all subject grades are determined calculae the gpa and identify the class level.<br />
<br />
for now im working on 1st year subjects only.<br />
i have absolutely no idea as to how i shud connect the code with a swing interface. below is the code i have.<br />
<br />
<span style="font-weight:bold"><span style="text-decoration:underline">CalculateGpa.java</span></span><br />
<br />
public class CalculateGpa {<br />
    int softDevMarks;<br />
    int sadMarks;<br />
    int bisMarks;<br />
    int linuxMarks;<br />
    int managementMarks;<br />
    int maths1Marks;<br />
    int econMarks;<br />
    int socioMarks;<br />
    int numberOfSubjects = 8;<br />
<br />
    //Business Information System Marks<br />
    public int getBisMarks() {<br />
        return bisMarks;<br />
    }<br />
<br />
    public void setBisMarks(int bisMarks) {<br />
        this.bisMarks = bisMarks;<br />
    }<br />
    <br />
    //Management Marks<br />
    public int getManagementMarks() {<br />
        return managementMarks;<br />
    }<br />
<br />
    public void setManagementMarks(int managementMarks) {<br />
        this.managementMarks = managementMarks;<br />
    }<br />
<br />
    //System Analysis and Design Marks<br />
    public int getSadMarks() {<br />
        return sadMarks;<br />
    }<br />
<br />
    public void setSadMarks(int sadMarks) {<br />
        this.sadMarks = sadMarks;<br />
    }<br />
    <br />
    //Software Development Marks<br />
    public int getSoftDevMarks() {<br />
        return softDevMarks;<br />
    }<br />
<br />
    public void setSoftDevMarks(int softDevMarks) {<br />
        this.softDevMarks = softDevMarks;<br />
    }<br />
    <br />
    <br />
    <br />
    //Mathematics 1 Marks<br />
    public int getMaths1Marks() {<br />
        return maths1Marks;<br />
    }<br />
<br />
    public void setMaths1Marks(int maths1Marks) {<br />
        this.maths1Marks = maths1Marks;<br />
    }<br />
    <br />
    //PC Application Laboratory Marks<br />
    public int getLinuxMarks() {<br />
        return linuxMarks;<br />
    }<br />
<br />
    public void setLinuxMarks(int linuxMarks) {<br />
        this.linuxMarks = linuxMarks;<br />
    }<br />
    <br />
    //Economics Marks<br />
    public int getEconMarks() {<br />
        return econMarks;<br />
    }<br />
    <br />
    public void setEconMarks(int econMarks) {<br />
        this.econMarks = econMarks;<br />
    }<br />
    <br />
    //Sociology marks<br />
    public int getSocioMarks() {<br />
        return socioMarks;<br />
    }<br />
<br />
    public void setSocioMarks(int socioMarks) {<br />
        this.socioMarks = socioMarks;<br />
    }<br />
    <br />
 <br />
    <br />
      <br />
        <br />
    public static void main(String args[]) {<br />
        new CalculateGpa().calcGpa();<br />
    }<br />
    <br />
    public double calcGpa() {<br />
                <br />
        <br />
        SubjectCredits subjectCredits = new SubjectCredits();<br />
        <br />
        int softDevCredits = subjectCredits.getSoftwareDevCredits();<br />
        double softDevGpa = softDevCredits * subjectCredits.getGrade(softDevMarks);<br />
        <br />
        int sadCredits = subjectCredits.getSadCredits();<br />
        double sadGpa = sadCredits * subjectCredits.getGrade(sadMarks);<br />
        <br />
        int managementCredits = subjectCredits.getManagementCredits();<br />
        double managementGpa = managementCredits * subjectCredits.getGrade(managementMarks);<br />
        <br />
        int bisCredits = subjectCredits.getBisCredits();<br />
        double bisGpa = bisCredits * subjectCredits.getGrade(bisMarks);<br />
        <br />
        int bisCredits = subjectCredits.getLinuxCredits();<br />
        double linuxGpa = linuxCredits * subjectCredits.getGrade(linuxMarks);<br />
        <br />
        int econCredits = subjectCredits.getEconCredits();<br />
        double econGpa = econCredits * subjectCredits.getGrade(econMarks);<br />
        <br />
        int socioCredits = subjectCredits.getSocioCredits();<br />
        double socioGpa = socioCredits * subjectCredits.getGrade(socioMarks);<br />
        <br />
        int maths1Credits = subjectCredits.getMaths1Credits();<br />
        double mathsGpa = mathsCredits * subjectCredits.getGrade(mathsMarks);<br />
        <br />
        double gpaAverage = softDevGpa + sadGpa + managementGpa + bisGpa;        <br />
        double gpa = gpaAverage/numberOfSubjects;<br />
        <br />
        System.out.println(&quot;ICT 1001 - Software Development grade is : &quot; + subjectCredits.getGradeRate(softDevMarks));<br />
        System.out.println(&quot;ICT 1002 - SAD grade is : &quot; + subjectCredits.getGradeRate(sadMarks));<br />
        System.out.println(&quot;ICT 1005 - Management grade is : &quot; + subjectCredits.getGradeRate(managementMarks));<br />
        System.out.println(&quot;ICT 1003 - BIS grade is : &quot; + subjectCredits.getGradeRate(bisMarks));<br />
        <br />
        System.out.println(&quot;GPA For this Semester is: &quot; + gpa);<br />
        return gpa;<br />
    }<br />
<br />
}<br />
<br />
-----------------------------------------------------------------------------------<span style="font-weight:bold"><span style="text-decoration:underline"><br />
subjectCredits.java</span></span><br />
<br />
public class SubjectCredits {<br />
    private String softwareDevelopment = &quot;Software development&quot;;<br />
    private String sad =&quot;System analysis and design&quot; ;<br />
    private String management = &quot;Management&quot;;<br />
    private String bis = &quot;Business information systems&quot;;<br />
<br />
    private String softwareDevelopmentGrade;<br />
    private String sadGrade;<br />
    private String managementGrade;<br />
    private String bisGrade;<br />
    <br />
    public int getSoftwareDevCredits() {<br />
        return 3;<br />
    }<br />
    <br />
    public int getSadCredits() {<br />
        return 3;<br />
    }<br />
    <br />
    public int getManagementCredits() {<br />
        return 2;<br />
    }<br />
    <br />
    public int getBisCredits() {<br />
        return 2;<br />
    }<br />
    <br />
    public String getSoftwareDevName() {<br />
        return softwareDevelopment;<br />
    }<br />
        <br />
    public String getSadName() {<br />
        return sad;<br />
    }<br />
    <br />
    public String getManagementName() {<br />
        return management;<br />
    }<br />
    public String getBisName() {<br />
        return bis;<br />
    }<br />
    <br />
    public double  getGrade(int marks) {<br />
        double gradepoints = 0;<br />
        <br />
        if (marks &gt;= 90) {<br />
            gradepoints =  3.75; //A+<br />
        } else if (marks &lt; 90 &amp;&amp; marks &gt;= 80) {<br />
            gradepoints =  3.5; //A<br />
        } else if (marks &lt; 80 &amp;&amp; marks &gt;= 70) {<br />
            gradepoints =  3.25; // A-<br />
        } else if (marks &lt; 70 &amp;&amp; marks &gt;= 60) {<br />
            gradepoints =  2.75; // B+<br />
        }else if (marks &lt; 60 &amp;&amp; marks &gt;= 70) {<br />
            gradepoints =  2.5; //B<br />
        }<br />
        <br />
        return gradepoints;<br />
    }<br />
    <br />
    public String  getGradeRate(int marks) {<br />
        String grade = null;<br />
        <br />
        if (marks &gt;= 90) {<br />
            grade =  &quot;A+&quot;;<br />
        } else if (marks &lt; 90 &amp;&amp; marks &gt;= 80) {<br />
            grade =  &quot;A&quot;;<br />
        } else if (marks &lt; 80 &amp;&amp; marks &gt;= 70) {<br />
            grade =  &quot;A-&quot;;<br />
        } else if (marks &lt; 70 &amp;&amp; marks &gt;= 60) {<br />
            grade =  &quot;B+&quot;;<br />
        }else if (marks &lt; 60 &amp;&amp; marks &gt;= 70) {<br />
            grade =  &quot;B&quot;;<br />
        } else {<br />
            grade = &quot;E&quot;;<br />
        }<br />
        <br />
        return grade;<br />
    }<br />
    <br />
}<br />
 what shall i do??<br />
please help</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/thread240678.html</guid>
		</item>
		<item>
			<title>crystal reports start help</title>
			<link>http://www.daniweb.com/forums/thread240665.html</link>
			<pubDate>Mon, 23 Nov 2009 10:49:57 GMT</pubDate>
			<description><![CDATA[hi,.. 
 
    I'm trying to start a java application and I want to use crystal reports XI as reporting tool,....pls help me with a start,....do i need to download any other sdk for that other than crystal reports XI and JDK?.... 
       and also tell me some beginner tutorial links 4 using crystal...]]></description>
			<content:encoded><![CDATA[<div>hi,..<br />
<br />
    I'm trying to start a java application and I want to use crystal reports XI as reporting tool,....pls help me with a start,....do i need to download any other sdk for that other than crystal reports XI and JDK?....<br />
       and also tell me some beginner tutorial links 4 using crystal reports with java (for beginners) ...<br />
<br />
thanks in adv,<br />
beanboy :)</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>beanboy</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240665.html</guid>
		</item>
		<item>
			<title>java reporting</title>
			<link>http://www.daniweb.com/forums/thread240662.html</link>
			<pubDate>Mon, 23 Nov 2009 10:33:02 GMT</pubDate>
			<description>I want to create some simple reports using mysl data through java. 
I found that there are many reporting tools. But they are very complicated to handle for me.  
I like to code to generate reports .Is there a way ? any easy libraries? 
 
Or help me with any simple tool that I can easily adopt to...</description>
			<content:encoded><![CDATA[<div>I want to create some simple reports using mysl data through java.<br />
I found that there are many reporting tools. But they are very complicated to handle for me. <br />
I like to code to generate reports .Is there a way ? any easy libraries?<br />
<br />
Or help me with any simple tool that I can easily adopt to my code?<br />
<br />
please help. <br />
thankx in advance</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>jrosh</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240662.html</guid>
		</item>
		<item>
			<title><![CDATA[String[] -> Split -> ArrayList]]></title>
			<link>http://www.daniweb.com/forums/thread240650.html</link>
			<pubDate>Mon, 23 Nov 2009 09:38:22 GMT</pubDate>
			<description><![CDATA[I have to split a line that has been stored in a String[], and then place the parts in an ArrayList. 
 
Currently I am doing the following: 
 
(vehicles is the origional String[], 
details is the String, detail_split is the ArrayList) 
  <div class="codeblock"> <div class="spaced"> <div...]]></description>
			<content:encoded><![CDATA[<div>I have to split a line that has been stored in a String[], and then place the parts in an ArrayList.<br />
<br />
Currently I am doing the following:<br />
<br />
(vehicles is the origional String[],<br />
details is the String, detail_split is the ArrayList)<br />
 <pre style="margin:20px; line-height:13px">for (int y = 0; y &lt; vehicles.size(); y++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; details = (String)vehicles.get(y);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; detail_split = (ArrayList)details.split(&quot;$$&quot;, -1);</pre><br />
When I try the above code, Eclipse says:&quot;Cannot cast from String[] to ArrayList&quot;<br />
<br />
What am I doing wrong?<br />
<br />
Is there a better way for me to do it?</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/thread240650.html</guid>
		</item>
		<item>
			<title>CollapsiblePane</title>
			<link>http://www.daniweb.com/forums/thread240629.html</link>
			<pubDate>Mon, 23 Nov 2009 07:24:43 GMT</pubDate>
			<description>Hi all, 
          May I know about the usage of collapsible pane at java application.Pls help me.Thank in advance.</description>
			<content:encoded><![CDATA[<div>Hi all,<br />
          May I know about the usage of collapsible pane at java application.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/thread240629.html</guid>
		</item>
		<item>
			<title>Quizzes.java</title>
			<link>http://www.daniweb.com/forums/thread240578.html</link>
			<pubDate>Mon, 23 Nov 2009 04:19:14 GMT</pubDate>
			<description><![CDATA[Can someone please explain why this division is not working. This is very simple division but for some reason it won't work.  
double Percent = Correct / Questions; 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a...]]></description>
			<content:encoded><![CDATA[<div>Can someone please explain why this division is not working. This is very simple division but for some reason it won't work. <br />
double Percent = Correct / Questions;<br />
<br />
 <pre style="margin:20px; line-height:13px">//****************************************************************<br />
// Quizzes.java<br />
//<br />
// Calculates quizz scores.<br />
// <br />
//<br />
// ****************************************************************<br />
import java.util.Scanner;<br />
<br />
public class Quizzes<br />
{<br />
&nbsp; &nbsp; public static void main(String[] args)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; final int SALESPEOPLE;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int sum;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int Questions;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int answers;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int Correct = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int Incorrect = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; //double Percent;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; Scanner scan = new Scanner(System.in);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;How many questions are in the quizz?&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; Questions = scan.nextInt();<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;The number of questions will be &quot; +Questions);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; int[] canswers = new int[Questions];<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; for (int i=0; i&lt;canswers.length; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Please give the correct answers &quot; + (i+1) + &quot;: &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; canswers[i] = scan.nextInt();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; for (int i=0; i&lt;canswers.length; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;What are the answers that the students put&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; answers = scan.nextInt();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (answers == canswers[i])<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Correct++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Incorrect++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; double Percent = Correct / Questions;<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;There are &quot; +Correct + &quot; correct answers and &quot; +Incorrect<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; +&quot; answers&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(Correct);<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(Incorrect);<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(Questions);<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(Percent);<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;The percentage correct is&quot; +Percent);<br />
<br />
<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/thread240578.html</guid>
		</item>
		<item>
			<title>Converting Between Loops</title>
			<link>http://www.daniweb.com/forums/thread240574.html</link>
			<pubDate>Mon, 23 Nov 2009 04:03:33 GMT</pubDate>
			<description><![CDATA[Hello I'm begining to learn Java and I'm trying to convert from a While loop into a for loop. Sadly I'm just not quite grasping it... 
I understand the loop is here   <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a...]]></description>
			<content:encoded><![CDATA[<div>Hello I'm begining to learn Java and I'm trying to convert from a While loop into a for loop. Sadly I'm just not quite grasping it...<br />
I understand the loop is here  <pre style="margin:20px; line-height:13px">while (n * n &gt; Math.pow(2,i))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  i++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }</pre> but it's not quite as simple as changing the while to a for either...<br />
 <pre style="margin:20px; line-height:13px">import javax.swing.JOptionPane;<br />
&nbsp;public class Main_Class_WhileLoop {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  public static void main(String[] args)<br />
&nbsp; &nbsp; &nbsp; &nbsp;  {;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  String input = JOptionPane.showInputDialog(<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;Please enter a number, 0 to quit:&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  int n = Integer.parseInt(input);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  int i = 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  while (n * n &gt; Math.pow(2,i))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  i++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp;  System.out.println(&quot;2 raised to &quot; + i<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + &quot; is the first power of two greater than &quot; + n + &quot; squared&quot;);<br />
&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>AngryOne</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240574.html</guid>
		</item>
		<item>
			<title>import com.sun.javafx.mediabox.*; package does not exist</title>
			<link>http://www.daniweb.com/forums/thread240571.html</link>
			<pubDate>Mon, 23 Nov 2009 03:17:46 GMT</pubDate>
			<description>hi, 
i am using netbeans 6.7.1 with javafx inside 
i saw alot of example from sun using *import com.sun.javafx.mediabox.; and *import com.sun.fxmediacomponent.*;*however in netbeans when i try to import either this 2 import 
it say that package does not exist 
can someone help me ? 
thanks alot</description>
			<content:encoded><![CDATA[<div>hi,<br />
i am using netbeans 6.7.1 with javafx inside<br />
i saw alot of example from sun using <span style="font-weight:bold">import com.sun.javafx.mediabox.; and *import com.sun.fxmediacomponent.*;</span>however in netbeans when i try to import either this 2 import<br />
it say that package does not exist<br />
can someone help me ?<br />
thanks alot</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>xclaim</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240571.html</guid>
		</item>
		<item>
			<title>omg I NEED HELP..im a n00b</title>
			<link>http://www.daniweb.com/forums/thread240504.html</link>
			<pubDate>Sun, 22 Nov 2009 21:01:07 GMT</pubDate>
			<description>I need to create  java interface that prompts users to imput their username and password to access a component database using access or text file. then i need tohave search fields and buy field and then a contact us.....aahhh im trying but im reqal frustrated aaaaaa</description>
			<content:encoded><![CDATA[<div>I need to create  java interface that prompts users to imput their username and password to access a component database using access or text file. then i need tohave search fields and buy field and then a contact us.....aahhh im trying but im reqal frustrated aaaaaa</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>theCommander</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240504.html</guid>
		</item>
		<item>
			<title>Graphics.drawImage() non-transparent image transparently</title>
			<link>http://www.daniweb.com/forums/thread240499.html</link>
			<pubDate>Sun, 22 Nov 2009 20:34:38 GMT</pubDate>
			<description><![CDATA[Hello all, 
  I have a new problem with my Paint app, I have a TYPE_INT_RGB buffered image, and I'm drawing a "preview" of it, but I want to be able to see through the "preview."  Is there a way to make it appear transparent without modifying the actual image?]]></description>
			<content:encoded><![CDATA[<div>Hello all,<br />
  I have a new problem with my Paint app, I have a TYPE_INT_RGB buffered image, and I'm drawing a &quot;preview&quot; of it, but I want to be able to see through the &quot;preview.&quot;  Is there a way to make it appear transparent without modifying the actual image?</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/thread240499.html</guid>
		</item>
		<item>
			<title>Game programming - allocating actions based on surroundings</title>
			<link>http://www.daniweb.com/forums/thread240493.html</link>
			<pubDate>Sun, 22 Nov 2009 19:35:55 GMT</pubDate>
			<description><![CDATA[I'm working on an rpg game, and one of the big issues that I had (have), is having the players actions change around other objects. 
 
For example, normally the "a" key would attack, but when next to a person, it would trigger a dialog sequence, and when next to a rock, allow you to push/pull it...]]></description>
			<content:encoded><![CDATA[<div>I'm working on an rpg game, and one of the big issues that I had (have), is having the players actions change around other objects.<br />
<br />
For example, normally the &quot;a&quot; key would attack, but when next to a person, it would trigger a dialog sequence, and when next to a rock, allow you to push/pull it around.<br />
<br />
At first I thought to do something like this:<br />
 <pre style="margin:20px; line-height:13px">if(nextToPerson()) aCommand = talk;<br />
else if(nextToRock()) aCommand = pushPull;<br />
else aCommand = attack;</pre>I then realized that this would be very inefficient in the long run, and cause the player class to be much larger than need-be.<br />
<br />
I then came up with the idea of the surrounding objects controlling the players available actions. <br />
<br />
example:<br />
 <pre style="margin:20px; line-height:13px">public interface ACommand{<br />
&nbsp; &nbsp; int aRange(); // how far does the action effect?<br />
&nbsp; &nbsp; void callACommand(/*args*/);<br />
}<br />
<br />
//========================<br />
<br />
public class Person implements ACommand{<br />
&nbsp; &nbsp; // Player's a command changes within 1 meter of a person<br />
&nbsp; &nbsp; int aRange(){ return 1; } <br />
&nbsp; &nbsp; void callACommand(/*args*/){ Player.talk(this); }<br />
}<br />
<br />
//========================<br />
<br />
public class Player implements ACommand{ // default command<br />
&nbsp; &nbsp; int aRange(){ return 150; } // default value (may be something else)<br />
&nbsp; &nbsp; void callACommand(/*args*/){ Player.attack(); }<br />
&nbsp; &nbsp; void keyPressed(KeyEvent e){<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(e.getKeyChar()=='a'){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Object closestActionChange = null;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(closestActionChange = findClosestAction()){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(closestActionChange instanceof Player) <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.callACommand();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(closestActionChange instanceof Person) <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ((Person)(closestActionChange)).callACommand();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp;  }<br />
}</pre><br />
This is the solution that I came up with.  It allows the Player class to remain somewhat simpler, and allows objects to govern themselves.  findClosestAction() talks to the game engine to see what is around that can influence the Player's available actions.  This is just something that I came up with, trying to make a game work a bit smoother.  Most times, the interface would be implemented by the abstract super class of the object, and be overridden as necessary.<br />
<br />
If you have any comments/suggestions, please let me know.  I'm hoping that this is a good way to do this, and if not, I would like to know why, and where it could be improved.  (This isn't really a question, rather a discussion about pros and cons of this way of doing things.)<br />
<br />
Also, this is just a rough outline.  The interfaces would be more structured, and things would fit together better than in the example.  The keyPressed method in the player class would be better structured as well.<br />
<br />
Edit:<br />
Now, I'm thinking that the keyPressed method should go in the GameEngine class, which would hold the window, rather than in the player class</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>llemes4011</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240493.html</guid>
		</item>
		<item>
			<title>Wake on lan program - with domain names?</title>
			<link>http://www.daniweb.com/forums/thread240473.html</link>
			<pubDate>Sun, 22 Nov 2009 16:49:37 GMT</pubDate>
			<description>Hi Guys, I am new to java and I need some help:) 
 
First of all: I admit, I did not write this, I re-wrote a bit of it for my needs, and therefore may not be able to fully understand parts of it. 
 
The thing is, the script accepts only ip adresses as the first argument, And I need it to accept a...</description>
			<content:encoded><![CDATA[<div>Hi Guys, I am new to java and I need some help:)<br />
<br />
First of all: I admit, I did not write this, I re-wrote a bit of it for my needs, and therefore may not be able to fully understand parts of it.<br />
<br />
The thing is, the script accepts only ip adresses as the first argument, And I need it to accept a domain name, as I have a dynamic ip:)<br />
<br />
Here it is. <br />
Any help, whether a link for further reading or actually doing the dirty work for me, is much appreciated.<br />
<br />
<br />
 <pre style="margin:20px; line-height:13px">import java.io.*;<br />
import java.net.*;<br />
<br />
public class wakeonlan {<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; public static final int PORT = 9;&nbsp; &nbsp; <br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; public static void main(String[] args) {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; String ipStr = &quot;THE IP GOES HERE&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; String macStr = &quot;THE MAC GOES HERE&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; try {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; byte[] macBytes = getMacBytes(macStr);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; byte[] bytes = new byte[6 + 16 * macBytes.length];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int i = 0; i &lt; 6; i++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bytes[i] = (byte) 0xff;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int i = 6; i &lt; bytes.length; i += macBytes.length) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.arraycopy(macBytes, 0, bytes, i, macBytes.length);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; InetAddress address = InetAddress.getByName(ipStr);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DatagramPacket packet = new DatagramPacket(bytes, bytes.length, address, PORT);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DatagramSocket socket = new DatagramSocket();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; socket.send(packet);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; socket.close();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Wake-on-LAN packet sent.&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; catch (Exception e) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Failed to send Wake-on-LAN packet: + e&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.exit(1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; private static byte[] getMacBytes(String macStr) throws IllegalArgumentException {<br />
&nbsp; &nbsp; &nbsp; &nbsp; byte[] bytes = new byte[6];<br />
&nbsp; &nbsp; &nbsp; &nbsp; String[] hex = macStr.split(&quot;(\\:|\\-)&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (hex.length != 6) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; throw new IllegalArgumentException(&quot;Invalid MAC address.&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; try {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int i = 0; i &lt; 6; i++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bytes[i] = (byte) Integer.parseInt(hex[i], 16);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; catch (NumberFormatException e) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; throw new IllegalArgumentException(&quot;Invalid hex digit in MAC address.&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; return bytes;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp;  <br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>Bladtman242</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240473.html</guid>
		</item>
		<item>
			<title>Excel</title>
			<link>http://www.daniweb.com/forums/thread240450.html</link>
			<pubDate>Sun, 22 Nov 2009 14:03:12 GMT</pubDate>
			<description>please help in writing to excel sheet using java program. Actually I know how to write to a text file but I don,t have any idea about this writing to an excel sheet. 
I would be grateful to you if you help me.</description>
			<content:encoded><![CDATA[<div>please help in writing to excel sheet using java program. Actually I know how to write to a text file but I don,t have any idea about this writing to an excel sheet.<br />
I would be grateful to you if you help me.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>itsmekarthik</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240450.html</guid>
		</item>
		<item>
			<title>Number Converion in Java</title>
			<link>http://www.daniweb.com/forums/thread240447.html</link>
			<pubDate>Sun, 22 Nov 2009 13:54:35 GMT</pubDate>
			<description>Modify NUMBER CONVERSION so that it can perform a conversion in the case when the base is a number between 10 and 17,(11..16).  Number systems with bases greater than 10 require more symbols.  Therefore, use capital letters.  For example, a hexadecimal system requires 16 digits:...</description>
			<content:encoded><![CDATA[<div>Modify NUMBER CONVERSION so that it can perform a conversion in the case when the base is a number between 10 and 17,(11..16).  Number systems with bases greater than 10 require more symbols.  Therefore, use capital letters.  For example, a hexadecimal system requires 16 digits: 0,1,…,9,A,B,C,D,E,F.  In this system, decimal number 26 is equal to 1A in hexadecimal notation, because 26/16 = 1 remainder 10 (that is A), and 1/16 = 0 remainder 1.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>trinity_08</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240447.html</guid>
		</item>
		<item>
			<title>AVL tree project</title>
			<link>http://www.daniweb.com/forums/thread240424.html</link>
			<pubDate>Sun, 22 Nov 2009 11:35:58 GMT</pubDate>
			<description>hi everyone  
i have a problem in my project that i have made 
pleaze help!!!!! 
this project allows the user to read words and their meanings from file and store them in AVL tree and then print the tree inorder, postorder, and preorder then print the result to file in the form of dictionary A:...</description>
			<content:encoded><![CDATA[<div>hi everyone <br />
i have a problem in my project that i have made<br />
pleaze help!!!!!<br />
this project allows the user to read words and their meanings from file and store them in AVL tree and then print the tree inorder, postorder, and preorder then print the result to file in the form of dictionary A: .........<br />
                    ..........<br />
                B:..........<br />
and so on, and then search for a word and its all meanings and if  the word is not found add it to the tree then draw the tree in java graphics and finally ask the user if he want to delete any word</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/java.gif" alt="File Type: java" width="16" height="16" border="0" style="vertical-align:baseline" /></td> <td><a href="http://www.daniweb.com/forums/attachment.php?attachmentid=12671&amp;d=1258889674">AVLTree.java</a> (11.7 KB)</td> </tr> </table> </fieldset>  </div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>samoo</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240424.html</guid>
		</item>
		<item>
			<title>Print stars in console  using java ?</title>
			<link>http://www.daniweb.com/forums/thread240391.html</link>
			<pubDate>Sun, 22 Nov 2009 07:51:49 GMT</pubDate>
			<description>Print stars in console like this using java ? 
......* 
.....*.* 
... *...* 
.. *.....* 
. *.......* 
...*.....* 
... *...* 
.....*.* 
......*</description>
			<content:encoded><![CDATA[<div>Print stars in console like this using java ?<br />
......*<br />
.....*.*<br />
... *...*<br />
.. *.....*<br />
. *.......*<br />
...*.....*<br />
... *...*<br />
.....*.*<br />
......*<br />
<br />
dot = spaces<br />
<br />
<span style="font-weight:bold">look to my code just i need to print border not filled shape</span><br />
 <pre style="margin:20px; line-height:13px">import java.util.Scanner;<br />
public class Stars {<br />
<br />
public static void main( String args[] )<br />
{<br />
Scanner input = new Scanner(System.in);<br />
int number ;<br />
System.out.print(&quot; Enter Number of Middle Stars : &quot;);<br />
number = input.nextInt();<br />
<br />
for (int i = 1; i &lt;= number; i++)<br />
{<br />
<br />
for (int j = number; j &gt;= i; j--)<br />
<br />
{<br />
System.out.print(&quot; &quot;);<br />
<br />
if (j == i)<br />
{<br />
for (int d = 1; d &lt;= i; d++)<br />
{<br />
System.out.print(&quot; &quot;);<br />
System.out.print(&quot;*&quot;);<br />
}<br />
}<br />
}<br />
System.out.println(&quot;&quot;);<br />
}<br />
<br />
for (int i = number-1; i &gt;= 1; i--)<br />
{<br />
<br />
for (int j = number; j &gt;= i; j--)<br />
<br />
<br />
{<br />
System.out.print(&quot; &quot;);<br />
<br />
if (j == i)<br />
{<br />
for (int d = 1; d &lt;= i; d++)<br />
{<br />
System.out.print(&quot; &quot;);<br />
System.out.print(&quot;*&quot;);<br />
}<br />
}<br />
}<br />
System.out.println(&quot;&quot;);<br />
}<br />
}<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/thread240391.html</guid>
		</item>
		<item>
			<title>Sales.java</title>
			<link>http://www.daniweb.com/forums/thread240384.html</link>
			<pubDate>Sun, 22 Nov 2009 06:46:25 GMT</pubDate>
			<description><![CDATA[After I ask the user to enter a number here 
System.out.println("Enter a number"); 
        number = scan.nextInt(); 
I would like print the id of each salesperson that exceeded that value and the amount of their sales. I Also want to print the total number of salespeople whose sales exceeded the...]]></description>
			<content:encoded><![CDATA[<div>After I ask the user to enter a number here<br />
System.out.println(&quot;Enter a number&quot;);<br />
        number = scan.nextInt();<br />
I would like print the id of each salesperson that exceeded that value and the amount of their sales. I Also want to print the total number of salespeople whose sales exceeded the value entered. So I would think I would need some kind of for loop and several print statements. This is what I am thinking for my for loop. <br />
for (int i=0; number&lt;i; i++)<br />
Line 1 to line 56 is good. After that is where I am trying to put my for loop. <br />
<br />
 <pre style="margin:20px; line-height:13px">//****************************************************************<br />
// Sales.java<br />
//<br />
// Reads in and stores sales for each of 5 salespeople.&nbsp; Displays<br />
// sales entered by salesperson id and total sales for all salespeople.<br />
//<br />
// ****************************************************************<br />
import java.util.Scanner;<br />
<br />
public class Sales<br />
{<br />
&nbsp; &nbsp; public static void main(String[] args)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; final int SALESPEOPLE = 5;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int[] sales = new int[SALESPEOPLE];<br />
&nbsp; &nbsp; &nbsp; &nbsp; int sum;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; Scanner scan = new Scanner(System.in);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; for (int i=0; i&lt;sales.length; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.print(&quot;Enter sales for salesperson &quot; + (i+1) + &quot;: &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sales[i] = scan.nextInt();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;\nSalesperson&nbsp;  Sales&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;--------------------&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; sum = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int maximum = sales[0];<br />
&nbsp; &nbsp; &nbsp; &nbsp; int minimum&nbsp; = sales[0];<br />
&nbsp; &nbsp; &nbsp; &nbsp; int a=1, b=1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; for (int i=0; i&lt;sales.length; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(maximum &lt; sales[i])<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; maximum = sales[i];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; a = i+1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(minimum &gt; sales[i])<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; minimum = sales[i];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b = i+1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;&nbsp; &nbsp;  &quot; + (i+1) + &quot;&nbsp; &nbsp; &nbsp; &nbsp;  &quot; + sales[i]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sum += sales[i];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;\nTotal sales: &quot; + sum);<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;The average sale is: &quot; + sum / SALESPEOPLE );<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;The maximum sale is: &quot; + maximum + &quot; by Salesperson &quot; + a );<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;The minimum sale is: &quot; + minimum + &quot; by Salesperson &quot; + b );<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; int number;<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Enter a number&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; number = scan.nextInt();<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;The number you entered is &quot; +number);<br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(sales);<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; for (int i=0; number&lt;i; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(+ sales[i]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; //if(number &lt; sales[i])<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //System.out.println( + SALESPEOPLE);<br />
<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/thread240384.html</guid>
		</item>
		<item>
			<title>Converting a percentage to a grade; without using the if and else function</title>
			<link>http://www.daniweb.com/forums/thread240362.html</link>
			<pubDate>Sun, 22 Nov 2009 02:57:40 GMT</pubDate>
			<description>An interesting question came across my mind: If it is possible to convert a percentage to a Grade(A,B,C,D, or an F). Firstly, there is an easy method to convert a percentage to a Grade; by using an If and Else loop. However, are there also other methods with which this can be achieved? Arrays,...</description>
			<content:encoded><![CDATA[<div>An interesting question came across my mind: If it is possible to convert a percentage to a Grade(A,B,C,D, or an F). Firstly, there is an easy method to convert a percentage to a Grade; by using an If and Else loop. However, are there also other methods with which this can be achieved? Arrays, shiftin bits, etc... It would be very interesting to see if there are any non-trivial methods to this.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>Chillawowa</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240362.html</guid>
		</item>
		<item>
			<title>Can I write into a jar?</title>
			<link>http://www.daniweb.com/forums/thread240323.html</link>
			<pubDate>Sat, 21 Nov 2009 23:18:36 GMT</pubDate>
			<description><![CDATA[I'm making a game and when it starts up I want the game to load a file in it's jar and set the display according to the contents of that file, I can do that just fine.  But if the file doesn't exist(the first time the program runs) or something is wrong with it I'd like to set the display to the...]]></description>
			<content:encoded><![CDATA[<div>I'm making a game and when it starts up I want the game to load a file in it's jar and set the display according to the contents of that file, I can do that just fine.  But if the file doesn't exist(the first time the program runs) or something is wrong with it I'd like to set the display to the lowest resolution possible and write a file reflecting it.  I haven't been able to find a way to do this.<br />
<br />
In case anyone points it out, I've started to think I probably shouldn't keep this file in the jar(a user might like to edit it) but I'd still like to know if this can be done.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>OffbeatPatriot</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240323.html</guid>
		</item>
		<item>
			<title>Help please, thanks</title>
			<link>http://www.daniweb.com/forums/thread240322.html</link>
			<pubDate>Sat, 21 Nov 2009 23:06:29 GMT</pubDate>
			<description>Hi guys, so I have this project where the requirements are as follows.  
 
Create a class called Car, which serves to represent a particular vehicle at a car 
dealership. Consider that each car has the following properties, entered by the user (all value 
ranges should be error checked): 
 Sticker...</description>
			<content:encoded><![CDATA[<div>Hi guys, so I have this project where the requirements are as follows. <br />
<br />
Create a class called Car, which serves to represent a particular vehicle at a car<br />
dealership. Consider that each car has the following properties, entered by the user (all value<br />
ranges should be error checked):<br />
 Sticker price (a decimal greater than $10,000)<br />
 Year (an integer between 2002 and 2010)<br />
 Make (a String that represents the manufacturer of the car)<br />
 Top speed (an integer between 100 and 160)<br />
 Color (a String)<br />
 Availability (a boolean that states whether the car has been sold (false) or is available (true))<br />
The class should also contain methods that perform the following functions:<br />
 Determine whether the car is used (if the car was made before 2009)<br />
 Apply a certain discount on the sticker price<br />
o The discount percentage should be a parameter to the method<br />
 Change a car to being sold<br />
o This replaces the mutator method for the “availability” property<br />
 Determine the final cost of the car, considering the following:<br />
o 8.875% sales tax<br />
o $500 delivery fee<br />
 Output a summary of all information about the car, using a toString() method<br />
<br />
So far I have this, <br />
 <pre style="margin:20px; line-height:13px">import javax.swing.JOptionPane;<br />
&nbsp; <br />
&nbsp; public class Car<br />
{<br />
&nbsp; //*******************************************************<br />
&nbsp; //Declaration of instance variables/fields of the class<br />
&nbsp; //*******************************************************<br />
&nbsp; private String make, color;<br />
&nbsp; private int year, topSpeed;<br />
&nbsp; private boolean availability;<br />
&nbsp; private double stickerPrice, discount, tax;<br />
&nbsp; <br />
&nbsp; public Car()<br />
&nbsp; {<br />
&nbsp; &nbsp; make = &quot;&quot;;<br />
&nbsp; &nbsp; color = &quot;&quot;;<br />
&nbsp; &nbsp; year = 0;<br />
&nbsp; &nbsp; topSpeed = 0;<br />
&nbsp; &nbsp; availability = true;<br />
&nbsp; &nbsp; stickerPrice = 0;<br />
&nbsp; &nbsp; discount = 0;<br />
&nbsp; }<br />
&nbsp; <br />
&nbsp; public Car(String make1, String color1, int year1, int topSpeed1, boolean availability1, double stickerPrice1, double tax1, double discount1)<br />
&nbsp; {<br />
&nbsp; &nbsp; make = make1;<br />
&nbsp; &nbsp; color = color1;<br />
&nbsp; &nbsp; year = year1;<br />
&nbsp; &nbsp; topSpeed = topSpeed1;<br />
&nbsp; &nbsp; availability = availability1;<br />
&nbsp; &nbsp; stickerPrice = stickerPrice1;<br />
&nbsp; &nbsp; tax = tax1;<br />
&nbsp; &nbsp; discount = discount1;<br />
&nbsp; }<br />
&nbsp; <br />
&nbsp; //***********************************************************<br />
&nbsp; //getMake()<br />
&nbsp; //This method will get the make of the car.<br />
&nbsp; //***********************************************************<br />
&nbsp; public String getMake()<br />
&nbsp; {<br />
&nbsp; &nbsp; return make;<br />
&nbsp; }<br />
&nbsp; <br />
&nbsp; //***********************************************************<br />
&nbsp; //setMake(String make)<br />
&nbsp; //This method will set the make of the car.<br />
&nbsp; //***********************************************************<br />
&nbsp; public void setMake(String make1)<br />
&nbsp; {<br />
&nbsp; &nbsp; make = make1;<br />
&nbsp; }<br />
&nbsp; <br />
&nbsp; //***********************************************************<br />
&nbsp; //getColor()<br />
&nbsp; //This method will get the color of the car.<br />
&nbsp; //***********************************************************<br />
&nbsp; public String getColor()<br />
&nbsp; {<br />
&nbsp; &nbsp; return color;<br />
&nbsp; }<br />
&nbsp; <br />
&nbsp; //***********************************************************<br />
&nbsp; //setColor(String color)<br />
&nbsp; //This method will set the color of the car.<br />
&nbsp; //***********************************************************<br />
&nbsp; public void setColor(String color1)<br />
&nbsp; {<br />
&nbsp; &nbsp; color = color1;<br />
&nbsp; }<br />
&nbsp; <br />
&nbsp; //***********************************************************<br />
&nbsp; //getYear()<br />
&nbsp; //This method will get the year that the car was made.<br />
&nbsp; //***********************************************************<br />
&nbsp; public int getYear()<br />
&nbsp; {<br />
&nbsp; &nbsp; return year;<br />
&nbsp; }<br />
&nbsp; <br />
&nbsp; //***********************************************************<br />
&nbsp; //setYear(int year1)<br />
&nbsp; //This method will set the year in which the car was made.<br />
&nbsp; //***********************************************************<br />
&nbsp; public void setYear(int year1)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; year = year1;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; <br />
&nbsp; //***********************************************************<br />
&nbsp; //getTopSpeed()<br />
&nbsp; //This method will get the top speed of the car.<br />
&nbsp; //***********************************************************<br />
&nbsp; public int getTopSpeed()<br />
&nbsp; {<br />
&nbsp; &nbsp; return topSpeed;<br />
&nbsp; }<br />
&nbsp; <br />
&nbsp; //***********************************************************<br />
&nbsp; //setTopSpeed(int topSpeed1)<br />
&nbsp; //This method will set the top speed of the car.<br />
&nbsp; //***********************************************************<br />
&nbsp; public void setTopSpeed(int topSpeed1)<br />
&nbsp; {<br />
&nbsp; &nbsp; &nbsp; topSpeed = topSpeed1;<br />
&nbsp; }<br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; //***********************************************************<br />
&nbsp; &nbsp; &nbsp; //getAvailability()<br />
&nbsp; &nbsp; &nbsp; //This method will get the availabilty of the car.<br />
&nbsp; &nbsp; &nbsp; //***********************************************************<br />
&nbsp; &nbsp; &nbsp; public boolean getAvailability()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; return availability;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; //***********************************************************<br />
&nbsp; &nbsp; //setMake(String make)<br />
&nbsp; &nbsp; //This method will set the make of the car.<br />
&nbsp; &nbsp; //***********************************************************<br />
&nbsp; &nbsp; public void setAvailability(boolean availability1)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; availability = availability1;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; //***********************************************************<br />
&nbsp; &nbsp; //getStickerPrice()<br />
&nbsp; &nbsp; //This method will get the sticker price of the car.<br />
&nbsp; &nbsp; //***********************************************************<br />
&nbsp; &nbsp; public double getStickerPrice()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; return stickerPrice;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; //***********************************************************<br />
&nbsp; &nbsp; //setStickerPrice(double stickerPrice)<br />
&nbsp; &nbsp; //This method will set the sticker price of the car.<br />
&nbsp; &nbsp; //***********************************************************<br />
&nbsp; &nbsp; public void setStickerPrice(double stickerPrice1)<br />
&nbsp; &nbsp; {&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; stickerPrice = stickerPrice1;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; //***********************************************************<br />
&nbsp; &nbsp; //getTax()<br />
&nbsp; &nbsp; //This method will get the tax on the car.<br />
&nbsp; &nbsp; //***********************************************************<br />
&nbsp; &nbsp; public double getTax()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; return tax;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; //***********************************************************<br />
&nbsp; &nbsp; //setMake(String make)<br />
&nbsp; &nbsp; //This method will set the tax on the car.<br />
&nbsp; &nbsp; //***********************************************************<br />
&nbsp; &nbsp; public void setTax(double tax1)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; tax = tax1;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; //***********************************************************<br />
&nbsp; &nbsp; //getDiscount()<br />
&nbsp; &nbsp; //This method will get the discount on the car.<br />
&nbsp; &nbsp; //***********************************************************<br />
&nbsp; &nbsp; public double getDiscount()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; return discount;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; //***********************************************************<br />
&nbsp; &nbsp; //setDiscount(double discount1)<br />
&nbsp; &nbsp; //This method will set the discount on the car.<br />
&nbsp; &nbsp; //***********************************************************<br />
&nbsp; &nbsp; public void setDiscount(double discount1)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; discount = discount1;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; //************************************************************<br />
&nbsp; &nbsp; //used()<br />
&nbsp; &nbsp; //This method if the car is used or not.<br />
&nbsp; &nbsp; //************************************************************<br />
&nbsp; &nbsp; public void used(int year)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; if (year &lt; 2009)<br />
&nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(&quot;The car is used.&quot;);<br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; JOptionPane.showMessageDialog(&quot;The car is new.&quot;);<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; //***************************************************************<br />
&nbsp; &nbsp; //discount(int percentOff)<br />
&nbsp; &nbsp; //This method puts a discount on the sticker price.<br />
&nbsp; &nbsp; //***************************************************************<br />
&nbsp; &nbsp; public double discount(int percentOff)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; percentOff *= .01;<br />
&nbsp; &nbsp; &nbsp; stickerPrice = (stickerPrice*percentOff);<br />
&nbsp; &nbsp; &nbsp; return stickerPrice;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; public double totalCost(int stickerPrice, int discount)<br />
&nbsp; &nbsp; {<br />
&nbsp; <br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; }<br />
&nbsp; }</pre>Sorry about all the commenting in the code, but I find it helps a lot. By the way, this is supposed to be a stand alone class. I'll have to write a driver for it later.<br />
<br />
I'm not exactly sure how I'd go about to calculate the final cost or how to change the availability.<br />
<br />
Also, an error that I'm getting is that the JOptionPane isn't being found.<br />
<br />
Thanks for the help guys, I really really do appreciate it.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>Ecliptical210</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240322.html</guid>
		</item>
		<item>
			<title>How to build a simple online bookstore</title>
			<link>http://www.daniweb.com/forums/thread240307.html</link>
			<pubDate>Sat, 21 Nov 2009 20:36:35 GMT</pubDate>
			<description>I am a bit familiar with java, but I am pretty ambitious and I want to build a simple book store. 
 
I need some suggestions and help. 
 
 
I can create a simple homepage using HTML which has links, navigation menu etc. on the homepage 
 
I am good at GUI programming. I can create an applet with...</description>
			<content:encoded><![CDATA[<div>I am a bit familiar with java, but I am pretty ambitious and I want to build a simple book store.<br />
<br />
I need some suggestions and help.<br />
<br />
<br />
I can create a simple homepage using HTML which has links, navigation menu etc. on the homepage<br />
<br />
I am good at GUI programming. I can create an applet with the links, navigation menu.<br />
<br />
I can create a database in Mysql with the name and price of the book for each book.<br />
<br />
now, I have to learn the JDBC ODBC connectivity and see if I can pull out the data from the database and print them on a webpage.<br />
<br />
I don't know anything about JSF.<br />
Do we need to know JSF in order to build an ecommerce site? any other suggestions about what I have to know.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>redmaverick</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240307.html</guid>
		</item>
		<item>
			<title>Trouble with stringtokenizer HELP</title>
			<link>http://www.daniweb.com/forums/thread240237.html</link>
			<pubDate>Sat, 21 Nov 2009 13:20:50 GMT</pubDate>
			<description><![CDATA[Hi 
 
I am trying to tokenize a string from a file.  
The file contains two lines that have different info. I need to tokenize the lines separately and compare the results of each line. 
Now, I think my problem is identifying the separate lines to perform operations separately 
  <div...]]></description>
			<content:encoded><![CDATA[<div>Hi<br />
<br />
I am trying to tokenize a string from a file. <br />
The file contains two lines that have different info. I need to tokenize the lines separately and compare the results of each line.<br />
Now, I think my problem is identifying the separate lines to perform operations separately<br />
 <pre style="margin:20px; line-height:13px">/*<br />
PROG: ride<br />
*/<br />
<br />
import java.io.*;<br />
import java.util.*;<br />
<br />
class ride {<br />
&nbsp; public static void main (String [] args) throws IOException {<br />
&nbsp; &nbsp; // Use BufferedReader rather than RandomAccessFile; it's much faster<br />
&nbsp; &nbsp; BufferedReader f = new BufferedReader(new FileReader(&quot;ride.in&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; &nbsp; // input file name goes above<br />
&nbsp; &nbsp; PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(&quot;ride.out&quot;)));<br />
&nbsp; &nbsp; // Use StringTokenizer vs. readLine/split -- lots faster<br />
<br />
<br />
&nbsp; &nbsp; StringTokenizer st = new StringTokenizer(f.readLine());<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; // Get line, break into tokens<br />
&nbsp; &nbsp; &nbsp; &nbsp; while (st.hasMoreTokens()){<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int i1 = Integer.parseInt(st.nextToken());&nbsp; // first value<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int i2 = Integer.parseInt(st.nextToken());&nbsp; // second value<br />
&nbsp; &nbsp; &nbsp; &nbsp; int i3 = Integer.parseInt(st.nextToken());&nbsp; // third value<br />
&nbsp; &nbsp; &nbsp; &nbsp; int i4 = Integer.parseInt(st.nextToken());&nbsp; // fourth value<br />
&nbsp; &nbsp; &nbsp; &nbsp; int i5 = Integer.parseInt(st.nextToken());&nbsp; // fifth value<br />
&nbsp; &nbsp; &nbsp; &nbsp; int i6 = Integer.parseInt(st.nextToken());&nbsp; // sixth value<br />
<br />
&nbsp; &nbsp; int i7 = (i1 - 64)*(i2 - 64)*(i3 - 64)*(i4 - 64)*(i5 - 64)*(i6 - 64);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  // product values<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; int product = i7%47;<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; StringTokenizer st2 = new StringTokenizer(f.readLine());<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; // Get line, break into tokens<br />
&nbsp; &nbsp; &nbsp; &nbsp; while (st2.hasMoreTokens()){<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int i8 = Integer.parseInt(st.nextToken());&nbsp; // first value<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int i9 = Integer.parseInt(st.nextToken());&nbsp; // second value<br />
&nbsp; &nbsp; &nbsp; &nbsp; int i10 = Integer.parseInt(st.nextToken());&nbsp; // third value<br />
&nbsp; &nbsp; &nbsp; &nbsp; int i11 = Integer.parseInt(st.nextToken());&nbsp; // fourth value<br />
&nbsp; &nbsp; &nbsp; &nbsp; int i12 = Integer.parseInt(st.nextToken());&nbsp; // fifth value<br />
&nbsp; &nbsp; &nbsp; &nbsp; int i13 = Integer.parseInt(st.nextToken());&nbsp; // sixth value<br />
<br />
&nbsp; &nbsp; int i14 = (i8 - 64)*(i9 - 64)*(i10 - 64)*(i11 - 64)*(i12 - 64)*(i13 - 64);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  // product values<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; int product2 = i14%47;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(product == product2) {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; out.println(&quot;GO&quot;);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Ready to go<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; else {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; out.println(&quot;STAY&quot;);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Next time guys!!<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp;  <br />
&nbsp; &nbsp; out.close();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // close the output file<br />
&nbsp; &nbsp; System.exit(0);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  // don't omit this!<br />
&nbsp; }<br />
}</pre><br />
Any help would be highly appreciated.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>justM</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240237.html</guid>
		</item>
		<item>
			<title>Simple JAVA Student Exam Records System</title>
			<link>http://www.daniweb.com/forums/thread240226.html</link>
			<pubDate>Sat, 21 Nov 2009 12:04:53 GMT</pubDate>
			<description>i would like to know what are the functional requirements of such a system as i am planning to build one. this has to be as simple as possible. please help. 
 
 
Thank you</description>
			<content:encoded><![CDATA[<div>i would like to know what are the functional requirements of such a system as i am planning to build one. this has to be as simple as possible. please help.<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/thread240226.html</guid>
		</item>
		<item>
			<title>game with computer</title>
			<link>http://www.daniweb.com/forums/thread240209.html</link>
			<pubDate>Sat, 21 Nov 2009 10:19:15 GMT</pubDate>
			<description>).  Design and implement an application that plays the Rock-Paper-Scissors game against the computer. When played between two people, each person picks one of three options (usually shown by a hand gesture) at the same time, and a winner is determined. In the game, Rock beats Scissors, Scissors...</description>
			<content:encoded><![CDATA[<div>).  Design and implement an application that plays the Rock-Paper-Scissors game against the computer. When played between two people, each person picks one of three options (usually shown by a hand gesture) at the same time, and a winner is determined. In the game, Rock beats Scissors, Scissors beats Paper, and Paper beats Rock. <br />
The program should randomly choose one of the three options (without revealing it), then prompt for the user's selection. At that point, the program reveals both choices and prints a statement indicating whether the user won, the computer won, or if it was a tie. <br />
Continue playing until the user chooses to stop, then print the number of user wins, losses, and ties.<br />
Hint: The user should choose from a list of numbered options, and the choice should be matched against a randomly generated number representing the computer's choice.<br />
If you find your code is repeating statements, consider whether the repeated statements might be able to be contained in a method.<br />
A design for the solution to this task is up to you! The output should look like something this:<br />
What is your choice?<br />
 1 Play the game<br />
 0 Quit<br />
Enter your choice:<br />
 <br />
(1)<br />
<br />
Playing Paper Rock Scissors. The computer has chosen!<br />
 1 Paper<br />
 2 Scissors<br />
 3 Rock<br />
Enter your choice:<br />
<br />
(2)<br />
<br />
You chose Scissors the computer chose Rock. You lose<br />
<br />
What is your choice ?<br />
 1 Play the game<br />
 0 Quit<br />
Enter your choice:<br />
<br />
( 0)<br />
<br />
You won 0  times <br />
You lost 1 times <br />
You tied 0 times <br />
Bye <br />
<br />
please help me.......</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/thread240209.html</guid>
		</item>
		<item>
			<title>pleas</title>
			<link>http://www.daniweb.com/forums/thread240199.html</link>
			<pubDate>Sat, 21 Nov 2009 09:18:07 GMT</pubDate>
			<description>please can some one soluation this programmm???? i need tomrrow 
Your task is to implement a program that displays the calendar for a specific 
month in the Hijri year. The program prompts for the month number and the 
first day of the week for the given month. For example, if the user entered 9...</description>
			<content:encoded><![CDATA[<div><span style="color:Red">please can some one soluation this programmm???? i need tomrrow</span><br />
Your task is to implement a program that displays the calendar for a specific<br />
month in the Hijri year. The program prompts for the month number and the<br />
first day of the week for the given month. For example, if the user entered 9<br />
for the month (Ramadan) and 6 for the first day (Thursday) then the output<br />
should be similar to the following.<br />
Ramadan<br />
Sun Mon Tue Wed Thu Fri Sat<br />
1 2 3<br />
4 5 6 7 8 9 10<br />
11 12 13 14 15 16 17<br />
18 19 20 21 22 23 24<br />
25 26 27 28 29 30<br />
You may assume that all Hijri months have fixed 30 days and first day of the<br />
week (day 1) is Saturday. In fact, use the tables below to guide you.<br />
Month Name Month Number<br />
Muharram 1<br />
Safar 2<br />
Rabi’ al-awwal 3<br />
Rabi’ al-thani 4<br />
Jumada al-awwal 5<br />
Jumada al-thani 6<br />
Rajab 7<br />
Sha’aban 8<br />
Ramadan 9<br />
Shawwal 10<br />
Dhu al-Qi’dah 11<br />
Dhu al-Hijjah 12<br />
Day Number<br />
Saturday 1<br />
Sunday 2<br />
Monday 3<br />
Tuesday 4<br />
Wednesday 5<br />
Thursday 6<br />
Friday 7</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>spiritsad</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240199.html</guid>
		</item>
		<item>
			<title>Please ... help me !!</title>
			<link>http://www.daniweb.com/forums/thread240184.html</link>
			<pubDate>Sat, 21 Nov 2009 07:40:58 GMT</pubDate>
			<description><![CDATA[welcome .... 
 
I'm starting learn java langauge , it is very intresting langauge .... 
 
I have this problem and I need your help... 
 
(( 
Write a java applet that will animate an analogue clock. The clock should look like the one shown in Figure 1. The background color of the clock, the color of...]]></description>
			<content:encoded><![CDATA[<div>welcome ....<br />
<br />
I'm starting learn java langauge , it is very intresting langauge ....<br />
<br />
I have this problem and I need your help...<br />
<br />
((<br />
<span style="color:Green">Write a java applet that will animate an analogue clock. The clock should look like the one shown in Figure 1. The background color of the clock, the color of the text, the color of the clock arms, the color of the clock ticks, the text that appears above the clock and the initial time should be read from a text file each time your applet starts. The clock should then be updated every second indefinitely. Figure 2 shows a sample input configuration file. Please note that the arms will be moving while the applet is running.<br />
<br />
 Figure 1: Sample run of the applet.</span><br />
<br />
see attached..<br />
<br />
Figure 2: Sample input configuration file.<br />
((<br />
<span style="color:green">Clock color: RED<br />
Font color: BLACK<br />
Clock arms color: YELLOW<br />
Clock ticks color: BLUE<br />
Top text: Welcome to clock animation<br />
Initial time: 06 50 00 PM<br />
<br />
))</span></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=12661&amp;d=1258789118" target="_blank">Picture1.png</a> (10.7 KB)</td> </tr> </table> </fieldset>   </div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>aksn315</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread240184.html</guid>
		</item>
	</channel>
</rss>
