Advertisement
Guest User

Untitled

a guest
Nov 30th, 2013
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.30 KB | None | 0 0
  1.         String everything = null;
  2.         BufferedReader br = null;
  3.           try {
  4.            br = new BufferedReader(new FileReader("file.txt"));
  5.           } catch (FileNotFoundException e1) {
  6.            // TODO Auto-generated catch block
  7.            e1.printStackTrace();
  8.           }
  9.               try {
  10.                   StringBuilder sb = new StringBuilder();
  11.                   String line = null;
  12.             try {
  13.              line = br.readLine();
  14.             } catch (IOException e) {
  15.              // TODO Auto-generated catch block
  16.              e.printStackTrace();
  17.             }
  18.          
  19.                   while (line != null) {
  20.                       sb.append(line);
  21.                       sb.append('\n');
  22.                       line = br.readLine();
  23.                   }
  24.                   everything = sb.toString();
  25.               } catch (IOException e) {
  26.             // TODO Auto-generated catch block
  27.             e.printStackTrace();
  28.            } finally {
  29.                   try {
  30.              br.close();
  31.             } catch (IOException e) {
  32.              // TODO Auto-generated catch block
  33.              e.printStackTrace();
  34.             }
  35.               }
  36.        
  37.        
  38.  
  39.        
  40.         help.setText("Segítség");
  41.         help.addActionListener(new ActionListener(){
  42.             public void actionPerformed(ActionEvent arg0) {
  43.                 JOptionPane.showMessageDialog( null, everything,"Valami",JOptionPane.OK_CANCEL_OPTION);
  44.                 //JOptionPane.showInputDialog(null, everything, "asd", JOptionPane.OK_CANCEL_OPTION);
  45.             }
  46.         });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement