Skip to content

Commit

Permalink
Lab 5 completed
Browse files Browse the repository at this point in the history
  • Loading branch information
Adeola Adeleke committed Sep 11, 2019
1 parent 00aa5d8 commit 75423c6
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 13 deletions.
19 changes: 10 additions & 9 deletions src/prog_5_1/AddressForm.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
import javax.swing.JTextField;

/**
* Purpose: Complete an Address Form by adding state and zip fields. Also added a check if any field is empty not to print out to console
* Purpose: Complete an Address Form by adding state and zip fields.
* Also added a check if any field is empty not to print out to console
* @author Adeola Adeleke
* Date: 09/10/2019
* Lab Number: 5
Expand Down Expand Up @@ -171,14 +172,14 @@ public void actionPerformed(ActionEvent evt){
}
}
public static void centerFrameOnDesktop(Component f) {
final int SHIFT_AMOUNT = 0;
Toolkit toolkit = Toolkit.getDefaultToolkit();
int height = toolkit.getScreenSize().height;
int width = toolkit.getScreenSize().width;
int frameHeight = f.getSize().height;
int frameWidth = f.getSize().width;
f.setLocation(((width-frameWidth)/2)-SHIFT_AMOUNT, (height-frameHeight)/3);
}
final int SHIFT_AMOUNT = 0;
Toolkit toolkit = Toolkit.getDefaultToolkit();
int height = toolkit.getScreenSize().height;
int width = toolkit.getScreenSize().width;
int frameHeight = f.getSize().height;
int frameWidth = f.getSize().width;
f.setLocation(((width-frameWidth)/2)-SHIFT_AMOUNT, (height-frameHeight)/3);
}

public static void main(String[] args){
AddressForm mf = new AddressForm();
Expand Down
9 changes: 8 additions & 1 deletion src/prog_5_2/Exercise_5_2.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@
import java.awt.event.ActionEvent;
import javax.swing.JTextField;
import javax.swing.JLabel;

/**
* Purpose: Create a Java Program to count letters, reverse letters and remove duplicates
* and output the result to an Output JTextField
* @author Adeola Adeleke
* Date: 09/10/2019
* Lab Number: 5
*
*/
public class Exercise_5_2 extends JFrame {

/**
Expand Down
16 changes: 13 additions & 3 deletions src/prog_5_3/gui/UserIO.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,14 @@
import javax.swing.JTextArea;

import prog_5_3.gui.prog_3_2.Employee;

/**
* Purpose: this program display the list of Employees and their accounts in the GUI.
* Also added a check if any field is empty not to print out to console
* @author Adeola Adeleke
* Date: 09/10/2019
* Lab Number: 5
*
*/


public class UserIO extends JFrame {
Expand Down Expand Up @@ -156,7 +163,7 @@ class SubmitListener implements ActionListener {
public void actionPerformed(ActionEvent evt) {
String inputString = upperText.getText();

// added this
// added by Adeola Adeleke
if(inputString.isBlank()) {
upperText.setText("");
return;
Expand Down Expand Up @@ -186,6 +193,9 @@ public void actionPerformed(ActionEvent evt) {
}
}

/**
* added by Adeola Adeleke
*/
private void setUpData() {
emps = new Employee[3];
emps[0] = new Employee("Jim Daley", 2000, 9, 4);
Expand All @@ -208,7 +218,7 @@ public void run() {
UserIO userIo = new UserIO();
userIo.setVisible(true);
//prepare employees
userIo.setUpData();
userIo.setUpData(); // added by Adeola Adeleke
}
});
}
Expand Down

0 comments on commit 75423c6

Please sign in to comment.