Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="SIGNUP_BACKEND/src/" kind="src" path=""/>
<classpathentry kind="src" path="SIGNUP_BACKEND/src"/>
<classpathentry kind="lib" path="C:/Users/Nebiyou/Desktop/Projects/6kiloCafeProject/lib/jfreechart-1.5.4.jar"/>
<classpathentry kind="lib" path="C:/Users/Nebiyou/Desktop/Projects/6kiloCafeProject/lib/mysql-connector-j-8.2.0.jar"/>
<classpathentry kind="output" path="out/production/6kiloCafeProject"/>
</classpath>
17 changes: 17 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>6kiloCafeProject</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
2 changes: 1 addition & 1 deletion GUI/FoodListPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class FoodListPage extends WelcomePage {
}

private void initialize() {
frame.setResizable(false);
frame.setResizable(true);
mondayButton = new ButtonStyle("Monday");
mondayButton.setBounds(0, 0, 800, 30);
tuesdayButton = new ButtonStyle("Tuesday");
Expand Down
2 changes: 1 addition & 1 deletion GUI/LoginPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public LoginPage() {

//finally we add the foreground panel to the Frame
frame.add(foreground);
frame.setUndecorated(true); //removes the minimize,maximize and close tabs
frame.setUndecorated(false); //removes the minimize,maximize and close tabs
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(500, 400);
frame.setLocationRelativeTo(null); //places it to center
Expand Down
139 changes: 139 additions & 0 deletions GUI/NewFoodListPage.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
package GUI;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;

import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JPanel;

public class NewFoodListPage extends WelcomePage{
private JButton mondayButton;
private JButton tuesdayButton;
private JButton wednesdayButton;

public static void main(String[] args) {
new NewFoodListPage();
}

NewFoodListPage() {
initialize();
}

private void initialize() {
frame.setResizable(true);

mondayButton = new ButtonStyle("Monday");
tuesdayButton = new ButtonStyle("Tuesday");
wednesdayButton = new ButtonStyle("Wednesday");

// -----------------------------------

ArrayList<JButton> dayButtons = new ArrayList<JButton>();
dayButtons.add(mondayButton);
dayButtons.add(tuesdayButton);
dayButtons.add(wednesdayButton);

// -----------------------------------

for (int i = 0; i < dayButtons.size(); i++) {
dayButtons.get(i).setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE));
}

// -----------------------------------

NewFoodListPanel mondayPanel = new NewFoodListPanel("Firfir", "aynet", "cake");
NewFoodListPanel tuesdayPanel = new NewFoodListPanel("Bread with marmlade","alicha", "siga wot");
NewFoodListPanel wednesdayPanel = new NewFoodListPanel("firfir", "dinch wot", "siga wot");

// Create a list of panels to use when setting one visible over the others
ArrayList<NewFoodListPanel> dayPanels = new ArrayList<NewFoodListPanel>();
dayPanels.add(mondayPanel);
dayPanels.add(tuesdayPanel);
dayPanels.add(wednesdayPanel);

// Set actions for the buttons

mondayButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (mondayPanel.count % 2 == 0) {
displayDayPanel(dayPanels, mondayPanel);

} else {
hideDayPanel(mondayPanel);
}
}
});
tuesdayButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (tuesdayPanel.count % 2 == 0) {
displayDayPanel(dayPanels, tuesdayPanel);

} else {
hideDayPanel(tuesdayPanel);
}
}
});
wednesdayButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (wednesdayPanel.count % 2 == 0) {
displayDayPanel(dayPanels, wednesdayPanel);

} else {
hideDayPanel(wednesdayPanel);
}
}
});

// -------------------------------------------

centerPanel.setLayout(new BoxLayout(centerPanel, BoxLayout.Y_AXIS));

for (int i = 0; i < dayPanels.size(); i++) {
centerPanel.add(dayButtons.get(i));
centerPanel.add(dayPanels.get(i));
}

centerPanel.setBackground(new Color(46, 5, 74));

}


public void displayDayPanel(ArrayList<NewFoodListPanel> dayPanels, NewFoodListPanel dayPanel) {

for (int i = 0; i < dayPanels.size(); i++) {
NewFoodListPanel current = dayPanels.get(i);

if (dayPanels.get(i) == dayPanel) {
current.count = 1;
current.setVisible(true);
} else {
current.count = 0;
current.setVisible(false);
}
}
}

public void hideDayPanel(NewFoodListPanel dayPanel) {

dayPanel.count = 0;
dayPanel.setVisible(false);

}

public void resizeButton(ArrayList<JButton> dayButtons) {

// DOESN'T WORK YET BUT IT IS GOING TO BE USED TO RESIZE THE BUTTONS FOR WHEN THEY ARE CLICKED
// It is a bug I will fix later.

for (int i = 0; i < dayButtons.size(); i++) {
dayButtons.get(i).setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE));
}
}
}
47 changes: 47 additions & 0 deletions GUI/NewFoodListPanel.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package GUI;

import java.awt.Color;
import java.awt.GridLayout;

import javax.swing.*;

public class NewFoodListPanel extends JPanel{

public String[] topSection = {
"Breakfast", "Lunch", "Dinner"
};

private String breakfast;
private String lunch;
private String dinner;
public int count = 0;

NewFoodListPanel(String breakfast, String lunch, String dinner){
this.breakfast = breakfast;
this.lunch = lunch;
this.dinner = dinner;
initialize();
}

public void initialize() {

String[] bottomSection = {this.breakfast, this.lunch, this.dinner};

// this.setBackground(new Color(46, 5, 74));
this.setLayout(new GridLayout(2, 3, 10, 10));
this.setVisible(false);

this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

for (int i = 0; i < 3; i++) {
JLabel label = new JLabel(topSection[i], SwingConstants.CENTER);
label.setBorder(BorderFactory.createLineBorder(Color.BLACK)); // Add border for clarity
this.add(label);
}
for (int i = 0; i < 3; i++) {
JLabel label = new JLabel(bottomSection[i], SwingConstants.CENTER);
label.setBorder(BorderFactory.createLineBorder(Color.BLACK)); // Add border for clarity
this.add(label);
}
}
}
2 changes: 2 additions & 0 deletions GUI/WelcomePage.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import javax.swing.border.EmptyBorder;

public class WelcomePage {

protected JButton AttendanceButton;
protected JLabel CafeManagementLabel;
protected JPanel topPanel;
Expand Down Expand Up @@ -53,6 +54,7 @@ public void actionPerformed(ActionEvent e) {
@Override
public void actionPerformed(ActionEvent e) {
new FoodListPage();
frame.add(centerPanel, BorderLayout.CENTER);
frame.dispose();
}
});
Expand Down
13 changes: 13 additions & 0 deletions out/production/6kiloCafeProject/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="SIGNUP_BACKEND/src/" kind="src" path=""/>
<classpathentry kind="src" path="SIGNUP_BACKEND/src"/>
<classpathentry kind="lib" path="C:/Users/Nebiyou/Desktop/Projects/6kiloCafeProject/lib/jfreechart-1.5.4.jar"/>
<classpathentry kind="lib" path="C:/Users/Nebiyou/Desktop/Projects/6kiloCafeProject/lib/mysql-connector-j-8.2.0.jar"/>
<classpathentry kind="output" path="out/production/6kiloCafeProject"/>
</classpath>
2 changes: 2 additions & 0 deletions out/production/6kiloCafeProject/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/GUI/
/out/
124 changes: 124 additions & 0 deletions out/production/6kiloCafeProject/.idea/uiDesigner.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading