3
How can I call the value of a function variable into another function?
I’m using the jPanel
, where I will add a text with:
jTextArea.append("AREA = " + /*AQUI*/);
Where it says HERE I wanted to put the value of a variable 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 that "area" that I liked to put in the UP THERE.
The method setCoordenadasB
is in a class
so-called rectangle and jTextArea
is in function main
, and the rectangular object was started as:
r = new Retangulo();
main function rectangular class initiate As these images I hope you can explain to me better, what I wanted to know was how I could make jTextArea.append work.
– Miguel Soeiro
There you are completely changing the question, I answered what was asked. If you want to know something else, you need to ask another question. This new code has no relation to what was asked. I can only answer what was asked, there’s no way I can guess what you really wanted.
– Maniero
I am sorry then, I will ask another question, I may have explained myself badly. .
– Miguel Soeiro
I have already asked a new question, this time with prints of my code to facilitate the understanding of who can help me, thank you for the advice. New Topic: Topical
– Miguel Soeiro