I am a beginner to java and i find it very difficult. can someone please help and tell me how you identify a main method in an application
and also how do i make a jbutton call a certain method and output it to a text field?
please explain with examples.
thank you. it is much help

The main method in a java application has the following signature:

public static void main(String[] args)

If you are a beginner I would suggest starting with something a bit simpler than a JButton's click method. But the theory behind it is to add an ActionListener to your button. This listener has an actionPerformed method that is called when the action is taken on the component, in this case pressing the button. Inside that method you can call another method or do whatever you like, such as JTextField.setText...

can u please explain the jbutton theory more??
i am currently working on a simple java software in netbeans. it included determining grades when marks are entered. i also have a button called calculateGPA, i want the text field next to it to output the result of GPA when i click that particular calculateGPA button.
was that confusing??

Well I thought I'd given you a pretty good outline of what you need to do. If you are after code example of how to implement a JButton's click behaviour, try this tutorial.

Like I said these concepts aren't simple, if you don't know basic java program elements and flow then you may struggle with your implementation.

This article has been dead for over six months. Start a new discussion instead.