How can I call the value of a variable of a function, into another function?
I'm using jPanel
, where I'm going to add text with:
jTextArea.append("AREA = " + /*AQUI*/);
Where it says HERE I wanted to put the value of a variable that I have in another class:
public int setCoordenadasB(int x1, int y1, int x2, int y2) {
p.x = Math.min(x1, x2);
p.y = Math.min(y1, y2);
largura = Math.abs(x1-x2);
altura = Math.abs(y1-y2);
area = largura * altura;
return area;
}
It was this "area" that I liked to put in HERE up there.
ThesetCoordenadasB
method is in class
called rectangle and jTextArea
is in the main
function, and the rectangle object was started as:
r = new Retangulo();