/** Listener to handle button actions */
 public void actionPerformed(ActionEvent e) {
   // Check if the user changed the service filter option
   if (e.getSource() == service_box) {
     service_list.setEnabled(service_box.isSelected());
     service_list.clearSelection();
     remove_service_button.setEnabled(false);
     add_service_field.setEnabled(service_box.isSelected());
     add_service_field.setText("");
     add_service_button.setEnabled(false);
   }
   // Check if the user pressed the add service button
   if ((e.getSource() == add_service_button) || (e.getSource() == add_service_field)) {
     String text = add_service_field.getText();
     if ((text != null) && (text.length() > 0)) {
       service_data.addElement(text);
       service_list.setListData(service_data);
     }
     add_service_field.setText("");
     add_service_field.requestFocus();
   }
   // Check if the user pressed the remove service button
   if (e.getSource() == remove_service_button) {
     Object[] sels = service_list.getSelectedValues();
     for (int i = 0; i < sels.length; i++) {
       service_data.removeElement(sels[i]);
     }
     service_list.setListData(service_data);
     service_list.clearSelection();
   }
 }
예제 #2
1
 @Override
 public void profileSelectionChanged(final Optional<MutableProfile> profile) {
   okButton.setEnabled(model.isSaveAllowed());
   deleteProfile.setEnabled(model.getSelectedProfile().isPresent());
   if (profile.isPresent()) {
     final int index = profilesModel.indexOf(profile.get());
     selectionModel.setLeadSelectionIndex(index);
   } else {
     selectionModel.setLeadSelectionIndex(-1);
   }
   addNickname.setEnabled(model.getSelectedProfile().isPresent());
   editNickname.setEnabled(model.getSelectedProfile().isPresent());
   addHighlight.setEnabled(model.getSelectedProfile().isPresent());
   editHighlight.setEnabled(model.getSelectedProfile().isPresent());
   name.setEnabled(model.getSelectedProfile().isPresent());
   name.setText(model.getSelectedProfileName().orElse(""));
   nicknames.setEnabled(model.getSelectedProfile().isPresent());
   nicknamesModel.clear();
   nicknamesModel.addAll(model.getSelectedProfileNicknames().orElse(Lists.newArrayList()));
   highlights.setEnabled(model.getSelectedProfile().isPresent());
   highlightsModel.clear();
   highlightsModel.addAll(model.getSelectedProfileHighlights().orElse(Lists.newArrayList()));
   realname.setEnabled(model.getSelectedProfile().isPresent());
   realname.setText(model.getSelectedProfileRealname().orElse(""));
   ident.setEnabled(model.getSelectedProfile().isPresent());
   ident.setText(model.getSelectedProfileIdent().orElse(""));
 }
예제 #3
0
          @Override
          public void mouseClicked(MouseEvent e) {
            if (tglbtnMouseMode.isSelected()) {
              tglbtnMouseMode.setText("Mode: Draw");
              globeDisplayAdapter.setArmed(true);
              mapDisplayAdapter.setArmed(true);
              mapSelectionList.setEnabled(false);
              slider.setEnabled(false);
              btnStep.setEnabled(false);
              btnStepToMarker.setEnabled(false);

              resumeValue = -1;
              int diff = slider.getMaximum() - dbgPosIndex;
              if (diff != 0) {
                resumeValue = dbgPosIndex;
                nDebugSteps(diff);
              }
            } else {
              tglbtnMouseMode.setText("Mode: Move");
              globeDisplayAdapter.setArmed(false);
              mapDisplayAdapter.setArmed(false);
              mapSelectionList.setEnabled(true);
              slider.setEnabled(true);
              btnStep.setEnabled(true);
              btnStepToMarker.setEnabled(true);

              if (resumeValue != -1) resetToIndex(resumeValue);
            }
          }
예제 #4
0
 private void setLoadOutForEscortGame() {
   possibleUnitList.removeAll();
   possibleUnitListModel.removeAllElements();
   userUnitListModel.removeAllElements();
   userUnitList.removeAll();
   userUnitListModel.addElement(new SoldierUnit("Alice"));
   userUnitListModel.addElement(new SoldierUnit("Bob"));
   userUnitListModel.addElement(new SoldierUnit("Charlie"));
   userUnitListModel.addElement(new SoldierUnit("Danielle"));
   userUnitListModel.addElement(new EscortUnit("Eve", 0));
   possibleUnitList.setEnabled(false);
   userUnitList.setEnabled(false);
   readyButton.doClick();
 }
예제 #5
0
  // Set up the client
  private void onConnectClicked() {
    // Create the arguments array
    String args[] = {
      "-ORBInitialHost", serverAddressField.getText(), "-ORBInitialPort", serverPortField.getText()
    };

    try {
      // create and initialize the ORB
      ORB orb = ORB.init(args, null);

      // get the root naming context
      org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");

      // Use NamingContextExt instead of NamingContext. This is
      // part of the Interoperable naming Service.
      ncRef = NamingContextExtHelper.narrow(objRef);

      // resolve the Object Reference in Naming
      String name = "AuctionFactory";
      auctionFactoryImpl = AuctionFactoryHelper.narrow(ncRef.resolve_str(name));

      appletDisplay("Connected to server");

      // Activate the login functionality
      btnLogIn.setEnabled(true);
      usernameField.setEnabled(true);
      passwordField.setEnabled(true);

    } catch (Exception e) {
      appletDisplay("Unable to connect to server");
      System.out.println("ERROR : " + e);
      e.printStackTrace(System.out);

      // Deactivate functionality
      btnLogIn.setEnabled(false);
      usernameField.setEnabled(false);
      passwordField.setEnabled(false);
      btnRefresh.setEnabled(false);
      sellList.setEnabled(false);
      bidList.setEnabled(false);
      btnCreateNewAuction.setEnabled(false);
      txtDescription.setEnabled(false);
      txtStartingPrice.setEnabled(false);
      btnSellItem.setEnabled(false);
      btnBid.setEnabled(false);
      txtBidPrice.setEnabled(false);
      loggedIn = false;
    }
  }
예제 #6
0
  public void load() {
    luser =
        new JXLabel(i18n.Language.getLabel(model.getEntity().getModelEntity().getIdLng()) + ":");
    tuser = new JList();
    tuser.setEnabled(false);
    checklistmanager = new CheckListManager(tuser);
    checklistmanager
        .getSelectionModel()
        .addListSelectionListener(
            new ListSelectionListener() {

              @Override
              public void valueChanged(ListSelectionEvent e) {

                if (!checklistmanager.getSelectionModel().isSelectionEmpty()) {
                  ArrayList<String> a = new ArrayList<>();
                  for (int i = checklistmanager.getSelectionModel().getMinSelectionIndex();
                      i <= checklistmanager.getSelectionModel().getMaxSelectionIndex();
                      i++) {
                    if (checklistmanager.getSelectionModel().isSelectedIndex(i)) {
                      a.add(model.getListUser().get(i));
                    }
                  }
                  model.setListUserSelect(a);
                }
              }
            });

    suser = new JScrollPane(tuser);
    pButton.addButton(pButton.bSelect, "selectAll");
    pButton.addButton(pButton.bUnselect, "unselectAll");
    pButton.bSelect.addActionListener(this);
    pButton.bUnselect.addActionListener(this);

    gbc = new GridBagConstraints();
    int y = 0;
    gbc.gridx = 0;
    gbc.gridy = y;
    gbc.gridwidth = 1;
    gbc.weightx = 0.1;
    gbc.anchor = java.awt.GridBagConstraints.WEST;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.insets = new java.awt.Insets(spaceTop + 10, spaceLeft + 10, spaceBottom, spaceRight);
    this.add(luser, gbc);

    gbc.gridx = 1;
    gbc.gridy = y;
    gbc.gridheight = 2;
    gbc.weightx = 0.9;
    gbc.insets = new java.awt.Insets(spaceTop + 10, spaceLeft, spaceBottom, spaceRight);
    this.add(suser, gbc);

    y += 2;
    gbc.gridx = 1;
    gbc.gridy = y;
    gbc.gridheight = 1;
    gbc.weightx = 1;
    gbc.insets = new java.awt.Insets(spaceTop, spaceLeft, spaceBottom, spaceRight);
    this.add(pButton, gbc);
  }
예제 #7
0
  private void setComponentsEnabled(boolean enabled) {
    list.setEnabled(enabled);
    process.setEnabled(enabled);
    remove.setEnabled(enabled);
    xres.setEnabled(enabled);
    yres.setEnabled(enabled);
    aspect.setEnabled(enabled);

    boolean b = aspect.isSelected() && enabled;
    colorLabel.setEnabled(b);
    colorBox.setEnabled(b);
    redLabel.setEnabled(b);
    red.setEnabled(b);
    redValue.setEnabled(b);
    greenLabel.setEnabled(b);
    green.setEnabled(b);
    greenValue.setEnabled(b);
    blueLabel.setEnabled(b);
    blue.setEnabled(b);
    blueValue.setEnabled(b);

    format.setEnabled(enabled);
    algorithm.setEnabled(enabled);
    prepend.setEnabled(enabled);
    append.setEnabled(enabled);
    output.setEnabled(enabled);
  }
예제 #8
0
  private void initDialog() {
    setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
    setTitle("");

    list.setVisibleRowCount(4);
    list.setEnabled(true);
    listPanel.add(new JScrollPane(list));

    JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    JPanel buttonPanel2 = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    String[] buttonNames = {"delete", "add", "cancel", "add"};
    for (int i = 0; i < buttonNames.length; i++) {
      JButton b = new JButton(buttonNames[i]);
      b.setActionCommand(Integer.toString(i));
      b.addActionListener(this);
      if (i < CANCEL) buttonPanel.add(b);
      else buttonPanel2.add(b);
    }
    listPanel.add(buttonPanel, BorderLayout.SOUTH);

    addElementPanel.add(buttonPanel2, BorderLayout.SOUTH);
    addElementPanel.setBorder(BorderFactory.createTitledBorder("add"));
    addElementPanel.setVisible(false);

    add(listPanel);
    add(addElementPanel);
  }
예제 #9
0
  private void setControlsEnabled(ButtonModel selection) {
    boolean newModuleEnabled = selection == myRbCreateNewModule.getModel();
    myTypesList.setEnabled(newModuleEnabled);
    myModuleDescriptionPane.setEnabled(newModuleEnabled);

    boolean importModuleEnabled = selection == myRbImportModule.getModel();
    myModulePathFieldPanel.setEnabled(importModuleEnabled);
  }
예제 #10
0
  private void onLoginClicked() {
    try {
      if (usernameField.getText().equals("") || passwordField.getText().equals("")) {
        throw new AuctionFailure(ErrorType.GENERIC_ERROR, "Invalid login info");
      }
      userName = usernameField.getText();
      auctionFactoryImpl.authenticate(userName, passwordField.getText());

      // Authentication was successful
      appletDisplay(usernameField.getText() + " logged in");

      // Enable functionality
      btnRefresh.setEnabled(true);
      sellList.setEnabled(true);
      bidList.setEnabled(true);
      btnCreateNewAuction.setEnabled(true);
      txtDescription.setEnabled(true);
      txtStartingPrice.setEnabled(true);
      btnSellItem.setEnabled(true);
      btnBid.setEnabled(true);
      txtBidPrice.setEnabled(true);
      loggedIn = true;

      // Update the auction lists
      updateAuctionLists(false);

    } catch (AuctionFailure e) {
      appletDisplay(e.description);

      // Disable functionality
      btnRefresh.setEnabled(false);
      sellList.setEnabled(false);
      bidList.setEnabled(false);
      btnCreateNewAuction.setEnabled(false);
      txtDescription.setEnabled(false);
      txtStartingPrice.setEnabled(false);
      btnSellItem.setEnabled(false);
      btnBid.setEnabled(false);
      txtBidPrice.setEnabled(false);
      loggedIn = false;
    } catch (Exception e1) {
      appletDisplay("Unable to log in");
      System.out.println("ERROR : " + e1);
      e1.printStackTrace(System.out);
    }
  }
  public void enableCustomDimension(boolean value) {
    txtLarghezza.setEditable(value);
    txtAltezza.setEditable(value);

    formatoCarta.setEnabled(!value);
    if (!value) {
      this.changeFormato(formatoCarta.getSelectedIndex());
    }
  }
  /** Enables the settings */
  public void enableSettings() {
    checkCreatePSMSets.setEnabled(true);
    fdrThreshold.setEnabled(true);

    decoyStrategy_pattern.setEnabled(true);
    decoyStrategy_searchengine.setEnabled(true);

    decoyPattern_pattern.setEnabled(true);

    usedIdentifications_top.setEnabled(true);
    usedIdentifications_all.setEnabled(true);

    availableScoresList.setEnabled(true);
    preferredScoresList.setEnabled(true);
    addToPreferred_button.setEnabled(true);
    removeFromPreferred_button.setEnabled(true);

    calculatePSMFDR.setEnabled(piaViewModel != null);
  }
예제 #13
0
 private void resetButtons() {
   userUnitList.setEnabled(true);
   gameTypeComboBox.setEnabled(true);
   mapTypeComboBox.setEnabled(true);
   AILabel.setEnabled(true);
   AILevelComboBox.setEnabled(true);
   AILevelComboBox.setSelectedIndex(0);
   gameTypeComboBox.setSelectedIndex(0);
   mapTypeComboBox.setSelectedIndex(0);
 }
예제 #14
0
  private void updateEnabled() {
    combo.setEnabled(action.isSelected());
    list.setEnabled(action.isSelected());

    boolean iconControlsEnabled = !separator.isSelected();
    builtin.setEnabled(iconControlsEnabled);
    file.setEnabled(iconControlsEnabled);
    builtinCombo.setEnabled(iconControlsEnabled && builtin.isSelected());
    fileButton.setEnabled(iconControlsEnabled && file.isSelected());
  }
예제 #15
0
  public ListReportLinksPanel(SocioProject sp) {

    list = new JList(new DefaultListModel());
    list.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
    list.setLayoutOrientation(JList.VERTICAL);
    list.setVisibleRowCount(-1);
    list.setSelectedIndex(0);
    list.setCellRenderer(new ListReportLinksElementRenderer());

    Border border = BorderFactory.createEmptyBorder(5, 5, 5, 5);
    list.setBorder(border);
    list.setBackground(new Color(50, 50, 50));
    list.setForeground(new Color(210, 210, 220));
    list.setEnabled(true);
    list.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            DefaultListModel mdl = (DefaultListModel) list.getModel();
            ListReportLinksElementData elem =
                (ListReportLinksElementData) mdl.getElementAt(list.getSelectedIndex());
            String link = elem.getName();
            // String ask = JOptionPane.showInputDialog("Link opened!");
            String browserPath =
                "C:/Program Files (x86)/Mozilla Firefox/firefox.exe"; // Use your browser path
            try {
              String[] b = {browserPath, link};
              Runtime.getRuntime().exec(b);
            } catch (IOException ex) {
              // TODO Auto-generated catch block
              ex.printStackTrace();
            }
          }
        });
    JScrollPane scroller = new JScrollPane(list);
    IAppWidgetFactory.makeIAppScrollPane(scroller);
    scroller.setFocusable(true);
    scroller.setPreferredSize(new Dimension(170, 220));

    toolbar = new ListReportLinksToolbar(sp, list);
    toolbar.setGroupID(idRoot);
    toolbar.setPreferredSize(new Dimension(170, 40));
    JLabel text = new JLabel("Список ccылок на отчеты:");
    Font f = new Font(Font.SANS_SERIF, Font.BOLD, 15);
    text.setFont(f);
    text.setText("Список груп:");
    text.setBackground(new Color(55, 95, 95));
    text.setForeground(new Color(80, 80, 80));

    this.setLayout(new BorderLayout());
    this.add(text, BorderLayout.NORTH);
    this.add(scroller, BorderLayout.CENTER);
    this.add(toolbar, BorderLayout.SOUTH);
  }
예제 #16
0
 private void setUpUnitLists() {
   possibleUnitList.removeAll();
   possibleUnitListModel.removeAllElements();
   userUnitListModel.removeAllElements();
   userUnitList.removeAll();
   System.out.println("units size: " + units.size());
   if (units.size() == 0) {
     possibleUnitListModel.addElement(new MeleeUnit("-----"));
     possibleUnitListModel.addElement(new RocketUnit("-----"));
     possibleUnitListModel.addElement(new SoldierUnit("-----"));
     possibleUnitListModel.addElement(new EngineerUnit("-----"));
     possibleUnitListModel.addElement(new DemolitionUnit("-----"));
     possibleUnitListModel.addElement(new ExplosivesUnit("-----"));
   } else {
     for (Unit u : units) possibleUnitListModel.addElement(u);
   }
   possibleUnitList.setEnabled(true);
   userUnitList.setEnabled(true);
   possibleUnitList.repaint();
   possibleUnitList.revalidate();
 }
 /** Constructor */
 public ServiceFilterPanel(String text, Vector list) {
   empty_border = new EmptyBorder(5, 5, 0, 5);
   indent_border = new EmptyBorder(5, 25, 5, 5);
   service_box = new JCheckBox(text);
   service_box.addActionListener(this);
   service_data = new Vector();
   if (list != null) {
     service_box.setSelected(true);
     service_data = (Vector) list.clone();
   }
   service_list = new JList(service_data);
   service_list.setBorder(new EtchedBorder());
   service_list.setVisibleRowCount(5);
   service_list.addListSelectionListener(this);
   service_list.setEnabled(service_box.isSelected());
   service_scroll = new JScrollPane(service_list);
   service_scroll.setBorder(new EtchedBorder());
   remove_service_button = new JButton("Remove");
   remove_service_button.addActionListener(this);
   remove_service_button.setEnabled(false);
   remove_service_panel = new JPanel();
   remove_service_panel.setLayout(new FlowLayout());
   remove_service_panel.add(remove_service_button);
   service_area = new JPanel();
   service_area.setLayout(new BorderLayout());
   service_area.add(service_scroll, BorderLayout.CENTER);
   service_area.add(remove_service_panel, BorderLayout.EAST);
   service_area.setBorder(indent_border);
   add_service_field = new JTextField();
   add_service_field.addActionListener(this);
   add_service_field.getDocument().addDocumentListener(this);
   add_service_field.setEnabled(service_box.isSelected());
   add_service_button = new JButton("Add");
   add_service_button.addActionListener(this);
   add_service_button.setEnabled(false);
   add_service_panel = new JPanel();
   add_service_panel.setLayout(new BorderLayout());
   JPanel dummy = new JPanel();
   dummy.setBorder(empty_border);
   add_service_panel.add(dummy, BorderLayout.WEST);
   add_service_panel.add(add_service_button, BorderLayout.EAST);
   add_service_area = new JPanel();
   add_service_area.setLayout(new BorderLayout());
   add_service_area.add(add_service_field, BorderLayout.CENTER);
   add_service_area.add(add_service_panel, BorderLayout.EAST);
   add_service_area.setBorder(indent_border);
   setLayout(new BorderLayout());
   add(service_box, BorderLayout.NORTH);
   add(service_area, BorderLayout.CENTER);
   add(add_service_area, BorderLayout.SOUTH);
   setBorder(empty_border);
 }
  @Override
  public void setEnabled(boolean enabled) {
    super.setEnabled(enabled);

    comboAvailableFilters.setEnabled(enabled);
    checkNegateFilter.setEnabled(enabled);
    comboAvailableFilterComparators.setEnabled(enabled);
    fieldFilterArgument.setEnabled(enabled);
    comboAvailableFilterScores.setEnabled(enabled);
    btnAddFilter.setEnabled(enabled);
    btnRemoveFilter.setEnabled(enabled);
    listAppliedFilters.setEnabled(enabled);
  }
예제 #19
0
  private void disableAllButDefaultEncoding() {
    rdbtnAsciiUnicode.setEnabled(true);
    rdbtnAsciiUnicode.setSelected(true);

    TextCorpusDialog.rdbtnOtherRawText.setEnabled(false);
    rdbtnPdfDocument.setEnabled(false);

    listFFormats.setEnabled(false);

    rdbtnRichTextFormat.setEnabled(false);
    rdbtnHtmlPage.setEnabled(false);
    rdbtndoc.setEnabled(false);
  }
예제 #20
0
  private void setFinder(IFinder finder) {
    list.setEnabled(finder.size() > 0);
    field.setEnabled(finder.size() > 0);

    ArticlesListModel.install(list, finder);

    // TODO refactor: restart search without this trick, just trigger a listener
    lastNavigated = null;

    if (field.getText().length() != 0) {
      navigateAndTranslate(field.getText());
    } else {
      setSelectedIndex(0);
    }
  }
예제 #21
0
  /**
   * Function that overrides SwingWorkers done() and displays the search results(files that were
   * found/ message about problems that occurred while search)
   */
  @SuppressWarnings({"rawtypes", "unchecked", "serial"})
  @Override
  protected void done() {
    progress.setIndeterminate(false);
    if (!isCancelled()) {
      try {
        if (!_listOfFiles.isEmpty()) {
          handlerFrame.enableButtons();
          list.setModel(
              new javax.swing.AbstractListModel() {
                String[] strings = get();

                public int getSize() {
                  return strings.length;
                }

                public Object getElementAt(int i) {
                  return strings[i];
                }
              });
          list.setEnabled(true);
        } else {
          list.setModel(
              new javax.swing.AbstractListModel() {
                String[] strings = {"No Files Were Found"};

                public int getSize() {
                  return 1;
                }

                public Object getElementAt(int i) {
                  return strings[i];
                }
              });
          JOptionPane.showMessageDialog(
              handlerFrame, "No Files Were Found", "DrCleaner", JOptionPane.INFORMATION_MESSAGE);
          handlerFrame.dispose();
        }
      } catch (InterruptedException ex) {
        JOptionPane.showMessageDialog(
            null, "Interupted while waiting for results", "Error", JOptionPane.ERROR_MESSAGE);
      } catch (ExecutionException ex) {
        JOptionPane.showMessageDialog(
            null, "Error encountered while performing search", "Error", JOptionPane.ERROR_MESSAGE);
      }
    } else handlerFrame.dispose();
  }
 private void enableItems() {
   boolean enabled = mRadioButton.isSelected();
   if (mDefaultColumn != -1) {
     mList.setEnabled(enabled);
     mButtonSort.setEnabled(enabled);
   } else {
     boolean listIsEnabled = enabled && !mRadioButtonSort.isSelected();
     mRadioButtonIsStructure.setEnabled(listIsEnabled);
     if (mStructurePane != null) mStructurePane.setEnabled(listIsEnabled);
     mTextArea.setEnabled(listIsEnabled);
     mRadioButtonSort.setEnabled(enabled);
   }
   boolean sortIsEnabled = enabled && (mRadioButtonSort == null || mRadioButtonSort.isSelected());
   mComboBoxSortOrder.setEnabled(sortIsEnabled);
   mComboBoxSortMode.setEnabled(sortIsEnabled);
   mComboBoxSortColumn.setEnabled(
       sortIsEnabled && mComboBoxSortMode.getSelectedIndex() != cSortModeSize);
 }
예제 #23
0
  public JComponent createEditComponent(PDFAnnotation annot, boolean readonly, boolean create) {
    try {
      final AnnotationStamp stamp = (AnnotationStamp) annot;
      String type = stamp.getType();
      DocumentPanel dp = getViewer().getActiveDocumentPanel();
      PDFParser parser = dp.getParser();

      JPanel panel = new JPanel(new GridBagLayout());
      addStockDetailsToEditComponent(annot, panel);

      GridBagConstraints gbc = new GridBagConstraints();
      gbc.weightx = gbc.weighty = 1;
      gbc.gridwidth = gbc.REMAINDER;
      gbc.fill = gbc.BOTH;

      final StampView sv = new StampView(parser, stampheight, stamplist);
      final JList<String> list =
          new JList<String>(stamplist) {
            public Dimension getPreferredScrollableViewportSize() {
              return new Dimension(sv.getMaxStampWidth(), stampheight * 4);
            }
          };
      list.setCellRenderer(sv);
      list.setSelectedValue(type, false);
      list.setFixedCellHeight(stampheight);
      list.addListSelectionListener(
          new ListSelectionListener() {
            public void valueChanged(ListSelectionEvent e) {
              stamp.setType((String) list.getSelectedValue(), 1);
            }
          });
      if (readonly) {
        list.setEnabled(false);
      }
      panel.add(new JScrollPane(list), gbc);
      return panel;
    } catch (IllegalArgumentException e) {
      e.printStackTrace();
      // If bfopdf-stamp.jar is missing
      return null;
    }
  }
