java - Printing out .txt file with JOptionPane -


i'm trying list of words have scroll instead of window running off screen. scroller working can't dimension work. says ( new dimension( 200, 400 )) ; has error in it. cannot find symbol

import javax.swing.jdialog; import javax.swing.*; import java.util.*; import java.io.*;   public class print1  {     public static void main(string [] args) throws ioexception     {         string input = "";          bufferedreader reader = new bufferedreader(new filereader("wordlist.txt"));         string line = null;         while ((line = reader.readline()) != null) {              input += line + "\n";         }         reader.close();          jtextarea textarea = new jtextarea(input);         jscrollpane scrollpane = new jscrollpane(textarea);           textarea.setlinewrap(true);           textarea.setwrapstyleword(true);           scrollpane.setpreferredsize( new dimension( 200, 400 )) ;         joptionpane.showmessagedialog(null,  scrollpane, "complete word list:",                    joptionpane.plain_message);     } } 

maybe you:

    public class joptiontest {          private string text;          public void readfilecontent() throws filenotfoundexception{             text = new scanner( new file("install.txt") ).usedelimiter("\\a").next();          }          public string getfilecontent(){             return this.text;         }          public void displayjoptiontest(){              joptionpane.showmessagedialog(null,             text,             "stackoverflow test",             joptionpane.error_message);          }           public static void main(string [] args) throws filenotfoundexception{               joptiontest test = new joptiontest();               test.readfilecontent();              test.displayjoptiontest();         }     } 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -