private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { Bank fr1=new Bank(); try { fr1.watch(); } catch (IOException ex) { Logger.getLogger(JFrame.class.getName()).log(Level.SEVERE, null, ex); } jTextField1.getText(); [I]??????[/I] } 

In general, there is a button and a text window; when you click this button, the fr1.watch () method is executed; BUT, how to make the result of this method is not displayed on the console, but in the graph window. Interface (TextField)

  • jTextField1.setText(...) ? - post_zeew
  • Not suitable, methods can not be put in brackets. - Sergey
  • What do you mean by методы нельзя засунуть в скобки ? - post_zeew
  • The very essence of any public void implies that the method returns nothing. To display the result of the method in the text field, it must be converted to public watch (int a) {return a; } where a is the result of your method. then using the setText method (fr1.watch ()); set the text - Dmitriy Mironov

1 answer 1

 *void watch() throws IOException { JFrame sc1= new JFrame(); String line; int n; Scanner sc = new Scanner(System.in, "windows-1251"); String name = "Комаров Сергей Влдаимирович"; try( BufferedReader bw = new BufferedReader(new FileReader(""+name+".txt"))) { sc1.jTextField1.setText(String.valueOf("Установка соединения..." + "\n")); } catch(IOException ex){ sc1.jTextField1.setText(ex.getMessage()); } }* 
  • Please try to leave a little more detailed answers. You can add an answer by clicking edit - aleksandr barakin
  • And what do you mean asterisks around the function? - 0xdb