예제 #24
0
  /**
   * Creates a player selector panel.
   *
   * @param title title for this selector
   * @param humanSet select the human player by default
   */
  public UciPlayerSelector(final String title, final boolean humanSet) {
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    JLabel label = new JLabel(title);
    add(label);

    /* Set up widgets. */
    ButtonGroup group = new ButtonGroup();
    group.add(human);
    group.add(computer);
    human.setSelected(humanSet);
    computer.setSelected(!humanSet);
    ai.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    ai.setSelectedIndex(DEFAULT_AI);
    ai.setEnabled(!humanSet);

    /* Set up widget alignment. */
    human.setAlignmentX(Component.LEFT_ALIGNMENT);
    computer.setAlignmentX(Component.LEFT_ALIGNMENT);
    ai.setAlignmentX(Component.LEFT_ALIGNMENT);

    /* Set up list enable/disable. */
    human.addActionListener(
        new ActionListener() {
          public final void actionPerformed(final ActionEvent e) {
            ai.setEnabled(!human.isSelected());
          }
        });
    computer.addActionListener(
        new ActionListener() {
          public final void actionPerformed(final ActionEvent e) {
            ai.setEnabled(computer.isSelected());
          }
        });

    add(human);
    add(computer);
    add(ai);
    setBorder(BorderFactory.createEmptyBorder(H_PADDING, V_PADDING, H_PADDING, V_PADDING));
  }
  private void loadAltStartNodeMap() {
    mAltStartNodeManager.loadAltStartNodeMap();

    if (mIEdge.getTargetNode() instanceof SuperNode) {
      Iterator it = mAltStartNodeManager.mAltStartNodeMap.entrySet().iterator();
      while (it.hasNext()) {
        Map.Entry pairs = (Map.Entry) it.next();
        TPLTuple<String, Node> startNodePair = (TPLTuple<String, Node>) pairs.getKey();
        TPLTuple<String, Node> altStartNodePair = (TPLTuple<String, Node>) pairs.getValue();
        ((DefaultListModel) mAltStartNodeList.getModel())
            .addElement(startNodePair.getFirst() + "/" + altStartNodePair.getFirst());
        //// System.err.println("loading start node "+startNodePair.getSecond());
        //// System.err.println("loading alt start node "+altStartNodePair.getSecond());
      }
    } else {
      mAddAltStartNodeButton.setEnabled(false);
      mRemoveAltStartNodeButton.setEnabled(false);
      mEditAltStartNodeButton.setEnabled(false);
      mAltStartNodeList.setEnabled(false);
      mAltStartNodeScrollPane.setEnabled(false);
    }
  }
예제 #26
0
 void buildGUI() {
   filePanel.add(fileScroll, BorderLayout.CENTER);
   filePanel.add(fileButtonPanel, BorderLayout.LINE_END);
   fileButtonPanel.setLayout(new BoxLayout(fileButtonPanel, BoxLayout.Y_AXIS));
   fileButtonPanel.add(fileSelectButton);
   fileButtonPanel.add(toFileCheckBox);
   fileButtonPanel.add(toDatabaseCheckBox);
   toFileCheckBox.addActionListener(this);
   toDatabaseCheckBox.addActionListener(this);
   fileButtonPanel.add(validateWChNames);
   fileSelectButton.addActionListener(this);
   fileSelectField.setEnabled(true);
   fileSelectField.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
   fileSelectField.setModel(fileListModel);
   nextButtonPanel.add(removeButton);
   removeButton.setEnabled(false);
   removeButton.addActionListener(this);
   nextButtonPanel.add(nextButton);
   nextButton.setEnabled(false);
   nextButton.addActionListener(this);
   this.add(filePanel, BorderLayout.CENTER);
   this.add(nextButtonPanel, BorderLayout.SOUTH);
   this.setVisible(true);
 }
예제 #27
0
  /**
   * Function that overrides SwingWorkers doInBackground() and performs search for files that suits
   * user's criteria. The search performed in dedicated thread that runs in background.
   *
   * @return string[] that contains file names that were found in search
   */
  @Override
  @SuppressWarnings({"unchecked", "serial", "rawtypes"})
  protected String[] doInBackground() {
    handlerFrame.disableButtons();
    list.setModel(
        new javax.swing.AbstractListModel() {
          String[] strings = {"Searching..."};

          public int getSize() {
            return 1;
          }

          public Object getElementAt(int i) {
            return strings[i];
          }
        });
    if (isCancelled()) {
      list.setModel(
          new javax.swing.AbstractListModel() {
            String[] strings = {"Search operation was canceled"};

            public int getSize() {
              return 1;
            }

            public Object getElementAt(int i) {
              return strings[i];
            }
          });
      return fileList();
    } else {
      list.setEnabled(false);
      searchDirectory(_source);
      return fileList();
    }
  }
예제 #28
0
  AuctionClientPanel() {
    super();
    this.setPreferredSize(new Dimension(500, 700));
    this.setLayout(
        new FormLayout(
            new ColumnSpec[] {
              FormFactory.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("default:grow"),
              ColumnSpec.decode("165px:grow"),
              FormFactory.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("max(70dlu;default):grow"),
              FormFactory.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("max(18dlu;default):grow"),
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
            },
            new RowSpec[] {
              FormFactory.MIN_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.LINE_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              RowSpec.decode("top:default"),
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              RowSpec.decode("max(50dlu;default)"),
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              RowSpec.decode("max(50dlu;default):grow"),
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
            }));

    JLabel lblServerAddress = new JLabel("Server Address:");
    add(lblServerAddress, "3, 3, left, default");

    serverAddressField = new JTextField();
    serverAddressField.setText("192.168.222.135");
    add(serverAddressField, "5, 3, fill, default");
    serverAddressField.setColumns(10);

    JButton btnConnect = new JButton("Connect");
    btnConnect.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            // Connect to the server
            onConnectClicked();
          }
        });
    add(btnConnect, "7, 3");

    JLabel lblServerPort = new JLabel("Server Port:");
    add(lblServerPort, "3, 5, left, default");

    serverPortField = new JTextField();
    serverPortField.setText("1050");
    add(serverPortField, "5, 5, fill, default");
    serverPortField.setColumns(10);

    JLabel lblUsername = new JLabel("Username:"******"3, 9, left, top");
    usernameField.setEnabled(false);
    this.add(usernameField, "5, 9");
    usernameField.setColumns(10);

    btnLogIn = new JButton("Log In");
    btnLogIn.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            if (btnLogIn.isEnabled()) {
              onLoginClicked();
            }
          }
        });
    btnLogIn.setEnabled(false);
    this.add(btnLogIn, "7, 9");

    JLabel lblPassword = new JLabel("Password:"******"3, 11, left, top");

    passwordField = new JTextField();
    passwordField.setEnabled(false);
    this.add(passwordField, "5, 11, fill, default");
    passwordField.setColumns(10);

    JLabel lblAvailableAuctions = new JLabel("Available Auctions");
    this.add(lblAvailableAuctions, "3, 13");

    btnRefresh = new JButton("Refresh");
    btnRefresh.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            if (btnRefresh.isEnabled()) {
              onRefreshClicked();
            }
          }
        });
    btnRefresh.setEnabled(false);
    this.add(btnRefresh, "7, 13");

    JLabel lblSell = new JLabel("Sell:");
    this.add(lblSell, "3, 15");
    this.add(lblBid, "5, 15");

    sellListModel = new DefaultListModel();

    bidListModel = new DefaultListModel();

    scrollPane_4 = new JScrollPane();
    add(scrollPane_4, "3, 17, fill, fill");
    sellList = new JList(sellListModel);
    sellList.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            if (sellList.isEnabled()) {
              // onSellListSelectionChanged();
            }
          }
        });
    scrollPane_4.setViewportView(sellList);
    sellList.addListSelectionListener(
        new ListSelectionListener() {
          public void valueChanged(ListSelectionEvent arg0) {
            if (sellList.isEnabled()) {
              onSellListSelectionChanged();
            }
          }
        });
    sellList.setEnabled(false);
    sellList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    scrollPane_3 = new JScrollPane();
    add(scrollPane_3, "5, 17, fill, fill");
    bidList = new JList(bidListModel);
    bidList.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            if (bidList.isEnabled()) {
              // onBidListSelectionChanged();
            }
          }
        });
    scrollPane_3.setViewportView(bidList);
    bidList.addListSelectionListener(
        new ListSelectionListener() {
          public void valueChanged(ListSelectionEvent e) {
            if (bidList.isEnabled()) {
              onBidListSelectionChanged();
            }
          }
        });
    bidList.setEnabled(false);
    bidList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    scrollPane_2 = new JScrollPane();
    add(scrollPane_2, "3, 19, fill, fill");

    sellAuctionDescription = new JTextArea();
    scrollPane_2.setViewportView(sellAuctionDescription);
    sellAuctionDescription.setLineWrap(true);
    sellAuctionDescription.setWrapStyleWord(true);
    sellAuctionDescription.setEditable(false);

    scrollPane_1 = new JScrollPane();
    add(scrollPane_1, "5, 19, fill, fill");

    bidAuctionDescription = new JTextArea();
    scrollPane_1.setViewportView(bidAuctionDescription);
    bidAuctionDescription.setLineWrap(true);
    bidAuctionDescription.setWrapStyleWord(true);
    bidAuctionDescription.setEditable(false);

    JLabel lblSellerCommands = new JLabel("Seller Commands");
    this.add(lblSellerCommands, "3, 21");

    btnCreateNewAuction = new JButton("New Auction");
    btnCreateNewAuction.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            if (btnCreateNewAuction.isEnabled()) {
              onCreateNewAuctionClicked();
            }
          }
        });
    btnCreateNewAuction.setEnabled(false);
    btnCreateNewAuction.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {}
        });
    this.add(btnCreateNewAuction, "3, 23");

    txtDescription = new JTextField();
    txtDescription.setEnabled(false);
    txtDescription.setText("Description");
    this.add(txtDescription, "5, 23, fill, default");
    txtDescription.setColumns(10);

    txtStartingPrice = new JTextField();
    txtStartingPrice.setEnabled(false);
    txtStartingPrice.setText("Starting Price");
    this.add(txtStartingPrice, "7, 23, fill, default");
    txtStartingPrice.setColumns(10);

    btnSellItem = new JButton("Sell Item");
    btnSellItem.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            if (btnSellItem.isEnabled()) {
              onSellItemClick();
            }
          }
        });
    btnSellItem.setEnabled(false);
    this.add(btnSellItem, "3, 25");

    JLabel lblBidderCommands = new JLabel("Bidder Commands");
    this.add(lblBidderCommands, "3, 29");

    btnBid = new JButton("Bid");
    btnBid.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            if (btnBid.isEnabled()) {
              onBidClicked();
            }
          }
        });
    btnBid.setEnabled(false);
    this.add(btnBid, "3, 31");

    txtBidPrice = new JTextField();
    txtBidPrice.setEnabled(false);
    txtBidPrice.setText("Bid Price");
    this.add(txtBidPrice, "5, 31, fill, default");
    txtBidPrice.setColumns(10);

    JScrollPane scrollPane = new JScrollPane();
    add(scrollPane, "3, 35, 5, 1, fill, fill");

    infoBox = new JTextArea();
    infoBox.setEditable(false);
    scrollPane.setViewportView(infoBox);
    infoBox.setText("Welcome to Auction Client 1.0");

    this.setVisible(true);
  }
