i use Array.sort() in swing and awt please help me with my code

here is my listener code i did not post my entire code because its very long and i believe that my only problem is in this line of code

sortbtn.addActionListener(new ActionListener()

{

publicvoid actionPerformed(ActionEvent e)

{

BufferedReader reader =new BufferedReader (new InputStreamReader(System.in));

try

{

int x, y;

String name[] =new String[3];

for(x = 0; x < 3; x++)

{

name[x]=JOptionPane.showInputDialog(null,"Enter a String");

name[x]=reader.readLine()

}

Arrays.sort(name);

for(y = 0; y < 3; y++)

{

txtsort2.append(name[y]);

}

}

catch(Exception ex)

{

JOptionPane.showMessageDialog(null,"Invalid");

}

}

});

i should enter a string 3 times then it will sort the strings and print the sorted strings in txtsort2 but instead of doing that the program stuck up please help me what's wrong with my code thank's

[1722 byte] By [Jaywhya] at [2007-11-27 8:42:31]
# 1

I'm confused by your code. I think that you have to make up your mind on whether you want a GUI app and get input through Swing or want a command-line program and get input through System.in.

My recommendation: stick with Swing:

1) Get rid of BufferedReader, reader.readLine().

2) Get your Strings by a call to JOptionPane.showInputDialog only

http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JOptionPane.html#showInputDialog(java.lang.Object)

petes1234a at 2007-7-12 20:41:51 > top of Java-index,Java Essentials,Java Programming...
# 2
dude your my hero:D i was thinking for 3 days and you gave me the idea you are right my error is the reader.readLine(); how stupid i am i forgot that im using a JOptionPane hahahah thank's dude your the man
Jaywhya at 2007-7-12 20:41:51 > top of Java-index,Java Essentials,Java Programming...
# 3

> dude your my hero:D i was thinking for 3 days and you

> gave me the idea you are right my error is the

> reader.readLine(); how stupid i am i forgot that im

> using a JOptionPane hahahah thank's dude your the man

no problem. i didn't do anything. you had the right code up there all along. you just had to get rid of the clutter. good luck w/ your coding.

petes1234a at 2007-7-12 20:41:51 > top of Java-index,Java Essentials,Java Programming...