Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

New Frame with TextArea JAR

$
0
0
hey, i have got a problem with my jar file.
If i dont convert it to a jar file everything works fine.
I press a button and another frame opens and shows me a textarea.
But if i use the jar file, press the same button it shows me an empty frame, why could that be?

if (event.getSource() == this.anzeige)
          { 
              JFrame fenster = new JFrame("Highscore");
              table = new JPanel(new GridLayout(3,12));
              fenster.pack();
              JTextArea textArea = new JTextArea(20,20);
              fenster.add(textArea);
              textArea.setEditable(false);
              textArea.setBackground(Color.ORANGE);
              fenster.setSize(600, 600);
              fenster.setLocation(350, 300);
              fenster.setVisible(true);
            try{           
            BufferedReader br = new BufferedReader(new FileReader("out.txt")); 
            for(int r=0; r<11;r++){
              
             zeile[r] = br.readLine();
             if (r != 10){
                 textArea.append(" ");
                }
             textArea.append(zeile[r]);
             textArea.append("\n ");
             textArea.append("\n");
             System.out.println(zeile[r]);
             System.out.println("");
            }

            
            }catch (Exception e){//Catch exception if any
            System.err.println("Error: " + e.getMessage());
              }
            }


Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>