Exemple #1
0
 public void doLayout() {
   if (isStuck()) {
     Dimension size = getSize();
     Dimension unStickSize = unstickButton.getPreferredSize();
     int x = size.width - unStickSize.width;
     int y = size.height / 2 - unStickSize.height / 2;
     unstickButton.setSize(unStickSize);
     unstickButton.setLocation(x, y);
   }
 }
  public Abschluss(String wahl, Sudoku s, Sudoku2 s2) {
    super("Sudoku-Abschluss");
    this.setSize(270, 135);
    this.setLocation(250, 300);
    this.setLayout(null);
    this.setAlwaysOnTop(true);
    this.setResizable(false);
    this.setUndecorated(true);
    if (s == null) this.setLocationRelativeTo(s2);
    else this.setLocationRelativeTo(s);

    su = s;
    su2 = s2;
    w = wahl;

    ImageIcon icon = new ImageIcon("files/minigames/Sudoku/beispiel2.jpg");
    icon.setImage(icon.getImage().getScaledInstance(290, 135, Image.SCALE_DEFAULT));

    lab = new JLabel(icon);
    lab.setSize(270, 135);
    lab.setLocation(0, 0);
    this.add(lab);

    text = new JLabel();
    text.setSize(250, 20);
    text.setLocation(10, 10);
    text.setForeground(Color.white);
    text.setHorizontalAlignment(0);
    lab.add(text);

    text2 = new JLabel();
    text2.setSize(270, 20);
    text2.setLocation(10, 30);
    text2.setForeground(Color.white);
    lab.add(text2);

    ok = new JButton("OK");
    ok.setSize(90, 30);
    ok.setLocation(80, 50);
    ok.setBorderPainted(false);
    ok.setBackground(Color.lightGray);
    ok.setForeground(Color.lightGray);
    ok.setOpaque(false);
    ok.setFont(new Font("Arial Black", 4, 20));
    ok.setContentAreaFilled(false);
    ok.setFocusPainted(false);
    ok.addActionListener(this);
    ok.addMouseListener(this);
    lab.add(ok);

    textWahl(wahl);

    this.setVisible(true);
  }
 private void init() {
   setSize(800, 600);
   cp = getContentPane();
   cp.setLayout(null);
   btnResize.addActionListener(this);
   btnResize.setLocation(0, 0);
   btnResize.setSize(100, 30);
   sp.setLocation(0, 31);
   sp.setBorder(BorderFactory.createLineBorder(Color.blue, 2));
   editorPane.setBorder(BorderFactory.createLineBorder(Color.red, 2));
   step.setLocation(0, 31);
   step.setSize(100, 100);
   cp.add(step);
   //		cp.add(sp);
   cp.add(btnResize);
 }
Exemple #4
0
  public ProgressPanel(final NodeBoxDocument document) {
    setMinimumSize(new Dimension(0, PROGRESS_PANEL_HEIGHT));
    setMaximumSize(new Dimension(PROGRESS_PANEL_WIDTH, PROGRESS_PANEL_HEIGHT));
    setPreferredSize(new Dimension(PROGRESS_PANEL_WIDTH, PROGRESS_PANEL_HEIGHT));
    setLayout(new FlowLayout(FlowLayout.LEADING, 0, 0));

    stopButton = new JButton(stopOffIcon);
    stopButton.setBorderPainted(false);
    stopButton.setBorder(null);
    stopButton.setSize(19, 19);
    stopButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            document.stopRendering();
          }
        });
    add(stopButton);
  }
  public GraphicsUI() {

    questionPool = new QuestionPool();

    setTitle("Question Pool");
    setSize(WIDTH, HEIGHT);

    fileL = new JLabel("Location of Question Pool File:");
    fileTF = new JTextField(10);

    checkB = new JButton("Check File");

    log = new JTextArea(6, 30);

    Container pane = getContentPane();
    pane.setLayout(null);

    // set locations and sizes for the elements
    fileL.setLocation(90, 15);
    fileL.setSize(ELEMENT_WIDTH, 30);
    fileTF.setLocation(90, 65);
    fileTF.setSize(ELEMENT_WIDTH, 30);
    checkB.setLocation(90, 105);
    checkB.setSize(300, 35);
    log.setLocation(90, 145);
    log.setSize(300, 30);

    // add listener to button
    CheckButtonHandler cbHandler = new CheckButtonHandler();
    checkB.addActionListener(cbHandler);
    fileTF.addActionListener(cbHandler);

    // add elements to pane
    pane.add(fileL);
    pane.add(fileTF);
    pane.add(checkB);
    pane.add(log);

    setLocation(100, 60);
    setVisible(true);
    setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
  }
Exemple #6
0
  Spacer(ZoneModel model, int index, SpacerHandle knobHandle) {
    this.model = model;
    this.index = index;
    this.knobHandle = knobHandle;

    knobPainter = new KnobPainter(this);

    setOpaque(false);
    setCursor(SliderCursor);

    initKeyMaps();

    Icon icon = getIcon("unstick");
    Icon pressedIcon = getIcon("unstickPressed");
    Icon highlightIcon = getIcon("unstickHighlight");
    unstickButton = new JButton(icon);
    unstickButton.setSize(icon.getIconWidth(), icon.getIconHeight());
    unstickButton.setPressedIcon(pressedIcon);
    unstickButton.setRolloverEnabled(true);
    unstickButton.setRolloverIcon(highlightIcon);
    unstickButton.setBorder(null);
    unstickButton.putClientProperty(SubstanceLookAndFeel.BUTTON_PAINT_NEVER_PROPERTY, Boolean.TRUE);
    unstickButton.setBorderPainted(false);
    unstickButton.setRolloverEnabled(true);
    unstickButton.setOpaque(false);
    unstickButton.setCursor(ClickCursor);
    unstickButton.setFocusable(false);
    unstickButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            Spacer.this.model.removePoint(Spacer.this.index);
          }
        });
    if (model.containsPoint(index)) {
      add(unstickButton);
    }
    model.addZoneModelListener(this);

    setFocusable(true);
    addFocusListener(this);
    addMouseListener(this);
  }
  void setupGUI() {
    taDictionary = new TextArea();
    taDictionary.setLocation(0, 0);
    taDictionary.setSize(106, 567);
    taDictionary.setBackground(new Color(-1));
    taDictionary.setText("");
    taDictionary.setRows(5);
    taDictionary.setColumns(1);
    getContentPane().add(taDictionary);

    tfSourc = new TextField();
    tfSourc.setLocation(224, 90);
    tfSourc.setSize(266, 25);
    tfSourc.setBackground(new Color(-1));
    tfSourc.setText("");
    tfSourc.setColumns(10);
    getContentPane().add(tfSourc);

    lblSourc = new Label();
    lblSourc.setLocation(106, 90);
    lblSourc.setSize(119, 25);
    lblSourc.setText("Source Word:");
    getContentPane().add(lblSourc);
    /*
    lblDestinatio = new Label();
    lblDestinatio.setLocation(106,97);
    lblDestinatio.setSize(119,25);
    lblDestinatio.setText("Destination Wor");
    getContentPane().add(lblDestinatio);
       */

    lblDestinatio = new Label();
    lblDestinatio.setLocation(106, 120);
    lblDestinatio.setSize(119, 25);
    lblDestinatio.setText("Destination Word:");
    getContentPane().add(lblDestinatio);

    lblWordSize = new Label();
    lblWordSize.setLocation(106, 27); // 106,120
    lblWordSize.setSize(119, 25);
    lblWordSize.setText("Word Size:");
    getContentPane().add(lblWordSize);

    tfWordSize = new TextField();
    tfWordSize.setLocation(224, 27); // 224,120
    tfWordSize.setSize(263, 25);
    tfWordSize.setBackground(new Color(-1));
    tfWordSize.setText("5");
    tfWordSize.setColumns(10);
    getContentPane().add(tfWordSize);

    tfSourc_6 = new TextField();
    tfSourc_6.setLocation(226, 120);
    tfSourc_6.setSize(263, 25);
    tfSourc_6.setBackground(new Color(-1));
    tfSourc_6.setText("");
    tfSourc_6.setColumns(10);
    getContentPane().add(tfSourc_6);

    lblFileNam = new Label();
    lblFileNam.setLocation(104, 0);
    lblFileNam.setSize(119, 25);
    lblFileNam.setText("FilePath:");
    getContentPane().add(lblFileNam);

    tfFilePat = new TextField();
    tfFilePat.setLocation(224, 0);
    tfFilePat.setSize(266, 25);
    tfFilePat.setBackground(new Color(-1));

    // OS Detection
    if (System.getProperty("os.name").startsWith("Windows")) {
      // includes: Windows 2000,  Windows 95, Windows 98, Windows NT, Windows Vista, Windows XP
      tfFilePat.setText("c:\\ics340\\words.txt");
      System.out.println("Detected Windows: " + System.getProperty("os.name"));
    } else {
      tfFilePat.setText("/Users/jasonedstrom/ics340/d1.txt");
      System.out.println("Detected Mac OS X: " + System.getProperty("os.name"));
    }

    tfFilePat.setColumns(10);
    getContentPane().add(tfFilePat);

    btLoadTextFiel = new JButton();
    btLoadTextFiel.setLocation(108, 50); // 108,27
    btLoadTextFiel.setSize(198, 32);
    btLoadTextFiel.setText("Load Words from Text Field");
    getContentPane().add(btLoadTextFiel);

    btLoadFil = new JButton();
    btLoadFil.setLocation(306, 50); // 306,27
    btLoadFil.setSize(183, 32);
    btLoadFil.setText("Load Words from File");
    getContentPane().add(btLoadFil);

    btFindPat = new JButton();
    btFindPat.setLocation(106, 160);
    btFindPat.setSize(384, 38);
    btFindPat.setText("Find Path");
    getContentPane().add(btFindPat);

    lblDictCoun = new JLabel();
    lblDictCoun.setLocation(108, 513);
    lblDictCoun.setSize(300, 27);
    lblDictCoun.setForeground(new Color(-65536));
    lblDictCoun.setText("Words in Dictionary = 0 words");
    getContentPane().add(lblDictCoun);

    lblIndexing1 = new JLabel();
    lblIndexing1.setLocation(107, 454);
    lblIndexing1.setSize(130, 27);
    lblIndexing1.setForeground(new Color(-16777216));
    lblIndexing1.setText("");
    getContentPane().add(lblIndexing1);

    lblFindPat = new JLabel();
    lblFindPat.setLocation(108, 540);
    lblFindPat.setSize(250, 27);
    lblFindPat.setForeground(new Color(-14646771));
    lblFindPat.setText("Time to find Path: 0 milliseconds");
    getContentPane().add(lblFindPat);

    lblCos = new JLabel();
    lblCos.setLocation(360, 540);
    lblCos.setSize(175, 27);
    lblCos.setForeground(new Color(-16777216));
    lblCos.setText("Cost of Path: 0.0");
    getContentPane().add(lblCos);

    lblProgres = new JLabel();
    lblProgres.setLocation(108, 484);
    lblProgres.setSize(371, 26);
    lblProgres.setForeground(new Color(-14646771));
    lblProgres.setText("Time to Build Graph: 0 milliseconds");
    getContentPane().add(lblProgres);

    testpanel = new JPanel();
    testpanel.setLocation(106, 200);
    testpanel.setSize(350, 200);
    testpanel.setForeground(new Color(-14646771));
    // testpanel.setText("Test Location");
    getContentPane().add(testpanel);

    btClear = new JButton();
    btClear.setLocation(355, 513);
    btClear.setSize(125, 25);
    btClear.setText("Clear Results");
    getContentPane().add(btClear);

    // add actionlisteners to buttons
    btFindPat.addActionListener(this);
    btLoadTextFiel.addActionListener(this);
    btLoadFil.addActionListener(this);
    btClear.addActionListener(this);

    setTitle("WordLadderGUI");
    setSize(500, 600);
    setVisible(true);
    setResizable(false);
  }
  public void createControls() {
    // Create all Swing components here
    JFrame.setDefaultLookAndFeelDecorated(true);
    controlFrame = new JFrame("Control");
    controlFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    controlFrame.setSize(new Dimension(100, 80));

    controlPanel = new JPanel(new GridLayout(1, 2));

    menuBar = new JMenuBar();
    menu = new JMenu("DJ Control");
    startMenuItem = new JMenuItem("Start");
    menu.add(startMenuItem);
    startMenuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            controller.start();
            // disableStartMenuItem();
            //  enableStopMenuItem();
          }
        });
    stopMenuItem = new JMenuItem("Stop");
    menu.add(stopMenuItem);
    stopMenuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            controller.stop();
            // enableStartMenuItem();
            //  disableStopMenuItem();
          }
        });
    JMenuItem exit = new JMenuItem("Quit");
    exit.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            System.exit(0);
          }
        });

    menu.add(exit);
    menuBar.add(menu);
    controlFrame.setJMenuBar(menuBar);

    bpmTextField = new JTextField(2);
    bpmLabel = new JLabel("Enter BPM:", SwingConstants.RIGHT);
    setBPMButton = new JButton("Set");
    setBPMButton.setSize(new Dimension(10, 40));
    increaseBPMButton = new JButton(">>");
    decreaseBPMButton = new JButton("<<");
    setBPMButton.addActionListener(this);
    increaseBPMButton.addActionListener(this);
    decreaseBPMButton.addActionListener(this);

    JPanel buttonPanel = new JPanel(new GridLayout(1, 2));

    buttonPanel.add(decreaseBPMButton);
    buttonPanel.add(increaseBPMButton);

    JPanel enterPanel = new JPanel(new GridLayout(1, 2));
    enterPanel.add(bpmLabel);
    enterPanel.add(bpmTextField);
    JPanel insideControlPanel = new JPanel(new GridLayout(3, 1));
    insideControlPanel.add(enterPanel);
    insideControlPanel.add(setBPMButton);
    insideControlPanel.add(buttonPanel);
    controlPanel.add(insideControlPanel);

    bpmLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    bpmOutputLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    controlFrame.getRootPane().setDefaultButton(setBPMButton);
    controlFrame.getContentPane().add(controlPanel, BorderLayout.CENTER);

    controlFrame.pack();
    controlFrame.setVisible(true);
  }
  // Set the positions and sizes of the buttons and display the panel
  public void paintComponent(Graphics page) {
    super.paintComponent(page);

    // Calculate the button width and height so the buttons span the screen
    int screenWidth = getWidth();
    int screenHeight = getHeight();
    int[] buttonWidth = new int[5];
    buttonWidth[0] = (screenWidth - (BUTTON_SPACE * 13)) / 13;
    buttonWidth[1] = buttonWidth[0];
    buttonWidth[2] = (screenWidth - (BUTTON_SPACE * 11)) / 11;
    buttonWidth[3] = (screenWidth - (BUTTON_SPACE * 11)) / 10;
    buttonWidth[4] = (screenWidth - (BUTTON_SPACE * 11)) / 10;
    int buttonHeight = (screenHeight - (BUTTON_SPACE * 7)) / 6;

    int xPos;
    int yPos;
    // Subtract 1 from this int every time a sound button is placed where it belongs
    // When it equals zero all sounds have been placed
    int keysToMap = soundList.size();
    ArrayList<BoardButton> copy = (ArrayList<BoardButton>) soundList.clone();

    // For each string in the rows array, check if any of the key strings for the sound match
    for (int j = 0; j < rows.length; j++) {
      int i = 0;

      // For each string in the rows array, check each sound object to see if it is played with a
      // key in that row
      while ((copy.size() > 0) && (i < soundList.size())) {
        int index = 0;
        if (soundList.get(i).getKeyName().indexOf("N") != -1) {
          if (j == 4) index = rows[j].indexOf(soundList.get(i).getKeyName().substring(1));
          else index = -1;
        } else {
          if (j != 4)
            // Get where the key string is in the rows array
            index = rows[j].indexOf(soundList.get(i).getKeyName());
          else index = -1;
        }
        // If the key string doesn't exist, the key is not in this row and the button won't be
        // placed
        if (index != -1) {
          // Place the button based on the corresponding key's position on the keyboard
          xPos = ((buttonWidth[j] + BUTTON_SPACE) * index) + BUTTON_SPACE;
          yPos = ((buttonHeight + BUTTON_SPACE) * j) + BUTTON_SPACE;

          JButton curr = soundList.get(i).getButton();
          // Set the button's size and position to the size and position calculated
          curr.setSize(new Dimension(buttonWidth[j], buttonHeight));
          curr.setLocation(xPos, yPos);
          // Decrement the number of sounds left to map
          copy.remove(soundList.get(i));
          keysToMap -= 1;
        }

        // Increment the index of the sound to check
        i++;
      }
    }

    // Set the x-position, y-position, and size of the spacebar key
    // It will span the bottom of the screen and be the same height as the other buttons
    JButton btnSpace = space.getButton();
    xPos = 10;
    yPos = ((buttonHeight + BUTTON_SPACE) * 5) + BUTTON_SPACE;
    btnSpace.setSize(new Dimension(screenWidth - (BUTTON_SPACE * 2), buttonHeight));
    btnSpace.setLocation(xPos, yPos);
  }
Exemple #10
0
  /**
   * Create a SubProj2DClickDialog instance
   *
   * @param frame the frame containing the dialog
   * @param level the index of current level
   * @param modal the modal option for the dialog
   * @param plots the plot panel for each sub-cluster
   * @param pointsNum the required number of click pointers for each sub-cluster
   */
  public SubProj2DClickDialog(
      JFrame frame, int level, boolean modal, Plot2DViewer plots[], int pointsNum[]) {
    super(frame, "Level " + level + " Cluster Centers Selection", modal);
    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    Container content = getContentPane();
    numClusters = plots.length;
    totalNum = numClusters;
    numPoints = pointsNum;
    cluster2DCenters = new double[numClusters][2];

    String labelText =
        "<html>Instruction: Left click to select the centers of clusters for each sub-window."
            + "<P>"
            + "When all finished, click the <b>DONE</b> button to continue.</html>";
    instructionsLabel = new JLabel(labelText);
    instructionsLabel.setForeground(java.awt.Color.magenta);

    JPanel buttonPanel = new JPanel();
    doneButton = new JButton("DONE");
    doneButton.setActionCommand("done-command");
    doneButton.setSize(90, 30);
    doneButton.setPreferredSize(new Dimension(90, 30));
    doneButton.setFocusPainted(false);
    buttonPanel.add(doneButton);
    doneButton.addActionListener(new EventListener());

    subPlots = new Proj2DClickPanel[numClusters];
    for (int i = 0; i < numClusters; i++) {
      String subTitle;
      subTitle = "Level_" + level + "_SubCluster_" + (i + 1) + " Plot";
      subPlots[i] = new Proj2DClickPanel(subTitle, plots[i], numPoints[i]);
    }

    // layout
    int rowNum = numClusters / 2;
    int remain = numClusters % 2;
    if (remain > 0) {
      rowNum += 1;
    }

    JPanel plotArea = new JPanel((new GridLayout(rowNum, 2)));
    for (int i = 0; i < numClusters; i++) {
      plotArea.add(subPlots[i]);
    }
    JScrollPane plotScrollPane =
        new JScrollPane(
            plotArea,
            ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    plotScrollPane.setPreferredSize(new Dimension(800, 600));

    content.setLayout(new GridBagLayout());
    GBA gba = new GBA();
    gba.add(
        content, plotScrollPane, 0, 0, 3, 2, 1, 1, GBA.B, GBA.C, (new Insets(5, 5, 5, 5)), 0, 0);
    gba.add(
        content, instructionsLabel, 0, 2, 2, 1, 1, 0, GBA.H, GBA.C, (new Insets(5, 5, 5, 5)), 0, 0);
    gba.add(content, buttonPanel, 2, 2, 1, 1, 1, 0, GBA.H, GBA.C, (new Insets(5, 5, 5, 5)), 40, 0);
    // content.add(plotArea, BorderLayout.NORTH);
    // content.add(instructionsLabel, BorderLayout.CENTER);
    // content.add(buttonPanel, BorderLayout.SOUTH);

    pack();
    setVisible(true);
  }
Exemple #11
0
  /**
   * This method creates the content pane that will be a part of the frame, including the JLabels,
   * JPanels and the JButtons INPUT (parameters): none OUTOUT (return): the main JPanel object that
   * includes everything
   */
  public JPanel createContentPane() {

    JPanel totalGUI = new JPanel(); // the main panel
    totalGUI.setBackground(Color.BLACK);
    totalGUI.setLayout(null);

    printInstructions();
    startNum = In.getInt();
    if (startNum == 1) startGame = true;
    else startGame = false;
    while (!startGame) {
      System.out.println("Please enter 1 to start the game");
      startNum = In.getInt();
      if (startNum == 1) startGame = true;
      else startGame = false;
    }
    if (startGame) {
      titlePanel = new JPanel(); // a panel where the title will be displayed
      titlePanel.setLayout(null);
      titlePanel.setLocation(0, 0);
      titlePanel.setSize(1600, 150);
      Color titlePanelColor = new Color(238, 130, 238);
      titlePanel.setBackground(titlePanelColor);
      totalGUI.add(titlePanel); // this panel is added to the main panel

      gamePanel = new JPanel(); // game panel (where the cards will be displayed)
      gamePanel.setLayout(null);
      gamePanel.setLocation(0, 150);
      gamePanel.setSize(950, 650);
      gamePanel.setBackground(Color.BLACK);
      totalGUI.add(gamePanel);

      newGameButton = new JButton("Start"); // a button to start the game
      newGameButton.setLocation(800, 155);
      newGameButton.setSize(120, 30);
      newGameButton.addActionListener(this);
      gamePanel.add(newGameButton); // this button is added to the game panel

      endGameButton = new JButton("End Game"); // a button to end the game
      endGameButton.setLocation(800, 195);
      endGameButton.setSize(120, 30);
      endGameButton.addActionListener(this);
      gamePanel.add(endGameButton);

      hitButton = new JButton("Hit! (Player)"); // a hit button for the player
      hitButton.setLocation(800, 235);
      hitButton.setSize(120, 30);
      hitButton.addActionListener(this);
      gamePanel.add(hitButton);

      hitButton2 = new JButton("Hit! (Dealer)"); // a hit button for the dealer
      hitButton2.setLocation(800, 275);
      hitButton2.setSize(120, 30);
      hitButton2.addActionListener(this);
      gamePanel.add(hitButton2);

      standButton = new JButton("Stand (Player)"); // a stand button for the player
      standButton.setLocation(800, 315);
      standButton.setSize(120, 30);
      standButton.addActionListener(this);
      gamePanel.add(standButton);

      standButton2 = new JButton("Stand (Dealer)"); // a stand button for the dealer
      standButton2.setLocation(800, 355);
      standButton2.setSize(120, 30);
      standButton2.addActionListener(this);
      gamePanel.add(standButton2);

      playerTitle =
          new JLabel(
              "Player"); // label that displays the word "Player" on the screen
      playerTitle.setFont(new Font("Comic Sans MS", Font.BOLD, 20));
      Color playerTitleColor = new Color(0, 250, 154);
      playerTitle.setForeground(playerTitleColor);
      playerTitle.setLocation(550, 150);
      playerTitle.setSize(100, 30);
      gamePanel.add(playerTitle);

      dealerTitle = new JLabel("Dealer"); // label that displays the word "Dealer" on the screen
      dealerTitle.setFont(new Font("Comic Sans MS", Font.BOLD, 20));
      Color dealerTitleColor = new Color(0, 250, 154);
      dealerTitle.setForeground(dealerTitleColor);
      dealerTitle.setLocation(550, 350);
      dealerTitle.setSize(100, 30);
      gamePanel.add(dealerTitle);

      scoreLabel = new JLabel(""); // label that displays the score
      scoreLabel.setFont(new Font("Comic Sans MS", Font.BOLD, 30));
      Color scoreLabelColor = new Color(255, 20, 147);
      scoreLabel.setForeground(scoreLabelColor);
      scoreLabel.setLocation(200, 130);
      scoreLabel.setSize(400, 300);
      gamePanel.add(scoreLabel);

      turnLabel = new JLabel(""); // label that informs the users whose turn it is
      turnLabel.setFont(new Font("Comic Sans MS", Font.BOLD, 20));
      Color turnLabelColor = new Color(255, 127, 80);
      turnLabel.setForeground(turnLabelColor);
      turnLabel.setLocation(250, 200);
      turnLabel.setSize(300, 100);
      gamePanel.add(turnLabel);

      score1 = new JLabel("");
      score1.setFont(new Font("Comic Sans MS", Font.BOLD, 20));
      Color score1Color = new Color(255, 127, 80);
      score1.setForeground(score1Color);
      score1.setLocation(660, 135);
      score1.setSize(100, 60);
      gamePanel.add(score1);

      score2 = new JLabel("");
      score2.setFont(new Font("Comic Sans MS", Font.BOLD, 20));
      Color score2Color = new Color(255, 127, 80);
      score2.setForeground(score2Color);
      score2.setLocation(660, 335);
      score2.setSize(100, 60);
      gamePanel.add(score2);

      ImageIcon titleIcon1 = new ImageIcon("BlackJack.jpg");
      titlePics = new JLabel(titleIcon1); // an image for decor
      titlePics.setLocation(0, 0);
      titlePics.setSize(150, 150);
      titlePanel.add(titlePics); // image added to title label

      welcomeLabel = new JLabel("Welcome To Casino Royale!");
      welcomeLabel.setFont(new Font("Monotype Corsiva", Font.BOLD, 40));
      Color titleColor = new Color(0, 255, 255); // title
      welcomeLabel.setForeground(titleColor);
      welcomeLabel.setLocation(245, 0);
      welcomeLabel.setSize(700, 100);
      titlePanel.add(welcomeLabel);

      commandLabel = new JLabel("Please press \"Start\" to start a game of Black Jack!");
      commandLabel.setFont(new Font("Comic Sans MS", Font.BOLD, 16));
      Color commandColor = new Color(0, 0, 0);
      commandLabel.setForeground(commandColor); // instruction to user on how to start the game
      commandLabel.setLocation(250, 101);
      commandLabel.setSize(700, 44);
      titlePanel.add(commandLabel);

      ImageIcon titleIcon3 = new ImageIcon("Swirl.jpg");
      titlePics = new JLabel(titleIcon3); // an image for decor
      titlePics.setLocation(783, 0);
      titlePics.setSize(150, 150);
      titlePanel.add(titlePics);

      totalGUI.setOpaque(true);
      return totalGUI; // return the final JPanel
    }
    return totalGUI;
  }
  public fileBackupProgram(JFrame frame) {
    super(new BorderLayout());
    this.frame = frame;

    errorDialog = new CustomDialog(frame, "Please enter a new name for the error log", this);
    errorDialog.pack();

    moveDialog = new CustomDialog(frame, "Please enter a new name for the move log", this);
    moveDialog.pack();

    printer = new FilePrinter();
    timers = new ArrayList<>();
    log = new JTextArea(5, 20);
    log.setMargin(new Insets(5, 5, 5, 5));
    log.setEditable(false);
    JScrollPane logScrollPane = new JScrollPane(log);
    Object obj;
    copy = true;
    listModel = new DefaultListModel();
    // destListModel = new DefaultListModel();
    directoryList = new directoryStorage();

    // Create a file chooser
    fc = new JFileChooser();

    // Create the menu bar.
    menuBar = new JMenuBar();

    // Build the first menu.
    menu = new JMenu("File");
    menu.getAccessibleContext()
        .setAccessibleDescription("The only menu in this program that has menu items");
    menuBar.add(menu);

    editError = new JMenuItem("Save Error Log As...");
    editError
        .getAccessibleContext()
        .setAccessibleDescription("Change the name of the error log file");
    editError.addActionListener(new ErrorListener());
    menu.add(editError);

    editMove = new JMenuItem("Save Move Log As...");
    editMove
        .getAccessibleContext()
        .setAccessibleDescription("Change the name of the move log file");
    editMove.addActionListener(new MoveListener());
    menu.add(editMove);

    exit = new JMenuItem("Exit");
    exit.getAccessibleContext().setAccessibleDescription("Exit the Program");
    exit.addActionListener(new CloseListener());
    menu.add(exit);
    frame.setJMenuBar(menuBar);
    // Uncomment one of the following lines to try a different
    // file selection mode.  The first allows just directories
    // to be selected (and, at least in the Java look and feel,
    // shown).  The second allows both files and directories
    // to be selected.  If you leave these lines commented out,
    // then the default mode (FILES_ONLY) will be used.
    //
    fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    // fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);

    openButton = new JButton(openString);
    openButton.setActionCommand(openString);
    openButton.addActionListener(new OpenListener());

    destButton = new JButton(destString);
    destButton.setActionCommand(destString);
    destButton.addActionListener(new DestListener());

    // Create the save button.  We use the image from the JLF
    // Graphics Repository (but we extracted it from the jar).
    saveButton = new JButton(saveString);
    saveButton.setActionCommand(saveString);
    saveButton.addActionListener(new SaveListener());

    URL imageURL = getClass().getResource(greenButtonIcon);
    ImageIcon greenSquare = new ImageIcon(imageURL);
    startButton = new JButton("Start", greenSquare);
    startButton.setSize(60, 20);
    startButton.setHorizontalTextPosition(AbstractButton.LEADING);
    startButton.setActionCommand("Start");
    startButton.addActionListener(new StartListener());

    imageURL = getClass().getResource(redButtonIcon);
    ImageIcon redSquare = new ImageIcon(imageURL);
    stopButton = new JButton("Stop", redSquare);
    stopButton.setSize(60, 20);
    stopButton.setHorizontalTextPosition(AbstractButton.LEADING);
    stopButton.setActionCommand("Stop");
    stopButton.addActionListener(new StopListener());

    copyButton = new JRadioButton("Copy");
    copyButton.setActionCommand("Copy");
    copyButton.setSelected(true);
    copyButton.addActionListener(new RadioListener());

    moveButton = new JRadioButton("Move");
    moveButton.setActionCommand("Move");
    moveButton.addActionListener(new RadioListener());

    ButtonGroup group = new ButtonGroup();
    group.add(copyButton);
    group.add(moveButton);

    // For layout purposes, put the buttons in a separate panel

    JPanel optionPanel = new JPanel();

    GroupLayout layout = new GroupLayout(optionPanel);
    optionPanel.setLayout(layout);

    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);

    layout.setHorizontalGroup(
        layout.createSequentialGroup().addComponent(copyButton).addComponent(moveButton));
    layout.setVerticalGroup(
        layout
            .createSequentialGroup()
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(copyButton)
                    .addComponent(moveButton)));

    JPanel buttonPanel = new JPanel(); // use FlowLayout

    layout = new GroupLayout(buttonPanel);
    buttonPanel.setLayout(layout);

    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);

    layout.setHorizontalGroup(
        layout
            .createSequentialGroup()
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.LEADING)
                    .addComponent(openButton)
                    .addComponent(optionPanel))
            .addComponent(destButton)
            .addComponent(startButton)
            .addComponent(stopButton)
        // .addComponent(saveButton)
        );
    layout.setVerticalGroup(
        layout
            .createSequentialGroup()
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(openButton)
                    .addComponent(destButton)
                    .addComponent(startButton)
                    .addComponent(stopButton)
                // .addComponent(saveButton)
                )
            .addComponent(optionPanel));

    buttonPanel.add(optionPanel);
    /*
    buttonPanel.add(openButton);
    buttonPanel.add(destButton);
    buttonPanel.add(startButton);
    buttonPanel.add(stopButton);
    buttonPanel.add(saveButton);
    buttonPanel.add(listLabel);
    buttonPanel.add(copyButton);
    buttonPanel.add(moveButton);
    */
    destButton.setEnabled(false);
    startButton.setEnabled(false);
    stopButton.setEnabled(false);

    // Add the buttons and the log to this panel.

    // add(logScrollPane, BorderLayout.CENTER);

    JLabel listLabel = new JLabel("Monitored Directory:");
    listLabel.setLabelFor(list);

    // Create the list and put it in a scroll pane.
    list = new JList(listModel);
    list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    list.setSelectedIndex(0);
    list.addListSelectionListener(this);
    list.setVisibleRowCount(8);
    JScrollPane listScrollPane = new JScrollPane(list);
    JPanel listPane = new JPanel();
    listPane.setLayout(new BorderLayout());

    listPane.add(listLabel, BorderLayout.PAGE_START);
    listPane.add(listScrollPane, BorderLayout.CENTER);

    listSelectionModel = list.getSelectionModel();
    listSelectionModel.addListSelectionListener(new SharedListSelectionHandler());
    // monitored, destination, waitInt, check

    destination = new JLabel("Destination Directory: ");

    waitField = new JFormattedTextField();
    // waitField.setValue(240);
    waitField.setEditable(false);
    waitField.addPropertyChangeListener(new FormattedTextListener());

    waitInt = new JLabel("Wait Interval (in minutes)");
    // waitInt.setLabelFor(waitField);

    checkField = new JFormattedTextField();
    checkField.setSize(1, 10);
    // checkField.setValue(60);
    checkField.setEditable(false);
    checkField.addPropertyChangeListener(new FormattedTextListener());

    check = new JLabel("Check Interval (in minutes)");
    // check.setLabelFor(checkField);

    fireButton = new JButton(fireString);
    fireButton.setActionCommand(fireString);
    fireButton.addActionListener(new FireListener());

    JPanel fieldPane = new JPanel();
    // fieldPane.add(destField);
    layout = new GroupLayout(fieldPane);
    fieldPane.setLayout(layout);

    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);

    layout.setHorizontalGroup(
        layout
            .createSequentialGroup()
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.LEADING)
                    .addComponent(waitInt)
                    .addComponent(check))
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.LEADING)
                    .addComponent(waitField, 60, 60, 60)
                    .addComponent(checkField, 60, 60, 60)));

    layout.setVerticalGroup(
        layout
            .createSequentialGroup()
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(waitInt)
                    .addComponent(waitField))
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(check)
                    .addComponent(checkField)));

    JPanel labelPane = new JPanel();

    labelPane.setLayout(new BorderLayout());

    labelPane.add(destination, BorderLayout.PAGE_START);
    labelPane.add(fieldPane, BorderLayout.CENTER);

    layout = new GroupLayout(labelPane);
    labelPane.setLayout(layout);

    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);

    layout.setHorizontalGroup(
        layout
            .createSequentialGroup()
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.LEADING)
                    .addComponent(destination)
                    .addComponent(fieldPane)));

    layout.setVerticalGroup(
        layout.createSequentialGroup().addComponent(destination).addComponent(fieldPane));
    // labelPane.add(destination);
    // labelPane.add(fieldPane);

    try {
      // Read from disk using FileInputStream
      FileInputStream f_in = new FileInputStream(LOG_DIRECTORY + "\\save.data");

      // Read object using ObjectInputStream
      ObjectInputStream obj_in = new ObjectInputStream(f_in);

      // Read an object
      directoryList = (directoryStorage) obj_in.readObject();
      ERROR_LOG_NAME = (String) obj_in.readObject();
      MOVE_LOG_NAME = (String) obj_in.readObject();

      if (ERROR_LOG_NAME instanceof String) {
        printer.changeErrorLogName(ERROR_LOG_NAME);
      }

      if (MOVE_LOG_NAME instanceof String) {
        printer.changeMoveLogName(MOVE_LOG_NAME);
      }

      if (directoryList instanceof directoryStorage) {
        System.out.println("found object");
        // directoryList = (directoryStorage) obj;

        Iterator<Directory> directories = directoryList.getDirectories();
        Directory d;
        while (directories.hasNext()) {
          d = directories.next();

          try {
            listModel.addElement(d.getDirectory().toRealPath());
          } catch (IOException x) {
            printer.printError(x.toString());
          }

          int index = list.getSelectedIndex();
          if (index == -1) {
            list.setSelectedIndex(0);
          }

          index = list.getSelectedIndex();
          Directory dir = directoryList.getDirectory(index);

          destButton.setEnabled(true);
          checkField.setValue(dir.getInterval());
          waitField.setValue(dir.getWaitInterval());
          checkField.setEditable(true);
          waitField.setEditable(true);

          // directoryList.addNewDirectory(d);
          // try {
          // listModel.addElement(d.getDirectory().toString());
          // } catch (IOException x) {
          // printer.printError(x.toString());
          // }

          // timer = new Timer();
          // timer.schedule(new CopyTask(d.directory, d.destination, d.getWaitInterval(), printer,
          // d.copy), 0, d.getInterval());
        }

      } else {
        System.out.println("did not find object");
      }
      obj_in.close();
    } catch (ClassNotFoundException x) {
      printer.printError(x.getLocalizedMessage());
      System.err.format("Unable to read");
    } catch (IOException y) {
      printer.printError(y.getLocalizedMessage());
    }

    // Layout the text fields in a panel.

    JPanel buttonPane = new JPanel();
    buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS));

    buttonPane.add(fireButton);
    buttonPane.add(Box.createHorizontalStrut(5));
    buttonPane.add(new JSeparator(SwingConstants.VERTICAL));
    buttonPane.add(Box.createHorizontalStrut(5));
    buttonPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    add(buttonPanel, BorderLayout.PAGE_START);
    add(listPane, BorderLayout.LINE_START);
    // add(destListScrollPane, BorderLayout.CENTER);

    add(fieldPane, BorderLayout.LINE_END);
    add(labelPane, BorderLayout.CENTER);
    add(buttonPane, BorderLayout.PAGE_END);
  }