Hi,
I'm having a problem getting the text i have entered within a JTextArea to print to the screen (console).
When i enter text in the JTextArea or open a file into the JTextArea (using a Filechooser) and then click on a JRadioButton - the value entered within the JTextArea should print out to the screen, but all that prints out is "null".
Any Suggestions would be much appreciated,
Thanks Again for any help,
public void openFile(){
fc.setFileSelectionMode(fc.FILES_ONLY);
int returnVal = fc.ShowOpenDialog(Frame1.this);
if(returnVal == fc.APPROVE_OPTION){
File file = fc.getSelectedFile();
if(file == null || file.getName().equals(""
JOptionPane.showMessageDialog(this, "Invalid File Name", "File name is Invalid", JOptionPane.ERROR_MESSAGE);
else {
try {
inp = new BufferedReader(new FileReader(file);
StringBuffer buffer = new StringBuffer();
while ((any = inp.readLine()) ! = null){
buffer.append (any + "\n"
jTextArea1.append(buffer.toString());
}
}
catch (IOException ioe){
JOptionPane.showMEssageDialog(this, "File Does not exist", "Invalid File name", JOptionPane.ERROR_MESSAGE);
}
}
}
public class ButtonListener implements ActionListener {
public void actionPerformed (ActionEvent e) {
String text1 = e.getActionCommand();
if (text1.equals("Upload Sequence"){
openFile();
}
else if (text1.equals ("PIPMAKER Analysis"){
System.out.println(any);
}
}
}
I'm having a problem getting the text i have entered within a JTextArea to print to the screen (console).
When i enter text in the JTextArea or open a file into the JTextArea (using a Filechooser) and then click on a JRadioButton - the value entered within the JTextArea should print out to the screen, but all that prints out is "null".
Any Suggestions would be much appreciated,
Thanks Again for any help,
public void openFile(){
fc.setFileSelectionMode(fc.FILES_ONLY);
int returnVal = fc.ShowOpenDialog(Frame1.this);
if(returnVal == fc.APPROVE_OPTION){
File file = fc.getSelectedFile();
if(file == null || file.getName().equals(""
JOptionPane.showMessageDialog(this, "Invalid File Name", "File name is Invalid", JOptionPane.ERROR_MESSAGE);
else {
try {
inp = new BufferedReader(new FileReader(file);
StringBuffer buffer = new StringBuffer();
while ((any = inp.readLine()) ! = null){
buffer.append (any + "\n"
jTextArea1.append(buffer.toString());
}
}
catch (IOException ioe){
JOptionPane.showMEssageDialog(this, "File Does not exist", "Invalid File name", JOptionPane.ERROR_MESSAGE);
}
}
}
public class ButtonListener implements ActionListener {
public void actionPerformed (ActionEvent e) {
String text1 = e.getActionCommand();
if (text1.equals("Upload Sequence"){
openFile();
}
else if (text1.equals ("PIPMAKER Analysis"){
System.out.println(any);
}
}
}