예제 #29
0
  // CONSTRUCTOR
  public FACFrame() {

    // SET PROPERTIES OF THE MAIN FRAME
    setTitle("Fully Associative Cache");
    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    setIconImage(Toolkit.getDefaultToolkit().createImage(FACFrame.class.getResource("cam.gif")));

    // CREATE COMPONENTS AND SET THEIR PROPERTIES

    // NAVIGATION BUTTONS
    restart = new JButton("Restart");
    next = new JButton("Next");
    back = new JButton("Back");
    quit = new JButton("Quit");

    // CACHE HITS AND MISSES INFO.
    lCacheHits = new JLabel("Cache Hits");
    lCacheMisses = new JLabel("Cache Misses");
    tCacheHits = new JTextField(5);
    tCacheMisses = new JTextField(5);
    tCacheHits.setEditable(false);
    tCacheHits.setFont(new Font("Monospaced", Font.BOLD, 14));
    tCacheHits.setText("  0");
    tCacheMisses.setEditable(false);
    tCacheMisses.setFont(new Font("Monospaced", Font.BOLD, 14));
    tCacheMisses.setText("  0");

    // PROGRESS UPDATE AREA
    tProgress = new JTextArea(3, 45);
    tProgress.setEditable(false);
    tProgress.setLineWrap(true);
    tProgress.setWrapStyleWord(true);
    tProgress.setCaretPosition(0);
    tProgress.setFont(new Font("Serif", Font.BOLD + Font.ITALIC, 16));
    tProgress.setText(
        "Welcome to Fully Associative Cache!\nThe system specs are as follows -"
            + "\n  16 Blocks in Cache\n  32 Blocks in Main Memory\n  8 Words per Block"
            + "\n  The replacement algorithm shown is the Least-Recently-Used algorithm"
            + "\n  as it is the most commonly used one."
            + "\nPlease generate the Address Reference String."
            + "\nThen click on \"Next\" to continue.");
    progressScroll = new JScrollPane();
    progressScroll.getViewport().add(tProgress);
    progressScroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    lProgress = new JLabel("PROGRESS UPDATE");

    // ADDRESS REFERENCE STRING
    addRefStrList = new JList();
    addRefStrList.setEnabled(false);
    addRefStrScroll = new JScrollPane();
    addRefStrScroll.getViewport().setView(addRefStrList);
    addRefStrScroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    addRefStrScroll.setPreferredSize(new Dimension(140, 300));

    // BUTTONS USED TO ADDRESS GENERATION
    autoGen = new JButton("Auto Generate Add. Ref. Str.");
    selfGen = new JButton("Self Generate Add. Ref. Str.");

    // BITS IN MAIN MEMORY ADDRESS
    lBits = new JLabel("                   TAG                        WORD");

    tTag = new JTextField(9);
    tTag.setEditable(false);
    tWord = new JTextField(7);
    tWord.setEditable(false);

    // SET THE FONT STYLES FOR THE BITS IN MAIN MEMORY ADDRESS
    tTag.setFont(new Font("Monospaced", Font.BOLD, 14));
    tWord.setFont(new Font("Monospaced", Font.BOLD, 14));

    // REGISTER LISTENERS
    restart.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            reStart();
          }
        });

    next.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            nextClicked = true;
            step();
          }
        });

    back.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            nextClicked = false;
            step();
          }
        });

    quit.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            int confirmQuit =
                JOptionPane.showConfirmDialog(
                    null,
                    "Really Quit?",
                    "Quit Confirmation",
                    JOptionPane.YES_NO_OPTION,
                    JOptionPane.QUESTION_MESSAGE);
            switch (confirmQuit) {
              case JOptionPane.YES_OPTION:
                removeInstance();
              case JOptionPane.NO_OPTION:
                break;
            }
          }
        });

    autoGen.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            autoGenerateString();
          }
        });

    selfGen.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            selfGenerateString();
          }
        });

    // DISABLE NAVIGATION BUTTONS FOR NOW
    next.setEnabled(false);
    back.setEnabled(false);

    // CREATE PANELS
    cachePanel = new FACachePanel();
    memoryPanel = new MemoryPanel();
    bottomPanel = new JPanel();
    cache = new JPanel();
    cacheHitsMisses = new JPanel();
    pAutoSelfGen = new JPanel();
    pAddRefStr = new JPanel();
    pEastPanel = new JPanel();
    pBitsInMM = new JPanel();

    // ADD COMPONENTS TO THE PANELS

    // PANEL WITH PROGRESS UPDATE TEXT AREA AND NAVIGATION BUTTONS
    bottomPanel.add(lProgress);
    bottomPanel.add(progressScroll);
    bottomPanel.add(restart);
    bottomPanel.add(next);
    bottomPanel.add(back);
    bottomPanel.add(quit);

    // PANEL WITH CACHE BLOCKS, HITS AND MISSES INFO.
    cacheHitsMisses.add(lCacheHits);
    cacheHitsMisses.add(tCacheHits);
    cacheHitsMisses.add(lCacheMisses);
    cacheHitsMisses.add(tCacheMisses);
    cacheHMBorder = BorderFactory.createEtchedBorder();
    cacheHitsMisses.setBorder(BorderFactory.createTitledBorder(cacheHMBorder, ""));

    cache.setLayout(new BorderLayout());
    cache.add(cachePanel, "Center");
    cache.add(cacheHitsMisses, "South");

    // PANEL WITH ADDRESS REFERENCE STRING AND STRING GENERATION BUTTONS
    pAutoSelfGen.setLayout(new GridLayout(2, 1));
    pAutoSelfGen.add(autoGen);
    pAutoSelfGen.add(selfGen);

    pAddRefStr.setLayout(new BorderLayout());
    pAddRefStr.setPreferredSize(new Dimension(160, 400));

    pAddRefStr.add(addRefStrScroll, "Center");
    pAddRefStr.add(pAutoSelfGen, "South");
    addRefStrBorder = BorderFactory.createEtchedBorder();
    pAddRefStr.setBorder(
        BorderFactory.createTitledBorder(addRefStrBorder, " Address Reference String "));

    // PANEL WITH THE MAIN MEMORY ADDRESS BITS INFO.
    pBitsInMM.setLayout(new BorderLayout());
    bitsInMMBorder = BorderFactory.createEtchedBorder();
    pBitsInMM.setBorder(BorderFactory.createTitledBorder(bitsInMMBorder, " Main Memory Address "));
    pBitsInMM.add(tTag, "Center");
    pBitsInMM.add(tWord, "East");
    pBitsInMM.add(lBits, "South");

    // PANEL CONTAINING THE ADDRESS REF. STRING PANEL AND BITS IN MM PANEL
    pEastPanel.setLayout(new BorderLayout());
    pEastPanel.setPreferredSize(new Dimension(310, 650));
    pEastPanel.add(pAddRefStr, "Center");
    pEastPanel.add(pBitsInMM, "South");

    // ADD COMPONENTS TO THE FRAME CONTAINER
    Container c = getContentPane();
    c.setLayout(new BorderLayout());
    c.add(cache, "West");
    c.add(memoryPanel, "Center");
    c.add(pEastPanel, "East");
    c.add(bottomPanel, "South");

    // INITIALIZE ARRAYS THAT HOLDS STATUS OF EMPTY AND LRU CACHE BLOCKS
    for (int i = 0; i < 16; i++) {
      statusCacheEmpty[i] = true;
      statusCacheLRU[i] = 0;
    }

    /*
     * CALL THE FUNCTION TO GENERATE THE ARRAY addresses, WHICH CONTAINS ALL THE POSSIBLE MEMORY ADDRESSES
     * THIS ARRAY WILL BE USEFUL IN THE AUTO GENERATION OF ADDRESSES AS WELL AS FOR VALIDATION OF
     * ADDRESS STRINGS INPUT BY THE USER IF HE/SHE CHOOSES SELF GENERATION.
     */
    createAddresses();

    pack();
  } // END CONSTRUCTOR
예제 #30
0
  public ChooseForm() {

    this.TITLE = MainForm.TITLE;

    curForm = this;

    cPanel = new JPanel();
    cPanel.setLayout(null);

    this.setTitle(TITLE + " - Choose files to rename");
    this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    this.setSize(640, 480);
    this.setResizable(false);
    this.setModalityType(DEFAULT_MODALITY_TYPE);
    this.setLocationRelativeTo(null);

    // Fulfilling read of the directory tree
    try {
      DirectoryHandle.cleanArrays();
      FileListingVisitor.runFileListingVisitor(DirectoryHandle.getPath().toString());
      arrayList = new String[DirectoryHandle.getFilesNumber() + 1];
      modelList = new DefaultListModel<>();
      pathList = new DefaultListModel<>();
    } catch (IOException e1) {
      JOptionPane.showMessageDialog(
          null,
          "Failed to get files list! Program will be closed!",
          TITLE,
          JOptionPane.PLAIN_MESSAGE);
      System.exit(0);
    }

    // Filling lists using data of file
    for (int i = 0; i <= DirectoryHandle.getFilesNumber(); i++) {

      if (DirectoryHandle.getFileName(i).toString().toLowerCase().endsWith(".jpg")
          && MainForm.isJPG) {
        arrayList[k] = DirectoryHandle.getFileName(i).toString();
        modelList.add(k, DirectoryHandle.getFileName(i).getFileName().toString());
        pathList.add(k, DirectoryHandle.getFileName(i).getParent().toString());
        k++;
      }

      if (DirectoryHandle.getFileName(i).toString().toLowerCase().endsWith(".png")
          && MainForm.isPNG) {
        arrayList[k] = DirectoryHandle.getFileName(i).toString();
        modelList.add(k, DirectoryHandle.getFileName(i).getFileName().toString());
        pathList.add(k, DirectoryHandle.getFileName(i).getParent().toString());
        k++;
      }

      if (DirectoryHandle.getFileName(i).toString().toLowerCase().endsWith(".bmp")
          && MainForm.isBMP) {
        arrayList[k] = DirectoryHandle.getFileName(i).toString();
        modelList.add(k, DirectoryHandle.getFileName(i).getFileName().toString());
        pathList.add(k, DirectoryHandle.getFileName(i).getParent().toString());
        k++;
      }
    }

    // Left list
    leftList = new JList<>(modelList);
    leftList.setVisibleRowCount(VISIBLE_ROW_COUNT);
    leftList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    leftList.setBounds(15, 25, 265, 350);
    leftList.setEnabled(true);
    cPanel.add(leftList);

    leftScrollPane = new JScrollPane(leftList);
    leftScrollPane.setBounds(15, 25, 265, 350);
    cPanel.add(leftScrollPane);

    leftLabel = new JLabel("Files list:");
    leftLabel.setBounds(20, 0, 260, 32);
    leftLabel.setEnabled(true);
    cPanel.add(leftLabel);

    // Transfer buttons
    toLeftButton = new JButton(">");
    toLeftButton.setBounds(290, 120, 65, 32);
    toLeftButton.setEnabled(true);
    cPanel.add(toLeftButton);

    allLeftButton = new JButton(">>>");
    allLeftButton.setBounds(290, 160, 65, 32);
    allLeftButton.setEnabled(true);
    cPanel.add(allLeftButton);

    toRightButton = new JButton("<");
    toRightButton.setBounds(290, 200, 65, 32);
    toRightButton.setEnabled(true);
    cPanel.add(toRightButton);

    allRightButton = new JButton("<<<");
    allRightButton.setBounds(290, 240, 65, 32);
    allRightButton.setEnabled(true);
    cPanel.add(allRightButton);

    // Right list
    rightLabel = new JLabel("Will be renamed:");
    rightLabel.setBounds(370, 0, 260, 32);
    rightLabel.setEnabled(true);
    cPanel.add(rightLabel);

    rightList = new JList<>(new DefaultListModel<String>());
    rightList.setVisibleRowCount(VISIBLE_ROW_COUNT);
    rightList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    rightList.setBounds(365, 25, 265, 350);
    rightList.setEnabled(true);
    cPanel.add(rightList);

    rightScrollPane = new JScrollPane(rightList);
    rightScrollPane.setBounds(365, 25, 265, 350);
    cPanel.add(rightScrollPane);

    // Control buttons
    cancelButton = new JButton("Cancel");
    cancelButton.setBounds(440, 395, 85, 32);
    cancelButton.setEnabled(true);
    cPanel.add(cancelButton);

    okButton = new JButton("Ok");
    okButton.setBounds(535, 395, 85, 32);
    okButton.setEnabled(false);
    cPanel.add(okButton);

    // Handling actions of controls.
    toLeftButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            List<String> selected = leftList.getSelectedValuesList();
            DefaultListModel<String> left = (DefaultListModel<String>) leftList.getModel();
            DefaultListModel<String> right = (DefaultListModel<String>) rightList.getModel();
            for (String item : selected) {
              left.removeElement(item);
              right.addElement(item);
            }

            setOkButtonEnabled(right);
          }
        });

    allLeftButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            DefaultListModel<String> left = (DefaultListModel<String>) leftList.getModel();
            DefaultListModel<String> right = (DefaultListModel<String>) rightList.getModel();
            for (Object item : left.toArray()) {
              right.addElement((String) item);
            }
            left.removeAllElements();

            setOkButtonEnabled(right);
          }
        });

    toRightButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            List<String> selected = rightList.getSelectedValuesList();
            DefaultListModel<String> left = (DefaultListModel<String>) leftList.getModel();
            DefaultListModel<String> right = (DefaultListModel<String>) rightList.getModel();
            for (String item : selected) {
              right.removeElement(item);
              left.addElement(item);
            }

            setOkButtonEnabled(right);
          }
        });

    allRightButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            DefaultListModel<String> left = (DefaultListModel<String>) leftList.getModel();
            DefaultListModel<String> right = (DefaultListModel<String>) rightList.getModel();
            for (Object item : right.toArray()) {
              left.addElement((String) item);
            }
            right.removeAllElements();

            setOkButtonEnabled(right);
          }
        });

    cancelButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent even) {
            dispose();
          }
        });

    okButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            RenameFiles rf = new RenameFiles(curForm);
            rf.runRenameFiles();
            dispose();
          }
        });

    getContentPane().add(cPanel);
  }