Results 1 to 2 of 2
Thread: void type not allowed here
- 07-24-2011, 02:09 PM #1
Senior Member
- Join Date
- Jul 2011
- Posts
- 112
- Rep Power
- 0
void type not allowed here
Java Code:private void jButtonReadActionPerformed(java.awt.event.ActionEvent evt) { DNA d1=new DNA(); d1.readFromFile(jTextFieldFilePath.getText()); d1.readFromFile(jTextFieldSequenceName.setText(d1.getName());//error d1.readFromFile(jTextAreaInput.setText(d1.getSeq()));//error
The code for these methods is as follows:
Java Code:String readFromFile(String path){ String stringFromFile= new String(); try { FileReader fro = new FileReader( path ); BufferedReader bro = new BufferedReader( fro ); String strline= bro.readLine( ); stringFromFile= ""; while( strline!= null ) { stringFromFile+= strline; strline= bro.readLine( ); } bro.close( );} catch( FileNotFoundException filenotfoundexxption) { System.out.println( "FastaDNA.txt, does not exist" ); } catch( IOException ioexception) { ioexception.printStackTrace( ); } System.out.println("To test if the file, FastaDNA.text located in G drive, has been read:\nSEQUENCE NAME:" + stringFromFile.substring(0, stringFromFile.indexOf(">"))); System.out.println("SEQUENCE:"+ stringFromFile.substring(stringFromFile.indexOf(">")+1,stringFromFile.length())); return stringFromFile; }
Java Code:String getName(){ return JOptionPane.showInputDialog(this,"Name of the sequence:"); }
Java Code:String getSeq(){ return JOptionPane.showInputDialog(this,"Sequence:"); }
- 07-24-2011, 02:23 PM #2
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,068
- Blog Entries
- 3
- Rep Power
- 15
setText returns void, the method most likely takes some argument. readFromFile(...) expects a string, but what you are passing in is a call to setText(...)
Similar Threads
-
Issue with "void type not allowed here" and I cannot see why.
By flpanthers1 in forum New To JavaReplies: 8Last Post: 05-25-2011, 07:26 PM -
void type not allowed
By jockhip12 in forum New To JavaReplies: 6Last Post: 05-05-2011, 06:26 PM -
'void' type not allowed here
By Torgero in forum New To JavaReplies: 15Last Post: 10-05-2008, 12:08 AM -
The different of static void,protected,and void in methods?
By Winarto in forum New To JavaReplies: 5Last Post: 01-25-2008, 12:53 AM -
is void a type?
By mary in forum New To JavaReplies: 3Last Post: 08-01-2007, 09:12 PM
Bookmarks