When I click on the button, the text is not displayed in the JTextField .
And even simple System.out.prntln(".."); not displayed in the console.
The code for the button was generated independently:
jButton1.setText("нажимай"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); The processing method itself:
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { for (Person h : people) { jLabel3.setText(String.valueOf(h.toString())); System.out.println("Clicked:"); System.out.println(h.toString()); } }
peopleempty? - Regentperson, it is not surprising that nothing is displayed on the screen and no text is set injLabel3.. And in any case it is very strange to set the text for all elements of the collection in turn. With the same success, you can simply set the text from the last element. And the construction ofString.valueOf(h.toString())redundant: ifhcannot benull, then it suffices to use onlyh.toString(). Otherwise, onlyString.valueOf(h). - Regent