-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBackground_Panel.java
More file actions
51 lines (36 loc) · 1.56 KB
/
Background_Panel.java
File metadata and controls
51 lines (36 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
/*****************************************************************************************************
* Represents an instance of a background on the JFrame to be the main layout container to hold items
* displayed to the user.
*****************************************************************************************************/
public class Background_Panel extends JPanel
{
/* Pointer to the main java window to access its get() methods for other panels */
protected JFrame outerFrame;
/* Current Screen displayed to the user */
private JPanel currentScreen;
/*********************************************************************************
* Main constructor used when creating a the background panel.
*********************************************************************************/
public Background_Panel(JFrame frame)
{
//setLayout(new GridLayout(2, 4));
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
// establish a reference to the frame to change the displayed panel
this.outerFrame = frame;
add(currentScreen = new Welcome_Screen(this));
}
/*********************************************************************************
* Switches the current main panel to the passed in one.
*********************************************************************************/
protected void changeCurrentPanel(JPanel panel)
{
//removeAll();
remove(currentScreen);
add(currentScreen = panel);
revalidate();
repaint();
} // end changeCurrentPanel()
} // end Background_Panel class