• Post Reply Bookmark Topic Watch Topic
  • New Topic

help with my first program mainly jbutton

 
mitchell cooper
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please can I have some help, I'm new to coding been doing it nearly a week, I have written a little program (I am expecting criticism). I want to create a j button so that it refreshes my table, so if anyone can point me in the right direction would be great. plus please tell me other things with my code e.g. easier ways of going around things..

 
Campbell Ritchie
Marshal
Posts: 52581
119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stop using NetBeans. The group layout code you get from the GUI builder is almost illegible. You also don't learn about layouts like that.

I presume you have a method which refreshes the table? You need to add a Listener to the button. For pushing the button you use an action listener which has one method (=actionPerformed). That is an interface so you can add it an an anonymous class (see this old post). You can find a process for writing the anonymous class here.Of course you can reduce that to a λ by means of the -> token and the delete bey, but that only works in Java8

Moving discussion to our GUIs forum.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!