Java input and filereader -


i trying open file , add textarea, textfile wont work not sure isnt working know compiler reaches function/method implement read in file code. here code

public class pictureandbutton extends jframe implements actionlistener {  private jmenuitem menuoptionone = new jmenuitem("lägg till text", keyevent.vk_l); private jtextfield textfalt  = new jtextfield();   public pictureandbutton() { menuinfo.add(menuoptionone); menuoptionone.addactionlistener(this); textfield.addactionlistener(this);     setsize(350, 150); setdefaultcloseoperation(exit_on_close); setvisible(true);        }  public void actionperformed(actionevent e) {   if(e.getsource() == menuoptionone)     {         readinfile(textfield.gettext());     }    }      private void readinfile(string hej)  {    try    {        bufferedreader infile = new bufferedreader(new filereader(hej));          while(true)        {            string rad = infile.readline();           if(rad == null)            break;            textarea.append(rad);                }    }    catch(ioexception e){} }  public static void main(string[] args)     {         pictureandbutton peanutbutter = new pictureandbutton();     } 

}

i running on eclipse , not getting errors, input text in textfield doesnt change @ all. nothing added text area. need on this

i trying open file , add textarea, ..

use jtextcomponent.read(reader,object) instead.

e.g.

textarea.read(new filereader(hej), hej); 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -