Esempio n. 1
0
  private void listPeople() {

    try {

      jScrollPane1.getViewport().setView(null);

      JFlowPanel jPeople = new JFlowPanel();
      jPeople.applyComponentOrientation(getComponentOrientation());

      java.util.List people = m_dlSystem.listPeopleVisible();

      for (int i = 0; i < people.size(); i++) {

        AppUser user = (AppUser) people.get(i);

        JButton btn = new JButton(new AppUserAction(user));
        btn.applyComponentOrientation(getComponentOrientation());
        btn.setFocusPainted(false);
        btn.setFocusable(false);
        btn.setRequestFocusEnabled(false);
        btn.setHorizontalAlignment(SwingConstants.LEADING);
        btn.setMaximumSize(new Dimension(150, 50));
        btn.setPreferredSize(new Dimension(150, 50));
        btn.setMinimumSize(new Dimension(150, 50));

        jPeople.add(btn);
      }
      jScrollPane1.getViewport().setView(jPeople);

    } catch (BasicException ee) {
      ee.printStackTrace();
    }
  }
Esempio n. 2
0
 /** force the search button to be large enough for the longer of the two texts */
 private void setSearchButtonSizes() {
   search.setText(Globals.lang("Search specified field(s)"));
   Dimension size1 = search.getPreferredSize();
   search.setText(Globals.lang("Search all fields"));
   Dimension size2 = search.getPreferredSize();
   size2.width = Math.max(size1.width, size2.width);
   search.setMinimumSize(size2);
   search.setPreferredSize(size2);
 }
  /**
   * If the add button is pressed, this function creates a spot for it in the scroll pane, and tells
   * the restaurant panel to add a new person.
   *
   * @param name name of new person
   */
  public void addPerson(String name, boolean isHungry) {
    if (name != null) {
      JButton button = new JButton(name);
      button.setBackground(Color.white);

      Dimension paneSize = scrollPane.getSize();
      Dimension buttonSize =
          new Dimension(
              (paneSize.width / NUM_BUTTONS_COLS) - BUTTON_WIDTH_ADJUST,
              paneSize.height / NUM_BUTTONS_ROWS);
      button.setPreferredSize(buttonSize);
      button.setMinimumSize(buttonSize);
      button.setMaximumSize(buttonSize);
      button.addActionListener(this);
      list.add(button);
      view.add(button);
      if (isHungry)
        restPanel.addPerson(null, "Hungry" + type, name, 50); // puts hungry customer on list
      else restPanel.addPerson(null, type, name, 50); // puts customer on list
      //        restPanel.showInfo(type, name);//puts hungry button on panel
      validate();
    }
  }
Esempio n. 4
0
  /** Create GUI elements */
  private void loadGUI() {
    setTitle("Wifi QRCode Generator");

    mainPanel = new JPanel();
    BoxLayout vBoxLayout = new BoxLayout(mainPanel, BoxLayout.Y_AXIS);
    mainPanel.setLayout(vBoxLayout);

    int LABEL_WIDTH = 100;
    int LABEL_HEIGHT = 30;

    int EDIT_WIDTH = 200;
    int EDIT_HEIGHT = 30;

    // guide label
    {
      // This layout simply makes label looks left-alignmented
      JPanel barPanel = new JPanel();
      BoxLayout barHLayout = new BoxLayout(barPanel, BoxLayout.X_AXIS);
      barPanel.setLayout(barHLayout);

      JLabel ssoGuideLabel = new JLabel("Enter your SSO and click button below to login");
      ssoGuideLabel.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 15));
      barPanel.add(ssoGuideLabel);
      mainPanel.add(barPanel);
    }

    Font gFont = new Font(Font.SANS_SERIF, Font.PLAIN, 13);

    Config config = Config.instance();

    // email password remember password
    {
      JPanel userPanel = new JPanel();
      BoxLayout hBoxLayout = new BoxLayout(userPanel, BoxLayout.X_AXIS);
      userPanel.setLayout(hBoxLayout);
      JLabel emailLabel = new JLabel("Email:");
      Dimension labelDimension = new Dimension(LABEL_WIDTH, LABEL_HEIGHT);
      emailLabel.setMinimumSize(labelDimension);
      emailLabel.setPreferredSize(labelDimension);
      emailLabel.setMaximumSize(labelDimension);
      userPanel.add(emailLabel);
      userPanel.add(Box.createRigidArea(new Dimension(5, 0)));
      emailField = new TextField();
      emailField.setMinimumSize(new Dimension(EDIT_WIDTH, EDIT_HEIGHT));
      emailField.setMaximumSize(new Dimension(EDIT_WIDTH + 300, EDIT_HEIGHT));
      emailField.setFont(gFont);
      emailField.setText(config.getEmail());

      userPanel.add(emailField);

      mainPanel.add(userPanel);

      JPanel passwordPanel = new JPanel();
      BoxLayout hBoxLayout2 = new BoxLayout(passwordPanel, BoxLayout.X_AXIS);
      passwordPanel.setLayout(hBoxLayout2);
      JLabel passwordLabel = new JLabel("SSO Password:"******"Remember password", false);
      rememberPasswordCheckbox.setState(config.getRememberPassword());

      mainPanel.add(rememberPasswordCheckbox);
      mainPanel.add(Box.createHorizontalGlue());
    }

    JPanel centerPanel = new JPanel();
    BorderLayout bLayout = new BorderLayout();
    centerPanel.setLayout(bLayout);

    buttonGetPassword = new JButton(idleButtonText);
    Font font = new Font(Font.SERIF, Font.BOLD, 18);
    buttonGetPassword.setFont(font);
    buttonGetPassword.setMinimumSize(new Dimension(300, 50));
    buttonGetPassword.setPreferredSize(new Dimension(300, 50));
    buttonGetPassword.setMaximumSize(new Dimension(300, 50));

    centerPanel.add(buttonGetPassword, BorderLayout.CENTER);

    hintLabel = new JLabel("Enter your SSO and click button to start");
    hintLabel.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 15));

    centerPanel.add(hintLabel, BorderLayout.SOUTH);
    mainPanel.add(centerPanel);

    wifiPasswordField = new TextField("Wifi password has not been generated");
    mainPanel.add(wifiPasswordField);

    JPanel qrCenterPanel = new JPanel();
    BorderLayout bLayout2 = new BorderLayout();
    qrCenterPanel.setLayout(bLayout2);
    qrCodeLabel = new JLabel("");
    qrCodeLabel.setMinimumSize(new Dimension(400, 400));
    qrCodeLabel.setPreferredSize(new Dimension(400, 400));
    qrCodeLabel.setMaximumSize(new Dimension(400, 400));
    qrCodeLabel.setHorizontalAlignment(JLabel.CENTER);
    qrCodeLabel.setVerticalAlignment(JLabel.CENTER);
    qrCodeLabel.setIcon(idleIcon);

    qrCenterPanel.add(qrCodeLabel, BorderLayout.CENTER);
    mainPanel.add(qrCenterPanel);

    // client download section
    {
      Font clientFont = new Font(Font.SANS_SERIF, Font.BOLD, 15);
      Dimension clientDimension = new Dimension(200, 30);
      JPanel clientPanel = new JPanel();
      BorderLayout cp_bLayout = new BorderLayout();
      clientPanel.setLayout(cp_bLayout);
      HyberLinkLabel androidLabel =
          new HyberLinkLabel(
              " [ Android Client ] ",
              "https://github.com/tangyanhan/ClrGstAutoLogin-/blob/master/ClrGstAutoConnect/bin/ClrGstAutoConnect.apk");
      androidLabel.setMinimumSize(clientDimension);
      androidLabel.setFont(clientFont);
      clientPanel.add(androidLabel, BorderLayout.WEST);

      HyberLinkLabel iosLabel = new HyberLinkLabel(" [ iOS Client ] ", "");
      iosLabel.setMinimumSize(clientDimension);
      iosLabel.setFont(clientFont);
      clientPanel.add(iosLabel, BorderLayout.EAST);

      mainPanel.add(clientPanel);
    }

    add(mainPanel);

    this.pack();
    this.setVisible(true);
    this.setLocation(300, 100);
    this.setSize(500, 730);

    buttonGetPassword.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent arg0) {

            long elapsed = Calendar.getInstance().getTimeInMillis() - lastClickTime;

            // If we got the successfull password 5 minutes ago
            if (((elapsed / 1000) / 60) < 5) {
              hintLabel.setText("Take a rest! You have got the QR code already!");
              return;
            }

            fetchPassword();

            if (!Config.instance().getWifiPassword().isEmpty())
              lastClickTime = Calendar.getInstance().getTimeInMillis();
          }
        });
  }
    private void initComponents() {

      setPreferredSize(new java.awt.Dimension(420, 65));

      this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

      JPanel buttonPanel = new JPanel();
      buttonPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
      JPanel textPanel = new JPanel();
      SpringLayout textLayout = new SpringLayout();
      textPanel.setLayout(textLayout);
      this.add(buttonPanel);
      this.add(textPanel);

      // button area
      abortButton_ = new JButton();
      abortButton_.setBackground(new java.awt.Color(255, 255, 255));
      abortButton_.setIcon(
          new javax.swing.ImageIcon(
              getClass().getResource("/org/micromanager/icons/cancel.png"))); // NOI18N
      abortButton_.setToolTipText("Abort acquisition");
      abortButton_.setFocusable(false);
      abortButton_.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
      abortButton_.setMaximumSize(new java.awt.Dimension(30, 28));
      abortButton_.setMinimumSize(new java.awt.Dimension(30, 28));
      abortButton_.setPreferredSize(new java.awt.Dimension(30, 28));
      abortButton_.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
      abortButton_.addActionListener(
          new ActionListener() {

            public void actionPerformed(ActionEvent e) {
              try {
                JavaUtils.invokeRestrictedMethod(vad_, VirtualAcquisitionDisplay.class, "abort");
              } catch (Exception ex) {
                ReportingUtils.showError(
                    "Couldn't abort. Try pressing stop on Multi-Dimensional acquisition Window");
              }
            }
          });
      buttonPanel.add(abortButton_);

      pauseButton_ = new JButton();
      pauseButton_.setIcon(
          new javax.swing.ImageIcon(
              getClass().getResource("/org/micromanager/icons/control_pause.png"))); // NOI18N
      pauseButton_.setToolTipText("Pause acquisition");
      pauseButton_.setFocusable(false);
      pauseButton_.setMargin(new java.awt.Insets(0, 0, 0, 0));
      pauseButton_.setMaximumSize(new java.awt.Dimension(30, 28));
      pauseButton_.setMinimumSize(new java.awt.Dimension(30, 28));
      pauseButton_.setPreferredSize(new java.awt.Dimension(30, 28));
      pauseButton_.addActionListener(
          new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
              try {
                JavaUtils.invokeRestrictedMethod(vad_, VirtualAcquisitionDisplay.class, "pause");
              } catch (Exception ex) {
                ReportingUtils.showError("Couldn't pause");
              }
              if (eng_.isPaused()) {
                pauseButton_.setIcon(
                    new javax.swing.ImageIcon(
                        getClass()
                            .getResource("/org/micromanager/icons/resultset_next.png"))); // NOI18N
              } else {
                pauseButton_.setIcon(
                    new javax.swing.ImageIcon(
                        getClass()
                            .getResource("/org/micromanager/icons/control_pause.png"))); // NOI18N
              }
            }
          });
      buttonPanel.add(pauseButton_);

      gridXSpinner_ = new JSpinner();
      gridXSpinner_.setModel(new SpinnerNumberModel(2, 1, 1000, 1));
      gridXSpinner_.setPreferredSize(new Dimension(35, 24));
      gridYSpinner_ = new JSpinner();
      gridYSpinner_.setModel(new SpinnerNumberModel(2, 1, 1000, 1));
      gridYSpinner_.setPreferredSize(new Dimension(35, 24));
      gridXSpinner_.addChangeListener(
          new ChangeListener() {
            @Override
            public void stateChanged(ChangeEvent e) {
              gridSizeChanged();
            }
          });
      gridYSpinner_.addChangeListener(
          new ChangeListener() {
            @Override
            public void stateChanged(ChangeEvent e) {
              gridSizeChanged();
            }
          });
      final JLabel gridLabel = new JLabel(" grid");
      final JLabel byLabel = new JLabel("by");
      gridLabel.setEnabled(false);
      byLabel.setEnabled(false);
      gridXSpinner_.setEnabled(false);
      gridYSpinner_.setEnabled(false);

      final JButton createGridButton = new JButton("Create");
      createGridButton.setEnabled(false);
      createGridButton.addActionListener(
          new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
              createGrid();
            }
          });

      newGridButton_ = new JToggleButton("New grid");
      buttonPanel.add(new JLabel("    "));
      buttonPanel.add(newGridButton_);
      newGridButton_.addActionListener(
          new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
              if (newGridButton_.isSelected()) {
                makeGridOverlay(
                    vad_.getImagePlus().getWidth() / 2, vad_.getImagePlus().getHeight() / 2);
                newGridButton_.setText("Cancel");
                gridLabel.setEnabled(true);
                byLabel.setEnabled(true);
                gridXSpinner_.setEnabled(true);
                gridYSpinner_.setEnabled(true);
                createGridButton.setEnabled(true);
              } else {
                vad_.getImagePlus().getOverlay().clear();
                vad_.getImagePlus().getCanvas().repaint();
                newGridButton_.setText("New grid");
                gridLabel.setEnabled(false);
                byLabel.setEnabled(false);
                gridXSpinner_.setEnabled(false);
                gridYSpinner_.setEnabled(false);
                createGridButton.setEnabled(false);
              }
            }
          });

      buttonPanel.add(gridXSpinner_);
      buttonPanel.add(byLabel);
      buttonPanel.add(gridYSpinner_);
      buttonPanel.add(gridLabel);
      buttonPanel.add(createGridButton);

      // text area
      zPosLabel_ = new JLabel("Z position:                    ");
      textPanel.add(zPosLabel_);

      timeStampLabel_ = new JLabel("Elapsed time:                               ");
      textPanel.add(timeStampLabel_);

      fpsField_ = new JTextField();
      fpsField_.setText("7");
      fpsField_.setToolTipText("Set the speed at which the acquisition is played back.");
      fpsField_.setPreferredSize(new Dimension(25, 18));
      fpsField_.addFocusListener(
          new java.awt.event.FocusAdapter() {

            public void focusLost(java.awt.event.FocusEvent evt) {
              updateFPS();
            }
          });
      fpsField_.addKeyListener(
          new java.awt.event.KeyAdapter() {

            public void keyReleased(java.awt.event.KeyEvent evt) {
              updateFPS();
            }
          });
      JLabel fpsLabel = new JLabel("Animation playback FPS: ");
      textPanel.add(fpsLabel);
      textPanel.add(fpsField_);

      textLayout.putConstraint(SpringLayout.WEST, textPanel, 0, SpringLayout.WEST, zPosLabel_);
      textLayout.putConstraint(
          SpringLayout.EAST, zPosLabel_, 0, SpringLayout.WEST, timeStampLabel_);
      textLayout.putConstraint(SpringLayout.EAST, timeStampLabel_, 0, SpringLayout.WEST, fpsLabel);
      textLayout.putConstraint(SpringLayout.EAST, fpsLabel, 0, SpringLayout.WEST, fpsField_);
      textLayout.putConstraint(SpringLayout.EAST, fpsField_, 0, SpringLayout.EAST, textPanel);

      textLayout.putConstraint(SpringLayout.NORTH, fpsField_, 0, SpringLayout.NORTH, textPanel);
      textLayout.putConstraint(SpringLayout.NORTH, zPosLabel_, 3, SpringLayout.NORTH, textPanel);
      textLayout.putConstraint(
          SpringLayout.NORTH, timeStampLabel_, 3, SpringLayout.NORTH, textPanel);
      textLayout.putConstraint(SpringLayout.NORTH, fpsLabel, 3, SpringLayout.NORTH, textPanel);
    }
Esempio n. 6
0
 void jbInit() throws Exception {
   border1 = BorderFactory.createEmptyBorder(10, 10, 5, 5);
   panel1.setLayout(borderLayout1);
   jPanel1.setLayout(borderLayout2);
   jScrollPane1.getViewport().setBackground(Color.white);
   jPanel2.setLayout(gridBagLayout1);
   jLabel1.setText("Profile Name : ");
   nameTextField.setMinimumSize(new Dimension(4, 18));
   nameTextField.setPreferredSize(new Dimension(63, 18));
   jLabel2.setText("Profile Type : ");
   openButton.setMaximumSize(new Dimension(73, 24));
   openButton.setMinimumSize(new Dimension(73, 24));
   openButton.setPreferredSize(new Dimension(73, 24));
   openButton.setText("Open");
   openButton.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent e) {
           openButton_actionPerformed(e);
         }
       });
   cancelButton.setMaximumSize(new Dimension(73, 24));
   cancelButton.setMinimumSize(new Dimension(73, 24));
   cancelButton.setPreferredSize(new Dimension(73, 24));
   cancelButton.setMargin(new Insets(0, 5, 0, 5));
   cancelButton.setText("Cancel");
   cancelButton.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent e) {
           cancelButton_actionPerformed(e);
         }
       });
   profileList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
   profileList.addMouseListener(
       new java.awt.event.MouseAdapter() {
         public void mouseClicked(MouseEvent e) {
           profileList_mouseClicked(e);
         }
       });
   jPanel2.setBorder(border1);
   typeComboBox.setMaximumSize(new Dimension(32767, 18));
   typeComboBox.setMinimumSize(new Dimension(122, 18));
   typeComboBox.setPreferredSize(new Dimension(176, 18));
   getContentPane().add(panel1);
   panel1.add(jPanel1, BorderLayout.CENTER);
   jPanel1.add(jScrollPane1, BorderLayout.CENTER);
   panel1.add(jPanel2, BorderLayout.SOUTH);
   jPanel2.add(
       jLabel1,
       new GridBagConstraints(
           0,
           0,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.HORIZONTAL,
           new Insets(0, 0, 7, 0),
           0,
           0));
   jPanel2.add(
       nameTextField,
       new GridBagConstraints(
           1,
           0,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.HORIZONTAL,
           new Insets(0, 11, 7, 0),
           0,
           0));
   jPanel2.add(
       jLabel2,
       new GridBagConstraints(
           0,
           1,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.HORIZONTAL,
           new Insets(0, 0, 17, 0),
           0,
           0));
   jScrollPane1.getViewport().add(profileList, null);
   jPanel2.add(
       openButton,
       new GridBagConstraints(
           3,
           0,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.NONE,
           new Insets(0, 11, 2, 10),
           0,
           0));
   jPanel2.add(
       cancelButton,
       new GridBagConstraints(
           3,
           1,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.NONE,
           new Insets(0, 11, 9, 10),
           0,
           0));
   jPanel2.add(
       typeComboBox,
       new GridBagConstraints(
           1,
           1,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.HORIZONTAL,
           new Insets(0, 11, 17, 0),
           0,
           0));
 }
  public JMovieControlAqua() {
    // Set the background color to the border color of the buttons.
    // This way the toolbar won't look too ugly when the buttons
    // are displayed before they have been loaded completely.
    // setBackground(new Color(118, 118, 118));
    setBackground(Color.WHITE);

    Dimension buttonSize = new Dimension(16, 16);
    GridBagLayout gridbag = new GridBagLayout();
    Insets margin = new Insets(0, 0, 0, 0);
    setLayout(gridbag);
    GridBagConstraints c;

    ResourceBundle labels = ResourceBundle.getBundle("org.monte.media.Labels");
    colorCyclingButton = new JToggleButton();
    colorCyclingButton.setToolTipText(labels.getString("colorCycling.toolTipText"));
    colorCyclingButton.addActionListener(this);
    colorCyclingButton.setPreferredSize(buttonSize);
    colorCyclingButton.setMinimumSize(buttonSize);
    colorCyclingButton.setVisible(false);
    colorCyclingButton.setMargin(margin);
    c = new GridBagConstraints();
    // c.gridx = 0;
    // c.gridy = 0;
    gridbag.setConstraints(colorCyclingButton, c);
    add(colorCyclingButton);

    audioButton = new JToggleButton();
    audioButton.setToolTipText(labels.getString("audio.toolTipText"));
    audioButton.addActionListener(this);
    audioButton.setPreferredSize(buttonSize);
    audioButton.setMinimumSize(buttonSize);
    audioButton.setVisible(false);
    audioButton.setMargin(margin);
    c = new GridBagConstraints();
    // c.gridx = 0;
    // c.gridy = 0;
    gridbag.setConstraints(audioButton, c);
    add(audioButton);

    startButton = new JToggleButton();
    startButton.setToolTipText(labels.getString("play.toolTipText"));
    startButton.addActionListener(this);
    startButton.setPreferredSize(buttonSize);
    startButton.setMinimumSize(buttonSize);
    startButton.setMargin(margin);
    c = new GridBagConstraints();
    // c.gridx = 1;
    // c.gridy = 0;
    gridbag.setConstraints(startButton, c);
    add(startButton);

    slider = new JMovieSliderAqua();
    c = new GridBagConstraints();
    // c.gridx = 2;
    // c.gridy = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1.0;
    gridbag.setConstraints(slider, c);
    add(slider);

    rewindButton = new JButton();
    rewindButton.setToolTipText(labels.getString("previous.toolTipText"));
    rewindButton.setPreferredSize(buttonSize);
    rewindButton.setMinimumSize(buttonSize);
    rewindButton.setMargin(margin);
    c = new GridBagConstraints();
    // c.gridx = 3;
    // c.gridy = 0;

    gridbag.setConstraints(rewindButton, c);
    add(rewindButton);
    rewindButton.addActionListener(this);

    forwardButton = new JButton();
    forwardButton.setToolTipText(labels.getString("next.toolTipText"));
    buttonSize = new Dimension(17, 16);
    forwardButton.setPreferredSize(buttonSize);
    forwardButton.setMinimumSize(buttonSize);
    forwardButton.setMargin(margin);
    c = new GridBagConstraints();
    // c.gridx = 4;
    // c.gridy = 0;
    gridbag.setConstraints(forwardButton, c);
    add(forwardButton);
    forwardButton.addActionListener(this);

    // The spacer is used when the play controls are hidden
    spacer = new JPanel(new BorderLayout());
    spacer.setVisible(false);
    spacer.setPreferredSize(new Dimension(16, 16));
    spacer.setMinimumSize(new Dimension(16, 16));
    spacer.setOpaque(false);
    c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1.0;
    gridbag.setConstraints(spacer, c);
    add(spacer);

    Border border =
        new BackdropBorder(
            new ButtonStateBorder(
                new ImageBevelBorder(
                    Images.createImage(getClass(), "images/Player.border.png"),
                    new Insets(1, 1, 1, 1),
                    new Insets(0, 4, 1, 4)),
                new ImageBevelBorder(
                    Images.createImage(getClass(), "images/Player.borderP.png"),
                    new Insets(1, 1, 1, 1),
                    new Insets(0, 4, 1, 4))));

    Border westBorder =
        new BackdropBorder(
            new ButtonStateBorder(
                new ImageBevelBorder(
                    Images.createImage(getClass(), "images/Player.borderWest.png"),
                    new Insets(1, 1, 1, 0),
                    new Insets(0, 4, 1, 4)),
                new ImageBevelBorder(
                    Images.createImage(getClass(), "images/Player.borderWestP.png"),
                    new Insets(1, 1, 1, 0),
                    new Insets(0, 4, 1, 4))));

    startButton.setBorder(westBorder);
    colorCyclingButton.setBorder(westBorder);
    audioButton.setBorder(westBorder);
    rewindButton.setBorder(westBorder);
    forwardButton.setBorder(border);
    startButton.setUI((ButtonUI) CustomButtonUI.createUI(startButton));
    colorCyclingButton.setUI((ButtonUI) CustomButtonUI.createUI(audioButton));
    audioButton.setUI((ButtonUI) CustomButtonUI.createUI(audioButton));
    rewindButton.setUI((ButtonUI) CustomButtonUI.createUI(rewindButton));
    forwardButton.setUI((ButtonUI) CustomButtonUI.createUI(forwardButton));

    colorCyclingButton.setIcon(
        new ImageIcon(Images.createImage(getClass(), "images/PlayerStartColorCycling.png")));
    colorCyclingButton.setSelectedIcon(
        new ImageIcon(Images.createImage(getClass(), "images/PlayerStartColorCycling.png")));
    colorCyclingButton.setDisabledIcon(
        new ImageIcon(
            Images.createImage(getClass(), "images/PlayerStartColorCycling.disabled.png")));
    audioButton.setIcon(
        new ImageIcon(Images.createImage(getClass(), "images/PlayerStartAudio.png")));
    audioButton.setSelectedIcon(
        new ImageIcon(Images.createImage(getClass(), "images/PlayerStopAudio.png")));
    audioButton.setDisabledIcon(
        new ImageIcon(Images.createImage(getClass(), "images/PlayerStartAudio.disabled.png")));
    startButton.setIcon(new ImageIcon(Images.createImage(getClass(), "images/PlayerStart.png")));
    startButton.setSelectedIcon(
        new ImageIcon(Images.createImage(getClass(), "images/PlayerStop.png")));
    startButton.setDisabledIcon(
        new ImageIcon(Images.createImage(getClass(), "images/PlayerStart.disabled.png")));
    rewindButton.setIcon(new ImageIcon(Images.createImage(getClass(), "images/PlayerBack.png")));
    rewindButton.setDisabledIcon(
        new ImageIcon(Images.createImage(getClass(), "images/PlayerBack.disabled.png")));
    forwardButton.setIcon(new ImageIcon(Images.createImage(getClass(), "images/PlayerNext.png")));
    forwardButton.setDisabledIcon(
        new ImageIcon(Images.createImage(getClass(), "images/PlayerNext.disabled.png")));

    // Automatic scrolling
    scrollHandler = new ScrollHandler();
    scrollTimer = new Timer(60, scrollHandler);
    scrollTimer.setInitialDelay(300); // default InitialDelay?
    forwardButton.addMouseListener(scrollHandler);
    rewindButton.addMouseListener(scrollHandler);
  }
Esempio n. 8
0
  public final void createNotificationUI() {
    JButton createMasks = new JButton("Recreate Bathymetry Masks");
    createMasks.setPreferredSize(createMasks.getPreferredSize());
    createMasks.setMinimumSize(createMasks.getPreferredSize());
    createMasks.setMaximumSize(createMasks.getPreferredSize());

    createMasks.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent event) {
            bathymetryData.setDeleteMasks(true);
            dispose();
          }
        });

    JButton cancelButton = new JButton("Cancel");
    cancelButton.setPreferredSize(cancelButton.getPreferredSize());
    cancelButton.setMinimumSize(cancelButton.getPreferredSize());
    cancelButton.setMaximumSize(cancelButton.getPreferredSize());

    cancelButton.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent event) {
            dispose();
          }
        });

    JLabel filler = new JLabel("                            ");

    JPanel buttonsJPanel = new JPanel(new GridBagLayout());
    buttonsJPanel.add(
        cancelButton,
        new ExGridBagConstraints(0, 0, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE));
    buttonsJPanel.add(
        filler,
        new ExGridBagConstraints(
            1, 0, 0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL));
    buttonsJPanel.add(
        createMasks,
        new ExGridBagConstraints(2, 0, 1, 0, GridBagConstraints.EAST, GridBagConstraints.NONE));
    buttonsJPanel.add(
        helpButton,
        new ExGridBagConstraints(3, 0, 1, 0, GridBagConstraints.EAST, GridBagConstraints.NONE));

    JLabel jLabel = new JLabel("Bathymetry has already been created for this product");

    JPanel jPanel = new JPanel(new GridBagLayout());
    jPanel.add(
        jLabel,
        new ExGridBagConstraints(0, 0, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE));
    jPanel.add(
        buttonsJPanel,
        new ExGridBagConstraints(0, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE));

    add(jPanel);

    setModalityType(ModalityType.APPLICATION_MODAL);

    setTitle("Bathymetry");
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    setLocationRelativeTo(null);
    pack();

    setPreferredSize(getPreferredSize());
    setMinimumSize(getPreferredSize());
    setMaximumSize(getPreferredSize());
    setSize(getPreferredSize());
  }
Esempio n. 9
0
  public final void createBathymetryUI(boolean bandCreated) {

    final int rightInset = 5;

    final MaskEnabledAllBandsCheckbox maskEnabledAllBandsCheckbox =
        new MaskEnabledAllBandsCheckbox(bathymetryData);
    final MaskTransparencySpinner maskTransparencySpinner =
        new MaskTransparencySpinner(bathymetryData);
    final MaskColorComboBox maskColorComboBox = new MaskColorComboBox(bathymetryData);
    final MaskMaxDepthTextfield maskMaxDepthTextfield = new MaskMaxDepthTextfield(bathymetryData);
    final MaskMinDepthTextfield maskMinDepthTextfield = new MaskMinDepthTextfield(bathymetryData);

    final boolean[] fileSelectorEnabled = {true};

    if (bandCreated) {
      fileSelectorEnabled[0] = false;
    } else {
      fileSelectorEnabled[0] = true;
    }

    final ResolutionComboBox resolutionComboBox = new ResolutionComboBox(bathymetryData);

    JPanel resolutionSamplingPanel = new JPanel(new GridBagLayout());
    resolutionSamplingPanel.setBorder(BorderFactory.createTitledBorder(""));

    if (fileSelectorEnabled[0]) {
      resolutionSamplingPanel.add(
          resolutionComboBox.getjLabel(),
          new ExGridBagConstraints(
              0,
              0,
              0,
              0,
              GridBagConstraints.EAST,
              GridBagConstraints.NONE,
              new Insets(0, 0, 0, rightInset)));

      JComboBox jComboBox = resolutionComboBox.getjComboBox();
      jComboBox.setEnabled(fileSelectorEnabled[0]);

      bathymetryData.addPropertyChangeListener(
          BathymetryData.PROMPT_REQUEST_TO_INSTALL_FILE_EVENT,
          new PropertyChangeListener() {
            @Override
            public void propertyChange(PropertyChangeEvent evt) {
              SourceFileInfo sourceFileInfo =
                  (SourceFileInfo) resolutionComboBox.getjComboBox().getSelectedItem();

              InstallResolutionFileDialog dialog =
                  new InstallResolutionFileDialog(
                      bathymetryData,
                      sourceFileInfo,
                      InstallResolutionFileDialog.Step.INSTALLATION);
              dialog.setVisible(true);
              dialog.setEnabled(true);
            }
          });

      resolutionSamplingPanel.add(
          jComboBox,
          new ExGridBagConstraints(1, 0, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE));
    } else {
      resolutionSamplingPanel.add(
          new JLabel("Note: Cannot recreate a different band, only a different mask"),
          new ExGridBagConstraints(1, 0, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE));
    }

    JPanel maskJPanel = new JPanel(new GridBagLayout());
    maskJPanel.setBorder(BorderFactory.createTitledBorder(""));

    JTextField maskNameTextfield = new JTextField(bathymetryData.getMaskName());
    maskNameTextfield.setEditable(false);
    maskNameTextfield.setToolTipText("Name of the mask (this field is not editable)");

    maskJPanel.add(
        new JLabel("Mask Name"),
        new ExGridBagConstraints(
            0,
            0,
            0,
            0,
            GridBagConstraints.EAST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, rightInset)));

    maskJPanel.add(
        maskNameTextfield,
        new ExGridBagConstraints(1, 0, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE));

    maskJPanel.add(
        maskColorComboBox.getjLabel(),
        new ExGridBagConstraints(
            0,
            1,
            0,
            0,
            GridBagConstraints.EAST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, rightInset)));

    maskJPanel.add(
        maskColorComboBox.getColorExComboBox(),
        new ExGridBagConstraints(1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE));

    maskJPanel.add(
        maskTransparencySpinner.getjLabel(),
        new ExGridBagConstraints(
            0,
            2,
            0,
            0,
            GridBagConstraints.EAST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, rightInset)));

    maskJPanel.add(
        maskTransparencySpinner.getjSpinner(),
        new ExGridBagConstraints(1, 2, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE));

    maskJPanel.add(
        maskMaxDepthTextfield.getjLabel(),
        new ExGridBagConstraints(
            0,
            3,
            0,
            0,
            GridBagConstraints.EAST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, rightInset)));

    maskJPanel.add(
        maskMaxDepthTextfield.getjTextField(),
        new ExGridBagConstraints(1, 3, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE));

    maskJPanel.add(
        maskMinDepthTextfield.getjLabel(),
        new ExGridBagConstraints(
            0,
            4,
            0,
            0,
            GridBagConstraints.EAST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, rightInset)));

    maskJPanel.add(
        maskMinDepthTextfield.getjTextField(),
        new ExGridBagConstraints(1, 4, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE));

    maskJPanel.add(
        maskEnabledAllBandsCheckbox.getjLabel(),
        new ExGridBagConstraints(
            0,
            5,
            0,
            0,
            GridBagConstraints.EAST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, rightInset)));

    maskJPanel.add(
        maskEnabledAllBandsCheckbox.getjCheckBox(),
        new ExGridBagConstraints(1, 5, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE));

    JPanel mainPanel = new JPanel(new GridBagLayout());

    mainPanel.add(
        resolutionSamplingPanel,
        new ExGridBagConstraints(
            0, 0, 0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, 3));

    mainPanel.add(
        maskJPanel,
        new ExGridBagConstraints(
            0, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, 3));

    String label;
    if (bandCreated) {
      label = "Recreate Bathymetry Mask";
    } else {
      label = "Create Bathymetry Band and Mask";
    }
    JButton createMasks = new JButton(label);
    createMasks.setPreferredSize(createMasks.getPreferredSize());
    createMasks.setMinimumSize(createMasks.getPreferredSize());
    createMasks.setMaximumSize(createMasks.getPreferredSize());

    createMasks.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent event) {
            bathymetryData.setCreateMasks(true);
            dispose();
          }
        });

    JButton cancelButton = new JButton("Cancel");
    cancelButton.setPreferredSize(cancelButton.getPreferredSize());
    cancelButton.setMinimumSize(cancelButton.getPreferredSize());
    cancelButton.setMaximumSize(cancelButton.getPreferredSize());

    cancelButton.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent event) {
            dispose();
          }
        });

    JLabel filler = new JLabel("                            ");

    JPanel buttonsJPanel = new JPanel(new GridBagLayout());
    buttonsJPanel.add(
        cancelButton,
        new ExGridBagConstraints(0, 0, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE));
    buttonsJPanel.add(
        filler,
        new ExGridBagConstraints(
            1, 0, 0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL));
    buttonsJPanel.add(
        createMasks,
        new ExGridBagConstraints(2, 0, 1, 0, GridBagConstraints.EAST, GridBagConstraints.NONE));
    buttonsJPanel.add(
        helpButton,
        new ExGridBagConstraints(3, 0, 1, 0, GridBagConstraints.EAST, GridBagConstraints.NONE));

    createMasks.setAlignmentX(0.5f);

    mainPanel.add(
        buttonsJPanel,
        new ExGridBagConstraints(0, 4, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, 5));

    add(mainPanel);

    setModalityType(ModalityType.APPLICATION_MODAL);

    setTitle("Bathymetry");
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    setLocationRelativeTo(null);
    pack();

    setPreferredSize(getPreferredSize());
    setMinimumSize(getPreferredSize());
    setMaximumSize(getPreferredSize());
    setSize(getPreferredSize());
  }
Esempio n. 10
0
  /** Initialize the common user interface components. */
  private void initUI() {
    /* initialize fields */
    {
      pFileSeqPanels = new TreeMap<FileSeq, JFileSeqPanel>();
    }

    /* initialize the popup menus */
    {
      initBasicMenus(true, false);
      updateMenuToolTips();
    }

    /* initialize the panel components */
    {
      setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

      /* header */
      {
        pApplyToolTipText = "Replace the working area files with the selected checked-in files.";
        pUnApplyToolTipText = "There are no unsaved changes to Apply at this time.";

        JPanel panel = initHeader(true);
        add(panel);
      }

      add(Box.createRigidArea(new Dimension(0, 4)));

      /* full node name */
      {
        LinkedList<Component> extra = new LinkedList<Component>();
        extra.add(Box.createRigidArea(new Dimension(4, 0)));
        {
          JButton btn = new JButton();
          pSeqLayoutButton = btn;
          btn.setName(pIsListLayout ? "ListLayoutButton" : "TabbedLayoutButton");

          Dimension size = new Dimension(19, 19);
          btn.setMinimumSize(size);
          btn.setMaximumSize(size);
          btn.setPreferredSize(size);

          btn.setActionCommand("seq-layout-changed");
          btn.addActionListener(this);

          extra.add(btn);
        }

        initNameField(this, extra);

        pNodeNameField.setFocusable(true);
        pNodeNameField.addKeyListener(this);
        pNodeNameField.addMouseListener(this);
      }

      add(Box.createRigidArea(new Dimension(0, 4)));

      {
        JTabbedPane tab = new JTabbedPane();
        pFileSeqsTab = tab;
        tab.setVisible(!pIsListLayout);
        add(tab);
      }

      {
        Box vbox = new Box(BoxLayout.Y_AXIS);
        pFileSeqsBox = vbox;

        {
          JScrollPane scroll = UIFactory.createVertScrollPane(vbox);
          pFileSeqsScroll = scroll;
          scroll.setVisible(!pIsListLayout);

          add(scroll);
        }
      }

      Dimension size = new Dimension(sSize + 22, 120);
      setMinimumSize(size);
      setPreferredSize(size);

      setFocusable(true);
      addKeyListener(this);
      addMouseListener(this);
    }

    updateNodeStatus(null, null, null);
  }
Esempio n. 11
0
  public SearchManager2(JabRefFrame frame, SidePaneManager manager) {
    super(manager, GUIGlobals.getIconUrl("search"), Globals.lang("Search"));

    this.frame = frame;
    incSearcher = new IncrementalSearcher(Globals.prefs);

    // setBorder(BorderFactory.createMatteBorder(1,1,1,1,Color.magenta));

    searchReq =
        new JCheckBoxMenuItem(
            Globals.lang("Search required fields"),
            Globals.prefs.getBoolean(JabRefPreferences.SEARCH_REQ));
    searchOpt =
        new JCheckBoxMenuItem(
            Globals.lang("Search optional fields"),
            Globals.prefs.getBoolean(JabRefPreferences.SEARCH_OPT));
    searchGen =
        new JCheckBoxMenuItem(
            Globals.lang("Search general fields"),
            Globals.prefs.getBoolean(JabRefPreferences.SEARCH_GEN));
    searchAll =
        new JCheckBoxMenuItem(
            Globals.lang("Search all fields"),
            Globals.prefs.getBoolean(JabRefPreferences.SEARCH_ALL));
    regExpSearch =
        new JCheckBoxMenuItem(
            Globals.lang("Use regular expressions"),
            Globals.prefs.getBoolean(JabRefPreferences.REG_EXP_SEARCH));

    increment = new JRadioButton(Globals.lang("Incremental"), false);
    floatSearch = new JRadioButton(Globals.lang("Float"), true);
    hideSearch = new JRadioButton(Globals.lang("Filter"), true);
    showResultsInDialog = new JRadioButton(Globals.lang("Show results in dialog"), true);
    searchAllBases =
        new JRadioButton(
            Globals.lang("Global search"),
            Globals.prefs.getBoolean(JabRefPreferences.SEARCH_ALL_BASES));
    ButtonGroup types = new ButtonGroup();
    types.add(increment);
    types.add(floatSearch);
    types.add(hideSearch);
    types.add(showResultsInDialog);
    types.add(searchAllBases);

    select = new JCheckBoxMenuItem(Globals.lang("Select matches"), false);
    increment.setToolTipText(Globals.lang("Incremental search"));
    floatSearch.setToolTipText(Globals.lang("Gray out non-matching entries"));
    hideSearch.setToolTipText(Globals.lang("Hide non-matching entries"));
    showResultsInDialog.setToolTipText(Globals.lang("Show search results in a window"));

    // Add an item listener that makes sure we only listen for key events
    // when incremental search is turned on.
    increment.addItemListener(this);
    floatSearch.addItemListener(this);
    hideSearch.addItemListener(this);
    showResultsInDialog.addItemListener(this);
    // Add the global focus listener, so a menu item can see if this field was focused when
    // an action was called.
    searchField.addFocusListener(Globals.focusListener);

    if (searchAll.isSelected()) {
      searchReq.setEnabled(false);
      searchOpt.setEnabled(false);
      searchGen.setEnabled(false);
    }
    searchAll.addChangeListener(
        new ChangeListener() {

          @Override
          public void stateChanged(ChangeEvent event) {
            boolean state = !searchAll.isSelected();
            searchReq.setEnabled(state);
            searchOpt.setEnabled(state);
            searchGen.setEnabled(state);
          }
        });

    caseSensitive =
        new JCheckBoxMenuItem(
            Globals.lang("Case sensitive"),
            Globals.prefs.getBoolean(JabRefPreferences.CASE_SENSITIVE_SEARCH));

    highLightWords =
        new JCheckBoxMenuItem(
            Globals.lang("Highlight Words"),
            Globals.prefs.getBoolean(JabRefPreferences.HIGH_LIGHT_WORDS));

    searchAutoComplete =
        new JCheckBoxMenuItem(
            Globals.lang("Autocomplete names"),
            Globals.prefs.getBoolean(JabRefPreferences.SEARCH_AUTO_COMPLETE));
    settings.add(select);

    // 2005.03.29, trying to remove field category searches, to simplify
    // search usability.
    // settings.addSeparator();
    // settings.add(searchReq);
    // settings.add(searchOpt);
    // settings.add(searchGen);
    // settings.addSeparator();
    // settings.add(searchAll);
    // ---------------------------------------------------------------
    settings.addSeparator();
    settings.add(caseSensitive);
    settings.add(regExpSearch);
    settings.addSeparator();
    settings.add(highLightWords);
    settings.addSeparator();
    settings.add(searchAutoComplete);

    searchField.addActionListener(this);
    searchField.addCaretListener(this);
    search.addActionListener(this);
    searchField.addFocusListener(
        new FocusAdapter() {

          @Override
          public void focusGained(FocusEvent e) {
            if (increment.isSelected()) {
              searchField.setText("");
            }
          }

          @Override
          public void focusLost(FocusEvent e) {
            incSearch = false;
            incSearchPos = -1; // Reset incremental
            // search. This makes the
            // incremental search reset
            // once the user moves focus to
            // somewhere else.
            if (increment.isSelected()) {
              // searchField.setText("");
              // System.out.println("focuslistener");
            }
          }
        });
    escape.addActionListener(this);
    escape.setEnabled(false); // enabled after searching

    openset.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            if (settings.isVisible()) {
              // System.out.println("oee");
              // settings.setVisible(false);
            } else {
              JButton src = (JButton) e.getSource();
              settings.show(src, 0, openset.getHeight());
            }
          }
        });

    searchAutoComplete.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent actionEvent) {
            Globals.prefs.putBoolean(
                JabRefPreferences.SEARCH_AUTO_COMPLETE, searchAutoComplete.isSelected());
            if (SearchManager2.this.frame.basePanel() != null) {
              SearchManager2.this.frame.basePanel().updateSearchManager();
            }
          }
        });
    Insets margin = new Insets(0, 2, 0, 2);
    // search.setMargin(margin);
    escape.setMargin(margin);
    openset.setMargin(margin);
    JButton help = new JButton(GUIGlobals.getImage("help"));
    int butSize = help.getIcon().getIconHeight() + 5;
    Dimension butDim = new Dimension(butSize, butSize);
    help.setPreferredSize(butDim);
    help.setMinimumSize(butDim);
    help.setMargin(margin);
    help.addActionListener(new HelpAction(Globals.helpDiag, GUIGlobals.searchHelp, "Help"));

    // Select the last used mode of search:
    if (Globals.prefs.getBoolean(JabRefPreferences.INCREMENT_S)) {
      increment.setSelected(true);
    } else if (Globals.prefs.getBoolean(JabRefPreferences.FLOAT_SEARCH)) {
      floatSearch.setSelected(true);
    } else if (Globals.prefs.getBoolean(JabRefPreferences.SHOW_SEARCH_IN_DIALOG)) {
      showResultsInDialog.setSelected(true);
    } else if (Globals.prefs.getBoolean(JabRefPreferences.SEARCH_ALL_BASES)) {
      searchAllBases.setSelected(true);
    } else {
      hideSearch.setSelected(true);
    }

    JPanel main = new JPanel();
    GridBagLayout gbl = new GridBagLayout();
    main.setLayout(gbl);
    GridBagConstraints con = new GridBagConstraints();
    con.gridwidth = GridBagConstraints.REMAINDER;
    con.fill = GridBagConstraints.BOTH;
    con.weightx = 1;

    gbl.setConstraints(searchField, con);
    main.add(searchField);
    // con.gridwidth = 1;
    gbl.setConstraints(search, con);
    main.add(search);
    con.gridwidth = GridBagConstraints.REMAINDER;
    gbl.setConstraints(escape, con);
    main.add(escape);
    con.insets = new Insets(0, 2, 0, 0);
    gbl.setConstraints(increment, con);
    main.add(increment);
    gbl.setConstraints(floatSearch, con);
    main.add(floatSearch);
    gbl.setConstraints(hideSearch, con);
    main.add(hideSearch);
    gbl.setConstraints(showResultsInDialog, con);
    main.add(showResultsInDialog);
    gbl.setConstraints(searchAllBases, con);
    main.add(searchAllBases);
    con.insets = new Insets(0, 0, 0, 0);
    JPanel pan = new JPanel();
    GridBagLayout gb = new GridBagLayout();
    gbl.setConstraints(pan, con);
    pan.setLayout(gb);
    con.weightx = 1;
    con.gridwidth = 1;
    gb.setConstraints(openset, con);
    pan.add(openset);
    con.weightx = 0;
    gb.setConstraints(help, con);
    pan.add(help);
    main.add(pan);
    main.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));

    setContentContainer(main);

    searchField.getInputMap().put(Globals.prefs.getKey("Repeat incremental search"), "repeat");

    searchField
        .getActionMap()
        .put(
            "repeat",
            new AbstractAction() {

              @Override
              public void actionPerformed(ActionEvent e) {
                if (increment.isSelected()) {
                  repeatIncremental();
                }
              }
            });
    searchField.getInputMap().put(Globals.prefs.getKey("Clear search"), "escape");
    searchField
        .getActionMap()
        .put(
            "escape",
            new AbstractAction() {

              @Override
              public void actionPerformed(ActionEvent e) {
                hideAway();
                // SearchManager2.this.actionPerformed(new ActionEvent(escape, 0, ""));
              }
            });
    setSearchButtonSizes();
    updateSearchButtonText();
  }
Esempio n. 12
0
  private void jbInit() throws Exception {

    saveButton.setText("Save");
    saveButton.addActionListener(new PrintfTemplateEditor_saveButton_actionAdapter(this));
    cancelButton.setText("Cancel");
    cancelButton.addActionListener(new PrintfTemplateEditor_cancelButton_actionAdapter(this));
    this.setTitle(this.getTitle() + " Template Editor");
    printfPanel.setLayout(gridBagLayout1);
    formatLabel.setFont(new java.awt.Font("DialogInput", 0, 12));
    formatLabel.setText("Format String:");
    buttonPanel.setLayout(flowLayout1);
    printfPanel.setBorder(BorderFactory.createEtchedBorder());
    printfPanel.setMinimumSize(new Dimension(100, 160));
    printfPanel.setPreferredSize(new Dimension(380, 160));
    parameterPanel.setLayout(gridBagLayout2);
    parameterLabel.setText("Parameters:");
    parameterLabel.setFont(new java.awt.Font("DialogInput", 0, 12));
    parameterTextArea.setMinimumSize(new Dimension(100, 25));
    parameterTextArea.setPreferredSize(new Dimension(200, 25));
    parameterTextArea.setEditable(true);
    parameterTextArea.setText("");
    insertButton.setMaximumSize(new Dimension(136, 20));
    insertButton.setMinimumSize(new Dimension(136, 20));
    insertButton.setPreferredSize(new Dimension(136, 20));
    insertButton.setToolTipText(
        "insert the format in the format string and add parameter to list.");
    insertButton.setText("Insert Parameter");
    insertButton.addActionListener(new PrintfTemplateEditor_insertButton_actionAdapter(this));
    formatTextArea.setMinimumSize(new Dimension(100, 25));
    formatTextArea.setPreferredSize(new Dimension(200, 15));
    formatTextArea.setText("");
    parameterPanel.setBorder(null);
    parameterPanel.setMinimumSize(new Dimension(60, 40));
    parameterPanel.setPreferredSize(new Dimension(300, 40));
    insertMatchButton.addActionListener(
        new PrintfTemplateEditor_insertMatchButton_actionAdapter(this));
    insertMatchButton.setText("Insert Match");
    insertMatchButton.setToolTipText(
        "insert the match in the format string and add parameter to list.");
    insertMatchButton.setPreferredSize(new Dimension(136, 20));
    insertMatchButton.setMinimumSize(new Dimension(136, 20));
    insertMatchButton.setMaximumSize(new Dimension(136, 20));
    matchPanel.setPreferredSize(new Dimension(300, 40));
    matchPanel.setBorder(null);
    matchPanel.setMinimumSize(new Dimension(60, 60));
    matchPanel.setLayout(gridBagLayout3);
    InsertPanel.setLayout(gridLayout1);
    gridLayout1.setColumns(1);
    gridLayout1.setRows(2);
    gridLayout1.setVgap(0);
    InsertPanel.setBorder(BorderFactory.createEtchedBorder());
    InsertPanel.setMinimumSize(new Dimension(100, 100));
    InsertPanel.setPreferredSize(new Dimension(380, 120));
    editorPane.setText("");
    editorPane.addKeyListener(new PrintfEditor_editorPane_keyAdapter(this));
    printfTabPane.addChangeListener(new PrintfEditor_printfTabPane_changeAdapter(this));
    parameterPanel.add(
        insertButton,
        new GridBagConstraints(
            1,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.NONE,
            new Insets(8, 6, 13, 8),
            0,
            10));
    parameterPanel.add(
        paramComboBox,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL,
            new Insets(8, 8, 13, 0),
            258,
            11));
    paramComboBox.setRenderer(new MyCellRenderer());
    InsertPanel.add(matchPanel, null);
    InsertPanel.add(parameterPanel, null);
    buttonPanel.add(cancelButton, null);
    buttonPanel.add(saveButton, null);
    this.getContentPane().add(printfTabPane, BorderLayout.NORTH);
    this.getContentPane().add(InsertPanel, BorderLayout.CENTER);
    matchPanel.add(
        insertMatchButton,
        new GridBagConstraints(
            1,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.NONE,
            new Insets(8, 6, 13, 8),
            0,
            10));
    matchPanel.add(
        matchComboBox,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL,
            new Insets(8, 8, 13, 0),
            258,
            11));
    printfPanel.add(
        parameterLabel,
        new GridBagConstraints(
            0,
            2,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(7, 5, 0, 5),
            309,
            0));
    printfPanel.add(
        formatLabel,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(4, 5, 0, 5),
            288,
            0));
    printfPanel.add(
        formatTextArea,
        new GridBagConstraints(
            0,
            1,
            1,
            1,
            1.0,
            1.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(6, 5, 0, 5),
            300,
            34));
    printfPanel.add(
        parameterTextArea,
        new GridBagConstraints(
            0,
            3,
            1,
            1,
            1.0,
            1.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(6, 5, 6, 5),
            300,
            34));
    printfTabPane.addTab("Editor View", null, editorPanel, "View in Editor");
    printfTabPane.addTab("Printf View", null, printfPanel, "Vies as Printf");
    editorPane.setCharacterAttributes(PLAIN_ATTR, true);
    editorPane.addStyle("PLAIN", editorPane.getLogicalStyle());
    editorPanel.getViewport().add(editorPane, null);
    this.getContentPane().add(buttonPanel, BorderLayout.SOUTH);
    buttonGroup.add(cancelButton);
  }
  public void initializeComponents(
      DiscountCardsTableModel tableModel, MessageSource messageSource, LocaleHolder localeHolder) {
    this.tableModel = tableModel;
    this.filters = new ArrayList<>();
    FiltersPurpose filtersPurpose = tableModel.getFiltersPurpose();

    FilterElementsListener filterElementsListener = new FilterElementsListener();

    //      panel for search operations
    filtersPanel = new JPanel();
    filtersPanel.setBorder(
        BorderFactory.createCompoundBorder(
            BorderFactory.createTitledBorder(
                messageSource.getMessage(
                    "mainForm.panel.search.title", null, localeHolder.getLocale())),
            BorderFactory.createEmptyBorder()));
    filtersPanel.setLayout(new GridBagLayout());

    GridBagConstraints constraints = new GridBagConstraints();
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.insets = new Insets(1, 5, 1, 5);

    boolean allCardsPurpose = FiltersPurpose.ALL_DISCOUNT_CARDS == filtersPurpose;
    for (Field field : DiscountCardJdo.class.getDeclaredFields()) {
      FilterColumn filterColumn = field.getAnnotation(FilterColumn.class);
      if (filterColumn != null) {
        if (allCardsPurpose && filterColumn.showForAllDiscountCards()) {
          FilterUnit filterUnit = new FilterUnit();
          if (allCardsPurpose) {
            filterUnit.order = filterColumn.orderForAllDiscountCards();
          }

          filterUnit.order = filterUnit.order == 0 ? Integer.MAX_VALUE : filterUnit.order;
          filterUnit.filterType = filterColumn.type();
          filterUnit.columnTitle = getColumnTitle(field, messageSource, localeHolder);
          filterUnit.columnDatePattern = getColumnDatePattern(field);

          if (!filterColumn.labelKey().isEmpty()) {
            filterUnit.label =
                new JLabel(
                    messageSource.getMessage(
                        filterColumn.labelKey(), null, localeHolder.getLocale()));
            filterUnit.textField = new JTextField(filterColumn.editSize());
            filterUnit.textField.getDocument().addDocumentListener(filterElementsListener);
          }
          if (filterColumn.checkBoxesNumber() > 0) {
            filterUnit.checkBoxes = new JCheckBox[filterColumn.checkBoxesNumber()];
            for (int i = 0; i < filterColumn.checkBoxesNumber(); ++i) {
              String text =
                  messageSource.getMessage(
                      filterColumn.checkBoxesText()[i], null, localeHolder.getLocale());
              String actionCommand =
                  messageSource.getMessage(
                      filterColumn.checkBoxesAction()[i], null, localeHolder.getLocale());
              filterUnit.checkBoxes[i] = new JCheckBox(text);
              filterUnit.checkBoxes[i].setActionCommand(actionCommand);
              if (field.getName().equals("activationDate")) {
                filterUnit.checkBoxes[i].setSelected(true);
              } else {
                filterUnit.checkBoxes[i].setSelected(false);
              }
              filterUnit.checkBoxes[i].addItemListener(
                  new ItemListener() {
                    @Override
                    public void itemStateChanged(ItemEvent e) {
                      int state = e.getStateChange();
                      if (state == ItemEvent.SELECTED) {
                        applyFilters();
                        updateAnalyzeComponent();

                      } else if (state == ItemEvent.DESELECTED) {
                        applyFilters();
                        updateAnalyzeComponent();
                      }
                    }
                  });
            }
          }

          filters.add(filterUnit);
        }
      }
    }
    Collections.sort(
        filters,
        new Comparator<FilterUnit>() {
          @Override
          public int compare(FilterUnit filterUnit1, FilterUnit filterUnit2) {
            return filterUnit1.order - filterUnit2.order;
          }
        });
    for (int i = 0; i < filters.size(); ++i) {
      if (filters.get(i).label != null) {
        filters.get(i).label.setLabelFor(filters.get(i).textField);
        constraints.fill = GridBagConstraints.NONE;
        constraints.gridwidth = GridBagConstraints.RELATIVE;
        constraints.anchor = GridBagConstraints.EAST;
        constraints.weightx = 0.0;
        filtersPanel.add(filters.get(i).label, constraints);
        constraints.fill = GridBagConstraints.HORIZONTAL;
        constraints.gridwidth = GridBagConstraints.REMAINDER;
        constraints.anchor = GridBagConstraints.EAST;
        constraints.weightx = 1.0;
        filtersPanel.add(filters.get(i).textField, constraints);
      } else if (filters.get(i).checkBoxes != null) {
        JPanel checkBoxPanel = new JPanel();
        checkBoxPanel.setLayout(new BoxLayout(checkBoxPanel, BoxLayout.LINE_AXIS));
        checkBoxPanel.add(Box.createHorizontalGlue());
        for (int j = 0; j < filters.get(i).checkBoxes.length; ++j) {
          checkBoxPanel.add(filters.get(i).checkBoxes[j]);
          checkBoxPanel.add(Box.createHorizontalGlue());
        }
        constraints.fill = GridBagConstraints.HORIZONTAL;
        constraints.gridwidth = GridBagConstraints.REMAINDER;
        constraints.anchor = GridBagConstraints.EAST;
        constraints.weightx = 1.0;
        filtersPanel.add(checkBoxPanel, constraints);
      }
    }

    JButton clearSearchButton =
        new JButton(
            messageSource.getMessage(
                "mainForm.button.clear.title", null, localeHolder.getLocale()));
    clearSearchButton.setPreferredSize(new Dimension(500, 20));
    clearSearchButton.setMaximumSize(new Dimension(500, 20));
    clearSearchButton.setMinimumSize(new Dimension(500, 20));
    constraints.gridx = 1;
    constraints.gridy = filters.size() + 1;
    constraints.gridwidth = GridBagConstraints.REMAINDER;
    constraints.anchor = GridBagConstraints.EAST;
    constraints.weightx = 1.0;
    clearSearchButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            for (FilterUnit filterUnit : filters) {
              if (filterUnit.label != null) {
                filterUnit.textField.setText("");
              } else if (filterUnit.checkBoxes != null) {
                for (int j = 0; j < filterUnit.checkBoxes.length; ++j) {
                  filterUnit.checkBoxes[j].setSelected(true);
                }
              }
            }
          }
        });
    filtersPanel.add(clearSearchButton, constraints);
    sorter = new TableRowSorter<>(tableModel);

    cardAnalyzeComponent.initializeComponents(tableModel, messageSource, localeHolder);
  }
Esempio n. 14
0
  /** Initialize the contents of the frame. */
  private void initialize() {
    frame = new JFrame("SkAppA");
    frame.setBounds(100, 100, 750, 400);
    frame.setResizable(false);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    /*  */
    ImageIcon imIcon = new ImageIcon(this.getClass().getClassLoader().getResource("res/logo.png"));
    // ImageIcon imIcon = new ImageIcon("C:\\Users\\davem\\workspace\\Skappa\\res\\logo.png");
    Image image = imIcon.getImage();
    Image newImage = image.getScaledInstance(120, 120, Image.SCALE_SMOOTH);
    imIcon = new ImageIcon(newImage);
    frame.getContentPane().setLayout(new CardLayout(0, 0));

    panelIniziale = new JPanel();
    frame.getContentPane().add(panelIniziale, "name_10245570710976");
    panelIniziale.setLayout(new BorderLayout(0, 0));

    JPanel panel = new JPanel();
    panelIniziale.add(panel, BorderLayout.SOUTH);
    panel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));

    JPanel panelInviaMail = new JPanel();
    frame.getContentPane().add(panelInviaMail, "name_74765522122111");
    frame.setBounds(100, 100, 750, 400);
    panelInviaMail.setLayout(new BorderLayout(0, 0));

    JPanel panel_6 = new JPanel();
    panelInviaMail.add(panel_6, BorderLayout.CENTER);
    GridBagLayout gbl_panel_6 = new GridBagLayout();
    gbl_panel_6.columnWidths = new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
    gbl_panel_6.rowHeights = new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
    gbl_panel_6.columnWeights =
        new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
    gbl_panel_6.rowWeights =
        new double[] {
          0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE
        };
    panel_6.setLayout(gbl_panel_6);

    JLabel lblIndirizzoEmail = new JLabel("Indirizzo email");
    GridBagConstraints gbc_lblIndirizzoEmail = new GridBagConstraints();
    gbc_lblIndirizzoEmail.insets = new Insets(0, 0, 5, 5);
    gbc_lblIndirizzoEmail.gridx = 3;
    gbc_lblIndirizzoEmail.gridy = 1;
    panel_6.add(lblIndirizzoEmail, gbc_lblIndirizzoEmail);

    textFieldEmail = new JTextField();
    GridBagConstraints gbc_textFieldEmail = new GridBagConstraints();
    gbc_textFieldEmail.insets = new Insets(0, 0, 5, 5);
    gbc_textFieldEmail.fill = GridBagConstraints.HORIZONTAL;
    gbc_textFieldEmail.gridx = 5;
    gbc_textFieldEmail.gridy = 1;
    panel_6.add(textFieldEmail, gbc_textFieldEmail);
    textFieldEmail.setColumns(10);

    JLabel lblUsername = new JLabel("Username");
    GridBagConstraints gbc_lblUsername = new GridBagConstraints();
    gbc_lblUsername.insets = new Insets(0, 0, 5, 5);
    gbc_lblUsername.gridx = 3;
    gbc_lblUsername.gridy = 3;
    panel_6.add(lblUsername, gbc_lblUsername);

    textFieldUsername = new JTextField();
    GridBagConstraints gbc_textFieldUsername = new GridBagConstraints();
    gbc_textFieldUsername.insets = new Insets(0, 0, 5, 5);
    gbc_textFieldUsername.fill = GridBagConstraints.HORIZONTAL;
    gbc_textFieldUsername.gridx = 5;
    gbc_textFieldUsername.gridy = 3;
    panel_6.add(textFieldUsername, gbc_textFieldUsername);
    textFieldUsername.setColumns(10);

    JLabel lblPassword = new JLabel("Password");
    GridBagConstraints gbc_lblPassword = new GridBagConstraints();
    gbc_lblPassword.insets = new Insets(0, 0, 5, 5);
    gbc_lblPassword.gridx = 3;
    gbc_lblPassword.gridy = 5;
    panel_6.add(lblPassword, gbc_lblPassword);

    passwordField = new JPasswordField();
    GridBagConstraints gbc_passwordField = new GridBagConstraints();
    gbc_passwordField.insets = new Insets(0, 0, 5, 5);
    gbc_passwordField.fill = GridBagConstraints.HORIZONTAL;
    gbc_passwordField.gridx = 5;
    gbc_passwordField.gridy = 5;
    panel_6.add(passwordField, gbc_passwordField);

    JLabel lblIndirizzoServerSmtp = new JLabel("Indirizzo server smtp");
    GridBagConstraints gbc_lblIndirizzoServerSmtp = new GridBagConstraints();
    gbc_lblIndirizzoServerSmtp.insets = new Insets(0, 0, 5, 5);
    gbc_lblIndirizzoServerSmtp.gridx = 3;
    gbc_lblIndirizzoServerSmtp.gridy = 7;
    panel_6.add(lblIndirizzoServerSmtp, gbc_lblIndirizzoServerSmtp);

    textFieldSMTP = new JTextField();
    GridBagConstraints gbc_textFieldSMTP = new GridBagConstraints();
    gbc_textFieldSMTP.insets = new Insets(0, 0, 5, 5);
    gbc_textFieldSMTP.fill = GridBagConstraints.HORIZONTAL;
    gbc_textFieldSMTP.gridx = 5;
    gbc_textFieldSMTP.gridy = 7;
    panel_6.add(textFieldSMTP, gbc_textFieldSMTP);
    textFieldSMTP.setColumns(10);

    JLabel lblPortaServerSmtp = new JLabel("Porta server smtp");
    GridBagConstraints gbc_lblPortaServerSmtp = new GridBagConstraints();
    gbc_lblPortaServerSmtp.insets = new Insets(0, 0, 5, 5);
    gbc_lblPortaServerSmtp.gridx = 3;
    gbc_lblPortaServerSmtp.gridy = 9;
    panel_6.add(lblPortaServerSmtp, gbc_lblPortaServerSmtp);

    textFieldSMTPPort = new JTextField();
    GridBagConstraints gbc_textFieldSMTPPort = new GridBagConstraints();
    gbc_textFieldSMTPPort.insets = new Insets(0, 0, 5, 5);
    gbc_textFieldSMTPPort.fill = GridBagConstraints.HORIZONTAL;
    gbc_textFieldSMTPPort.gridx = 5;
    gbc_textFieldSMTPPort.gridy = 9;
    panel_6.add(textFieldSMTPPort, gbc_textFieldSMTPPort);
    textFieldSMTPPort.setColumns(10);

    progressBar = new JProgressBar();
    GridBagConstraints gbc_progressBar = new GridBagConstraints();
    gbc_progressBar.fill = GridBagConstraints.HORIZONTAL;
    gbc_progressBar.insets = new Insets(0, 0, 5, 5);
    gbc_progressBar.gridx = 5;
    gbc_progressBar.gridy = 11;
    panel_6.add(progressBar, gbc_progressBar);
    progressBar.setVisible(false);

    JPanel panel_7 = new JPanel();
    panelInviaMail.add(panel_7, BorderLayout.NORTH);

    JLabel lblInserisciCredenziali = new JLabel("Inserisci credenziali");
    lblInserisciCredenziali.setFont(new Font("Tahoma", Font.PLAIN, 18));
    panel_7.add(lblInserisciCredenziali);

    JPanel panel_8 = new JPanel();
    panelInviaMail.add(panel_8, BorderLayout.SOUTH);

    btnNewButton_5 = new JButton("Invia");
    btnNewButton_5.setPreferredSize(new Dimension(70, 25));
    btnNewButton_5.addActionListener(this);

    panel_8.add(btnNewButton_5);

    JButton btnNewButton_6 = new JButton("Annulla");
    btnNewButton_6.setPreferredSize(new Dimension(70, 25));
    btnNewButton_6.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            panelInviaMail.setVisible(false);
            panelCreaEvento.setVisible(true);
            frame.setBounds(100, 100, 750, 400);
          }
        });
    panel_8.add(btnNewButton_6);

    JButton btnNewButton = new JButton("Crea evento");
    btnNewButton.setPreferredSize(new Dimension(150, 30));
    btnNewButton.setMinimumSize(new Dimension(150, 30));
    btnNewButton.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            panelCreaEvento.setVisible(true);
            panelIniziale.setVisible(false);
            // frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
            frame.setBounds(100, 100, 750, 400);
          }
        });
    panel.add(btnNewButton);

    JButton btnNewButton_1 = new JButton("Carica partecipanti");
    btnNewButton_1.setPreferredSize(new Dimension(150, 30));
    btnNewButton_1.setMinimumSize(new Dimension(150, 30));
    btnNewButton_1.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            panelCaricaPartecipanti.setVisible(true);
            panelIniziale.setVisible(false);
          }
        });
    panel.add(btnNewButton_1);

    JPanel panel_1 = new JPanel();
    panelIniziale.add(panel_1, BorderLayout.CENTER);
    SimpleAttributeSet attribs = new SimpleAttributeSet();
    StyleConstants.setAlignment(attribs, StyleConstants.ALIGN_CENTER);
    JTextPane txtpnSelezionaLaModalit = new JTextPane();
    txtpnSelezionaLaModalit.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
    txtpnSelezionaLaModalit.setEnabled(false);
    txtpnSelezionaLaModalit.setEditable(false);
    txtpnSelezionaLaModalit.setFont(new Font("Tahoma", Font.PLAIN, 16));
    txtpnSelezionaLaModalit.setText("Seleziona la modalit\u00E0");
    txtpnSelezionaLaModalit.setParagraphAttributes(attribs, true);
    panel_1.setLayout(new BoxLayout(panel_1, BoxLayout.X_AXIS));
    panel_1.add(txtpnSelezionaLaModalit);

    JPanel panel_2 = new JPanel();
    panelIniziale.add(panel_2, BorderLayout.NORTH);

    JLabel lblLogo = new JLabel("");
    lblLogo.setIcon(imIcon);
    panel_2.add(lblLogo);

    panelCreaEvento = new JPanel();
    frame.getContentPane().add(panelCreaEvento, "name_10426205657299");

    JPanel panel_5 = new JPanel();

    JPanel panel_3 = new JPanel();
    panelCreaEvento.setLayout(new BorderLayout(0, 0));
    panelCreaEvento.add(panel_5);
    GridBagLayout gbl_panel_5 = new GridBagLayout();
    gbl_panel_5.columnWidths =
        new int[] {64, 66, 67, 0, 0, 0, 0, 0, 65, 0, 0, 0, 0, 0, 0, 81, 48, 43, 55, 0};
    gbl_panel_5.rowHeights = new int[] {0, 0, 30, 20, 35, 20, 35, 20, 0, 0};
    gbl_panel_5.columnWeights =
        new double[] {
          0.0,
          0.0,
          0.0,
          0.0,
          0.0,
          0.0,
          0.0,
          0.0,
          0.0,
          1.0,
          0.0,
          1.0,
          0.0,
          0.0,
          0.0,
          0.0,
          0.0,
          0.0,
          0.0,
          Double.MIN_VALUE
        };
    gbl_panel_5.rowWeights =
        new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
    panel_5.setLayout(gbl_panel_5);

    Component verticalStrut_1 = Box.createVerticalStrut(20);
    GridBagConstraints gbc_verticalStrut_1 = new GridBagConstraints();
    gbc_verticalStrut_1.insets = new Insets(0, 0, 5, 5);
    gbc_verticalStrut_1.gridx = 13;
    gbc_verticalStrut_1.gridy = 0;
    panel_5.add(verticalStrut_1, gbc_verticalStrut_1);

    Component verticalStrut_2 = Box.createVerticalStrut(20);
    GridBagConstraints gbc_verticalStrut_2 = new GridBagConstraints();
    gbc_verticalStrut_2.insets = new Insets(0, 0, 5, 5);
    gbc_verticalStrut_2.gridx = 13;
    gbc_verticalStrut_2.gridy = 1;
    panel_5.add(verticalStrut_2, gbc_verticalStrut_2);

    JLabel lblInserisciDatiEvento = new JLabel("Inserisci dati evento");
    lblInserisciDatiEvento.setFont(new Font("Tahoma", Font.PLAIN, 18));
    GridBagConstraints gbc_lblInserisciDatiEvento = new GridBagConstraints();
    gbc_lblInserisciDatiEvento.gridwidth = 2;
    gbc_lblInserisciDatiEvento.insets = new Insets(0, 0, 5, 5);
    gbc_lblInserisciDatiEvento.gridx = 1;
    gbc_lblInserisciDatiEvento.gridy = 2;
    panel_5.add(lblInserisciDatiEvento, gbc_lblInserisciDatiEvento);

    JLabel lblNomeEvento = new JLabel("Nome evento");
    lblNomeEvento.setFont(new Font("Tahoma", Font.PLAIN, 13));
    GridBagConstraints gbc_lblNomeEvento = new GridBagConstraints();
    gbc_lblNomeEvento.gridwidth = 2;
    gbc_lblNomeEvento.fill = GridBagConstraints.HORIZONTAL;
    gbc_lblNomeEvento.insets = new Insets(0, 0, 5, 5);
    gbc_lblNomeEvento.gridx = 1;
    gbc_lblNomeEvento.gridy = 3;
    panel_5.add(lblNomeEvento, gbc_lblNomeEvento);

    textFieldNome = new JTextField();
    textFieldNome.setColumns(10);
    GridBagConstraints gbc_textFieldNome = new GridBagConstraints();
    gbc_textFieldNome.anchor = GridBagConstraints.NORTH;
    gbc_textFieldNome.fill = GridBagConstraints.HORIZONTAL;
    gbc_textFieldNome.insets = new Insets(0, 0, 5, 5);
    gbc_textFieldNome.gridwidth = 5;
    gbc_textFieldNome.gridx = 3;
    gbc_textFieldNome.gridy = 3;
    panel_5.add(textFieldNome, gbc_textFieldNome);

    JLabel lblLuogoEvento = new JLabel("Luogo evento");
    lblLuogoEvento.setFont(new Font("Tahoma", Font.PLAIN, 13));
    GridBagConstraints gbc_lblLuogoEvento = new GridBagConstraints();
    gbc_lblLuogoEvento.gridwidth = 2;
    gbc_lblLuogoEvento.fill = GridBagConstraints.HORIZONTAL;
    gbc_lblLuogoEvento.insets = new Insets(0, 0, 5, 5);
    gbc_lblLuogoEvento.gridx = 1;
    gbc_lblLuogoEvento.gridy = 5;
    panel_5.add(lblLuogoEvento, gbc_lblLuogoEvento);

    textFieldLuogo = new JTextField();
    textFieldLuogo.setColumns(10);
    GridBagConstraints gbc_textFieldLuogo = new GridBagConstraints();
    gbc_textFieldLuogo.anchor = GridBagConstraints.NORTH;
    gbc_textFieldLuogo.fill = GridBagConstraints.HORIZONTAL;
    gbc_textFieldLuogo.insets = new Insets(0, 0, 5, 5);
    gbc_textFieldLuogo.gridwidth = 5;
    gbc_textFieldLuogo.gridx = 3;
    gbc_textFieldLuogo.gridy = 5;
    panel_5.add(textFieldLuogo, gbc_textFieldLuogo);

    JLabel lblProvincia = new JLabel("Provincia");
    GridBagConstraints gbc_lblProvincia = new GridBagConstraints();
    gbc_lblProvincia.anchor = GridBagConstraints.WEST;
    gbc_lblProvincia.insets = new Insets(0, 0, 5, 5);
    gbc_lblProvincia.gridx = 9;
    gbc_lblProvincia.gridy = 5;
    panel_5.add(lblProvincia, gbc_lblProvincia);

    JComboBox comboBoxProvincia = new JComboBox(provinceArray);
    GridBagConstraints gbc_comboBoxProvincia = new GridBagConstraints();
    gbc_comboBoxProvincia.anchor = GridBagConstraints.NORTHWEST;
    gbc_comboBoxProvincia.insets = new Insets(0, 0, 5, 5);
    gbc_comboBoxProvincia.gridx = 10;
    gbc_comboBoxProvincia.gridy = 5;
    panel_5.add(comboBoxProvincia, gbc_comboBoxProvincia);

    JLabel lblDataEvento = new JLabel("Data evento");
    lblDataEvento.setFont(new Font("Tahoma", Font.PLAIN, 13));
    GridBagConstraints gbc_lblDataEvento = new GridBagConstraints();
    gbc_lblDataEvento.gridwidth = 2;
    gbc_lblDataEvento.fill = GridBagConstraints.HORIZONTAL;
    gbc_lblDataEvento.insets = new Insets(0, 0, 0, 5);
    gbc_lblDataEvento.gridx = 1;
    gbc_lblDataEvento.gridy = 7;
    panel_5.add(lblDataEvento, gbc_lblDataEvento);

    JComboBox comboBoxGiorno = new JComboBox(giorniArray);
    GridBagConstraints gbc_comboBoxGiorno = new GridBagConstraints();
    gbc_comboBoxGiorno.anchor = GridBagConstraints.NORTHWEST;
    gbc_comboBoxGiorno.insets = new Insets(0, 0, 0, 5);
    gbc_comboBoxGiorno.gridx = 3;
    gbc_comboBoxGiorno.gridy = 7;
    panel_5.add(comboBoxGiorno, gbc_comboBoxGiorno);

    JComboBox comboBoxMese = new JComboBox(mesiArray);
    GridBagConstraints gbc_comboBoxMese = new GridBagConstraints();
    gbc_comboBoxMese.anchor = GridBagConstraints.NORTHWEST;
    gbc_comboBoxMese.insets = new Insets(0, 0, 0, 5);
    gbc_comboBoxMese.gridx = 4;
    gbc_comboBoxMese.gridy = 7;
    panel_5.add(comboBoxMese, gbc_comboBoxMese);

    JComboBox comboBoxAnno = new JComboBox(anniArray);
    GridBagConstraints gbc_comboBoxAnno = new GridBagConstraints();
    gbc_comboBoxAnno.insets = new Insets(0, 0, 0, 5);
    gbc_comboBoxAnno.anchor = GridBagConstraints.NORTHEAST;
    gbc_comboBoxAnno.gridx = 5;
    gbc_comboBoxAnno.gridy = 7;
    panel_5.add(comboBoxAnno, gbc_comboBoxAnno);

    JLabel lblOra = new JLabel("Ora");
    GridBagConstraints gbc_lblOra = new GridBagConstraints();
    gbc_lblOra.anchor = GridBagConstraints.EAST;
    gbc_lblOra.insets = new Insets(0, 0, 0, 5);
    gbc_lblOra.gridx = 8;
    gbc_lblOra.gridy = 7;
    panel_5.add(lblOra, gbc_lblOra);

    JComboBox comboBoxOre = new JComboBox(oreArray);
    GridBagConstraints gbc_comboBox_1 = new GridBagConstraints();
    gbc_comboBox_1.insets = new Insets(0, 0, 0, 5);
    gbc_comboBox_1.fill = GridBagConstraints.HORIZONTAL;
    gbc_comboBox_1.gridx = 10;
    gbc_comboBox_1.gridy = 7;
    panel_5.add(comboBoxOre, gbc_comboBox_1);

    JComboBox comboBoxMinuti = new JComboBox(minutiArray);
    GridBagConstraints gbc_comboBox_2 = new GridBagConstraints();
    gbc_comboBox_2.insets = new Insets(0, 0, 0, 5);
    gbc_comboBox_2.fill = GridBagConstraints.HORIZONTAL;
    gbc_comboBox_2.gridx = 12;
    gbc_comboBox_2.gridy = 7;
    panel_5.add(comboBoxMinuti, gbc_comboBox_2);
    panelCreaEvento.add(panel_3, BorderLayout.NORTH);
    GridBagLayout gbl_panel_3 = new GridBagLayout();
    gbl_panel_3.columnWidths = new int[] {0, 0, 0, 200, 0, 227, 77, 0, 0, 0};
    gbl_panel_3.rowHeights = new int[] {0, 0, 23, 0};
    gbl_panel_3.columnWeights =
        new double[] {0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0.0, 0.0, Double.MIN_VALUE};
    gbl_panel_3.rowWeights = new double[] {0.0, 0.0, 0.0, Double.MIN_VALUE};
    panel_3.setLayout(gbl_panel_3);

    Component verticalStrut = Box.createVerticalStrut(20);
    GridBagConstraints gbc_verticalStrut = new GridBagConstraints();
    gbc_verticalStrut.insets = new Insets(0, 0, 5, 5);
    gbc_verticalStrut.gridx = 6;
    gbc_verticalStrut.gridy = 0;
    panel_3.add(verticalStrut, gbc_verticalStrut);

    JLabel lblInserisciPercorsoFile = new JLabel("Inserisci percorso file nominativi");
    GridBagConstraints gbc_lblInserisciPercorsoFile = new GridBagConstraints();
    gbc_lblInserisciPercorsoFile.insets = new Insets(0, 0, 5, 5);
    gbc_lblInserisciPercorsoFile.gridx = 3;
    gbc_lblInserisciPercorsoFile.gridy = 1;
    panel_3.add(lblInserisciPercorsoFile, gbc_lblInserisciPercorsoFile);

    textField = new JTextField();
    textField.setPreferredSize(new Dimension(6, 25));
    textField.setColumns(10);
    GridBagConstraints gbc_textField = new GridBagConstraints();
    gbc_textField.fill = GridBagConstraints.HORIZONTAL;
    gbc_textField.insets = new Insets(0, 0, 5, 5);
    gbc_textField.gridx = 5;
    gbc_textField.gridy = 1;
    panel_3.add(textField, gbc_textField);

    JButton btnNewButton_2 = new JButton("Apri...");
    btnNewButton_2.setPreferredSize(new Dimension(135, 25));
    btnNewButton_2.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent arg0) {
            JFileChooser chooser = new JFileChooser();
            chooser.setCurrentDirectory(new java.io.File("."));
            chooser.setDialogTitle("Choose the folder");
            chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
            chooser.setAcceptAllFileFilterUsed(false);
            if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
              System.out.println("getCurrentDirectory(): " + chooser.getSelectedFile());
              file = chooser.getSelectedFile();
              inputFilePath = file.getAbsolutePath();
              textField.setText(inputFilePath);
            }
          }
        });
    GridBagConstraints gbc_btnNewButton_2 = new GridBagConstraints();
    gbc_btnNewButton_2.insets = new Insets(0, 0, 5, 5);
    gbc_btnNewButton_2.fill = GridBagConstraints.HORIZONTAL;
    gbc_btnNewButton_2.gridx = 6;
    gbc_btnNewButton_2.gridy = 1;
    panel_3.add(btnNewButton_2, gbc_btnNewButton_2);

    Component horizontalStrut = Box.createHorizontalStrut(20);
    GridBagConstraints gbc_horizontalStrut = new GridBagConstraints();
    gbc_horizontalStrut.insets = new Insets(0, 0, 0, 5);
    gbc_horizontalStrut.gridx = 2;
    gbc_horizontalStrut.gridy = 2;
    panel_3.add(horizontalStrut, gbc_horizontalStrut);

    Component horizontalStrut_1 = Box.createHorizontalStrut(20);
    GridBagConstraints gbc_horizontalStrut_1 = new GridBagConstraints();
    gbc_horizontalStrut_1.insets = new Insets(0, 0, 0, 5);
    gbc_horizontalStrut_1.gridx = 7;
    gbc_horizontalStrut_1.gridy = 2;
    panel_3.add(horizontalStrut_1, gbc_horizontalStrut_1);

    JPanel panel_4 = new JPanel();
    panelCreaEvento.add(panel_4, BorderLayout.SOUTH);

    JButton btnNewButton_3 = new JButton("Crea evento");
    btnNewButton_3.setPreferredSize(new Dimension(95, 25));
    btnNewButton_3.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {

            int giorno = Integer.parseInt((String) comboBoxGiorno.getSelectedItem());
            int mese = comboBoxMese.getSelectedIndex();
            int anno = Integer.parseInt((String) comboBoxAnno.getSelectedItem());
            int ore = Integer.parseInt((String) comboBoxOre.getSelectedItem());
            int minuti = Integer.parseInt((String) comboBoxMinuti.getSelectedItem());
            inputFilePath = textField.getText();
            file = new File(inputFilePath);

            if (!isValidDate(giorno, mese, anno)) {
              JOptionPane.showMessageDialog(
                  frame, "Data non corretta.", "Errore", JOptionPane.ERROR_MESSAGE);
            } else if (!extensionIs("xlsx", file)) {
              JOptionPane.showMessageDialog(
                  frame, "Formato file non corretto.", "Errore", JOptionPane.ERROR_MESSAGE);
            } else {
              inputFilePath = textField.getText();
              /*try {
                  l = Loader.generateList(inputFilePath);
              } catch (Exception e) {
                  JOptionPane.showMessageDialog(frame, "Errore nel file di input.", "Errore", JOptionPane.ERROR_MESSAGE);
              }*/

              evento =
                  new Event(
                      textFieldNome.getText(),
                      textFieldLuogo.getText(),
                      (String) comboBoxProvincia.getSelectedItem(),
                      new GregorianCalendar(anno, mese, giorno, ore, minuti),
                      l);
              frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
              try {
                evento.generateList(inputFilePath);
              } catch (Exception e) {
                e.printStackTrace();
                JOptionPane.showMessageDialog(
                    frame, "Errore nel file di output.", "Errore", JOptionPane.ERROR_MESSAGE);
              }

              evento.toString();
              File dir = new File(inputFilePath);
              evento.assignQR(dir.getParent());

              frame.setCursor(null);

              frame.setBounds(100, 100, 750, 400);
              panelCreaEvento.setVisible(false);
              panelInviaMail.setVisible(true);
            }
          }
        });
    panel_4.add(btnNewButton_3);

    JButton btnNewButton_4 = new JButton("Indietro");
    btnNewButton_4.setPreferredSize(new Dimension(95, 25));
    btnNewButton_4.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            panelCreaEvento.setVisible(false);
            panelIniziale.setVisible(true);
          }
        });
    panel_4.add(btnNewButton_4);

    panelCaricaPartecipanti = new JPanel();
    frame.getContentPane().add(panelCaricaPartecipanti, "name_80084471932092");
    panelCaricaPartecipanti.setLayout(new BorderLayout(0, 0));

    JPanel panel_9 = new JPanel();
    panelCaricaPartecipanti.add(panel_9);
    GridBagLayout gbl_panel_9 = new GridBagLayout();
    gbl_panel_9.columnWidths = new int[] {0, 0, 0, 0, 0, 0, 0, 0};
    gbl_panel_9.rowHeights = new int[] {0, 0, 0, 0, 0, 0};
    gbl_panel_9.columnWeights = new double[] {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
    gbl_panel_9.rowWeights = new double[] {0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
    panel_9.setLayout(gbl_panel_9);

    JLabel lblInserisciFileExcel = new JLabel("Inserisci file Excel di output");
    GridBagConstraints gbc_lblInserisciFileExcel = new GridBagConstraints();
    gbc_lblInserisciFileExcel.insets = new Insets(0, 0, 5, 5);
    gbc_lblInserisciFileExcel.gridx = 2;
    gbc_lblInserisciFileExcel.gridy = 2;
    panel_9.add(lblInserisciFileExcel, gbc_lblInserisciFileExcel);

    textField_1 = new JTextField();
    GridBagConstraints gbc_textField_1 = new GridBagConstraints();
    gbc_textField_1.insets = new Insets(0, 0, 5, 5);
    gbc_textField_1.fill = GridBagConstraints.HORIZONTAL;
    gbc_textField_1.gridx = 3;
    gbc_textField_1.gridy = 2;
    panel_9.add(textField_1, gbc_textField_1);
    textField_1.setColumns(10);

    JButton btnNewButton_7 = new JButton("Scegli file...");
    btnNewButton_7.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            JFileChooser chooser = new JFileChooser();
            chooser.setCurrentDirectory(new java.io.File("."));
            chooser.setDialogTitle("Choose the folder");
            chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
            chooser.setAcceptAllFileFilterUsed(false);
            if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
              System.out.println("getCurrentDirectory(): " + chooser.getSelectedFile());
              file = chooser.getSelectedFile();
              excelOutputFilePath = file.getAbsolutePath();
              textField_1.setText(excelOutputFilePath);
            }
          }
        });
    GridBagConstraints gbc_btnNewButton_7 = new GridBagConstraints();
    gbc_btnNewButton_7.insets = new Insets(0, 0, 5, 5);
    gbc_btnNewButton_7.gridx = 5;
    gbc_btnNewButton_7.gridy = 2;
    panel_9.add(btnNewButton_7, gbc_btnNewButton_7);

    JLabel lblInserisciFileDelle = new JLabel("Inserisci file delle scansioni");
    GridBagConstraints gbc_lblInserisciFileDelle = new GridBagConstraints();
    gbc_lblInserisciFileDelle.insets = new Insets(0, 0, 0, 5);
    gbc_lblInserisciFileDelle.gridx = 2;
    gbc_lblInserisciFileDelle.gridy = 4;
    panel_9.add(lblInserisciFileDelle, gbc_lblInserisciFileDelle);

    textField_2 = new JTextField();
    GridBagConstraints gbc_textField_2 = new GridBagConstraints();
    gbc_textField_2.insets = new Insets(0, 0, 0, 5);
    gbc_textField_2.fill = GridBagConstraints.HORIZONTAL;
    gbc_textField_2.gridx = 3;
    gbc_textField_2.gridy = 4;
    panel_9.add(textField_2, gbc_textField_2);
    textField_2.setColumns(10);

    JButton btnNewButton_8 = new JButton("Scegli file...");
    btnNewButton_8.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            JFileChooser chooser = new JFileChooser();
            chooser.setCurrentDirectory(new java.io.File("."));
            chooser.setDialogTitle("Choose the folder");
            chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
            chooser.setAcceptAllFileFilterUsed(false);
            if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
              System.out.println("getCurrentDirectory(): " + chooser.getSelectedFile());
              file = chooser.getSelectedFile();
              txtOutputFilePath = file.getAbsolutePath();
              textField_2.setText(txtOutputFilePath);
            }
          }
        });
    GridBagConstraints gbc_btnNewButton_8 = new GridBagConstraints();
    gbc_btnNewButton_8.insets = new Insets(0, 0, 0, 5);
    gbc_btnNewButton_8.gridx = 5;
    gbc_btnNewButton_8.gridy = 4;
    panel_9.add(btnNewButton_8, gbc_btnNewButton_8);

    JPanel panel_10 = new JPanel();
    panelCaricaPartecipanti.add(panel_10, BorderLayout.NORTH);

    JPanel panel_11 = new JPanel();
    panelCaricaPartecipanti.add(panel_11, BorderLayout.SOUTH);

    JButton btnNewButton_9 = new JButton("Associa");
    btnNewButton_9.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            txtOutputFilePath = textField_2.getText();
            File f = new File(txtOutputFilePath);
            excelOutputFilePath = textField_1.getText();
            Loader.writeInOut(excelOutputFilePath, Loader.loadParticipants(f));
            JOptionPane.showMessageDialog(
                frame, "Associazione degli orari eseguita!", "", JOptionPane.PLAIN_MESSAGE);
          }
        });
    panel_11.add(btnNewButton_9);

    JButton btnNewButton_10 = new JButton("Annulla");
    panel_11.add(btnNewButton_10);
  }
Esempio n. 15
0
  /**
   * Set up a menu and tool bar
   *
   * @param pane panel to add toolbar to
   * @param ftree file tree display
   */
  private JMenuBar makeMenuBar(JPanel pane, final FileTree ftree) {
    JMenuBar mBar = new JMenuBar();
    JMenu fileMenu = new JMenu("File");
    mBar.add(fileMenu);

    JMenuItem fileMenuGoto = new JMenuItem("Go to Directory ...");
    fileMenuGoto.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            String dir = ftree.getRoot().getAbsolutePath();
            String newDir = JOptionPane.showInputDialog(FileManager.this, "Go to Directory:", dir);

            if (newDir == null) return;

            newDir = newDir.trim();
            File newDirFile = new File(newDir);

            if (newDirFile.exists() && newDirFile.canRead() && !newDir.equals(dir))
              ftree.newRoot(newDir);
            else {
              String error = null;
              if (!newDirFile.exists()) error = new String(newDir + " doesn't exist!");
              else if (!newDirFile.canRead()) error = new String(newDir + " cannot be read!");
              else if (newDir.equals(dir)) error = new String("Same directory!");

              if (error != null)
                JOptionPane.showMessageDialog(
                    FileManager.this, error, "Warning", JOptionPane.WARNING_MESSAGE);
            }
          }
        });
    fileMenu.add(fileMenuGoto);
    fileMenu.add(new JSeparator());

    JMenuItem fileMenuClose = new JMenuItem("Close");
    fileMenuClose.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            setVisible(false);
          }
        });
    fileMenu.add(fileMenuClose);

    // tool bar set up
    JToolBar toolBar = new JToolBar();
    Dimension buttonSize = new Dimension(22, 24);

    JButton upBt =
        new JButton() {
          public void paintComponent(Graphics g) {
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D) g;

            g2.setColor(new Color(0, 128, 0));
            float loc1[][] = {{11, 18}, {7, 18}, {7, 14}, {3, 14}, {11, 4}};

            g2.fill(makeShape(loc1));
            g2.setColor(Color.green);

            float loc2[][] = {{11, 18}, {15, 18}, {15, 14}, {19, 14}, {11, 4}};
            g2.fill(makeShape(loc2));

            setSize(22, 24);
          }
        };
    upBt.setPreferredSize(buttonSize);
    upBt.setMinimumSize(buttonSize);

    upBt.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            FileManager.this.setCursor(cbusy);
            File root = ftree.getRoot();
            String parent = root.getParent();
            if (parent != null) ftree.newRoot(parent);
            FileManager.this.setCursor(cdone);
          }
        });
    toolBar.add(upBt);

    // yeastpub
    JButton shortCut1 =
        new JButton() {
          public void paintComponent(Graphics g) {
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D) g;
            Font font = new Font("Monospaced", Font.BOLD, 14);
            g2.setFont(font);

            g2.setColor(Color.black);
            g2.drawString("Y", 4, 18);
            g2.setColor(Color.red);
            g2.drawString("P", 10, 15);
            setSize(22, 24);
          }
        };
    shortCut1.setPreferredSize(buttonSize);
    shortCut1.setMinimumSize(buttonSize);
    shortCut1.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            ftree.newRoot("/nfs/disk222/yeastpub");
          }
        });

    if ((new File("/nfs/disk222/yeastpub")).exists()) toolBar.add(shortCut1);

    // pathdata
    JButton shortCut2 =
        new JButton() {
          public void paintComponent(Graphics g) {
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D) g;
            Font font = new Font("Monospaced", Font.BOLD, 14);
            g2.setFont(font);

            g2.setColor(Color.black);
            g2.drawString("P", 4, 18);
            g2.setColor(Color.red);
            g2.drawString("D", 10, 15);
            setSize(22, 24);
          }
        };
    shortCut2.setPreferredSize(buttonSize);
    shortCut2.setMinimumSize(buttonSize);
    shortCut2.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            ftree.newRoot("/nfs/pathdata/");
          }
        });

    if ((new File("/nfs/pathdata/")).exists()) toolBar.add(shortCut2);

    // home button
    JButton homeBt =
        new JButton() {
          public void paintComponent(Graphics g) {
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D) g;

            g2.setColor(Color.blue);
            float loc1[][] = {{3, 14}, {11, 3}, {19, 14}, {17, 14}, {17, 18}, {5, 18}, {5, 14}};
            g2.fill(makeShape(loc1));

            setSize(22, 24);
          }
        };
    homeBt.setPreferredSize(buttonSize);
    homeBt.setMinimumSize(buttonSize);
    homeBt.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            ftree.newRoot(System.getProperty("user.home"));
          }
        });
    toolBar.add(homeBt);

    toolBar.add(Box.createVerticalStrut(35));
    pane.add(toolBar, BorderLayout.NORTH);

    return mBar;
  }
