Re: Calling a Button in another Button

ButtonNovice schreef:


I have made a program that has two buttons. One of the buttons calls
over half of what the other button does. I was not sure how to make one
button call another button and harness all of the data so I copied all
of the code from the first button and then add some code for the second
buttons ActionEvent. (This way the user gets choices as to how they can
view the data.) The first button is calculate and the second is show. I
would like for show to do all the actions in calculate, plus.

I worked on trying this for hours and had issues with the array, among
other things.


Thanks in advance,


You can simply extract the functionality to separate methods and call
those from your actionPerformed methods.

private void doCalculate() {

private void doShow() {

public void actionPerformed(ActionEvent evt) {
if (calcButton) {
} else if (showButton) {