public class Test{
private JButton button1 = new JButton();
public void setButtonText(String text) {
this.button1.setText(text);
}
}
Test test = new Test();
test.setButtonText(bla);
public class Main {
public static void main (String[] args) {
JButton button1 = new JButton();
Andere andere = new Andere();
andere.setButtonText(button1);
}
}
public class Andere {
public void setButtonText(JButton button) {
button.setText("Dein Text");
}
}