コード例 #1
0
ファイル: Plotter.java プロジェクト: susotajuraj/jdk8u-jdk
  @Override
  public JPopupMenu getComponentPopupMenu() {
    if (popupMenu == null) {
      popupMenu = new JPopupMenu(Messages.CHART_COLON);
      timeRangeMenu = new JMenu(Messages.PLOTTER_TIME_RANGE_MENU);
      timeRangeMenu.setMnemonic(Resources.getMnemonicInt(Messages.PLOTTER_TIME_RANGE_MENU));
      popupMenu.add(timeRangeMenu);
      menuRBs = new JRadioButtonMenuItem[rangeNames.length];
      ButtonGroup rbGroup = new ButtonGroup();
      for (int i = 0; i < rangeNames.length; i++) {
        menuRBs[i] = new JRadioButtonMenuItem(rangeNames[i]);
        rbGroup.add(menuRBs[i]);
        menuRBs[i].addActionListener(this);
        if (viewRange == rangeValues[i]) {
          menuRBs[i].setSelected(true);
        }
        timeRangeMenu.add(menuRBs[i]);
      }

      popupMenu.addSeparator();

      saveAsMI = new JMenuItem(Messages.PLOTTER_SAVE_AS_MENU_ITEM);
      saveAsMI.setMnemonic(Resources.getMnemonicInt(Messages.PLOTTER_SAVE_AS_MENU_ITEM));
      saveAsMI.addActionListener(this);
      popupMenu.add(saveAsMI);
    }
    return popupMenu;
  }
コード例 #2
0
ファイル: ImageLabFrame.java プロジェクト: per-ola/db2004
 public void addFilter(JMenu menu, final ImageFilter f) {
   JMenuItem item = new JMenuItem(f.getMenuName());
   menu.add(item);
   item.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           swapImages();
           f.apply(pic1, pic2);
           lab.setIcon(pic2.getJLabel().getIcon());
           sliderPanel.setVisible(false);
           pack();
           repaint();
         }
       });
 }
コード例 #3
0
ファイル: ImageLabFrame.java プロジェクト: per-ola/db2004
 public void addPictureGenerator(JMenu menu, final PictureGenerator gen) {
   JMenuItem item = new JMenuItem(gen.getMenuName());
   menu.add(item);
   item.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           pic2 = gen.picture();
           pic1 = new Picture(pic2.width(), pic2.height());
           lab.setIcon(pic2.getJLabel().getIcon());
           sliderPanel.setVisible(false);
           pack();
           repaint();
         }
       });
 }
コード例 #4
0
ファイル: ImageLabFrame.java プロジェクト: per-ola/db2004
 public void addScalableFilter(JMenu menu, final ScalableFilter f) {
   JMenuItem item = new JMenuItem(f.getMenuName());
   menu.add(item);
   item.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           swapImages();
           currentFilter = f;
           slider.setValue(50);
           sliderPanel.setVisible(true);
           border.setTitle(f.getMenuName());
           pack();
           repaint();
         }
       });
 }
コード例 #5
0
ファイル: ImageLabFrame.java プロジェクト: per-ola/db2004
  public void actionPerformed(ActionEvent e) {
    String cmd = (e.getActionCommand());

    if (cmd.equals(aboutItem.getText()))
      JOptionPane.showMessageDialog(
          this,
          "Simple Image Program for DB2004\nversion 0.1\nThanks to BvS",
          "About imageLab",
          JOptionPane.INFORMATION_MESSAGE);
    else if (cmd.equals(quitItem.getText())) System.exit(0);
    else if (cmd.equals(openItem.getText())) {
      int returnVal = chooser.showOpenDialog(this);
      if (returnVal == JFileChooser.APPROVE_OPTION) {
        try {
          pic2 = new Picture(chooser.getSelectedFile().getName());
          pic1 = new Picture(pic2.width(), pic2.height());
          lab.setIcon(pic2.getJLabel().getIcon());
          sliderPanel.setVisible(false);
          pack();
          repaint();
        } catch (Exception ex) {
          JOptionPane.showMessageDialog(
              this,
              "Could not open " + chooser.getSelectedFile().getName() + "\n" + ex.getMessage(),
              "Open Error",
              JOptionPane.INFORMATION_MESSAGE);
        }
      }

    } else if (cmd.equals(saveItem.getText())) {
      int returnVal = chooser.showSaveDialog(this);
      if (returnVal == JFileChooser.APPROVE_OPTION) {
        try {
          pic2.save(chooser.getSelectedFile().getName());
        } catch (Exception ex) {
          JOptionPane.showMessageDialog(
              this,
              "Could not write " + chooser.getSelectedFile().getName() + "\n" + ex.getMessage(),
              "Save Error",
              JOptionPane.INFORMATION_MESSAGE);
        }
      }
    }
  }
コード例 #6
0
 public void disableRewind() {
   rewindButton.setEnabled(false);
   rewindMenuItem.setEnabled(false);
 }
コード例 #7
0
 public void enableSingleStep() {
   singleStepButton.setEnabled(true);
   singleStepMenuItem.setEnabled(true);
 }
コード例 #8
0
 public void disableSingleStep() {
   singleStepButton.setEnabled(false);
   singleStepMenuItem.setEnabled(false);
 }
コード例 #9
0
  public ImageViewerFrame() {
    setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);

    // set up menu bar
    JMenuBar menuBar = new JMenuBar();
    setJMenuBar(menuBar);

    JMenu menu = new JMenu("File");
    menuBar.add(menu);

    JMenuItem openItem = new JMenuItem("Open");
    menu.add(openItem);
    openItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            chooser.setCurrentDirectory(new File("."));

            // show file chooser dialog
            int result = chooser.showOpenDialog(ImageViewerFrame.this);

            // if image file accepted, set it as icon of the label
            if (result == JFileChooser.APPROVE_OPTION) {
              String name = chooser.getSelectedFile().getPath();
              label.setIcon(new ImageIcon(name));
              pack();
            }
          }
        });

    JMenuItem exitItem = new JMenuItem("Exit");
    menu.add(exitItem);
    exitItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            System.exit(0);
          }
        });

    // use a label to display the images
    label = new JLabel();
    add(label);

    // set up file chooser
    chooser = new JFileChooser();

    // accept all image files ending with .jpg, .jpeg, .gif
    /*
    final ExtensionFileFilter filter = new ExtensionFileFilter();
    filter.addExtension("jpg");
    filter.addExtension("jpeg");
    filter.addExtension("gif");
    filter.setDescription("Image files");
    */
    FileNameExtensionFilter filter =
        new FileNameExtensionFilter("Image files", "jpg", "jpeg", "gif");
    chooser.setFileFilter(filter);

    chooser.setAccessory(new ImagePreviewer(chooser));

    chooser.setFileView(new FileIconView(filter, new ImageIcon("palette.gif")));
  }
コード例 #10
0
 public void enableLoadSource() {
   loadButton.setEnabled(true);
   loadSourceMenuItem.setEnabled(true);
 }
コード例 #11
0
 public void enableFullCompilation() {
   fullTranslationButton.setEnabled(true);
   fullTranslationMenuItem.setEnabled(true);
 }
コード例 #12
0
 public void enableSave() {
   saveButton.setEnabled(true);
   saveDestMenuItem.setEnabled(true);
 }
コード例 #13
0
ファイル: ImageLabFrame.java プロジェクト: per-ola/db2004
  public ImageLabFrame() {

    // Set up menus
    JMenuBar menuBar = new JMenuBar();

    JMenu imageLabMenu = new JMenu("imageLab");
    menuBar.add(imageLabMenu);

    aboutItem = new JMenuItem("About imageLab");
    imageLabMenu.add(aboutItem);
    quitItem = new JMenuItem("Quit");
    imageLabMenu.add(quitItem);

    JMenu fileMenu = new JMenu("File");
    menuBar.add(fileMenu);
    openItem = new JMenuItem("Open File...");
    fileMenu.add(openItem);
    saveItem = new JMenuItem("Save As...");
    fileMenu.add(saveItem);

    JMenu imageMenu = new JMenu("Images");
    menuBar.add(imageMenu);
    addPictureGenerator(imageMenu, new Stripe());

    JMenu filterMenu = new JMenu("Filters");
    menuBar.add(filterMenu);
    addFilter(filterMenu, new BWFilter());
    filterMenu.addSeparator();
    addScalableFilter(filterMenu, new SwirlFilter());

    // Listeners for filters are added in addScalableFilter
    aboutItem.addActionListener(this);
    quitItem.addActionListener(this);
    openItem.addActionListener(this);
    saveItem.addActionListener(this);

    // Set up rest of GUI

    lab = initialImage().getJLabel();

    slider = new JSlider(0, 100);
    sliderPanel = new JPanel();
    sliderPanel.add(slider);
    sliderPanel.setVisible(false);
    Border b1 = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
    border = BorderFactory.createTitledBorder(b1, "");
    sliderPanel.setBorder(border);
    slider.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            double scale = (slider.getValue() - 50) / 50.0;
            currentFilter.apply(pic1, pic2, scale);
            lab.setIcon(pic2.getJLabel().getIcon());
            repaint();
          }
        });

    JPanel panel = new JPanel(new BorderLayout());
    getContentPane().add(panel);
    panel.add(lab, BorderLayout.NORTH);
    panel.add(sliderPanel, BorderLayout.SOUTH);
    setJMenuBar(menuBar);
    pack();
    setTitle("imageLab");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    // Prepare file chooser
    chooser = new JFileChooser(new File("."));
    FileNameExtensionFilter filter = new FileNameExtensionFilter("JPG Images", "jpg");
    chooser.setFileFilter(filter);
  }
コード例 #14
0
  public ImageProcessingFrame() {
    setTitle("ImageProcessingTest");
    setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);

    add(
        new JComponent() {
          public void paintComponent(Graphics g) {
            if (image != null) g.drawImage(image, 0, 0, null);
          }
        });

    JMenu fileMenu = new JMenu("File");
    JMenuItem openItem = new JMenuItem("Open");
    openItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            openFile();
          }
        });
    fileMenu.add(openItem);

    JMenuItem exitItem = new JMenuItem("Exit");
    exitItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            System.exit(0);
          }
        });
    fileMenu.add(exitItem);

    JMenu editMenu = new JMenu("Edit");
    JMenuItem blurItem = new JMenuItem("Blur");
    blurItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            float weight = 1.0f / 9.0f;
            float[] elements = new float[9];
            for (int i = 0; i < 9; i++) elements[i] = weight;
            convolve(elements);
          }
        });
    editMenu.add(blurItem);

    JMenuItem sharpenItem = new JMenuItem("Sharpen");
    sharpenItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            float[] elements = {0.0f, -1.0f, 0.0f, -1.0f, 5.f, -1.0f, 0.0f, -1.0f, 0.0f};
            convolve(elements);
          }
        });
    editMenu.add(sharpenItem);

    JMenuItem brightenItem = new JMenuItem("Brighten");
    brightenItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            float a = 1.1f;
            // float b = 20.0f;
            float b = 0;
            RescaleOp op = new RescaleOp(a, b, null);
            filter(op);
          }
        });
    editMenu.add(brightenItem);

    JMenuItem edgeDetectItem = new JMenuItem("Edge detect");
    edgeDetectItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            float[] elements = {0.0f, -1.0f, 0.0f, -1.0f, 4.f, -1.0f, 0.0f, -1.0f, 0.0f};
            convolve(elements);
          }
        });
    editMenu.add(edgeDetectItem);

    JMenuItem negativeItem = new JMenuItem("Negative");
    negativeItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            short[] negative = new short[256 * 1];
            for (int i = 0; i < 256; i++) negative[i] = (short) (255 - i);
            ShortLookupTable table = new ShortLookupTable(0, negative);
            LookupOp op = new LookupOp(table, null);
            filter(op);
          }
        });
    editMenu.add(negativeItem);

    JMenuItem rotateItem = new JMenuItem("Rotate");
    rotateItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            if (image == null) return;
            AffineTransform transform =
                AffineTransform.getRotateInstance(
                    Math.toRadians(5), image.getWidth() / 2, image.getHeight() / 2);
            AffineTransformOp op = new AffineTransformOp(transform, AffineTransformOp.TYPE_BICUBIC);
            filter(op);
          }
        });
    editMenu.add(rotateItem);

    JMenuBar menuBar = new JMenuBar();
    menuBar.add(fileMenu);
    menuBar.add(editMenu);
    setJMenuBar(menuBar);
  }
コード例 #15
0
 public void enableRewind() {
   rewindButton.setEnabled(true);
   rewindMenuItem.setEnabled(true);
 }
コード例 #16
0
 public void disableStop() {
   stopButton.setEnabled(false);
   stopMenuItem.setEnabled(false);
 }
コード例 #17
0
 public void disableSave() {
   saveButton.setEnabled(false);
   saveDestMenuItem.setEnabled(false);
 }
コード例 #18
0
 public void enableStop() {
   stopButton.setEnabled(true);
   stopMenuItem.setEnabled(true);
 }
コード例 #19
0
 public void disableFullCompilation() {
   fullTranslationButton.setEnabled(false);
   fullTranslationMenuItem.setEnabled(false);
 }
コード例 #20
0
 public void disableFastForward() {
   ffwdButton.setEnabled(false);
   ffwdMenuItem.setEnabled(false);
 }
コード例 #21
0
 public void disableLoadSource() {
   loadButton.setEnabled(false);
   loadSourceMenuItem.setEnabled(false);
 }
コード例 #22
0
 public void enableFastForward() {
   ffwdButton.setEnabled(true);
   ffwdMenuItem.setEnabled(true);
 }
コード例 #23
0
  // arranges the menu bar
  protected void arrangeMenu() {
    // Build the first menu.
    fileMenu = new JMenu("File");
    fileMenu.setMnemonic(KeyEvent.VK_F);
    menuBar.add(fileMenu);

    runMenu = new JMenu("Run");
    runMenu.setMnemonic(KeyEvent.VK_R);
    menuBar.add(runMenu);

    helpMenu = new JMenu("Help");
    helpMenu.setMnemonic(KeyEvent.VK_H);
    menuBar.add(helpMenu);

    loadSourceMenuItem = new JMenuItem("Load Source file", KeyEvent.VK_O);
    loadSourceMenuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            loadSourceMenuItem_actionPerformed(e);
          }
        });
    fileMenu.add(loadSourceMenuItem);

    saveDestMenuItem = new JMenuItem("Save Destination file", KeyEvent.VK_S);
    saveDestMenuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            saveDestMenuItem_actionPerformed(e);
          }
        });
    fileMenu.add(saveDestMenuItem);

    fileMenu.addSeparator();

    exitMenuItem = new JMenuItem("Exit", KeyEvent.VK_X);
    exitMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, ActionEvent.ALT_MASK));
    exitMenuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            exitMenuItem_actionPerformed(e);
          }
        });
    fileMenu.add(exitMenuItem);

    singleStepMenuItem = new JMenuItem("Single Step", KeyEvent.VK_S);
    singleStepMenuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            singleStepMenuItem_actionPerformed(e);
          }
        });
    runMenu.add(singleStepMenuItem);

    ffwdMenuItem = new JMenuItem("Fast Forward", KeyEvent.VK_F);
    ffwdMenuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            ffwdMenuItem_actionPerformed(e);
          }
        });
    runMenu.add(ffwdMenuItem);

    stopMenuItem = new JMenuItem("Stop", KeyEvent.VK_T);
    stopMenuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            stopMenuItem_actionPerformed(e);
          }
        });
    runMenu.add(stopMenuItem);

    rewindMenuItem = new JMenuItem("Rewind", KeyEvent.VK_R);
    rewindMenuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            rewindMenuItem_actionPerformed(e);
          }
        });
    runMenu.add(rewindMenuItem);
    runMenu.addSeparator();

    fullTranslationMenuItem = new JMenuItem("Fast Translation", KeyEvent.VK_U);
    fullTranslationMenuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            fullTranslationMenuItem_actionPerformed(e);
          }
        });
    runMenu.add(fullTranslationMenuItem);

    usageMenuItem = new JMenuItem("Usage", KeyEvent.VK_U);
    usageMenuItem.setAccelerator(KeyStroke.getKeyStroke("F1"));
    usageMenuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            usageMenuItem_actionPerformed(e);
          }
        });
    helpMenu.add(usageMenuItem);

    aboutMenuItem = new JMenuItem("About...", KeyEvent.VK_A);
    aboutMenuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            aboutMenuItem_actionPerformed(e);
          }
        });
    helpMenu.add(aboutMenuItem);
  }
コード例 #24
0
  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);
  }