Esempio n. 16
0
  public SmartToolBar(RuntimeConfigFrame fr) {
    frame = fr;
    setFloatable(true);
    treeCombo = new TreeCombo(frame.model);
    treeCombo.addActionListener(new ComboListener());
    treeCombo.setPreferredSize(new Dimension(210, 25));
    treeCombo.setMinimumSize(new Dimension(210, 25));
    treeCombo.setMaximumSize(new Dimension(210, 25));
    add(treeCombo);
    addSeparator();
    addSeparator();
    addSeparator();

    ToolBarAction toolBarAction = new ToolBarAction();
    JButton saveAsButton = add(toolBarAction);
    ImageIcon icon =
        frame
            .getCommonBuilderUIImpl()
            .getScaledImage("file.png", "images/runtimeadmin", 28, 28, Image.SCALE_DEFAULT);
    saveAsButton.setPreferredSize(new Dimension(28, 28));
    saveAsButton.setMinimumSize(new Dimension(28, 28));
    saveAsButton.setMaximumSize(new Dimension(28, 28));
    saveAsButton.setBorderPainted(false);
    saveAsButton.setIcon(icon);
    icon =
        frame
            .getCommonBuilderUIImpl()
            .getScaledImage("file_mo.png", "images/runtimeadmin", 28, 28, Image.SCALE_DEFAULT);
    saveAsButton.setRolloverIcon(icon);
    saveAsButton.setActionCommand("Apply To Server");
    saveAsButton.setToolTipText(RuntimeConfigFrame.getString("Apply To Server"));
    addSeparator();

    JButton close = add(toolBarAction);
    icon =
        frame
            .getCommonBuilderUIImpl()
            .getScaledImage("exit.png", "images/", 28, 28, Image.SCALE_DEFAULT);
    close.setPreferredSize(new Dimension(28, 28));
    close.setMinimumSize(new Dimension(28, 28));
    close.setMaximumSize(new Dimension(28, 28));
    close.setIcon(icon);
    close.setBorderPainted(false);
    icon =
        frame
            .getCommonBuilderUIImpl()
            .getScaledImage("exit_mo.png", "images/", 28, 28, Image.SCALE_DEFAULT);
    close.setRolloverIcon(icon);
    close.setActionCommand("Close");
    close.setToolTipText(RuntimeConfigFrame.getString("Close"));
    addSeparator();

    JButton help = add(toolBarAction);
    icon =
        frame
            .getCommonBuilderUIImpl()
            .getScaledImage("toolhelp.png", "images/", 28, 28, Image.SCALE_DEFAULT);
    help.setPreferredSize(new Dimension(28, 28));
    help.setMinimumSize(new Dimension(28, 28));
    help.setMaximumSize(new Dimension(28, 28));
    help.setBorderPainted(false);
    help.setIcon(icon);

    icon =
        frame
            .getCommonBuilderUIImpl()
            .getScaledImage("toolhelp_mo.png", "images/", 28, 28, Image.SCALE_DEFAULT);
    help.setRolloverIcon(icon);
    help.setActionCommand("Help Contents");
    help.setToolTipText(RuntimeConfigFrame.getString("Help"));
    // addSeparator();

  }