java - JButton action in other class -
i have main frame 2 panels:
jpanel menu = new menu(); menu.setbounds(0, 37, 300, 644); contentpane.add(menu); menu.setvisible(false); jpanel fahrtenbearbeiten = new fahrtenbearbeiten(); fahrtenbearbeiten.setbounds(0, 0, 1422, 668); contentpane.add(fahrtenbearbeiten);
in menu panel, want make button, sets fahrtenbearbeiten
panel's visible(false)
. problem is: how can reach action triggered in menu panel (menu.java
) , has action in other file (haupt.java
)?
declare
fahrtenbearbeiten
jpanel global variableprivate jpanel fahrtenbearbeitenpnl = new jpanel();
create method
public void hidefahrtenbearbeitenpnl() { fahrtenbearbeitenpnl.setvisible(false); }
call method on object of class contains panel. example:
menu.hidefahrtenbearbeitenpnl();
let me know if i've got question wrong. (maybe post whole class(es) easier support)
Comments
Post a Comment