COMP2396
Loading...
Searching...
No Matches
View Class Reference
Collaboration diagram for View:

Public Member Functions

 View ()
 
JButton getDownButton ()
 
JLabel getResultLabel ()
 
JButton getUpButton ()
 

Private Member Functions

void setControlPanel ()
 
void setDisplayPanel ()
 
void setFrame ()
 

Private Attributes

JButton downButton
 
JFrame frame
 
JLabel label
 
JPanel[] panels
 
JButton upButton
 

Detailed Description

Definition at line 18 of file View.java.

Constructor & Destructor Documentation

◆ View()

View.View ( )
inline

Definition at line 28 of file View.java.

28 {
29 setFrame();
32 }
void setFrame()
Definition View.java:34
void setControlPanel()
Definition View.java:59
void setDisplayPanel()
Definition View.java:50

References setControlPanel(), setDisplayPanel(), and setFrame().

Here is the call graph for this function:

Member Function Documentation

◆ getDownButton()

JButton View.getDownButton ( )
inline

Definition at line 80 of file View.java.

80 {
81 return downButton;
82 }
JButton downButton
Definition View.java:26

References downButton.

Referenced by Controller.start().

Here is the caller graph for this function:

◆ getResultLabel()

JLabel View.getResultLabel ( )
inline

Definition at line 84 of file View.java.

84 {
85 return label;
86 }
JLabel label
Definition View.java:23

References label.

◆ getUpButton()

JButton View.getUpButton ( )
inline

Definition at line 76 of file View.java.

76 {
77 return upButton;
78 }
JButton upButton
Definition View.java:25

References upButton.

Referenced by Controller.start().

Here is the caller graph for this function:

◆ setControlPanel()

void View.setControlPanel ( )
inlineprivate

Definition at line 59 of file View.java.

59 {
60
61 upButton = new JButton("Up");
62 downButton = new JButton("Down");
63 upButton.setAlignmentX(Component.CENTER_ALIGNMENT);
64 downButton.setAlignmentX(Component.CENTER_ALIGNMENT);
65
66 JPanel panelsContainer = new JPanel();
67
68 panels[1].setLayout(new BoxLayout(panels[1], BoxLayout.Y_AXIS));
69 panelsContainer.setLayout(new BoxLayout(panelsContainer, BoxLayout.X_AXIS));
70
71 panels[1].add(panelsContainer);
72 panelsContainer.add(upButton);
73 panelsContainer.add(downButton);
74 }
JPanel[] panels
Definition View.java:21

References downButton, panels, and upButton.

Referenced by View().

Here is the caller graph for this function:

◆ setDisplayPanel()

void View.setDisplayPanel ( )
inlineprivate

Definition at line 50 of file View.java.

50 {
51 label = new JLabel("-");
52 label.setFont(label.getFont().deriveFont(64.0f));
53 label.setAlignmentX(Component.CENTER_ALIGNMENT);
54 panels[0].setLayout(new BoxLayout(panels[0], BoxLayout.Y_AXIS));
55
56 panels[0].add(label);
57 }

References label, and panels.

Referenced by View().

Here is the caller graph for this function:

◆ setFrame()

void View.setFrame ( )
inlineprivate

Definition at line 34 of file View.java.

34 {
35 frame = new JFrame("Client");
36 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
37 frame.setSize(300, 300);
38 frame.setVisible(true);
39
40 Container cp = frame.getContentPane();
41 cp.setLayout(new BoxLayout(cp, BoxLayout.Y_AXIS));
42
43 panels = new JPanel[2];
44 for (int i = 0; i < panels.length; i++) {
45 panels[i] = new JPanel();
46 cp.add(panels[i]);
47 }
48 }
JFrame frame
Definition View.java:20

References frame, and panels.

Referenced by View().

Here is the caller graph for this function:

Member Data Documentation

◆ downButton

JButton View.downButton
private

Definition at line 26 of file View.java.

Referenced by getDownButton(), and setControlPanel().

◆ frame

JFrame View.frame
private

Definition at line 20 of file View.java.

Referenced by setFrame().

◆ label

JLabel View.label
private

Definition at line 23 of file View.java.

Referenced by getResultLabel(), and setDisplayPanel().

◆ panels

JPanel [] View.panels
private

Definition at line 21 of file View.java.

Referenced by setControlPanel(), setDisplayPanel(), and setFrame().

◆ upButton

JButton View.upButton
private

Definition at line 25 of file View.java.

Referenced by getUpButton(), and setControlPanel().


The documentation for this class was generated from the following file: