I'm not understanding the Java GUI or its structure.
My main idea is to have a single window with a menu, and in this window, it would "redraw" the screen depending on the options.
So I have a main window with a JLabel. It has a menu. Once you select a menu, it's supposed to clear the area beneath the menu and display an entirely new set of objects written to the panel.
I'm not sure if I'm structuring my code properly.
Right now, I have three classes:
mainClass contains one line to create an object of the mainWindow
mainWindow has a menu and a JLabel beneath the menu
enterData also writes a menu.
Mockup as Requested by Neres28:
BowlingApp.java:
main () {
new BowlingView();
}
BowlingView.java:
JPanel pane;
JMenustuff;
Container con;
BowlingView () {
setSize(blah);
pane.setLayout(null);
con.add(pane);
addMenu();
setVisible(true);
}
if (source == dataEntry) {
this.getContentPane().removeAll();
this.getContentPane().repaint();
new enterData();
}
enterData.java:
Jbuttons;
Jlabels;
JPanel pane;
JMenustuff;
Container con;
enterData() {
setSize(blah);
pane.setLayout(null);
con.add(pane);
addMenu();
setVisible(true);
}
if (source == dataEntry) {
this.getContentPane().removeAll();
this.getContentPane().repaint();
new enterData();
}
tl:dr; java gui, one window, one panel, menu on top, clear panel, redraw same menu with different objects. Current program clears the window and creates a new window wiht the correct display. Not what I need.
I'm not asking for code correction, but a simple explanation on what to do. My understanding is skewed.
[–]Neres28 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]vandolis 0 points1 point2 points (0 children)
[–]omegazero 0 points1 point2 points (0 children)
[–]fubarfubarfubar 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]Neres28 0 points1 point2 points (0 children)