Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * File: FacePamphlet.java
- * -----------------------
- * When it is finished, this program will implement a basic social network
- * management system.
- */
- import acm.program.*;
- import acm.graphics.*;
- import acm.util.*;
- import java.awt.event.*;
- import javax.swing.*;
- public class FacePamphlet extends Program implements FacePamphletConstants, ActionListener {
- private JTextField nameBar;
- private JTextField statusBar;
- private JTextField pictureBar;
- private JTextField friendBar;
- /**
- * This method has the responsibility for initializing the
- * interactors in the application, and taking care of any other
- * initialization that needs to be performed.
- */
- public void init() {
- /*Adds label for user to know what to input*/
- add (new JLabel("Name"), NORTH);
- /*Adds space for user to input Name*/
- nameBar = new JTextField(TEXT_FIELD_SIZE);
- add (nameBar, NORTH);
- nameBar.addActionListener(this);
- /*Adds Add Button*/
- add (new JButton("Add"), NORTH);
- /*Adds Delete Button*/
- add (new JButton("Delete"), NORTH);
- /*Adds Lookup Button*/
- add (new JButton("Lookup"), NORTH);
- /*Adds space for user to input status*/
- statusBar = new JTextField(TEXT_FIELD_SIZE);
- statusBar.setActionCommand("Change Status"); //Enables enter key
- add (statusBar, WEST);
- statusBar.addActionListener(this);
- /*Adds button to input new status*/
- add (new JButton("Change Status"), WEST);
- /*Adds empty space*/
- add (new JLabel(EMPTY_LABEL_TEXT), WEST);
- /*Adds space for user to input picture file*/
- pictureBar = new JTextField(TEXT_FIELD_SIZE);
- statusBar.setActionCommand("Change Picture"); //Enables enter key
- add (pictureBar, WEST);
- pictureBar.addActionListener(this);
- /*Adds button to select a new picture.*/
- add (new JButton("Change Picture"), WEST);
- /*Adds empty space*/
- add (new JLabel(EMPTY_LABEL_TEXT), WEST);
- /*Adds space for user to input a Friend's name*/
- friendBar = new JTextField(TEXT_FIELD_SIZE);
- add (friendBar, WEST);
- friendBar.addActionListener(this);
- /*Adds button to add friend.*/
- add (new JButton("Add Friend"), WEST);
- addActionListeners();
- }
- /**
- * This class is responsible for detecting when the buttons are
- * clicked or interactors are used, so you will have to add code
- * to respond to these actions.
- */
- public void actionPerformed(ActionEvent e) {
- //String cmd = e.getActionCommand();
- //Switch
- /*Enables the Enter Key*/
- // if (e.getSource() == Add) {
- // case "Add": {
- //// String query = searchBar.getText();
- //// if(database.findEntry(query) != null){//if name exists in database:
- //// graph.addEntry(database.findEntry(query));
- //// }
- // case "Delete":
- // case "Lookup":
- // case "Change Status":
- // case "Change Picture":
- // case "Add Friend":
- // case
- // } else if (cmd.equals("Delete")) {
- // //graph.clear();
- // /*Clears the arrayList of NameSurferEntry(s) in the graph object*/
- // } else if (cmd.equals("Lookup")) {
- //
- // } else if (cmd.equals("Change Status")) {
- //
- // } else if (cmd.equals("Change Picture")) {
- //
- // } else if (cmd.equals("Add Friend")) {
- //
- // }
- // }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement