hej.
metoda/funkcja. zamieszczam uproszczony fragment kodu…
public void ButtonColorOrange1() {
if (kolory == 1) {
if (obrysujB1 == 1) {
buttonColorRed4.setVisible(false);
buttonColorOrange4.setVisible(true);
buttonColorYellow4.setVisible(false);
}
}
}
public void ButtonColorYellow1() {
if (kolory == 1) {
if ((infPressed == 0) && (bPressed == 0)) {
buttonColorRed4.setVisible(false);
buttonColorOrange4.setVisible(false);
buttonColorYellow4.setVisible(true);
strokeB1 = colorYellow;
}
}
}
}
.......
takich metod mam około dwudziestu. moje pytanie brzmi:
czy mogę warunek if (kolory == 1) zapisać tylko raz dla wszystkich public void …()?