예제 #1
0
 /** Create the panel */
 public VomsProxyInfoPanel() {
   super();
   setBorder(BORDER_DEFAULT_TITLE);
   setLayout(
       new FormLayout(
           new ColumnSpec[] {
             FormFactory.RELATED_GAP_COLSPEC,
             ColumnSpec.decode("65dlu"),
             FormFactory.RELATED_GAP_COLSPEC,
             ColumnSpec.decode("default:grow(1.0)"),
             FormFactory.RELATED_GAP_COLSPEC,
             FormFactory.DEFAULT_COLSPEC,
             FormFactory.RELATED_GAP_COLSPEC
           },
           new RowSpec[] {
             FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
             FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
             FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
             FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
             FormFactory.RELATED_GAP_ROWSPEC
           }));
   add(getLabel(), new CellConstraints(2, 2));
   add(getLabel_1(), new CellConstraints(2, 4));
   add(getLabel_2(), new CellConstraints(2, 6));
   add(getLabel_3(), new CellConstraints(2, 8));
   add(getIdentityTextField(), new CellConstraints(4, 2, 3, 1));
   add(getAuthenticatedTextField(), new CellConstraints(4, 4, 3, 1));
   add(getRemainingTextField(), new CellConstraints(4, 6, 3, 1));
   add(getVoTextField(), new CellConstraints(4, 8));
   add(getDetailsButton(), new CellConstraints(6, 8));
   //
   updateStatus();
 }
예제 #2
0
  public TeamEntry(ITeam team, int relatedTeam) {
    setLayout(
        new FormLayout(
            new ColumnSpec[] {
              FormFactory.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("default:grow"),
              FormFactory.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("default:grow"),
            },
            new RowSpec[] {
              FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
            }));
    setBorder(
        new CompoundBorder(
            UIManager.getBorder("TitledBorder.aquaVariant"), new EmptyBorder(0, 5, 0, 5)));
    {
      JLabel lblTeamname = new JLabel("TeamName");
      if (team != null) {
        this.team = team;
        lblTeamname.setText(team.getName());
      }

      lblTeamname.setFont(new Font("Lucida Grande", Font.PLAIN, 11));
      add(lblTeamname, "2, 2, right, default");
    }
    {
      comboBox = new JComboBox();
      comboBox.setFont(new Font("Lucida Grande", Font.PLAIN, 11));
      comboBox.setModel(new DefaultComboBoxModel(new String[] {"Red", "Yellow", "Green", "Blue"}));
      if (relatedTeam >= 0 && relatedTeam < 4) {
        comboBox.setSelectedIndex(relatedTeam);
      }
      add(comboBox, "4, 2, fill, default");
    }
  }
  private void initActionsPanel() {
    JPanel actionPanel = new JPanel();
    getContentPane().add(actionPanel, BorderLayout.SOUTH);
    FormLayout layout =
        new FormLayout(
            new ColumnSpec[] {
              ColumnSpec.decode("default:grow"),
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("max(40dlu;default)"),
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("max(40dlu;default)"),
              FormFactory.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("max(5dlu;default)"),
            },
            new RowSpec[] {
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              RowSpec.decode("max(5dlu;default)"),
            });
    actionPanel.setLayout(layout);

    JButton btnCancel = new JButton(MESSAGES.get("cancel"));
    btnCancel.addActionListener(e -> setVisible(false));
    actionPanel.add(btnCancel, "7, 1, 2, 1");

    JButton btnDefaults = new JButton(MESSAGES.get("load_defaults"));
    btnDefaults.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            setDefaults();
          }
        });
    actionPanel.add(btnDefaults, "3, 1");

    JButton btnOk = new JButton(MESSAGES.get("ok"));
    btnOk.addActionListener(
        e -> {
          saveConfiguration();
          okPressed = true;
          setVisible(false);
        });
    actionPanel.add(btnOk, "11, 1, 2, 1");
  }
  public MediaFilesPanel(EventList<MediaFile> mediaFiles) {
    this.mediaFileEventList = mediaFiles;
    setLayout(
        new FormLayout(
            new ColumnSpec[] {
              ColumnSpec.decode("default:grow"),
            },
            new RowSpec[] {
              RowSpec.decode("default:grow"),
            }));

    mediaFileTableModel =
        new DefaultEventTableModel<MediaFile>(
            GlazedListsSwing.swingThreadProxyList(mediaFileEventList), new MediaTableFormat());
    tableFiles = new ZebraJTable(mediaFileTableModel);
    tableFiles.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);

    LinkListener linkListener = new LinkListener();
    tableFiles.addMouseListener(linkListener);
    tableFiles.addMouseMotionListener(linkListener);

    scrollPaneFiles = ZebraJTable.createStripedJScrollPane(tableFiles);
    add(scrollPaneFiles, "1, 1, fill, fill");

    scrollPaneFiles.setViewportView(tableFiles);
  }
예제 #5
0
  public AddOnDetailsPanel(final AddOnProperties addOn, final String warning) {
    this.warning = warning;
    setLayout(
        new FormLayout(
            new ColumnSpec[] {
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("default:grow"),
            },
            new RowSpec[] {
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              RowSpec.decode("top:default:grow"),
            }));

    JLabel imageLabel = createImageLabel(addOn);
    add(imageLabel, "1, 2");
    JLabel title = createTitleLabel(addOn);
    add(title, "3, 2");
    JLabel author = createAuthorLabel(addOn);
    add(author, "3, 4");
    final Box box = Box.createHorizontalBox();
    box.add(new JLabel(getText("homepage")));
    box.add(createAddOnHomepageButton(addOn));
    add(box, "3, 6, left, default");
    JComponent details = createDetails(addOn);
    add(details, "3, 7");
  }
예제 #6
0
파일: SlcsPanel.java 프로젝트: grith/jgrith
  /** Create the panel. */
  public SlcsPanel(String url) {

    if ((url == null) || "".equals(url)) {
      this.url = DEFAULT_URL;
    } else {
      this.url = url;
    }
    setLayout(
        new FormLayout(
            new ColumnSpec[] {
              FormSpecs.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("default:grow"),
              FormSpecs.RELATED_GAP_COLSPEC,
            },
            new RowSpec[] {
              FormSpecs.RELATED_GAP_ROWSPEC,
              RowSpec.decode("default:grow"),
              FormSpecs.RELATED_GAP_ROWSPEC,
              FormSpecs.DEFAULT_ROWSPEC,
              FormSpecs.RELATED_GAP_ROWSPEC,
            }));
    add(getShibLoginPanel(), "2, 2, fill, fill");
    add(getLoginButton(), "2, 4, right, default");
    slcs = new SLCS(getShibLoginPanel());
    slcs.addSlcsListener(this);
    enablePanel(false);
    getShibLoginPanel().refreshIdpList();
  }
예제 #7
0
  /** Initialize the contents of the frame. */
  private void initialize() {
    frame = new JFrame();
    frame.setBounds(100, 100, 450, 300);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame
        .getContentPane()
        .setLayout(
            new FormLayout(
                new ColumnSpec[] {
                  FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                  ColumnSpec.decode("default:grow"),
                  FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                },
                new RowSpec[] {
                  FormFactory.RELATED_GAP_ROWSPEC,
                  RowSpec.decode("default:grow"),
                  FormFactory.LINE_GAP_ROWSPEC,
                  RowSpec.decode("default:grow"),
                  FormFactory.LINE_GAP_ROWSPEC,
                }));

    JPanel panel = new JPanel();
    frame.getContentPane().add(panel, "2, 2, fill, fill");

    openDialog = new FileDialog(this, "Open File", FileDialog.LOAD);

    JButton btnCharger = new JButton("Charger une partie");
    btnCharger.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            openDialog.setVisible(true);
            try {
              String dir = openDialog.getDirectory() + openDialog.getFile();
              Utilitaire.writeln(dir, textArea);
              jeu = new Kakuro(frame, dir);
              jeu.setVisible(true);
            } catch (NullPointerException point) {

            }
          }
        });
    panel.add(btnCharger);

    JButton btnNvlPartie = new JButton("Nouvelle Partie");
    panel.add(btnNvlPartie);
    btnNvlPartie.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            Random list = new Random();
            int seed = list.nextInt();
            new Utilitaire(Utilitaire.x, Utilitaire.y, seed);
            jeu = new Kakuro(frame);
            jeu.setVisible(true);
          }
        });

    textArea = new JTextArea();
    JScrollPane scrollPane = new JScrollPane(textArea);
    frame.getContentPane().add(scrollPane, "2, 4, fill, fill");
  }
예제 #8
0
  public ContatoDialog() {
    setTitle(
        "Escola do Ministério Teocrátio - v"
            + br.com.dbcorp.escolaMinisterio.Params.propriedades().getProperty("versionName"));
    setResizable(false);
    setModal(true);
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);

    this.setPreferredSize(new Dimension(340, 147));
    this.setMinimumSize(new Dimension(340, 147));

    JPanel panel = new JPanel();
    getContentPane().add(panel, BorderLayout.SOUTH);

    JButton btnFechar = new JButton("Fechar");
    btnFechar.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            dispose();
          }
        });

    panel.add(btnFechar);

    JPanel panel_1 = new JPanel();
    getContentPane().add(panel_1, BorderLayout.CENTER);
    panel_1.setLayout(
        new FormLayout(
            new ColumnSpec[] {
              FormSpecs.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("default:grow"),
              FormSpecs.RELATED_GAP_COLSPEC,
            },
            new RowSpec[] {
              RowSpec.decode("5dlu"),
              FormSpecs.RELATED_GAP_ROWSPEC,
              FormSpecs.DEFAULT_ROWSPEC,
              FormSpecs.LINE_GAP_ROWSPEC,
              FormSpecs.DEFAULT_ROWSPEC,
              FormSpecs.LINE_GAP_ROWSPEC,
              FormSpecs.DEFAULT_ROWSPEC,
              FormSpecs.LINE_GAP_ROWSPEC,
            }));

    JLabel lblNewLabel = new JLabel("Contato para Informa\u00E7\u00F5es e Suporte:");
    lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
    panel_1.add(lblNewLabel, "2, 3");

    JLabel lblDavidPereiraB = new JLabel("David Barros - Congrega\u00E7\u00E3o Jd. Monte Carlos");
    lblDavidPereiraB.setHorizontalAlignment(SwingConstants.CENTER);
    panel_1.add(lblDavidPereiraB, "2, 5, center, default");

    JLabel lblEmailDavidpbarroshotmailcom = new JLabel("E-mail: [email protected]");
    panel_1.add(lblEmailDavidpbarroshotmailcom, "2, 7, center, default");

    this.centerScreen();
  }
예제 #9
0
  /** Create the panel. */
  public JContact() {
    // setPreferredSize(new Dimension(10, 10));
    setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));

    JPopupMenu popupMenu = new JPopupMenu();
    addPopup(this, popupMenu);

    JMenuItem mntmInfo = new JMenuItem("info");
    popupMenu.add(mntmInfo);
    setLayout(
        new FormLayout(
            new ColumnSpec[] {
              FormFactory.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("max(35dlu;default)"),
              FormFactory.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("max(47dlu;default)"),
            },
            new RowSpec[] {
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              RowSpec.decode("max(23dlu;default)"),
            }));

    contactName = new JLabel("ContactName");
    add(contactName, "2, 2, 3, 1");

    JPanel panel = new JPanel();
    add(panel, "2, 4, 3, 1, fill, fill");
    panel.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0));

    java.net.URL callImageURL =
        JContact.class.getResource("/com/git/client/ui/ico/phone_small.png");
    btnCall = new JButton(new ImageIcon(callImageURL));
    btnCall.setContentAreaFilled(false);
    panel.add(btnCall);

    java.net.URL delUserImageURL =
        JContact.class.getResource("/com/git/client/ui/ico/user_delete_small.png");
    btnDel = new JButton(new ImageIcon(delUserImageURL));
    btnDel.setContentAreaFilled(false);
    panel.add(btnDel);
  }
예제 #10
0
  private void initActionsPanel() {
    JPanel actionPanel = new JPanel();
    getContentPane().add(actionPanel, BorderLayout.SOUTH);
    FormLayout layout =
        new FormLayout(
            new ColumnSpec[] {
              ColumnSpec.decode("default:grow"),
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("max(40dlu;default)"),
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("max(40dlu;default)"),
              FormFactory.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("max(5dlu;default)"),
            },
            new RowSpec[] {
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              RowSpec.decode("max(5dlu;default)"),
            });
    actionPanel.setLayout(layout);

    JButton btnCancel = new JButton(MESSAGES.get("cancel"));
    btnCancel.addActionListener(e -> setVisible(false));
    actionPanel.add(btnCancel, "7, 1, 2, 1");

    JButton btnOk = new JButton(MESSAGES.get("ok"));
    btnOk.addActionListener(
        e -> {
          checkSettingsChanged();
          saveConfiguration();
          okPressed = true;
          setVisible(false);
        });
    actionPanel.add(btnOk, "11, 1, 2, 1");
  }
  private JPanel createPopularPhrasePanel(int index) {
    JPanel popularPhrasePanel = new JPanel();
    popularPhrasePanel.setLayout(
        new FormLayout(
            new ColumnSpec[] {
              ColumnSpec.decode("default"),
              FormFactory.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("default:grow"),
              FormFactory.DEFAULT_COLSPEC,
              ColumnSpec.decode("default")
            },
            new RowSpec[] {FormFactory.DEFAULT_ROWSPEC}));

    popularPhrasePanel.add(new JLabel("" + (index + 1)), "1, 1");

    textFields.add(new JTextField(PROPERTIES.getPopularPhrase(index)));
    popularPhrasePanel.add(textFields.get(index), "3, 1");

    JButton playButton = new JButton(Icon.getIcon("/icons/control_play.png"));
    playButton.addActionListener(
        a -> speeker.speek(Arrays.asList(textFields.get(index).getText())));
    popularPhrasePanel.add(playButton, "5, 1");
    return popularPhrasePanel;
  }
  public TableScannerCameraConfigurationWizard(TableScannerCamera camera) {
    this.camera = camera;

    panelGeneral = new JPanel();
    contentPanel.add(panelGeneral);
    panelGeneral.setBorder(
        new TitledBorder(
            new EtchedBorder(EtchedBorder.LOWERED, null, null),
            "General",
            TitledBorder.LEADING,
            TitledBorder.TOP,
            null,
            new Color(0, 0, 0)));
    panelGeneral.setLayout(
        new FormLayout(
            new ColumnSpec[] {
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("default:grow"),
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
            },
            new RowSpec[] {
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
            }));

    lblUrl = new JLabel("URL");
    panelGeneral.add(lblUrl, "2, 2, right, default");

    textFieldUrl = new JTextField();
    panelGeneral.add(textFieldUrl, "4, 2, 3, 1, fill, default");
    textFieldUrl.setColumns(10);

    lblCache = new JLabel("Cache");
    panelGeneral.add(lblCache, "2, 4");

    lblCacheInfo = new JLabel("");
    panelGeneral.add(lblCacheInfo, "4, 4");

    btnDelete = new JButton("Delete Cache");
    btnDelete.setAction(deleteCacheAction);
    panelGeneral.add(btnDelete, "6, 4");
  }
예제 #13
0
  private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner Open Source Project license - unknown
    ResourceBundle bundle = ResourceBundle.getBundle("InformationDialog");
    JPanel dialogPane = new JPanel();
    JPanel contentPanel = new JPanel();
    iconLabel = new JLabel();
    pathLabel = new JLabel();
    JLabel labelFrom = new JLabel();
    fieldFrom = new JTextField();
    JLabel labelSize = new JLabel();
    fieldSize = new JTextField();
    JLabel labelDescription = new JLabel();
    JScrollPane scrollPane1 = new JScrollPane();
    descriptionArea = ComponentFactory.getTextArea();
    JPanel optionsPanel = new JPanel();
    JLabel saveToLabel = new JLabel();
    comboPath = new JComboBox();
    btnSelectPath = new JButton();
    progressBar = new JProgressBar();
    JLabel labelRemaining = new JLabel();
    remainingLabel = new JLabel();
    JLabel labelEstimateTime = new JLabel();
    estTimeLabel = new JLabel();
    JLabel labelCurrentSpeed = new JLabel();
    currentSpeedLabel = new JLabel();
    JLabel labelAverageSpeed = new JLabel();
    avgSpeedLabel = new JLabel();
    JXButtonPanel buttonBar = new JXButtonPanel();
    okButton = new JButton();
    cancelButton = new JButton();
    CellConstraints cc = new CellConstraints();

    // ======== this ========
    Container contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());

    // ======== dialogPane ========
    {
      dialogPane.setBorder(Borders.DIALOG);
      dialogPane.setLayout(new BorderLayout());

      // ======== contentPanel ========
      {

        // ---- iconLabel ----
        iconLabel.setText(bundle.getString("iconLabel.text"));

        // ---- pathLabel ----
        pathLabel.setText(bundle.getString("pathLabel.text"));
        pathLabel.setFont(new Font("Tahoma", Font.BOLD, 12));

        // ---- labelFrom ----
        labelFrom.setText(bundle.getString("labelFrom.text"));

        // ---- fieldFrom ----
        fieldFrom.setBorder(null);
        fieldFrom.setOpaque(false);
        fieldFrom.setText(bundle.getString("fieldFrom.text"));

        // ---- labelSize ----
        labelSize.setText(bundle.getString("labelSize.text"));

        // ---- fieldSize ----
        fieldSize.setBorder(null);
        fieldSize.setOpaque(false);

        // ---- labelDescription ----
        labelDescription.setText(bundle.getString("labelDescription.text"));

        // ======== scrollPane1 ========
        {
          scrollPane1.setViewportView(descriptionArea);
        }

        // ======== optionsPanel ========
        {

          // ---- saveToLabel ----
          saveToLabel.setText(bundle.getString("saveToLabel.text"));
          saveToLabel.setLabelFor(comboPath);

          // ---- comboPath ----
          comboPath.setEditable(true);

          // ---- btnSelectPath ----
          btnSelectPath.setText(bundle.getString("btnSelectPath.text"));

          PanelBuilder optionsPanelBuilder =
              new PanelBuilder(
                  new FormLayout(
                      new ColumnSpec[] {
                        FormSpecs.DEFAULT_COLSPEC,
                        FormSpecs.LABEL_COMPONENT_GAP_COLSPEC,
                        new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW),
                        FormSpecs.LABEL_COMPONENT_GAP_COLSPEC,
                        FormSpecs.DEFAULT_COLSPEC
                      },
                      RowSpec.decodeSpecs("default")),
                  optionsPanel);

          optionsPanelBuilder.add(saveToLabel, cc.xy(1, 1));
          optionsPanelBuilder.add(comboPath, cc.xy(3, 1));
          optionsPanelBuilder.add(btnSelectPath, cc.xy(5, 1));
        }

        // ---- progressBar ----
        progressBar.setFont(new Font("Tahoma", Font.BOLD, 16));

        // ---- labelRemaining ----
        labelRemaining.setText(bundle.getString("labelRemaining.text"));

        // ---- remainingLabel ----
        remainingLabel.setText(bundle.getString("remainingLabel.text"));
        remainingLabel.setFont(new Font("Tahoma", Font.BOLD, 12));

        // ---- labelEstimateTime ----
        labelEstimateTime.setText(bundle.getString("labelEstimateTime.text"));

        // ---- estTimeLabel ----
        estTimeLabel.setText(bundle.getString("estTimeLabel.text"));
        estTimeLabel.setFont(new Font("Tahoma", Font.BOLD, 12));

        // ---- labelCurrentSpeed ----
        labelCurrentSpeed.setText(bundle.getString("labelCurrentSpeed.text"));

        // ---- currentSpeedLabel ----
        currentSpeedLabel.setText(bundle.getString("currentSpeedLabel.text"));
        currentSpeedLabel.setFont(new Font("Tahoma", Font.BOLD, 12));

        // ---- labelAverageSpeed ----
        labelAverageSpeed.setText(bundle.getString("labelAverageSpeed.text"));

        // ---- avgSpeedLabel ----
        avgSpeedLabel.setText(bundle.getString("avgSpeedLabel.text"));
        avgSpeedLabel.setFont(new Font("Tahoma", Font.BOLD, 12));

        PanelBuilder contentPanelBuilder =
            new PanelBuilder(
                new FormLayout(
                    new ColumnSpec[] {
                      new ColumnSpec(Sizes.dluX(49)),
                      FormSpecs.LABEL_COMPONENT_GAP_COLSPEC,
                      FormSpecs.DEFAULT_COLSPEC,
                      FormSpecs.LABEL_COMPONENT_GAP_COLSPEC,
                      new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW),
                      FormSpecs.LABEL_COMPONENT_GAP_COLSPEC,
                      FormSpecs.DEFAULT_COLSPEC,
                      FormSpecs.LABEL_COMPONENT_GAP_COLSPEC,
                      ColumnSpec.decode("max(min;70dlu)")
                    },
                    new RowSpec[] {
                      FormSpecs.DEFAULT_ROWSPEC,
                      FormSpecs.LINE_GAP_ROWSPEC,
                      FormSpecs.DEFAULT_ROWSPEC,
                      FormSpecs.LINE_GAP_ROWSPEC,
                      FormSpecs.DEFAULT_ROWSPEC,
                      FormSpecs.LINE_GAP_ROWSPEC,
                      FormSpecs.DEFAULT_ROWSPEC,
                      FormSpecs.LINE_GAP_ROWSPEC,
                      new RowSpec(
                          RowSpec.FILL,
                          Sizes.bounded(Sizes.PREFERRED, Sizes.dluY(40), Sizes.dluY(50)),
                          FormSpec.DEFAULT_GROW),
                      FormSpecs.LINE_GAP_ROWSPEC,
                      FormSpecs.DEFAULT_ROWSPEC,
                      FormSpecs.LINE_GAP_ROWSPEC,
                      RowSpec.decode("fill:max(pref;20dlu)"),
                      FormSpecs.LINE_GAP_ROWSPEC,
                      FormSpecs.DEFAULT_ROWSPEC,
                      FormSpecs.LINE_GAP_ROWSPEC,
                      FormSpecs.DEFAULT_ROWSPEC
                    }),
                contentPanel);

        contentPanelBuilder.add(iconLabel, cc.xywh(1, 1, 1, 5));
        contentPanelBuilder.add(pathLabel, cc.xywh(3, 1, 7, 1));
        contentPanelBuilder.add(labelFrom, cc.xy(3, 3));
        contentPanelBuilder.add(fieldFrom, cc.xywh(5, 3, 5, 1));
        contentPanelBuilder.add(labelSize, cc.xy(3, 5));
        contentPanelBuilder.add(fieldSize, cc.xywh(5, 5, 3, 1));
        contentPanelBuilder.add(labelDescription, cc.xy(1, 7));
        contentPanelBuilder.add(scrollPane1, cc.xywh(1, 9, 9, 1));
        contentPanelBuilder.add(optionsPanel, cc.xywh(1, 11, 9, 1));
        contentPanelBuilder.add(progressBar, cc.xywh(1, 13, 9, 1));
        contentPanelBuilder.add(labelRemaining, cc.xy(1, 15));
        contentPanelBuilder.add(remainingLabel, cc.xywh(3, 15, 3, 1));
        contentPanelBuilder.add(labelEstimateTime, cc.xy(7, 15));
        contentPanelBuilder.add(estTimeLabel, cc.xy(9, 15));
        contentPanelBuilder.add(labelCurrentSpeed, cc.xy(1, 17));
        contentPanelBuilder.add(currentSpeedLabel, cc.xywh(3, 17, 3, 1));
        contentPanelBuilder.add(labelAverageSpeed, cc.xy(7, 17));
        contentPanelBuilder.add(avgSpeedLabel, cc.xy(9, 17));
      }
      dialogPane.add(contentPanel, BorderLayout.CENTER);

      // ======== buttonBar ========
      {
        buttonBar.setBorder(new EmptyBorder(12, 0, 0, 0));

        // ---- okButton ----
        okButton.setText(bundle.getString("okButton.text"));

        // ---- cancelButton ----
        cancelButton.setText(bundle.getString("cancelButton.text"));

        PanelBuilder buttonBarBuilder =
            new PanelBuilder(
                new FormLayout(
                    new ColumnSpec[] {
                      new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW),
                      FormSpecs.UNRELATED_GAP_COLSPEC,
                      ColumnSpec.decode("max(pref;55dlu)"),
                      FormSpecs.LABEL_COMPONENT_GAP_COLSPEC,
                      FormSpecs.DEFAULT_COLSPEC
                    },
                    RowSpec.decodeSpecs("fill:pref")),
                buttonBar);
        ((FormLayout) buttonBar.getLayout()).setColumnGroups(new int[][] {{3, 5}});

        buttonBarBuilder.add(okButton, cc.xy(3, 1));
        buttonBarBuilder.add(cancelButton, cc.xy(5, 1));
      }
      dialogPane.add(buttonBar, BorderLayout.SOUTH);
    }
    contentPane.add(dialogPane, BorderLayout.CENTER);
    pack();
    setLocationRelativeTo(getOwner());
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
  }
예제 #14
0
  /** Create the panel. */
  public PayPal() {
    setLayout(
        new FormLayout(
            new ColumnSpec[] {
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("default:grow"),
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("max(87dlu;default)"),
              FormFactory.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("max(78dlu;default):grow"),
              FormFactory.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("left:max(27dlu;default)"),
            },
            new RowSpec[] {
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              RowSpec.decode("max(21dlu;default)"),
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
            }));

    JLabel lblWelcomeToPaypal = new JLabel("ENTER PAYMENT DETAILS ");
    lblWelcomeToPaypal.setFont(new Font("Tahoma", Font.BOLD, 15));
    add(lblWelcomeToPaypal, "6, 4, 5, 1, center, default");

    paymentMessage = new JLabel("");
    add(paymentMessage, "6, 6, 5, 1");

    JLabel lblAgreementNumber = new JLabel("Agreement Number");
    add(lblAgreementNumber, "4, 8, right, default");

    setTextField_9(new JTextField());
    add(getTextField_9(), "6, 8, fill, default");
    getTextField_9().setColumns(10);

    JLabel lblYourTotalBill = new JLabel("Your Total Bill");
    add(lblYourTotalBill, "10, 8, right, default");

    setTextField_8(new JTextField());
    add(getTextField_8(), "12, 8, fill, default");
    getTextField_8().setColumns(10);

    JLabel lblPleaseProvideYour = new JLabel("BILLING ADDRESS");
    lblPleaseProvideYour.setFont(new Font("Tahoma", Font.BOLD, 12));
    add(lblPleaseProvideYour, "6, 12, 5, 1, center, default");

    JLabel lblAdressLine = new JLabel("Adress Line 1");
    add(lblAdressLine, "4, 14, right, default");

    addressLine1 = new JTextField();
    add(addressLine1, "6, 14, fill, default");
    addressLine1.setColumns(10);

    JLabel lblCity = new JLabel("City");
    add(lblCity, "10, 14, right, default");

    city = new JTextField();
    city.setColumns(10);
    add(city, "12, 14, fill, default");

    JLabel lblAddressLine = new JLabel("Address line 2");
    add(lblAddressLine, "4, 16, right, default");

    addressLine2 = new JTextField();
    add(addressLine2, "6, 16, fill, default");
    addressLine2.setColumns(10);

    JLabel lblProvincestate = new JLabel("Province/State Code");
    add(lblProvincestate, "10, 16, right, default");

    province = new JTextField();
    province.setColumns(10);
    add(province, "12, 16, fill, default");

    JLabel lblPostalcode = new JLabel("PostalCode");
    add(lblPostalcode, "4, 18, right, default");

    postalcode = new JTextField();
    postalcode.setColumns(10);
    add(postalcode, "6, 18, fill, default");

    JLabel lblCountry = new JLabel("Country Code");
    add(lblCountry, "10, 18, right, default");

    country = new JTextField();
    country.setColumns(10);
    add(country, "12, 18, fill, default");

    JLabel lblCreditCardDetails = new JLabel("CREDIT CARD DETAILS");
    lblCreditCardDetails.setFont(new Font("Tahoma", Font.BOLD, 12));
    add(lblCreditCardDetails, "6, 22, 5, 1, center, default");

    JLabel lblCreditCardNumber = new JLabel("Credit Card number");
    add(lblCreditCardNumber, "4, 24, right, default");

    creditcardno = new JPasswordField();
    add(creditcardno, "6, 24, fill, default");
    creditcardno.setColumns(10);

    JLabel lblExpiryDate = new JLabel("Expiry Month");
    add(lblExpiryDate, "10, 24, right, default");

    expiryMonth = new JComboBox();
    String months[] = (new DateFormatSymbols()).getMonths();
    expiryMonth.setModel(new DefaultComboBoxModel(months));
    add(expiryMonth, "12, 24, fill, default");

    JLabel lblCardType = new JLabel("Card Type");
    add(lblCardType, "4, 26, right, default");

    cardType = new JComboBox();
    cardType.setModel(
        new DefaultComboBoxModel(new String[] {"Mastercard", "Visa", "American Express"}));
    add(cardType, "6, 26, fill, default");

    JLabel lblExpiryYear = new JLabel("Expiry Year (e.g. 2014)");
    add(lblExpiryYear, "10, 26, right, default");

    expiryYear = new JTextField();
    add(expiryYear, "12, 26, fill, default");
    expiryYear.setColumns(10);

    JLabel lblCvv = new JLabel("CVV");
    add(lblCvv, "4, 28, right, default");

    cvv = new JPasswordField();
    add(cvv, "6, 28, fill, default");
    cvv.setColumns(10);

    JLabel lblNameOnCard = new JLabel("Name on Card (Firstname)");
    add(lblNameOnCard, "10, 28, right, default");

    firstname = new JTextField();
    add(firstname, "12, 28, fill, default");
    firstname.setColumns(10);

    JLabel lblLastname = new JLabel("Lastname");
    add(lblLastname, "10, 30, right, default");

    lastname = new JTextField();
    add(lastname, "12, 30, fill, default");
    lastname.setColumns(10);

    btnProcessPayment = new JButton("Process Payment");
    // btnProcessPayment.addActionListener();
    add(btnProcessPayment, "6, 32, 5, 1, center, default");
  }
  /** Instantiates a new tv show settings panel. */
  public TvShowSettingsPanel() {
    setLayout(
        new FormLayout(
            new ColumnSpec[] {
              FormFactory.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("default:grow"),
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
            },
            new RowSpec[] {
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              RowSpec.decode("default:grow"),
            }));

    {
      JPanel panelTvShowDataSources = new JPanel();

      panelTvShowDataSources.setBorder(
          new TitledBorder(
              null,
              BUNDLE.getString("Settings.tvshowdatasource"),
              TitledBorder.LEADING,
              TitledBorder.TOP,
              null,
              null)); //$NON-NLS-1$
      add(panelTvShowDataSources, "2, 2, fill, top");
      panelTvShowDataSources.setLayout(
          new FormLayout(
              new ColumnSpec[] {
                FormFactory.RELATED_GAP_COLSPEC,
                FormFactory.DEFAULT_COLSPEC,
                FormFactory.RELATED_GAP_COLSPEC,
                ColumnSpec.decode("max(40dlu;default)"),
                FormFactory.RELATED_GAP_COLSPEC,
                ColumnSpec.decode("max(44dlu;default):grow"),
                FormFactory.RELATED_GAP_COLSPEC,
                FormFactory.DEFAULT_COLSPEC,
                FormFactory.RELATED_GAP_COLSPEC,
              },
              new RowSpec[] {
                FormFactory.RELATED_GAP_ROWSPEC,
                RowSpec.decode("160px:grow"),
                FormFactory.RELATED_GAP_ROWSPEC,
                FormFactory.DEFAULT_ROWSPEC,
                FormFactory.RELATED_GAP_ROWSPEC,
                FormFactory.DEFAULT_ROWSPEC,
                FormFactory.RELATED_GAP_ROWSPEC,
              }));

      JScrollPane scrollPane = new JScrollPane();
      panelTvShowDataSources.add(scrollPane, "2, 2, 5, 1, fill, fill");

      tableTvShowSources = new JTable();
      tableTvShowSources.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
      scrollPane.setViewportView(tableTvShowSources);

      JPanel panelTvShowSourcesButtons = new JPanel();
      panelTvShowDataSources.add(panelTvShowSourcesButtons, "8, 2, default, top");
      panelTvShowSourcesButtons.setLayout(
          new FormLayout(
              new ColumnSpec[] {
                FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC,
              },
              new RowSpec[] {
                FormFactory.DEFAULT_ROWSPEC,
                FormFactory.RELATED_GAP_ROWSPEC,
                FormFactory.DEFAULT_ROWSPEC,
              }));

      JButton btnAdd = new JButton(BUNDLE.getString("Button.add")); // $NON-NLS-1$
      btnAdd.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
              File file =
                  TmmUIHelper.selectDirectory(
                      BUNDLE.getString("Settings.tvshowdatasource.folderchooser")); // $NON-NLS-1$
              if (file != null && file.exists() && file.isDirectory()) {
                settings.getTvShowSettings().addTvShowDataSources(file.getAbsolutePath());
              }
            }
          });

      panelTvShowSourcesButtons.add(btnAdd, "2, 1, fill, top");

      JButton btnRemove = new JButton(BUNDLE.getString("Button.remove")); // $NON-NLS-1$
      btnRemove.addActionListener(
          new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent arg0) {
              int row =
                  tableTvShowSources.convertRowIndexToModel(tableTvShowSources.getSelectedRow());
              if (row != -1) { // nothing selected
                String path = Globals.settings.getTvShowSettings().getTvShowDataSource().get(row);
                String[] choices = {
                  BUNDLE.getString("Button.continue"), BUNDLE.getString("Button.abort")
                }; //$NON-NLS-1$
                int decision =
                    JOptionPane.showOptionDialog(
                        null,
                        String.format(
                            BUNDLE.getString("Settings.tvshowdatasource.remove.info"), path),
                        BUNDLE.getString("Settings.datasource.remove"),
                        JOptionPane.YES_NO_OPTION,
                        JOptionPane.PLAIN_MESSAGE,
                        null,
                        choices,
                        BUNDLE.getString("Button.abort")); // $NON-NLS-1$
                if (decision == 0) {
                  setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                  Globals.settings.getTvShowSettings().removeTvShowDataSources(path);
                  setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
                }
              }
            }
          });
      panelTvShowSourcesButtons.add(btnRemove, "2, 3, fill, top");

      JLabel lblDvdOrder = new JLabel(BUNDLE.getString("Settings.dvdorder")); // $NON-NLS-1$
      panelTvShowDataSources.add(lblDvdOrder, "2, 4, right, default");

      cbDvdOrder = new JCheckBox("");
      panelTvShowDataSources.add(cbDvdOrder, "4, 4");

      lblImageCache = new JLabel(BUNDLE.getString("Settings.imagecacheimport")); // $NON-NLS-1$
      panelTvShowDataSources.add(lblImageCache, "2, 6, right, default");

      chckbxImageCache = new JCheckBox("");
      panelTvShowDataSources.add(chckbxImageCache, "4, 6");

      lblImageCacheHint =
          new JLabel(BUNDLE.getString("Settings.imagecacheimporthint")); // $NON-NLS-1$
      TmmFontHelper.changeFont(lblImageCacheHint, 0.833);
      panelTvShowDataSources.add(lblImageCacheHint, "6, 6, 3, 1");
    }

    JPanel panel = new JPanel();
    add(panel, "2, 4, fill, fill");
    panel.setLayout(
        new FormLayout(
            new ColumnSpec[] {
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
            },
            new RowSpec[] {
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
            }));

    JLabel lblTraktTv = new JLabel(BUNDLE.getString("Settings.trakt")); // $NON-NLS-1$
    panel.add(lblTraktTv, "2, 2");

    chckbxTraktTv = new JCheckBox("");
    panel.add(chckbxTraktTv, "4, 2");
    btnClearTraktTvShows =
        new JButton(BUNDLE.getString("Settings.trakt.cleartvshows")); // $NON-NLS-1$
    btnClearTraktTvShows.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            int confirm =
                JOptionPane.showOptionDialog(
                    null,
                    BUNDLE.getString("Settings.trakt.cleartvshows.hint"),
                    BUNDLE.getString("Settings.trakt.cleartvshows"),
                    JOptionPane.YES_NO_OPTION,
                    JOptionPane.QUESTION_MESSAGE,
                    null,
                    null,
                    null); //$NON-NLS-1$
            if (confirm == JOptionPane.YES_OPTION) {
              TmmTask task = new ClearTraktTvTask(false, true);
              TmmTaskManager.getInstance().addUnnamedTask(task);
            }
          }
        });
    panel.add(btnClearTraktTvShows, "6, 2");

    initDataBindings();

    // column headings
    tableTvShowSources
        .getColumnModel()
        .getColumn(0)
        .setHeaderValue(BUNDLE.getString("Settings.source")); // $NON-NLS-1$

    if (!Globals.isDonator()) {
      chckbxTraktTv.setSelected(false);
      chckbxTraktTv.setEnabled(false);
      btnClearTraktTvShows.setEnabled(false);
    }
  }
예제 #16
0
  /** Main function for building the merge entry JPanel */
  private void initialize() {

    joint = new TreeSet<>(one.getFieldNames());
    joint.addAll(two.getFieldNames());

    // Remove field starting with __
    TreeSet<String> toberemoved = new TreeSet<>();
    for (String field : joint) {
      if (field.startsWith("__")) {
        toberemoved.add(field);
      }
    }

    for (String field : toberemoved) {
      joint.remove(field);
    }

    // Create storage arrays
    rb = new JRadioButton[3][joint.size() + 1];
    ButtonGroup[] rbg = new ButtonGroup[joint.size() + 1];
    identical = new Boolean[joint.size() + 1];
    jointStrings = new String[joint.size()];

    // Create main layout
    String colSpecMain =
        "left:pref, 5px, center:3cm:grow, 5px, center:pref, 3px, center:pref, 3px, center:pref, 5px, center:3cm:grow";
    String colSpecMerge =
        "left:pref, 5px, fill:3cm:grow, 5px, center:pref, 3px, center:pref, 3px, center:pref, 5px, fill:3cm:grow";
    String rowSpec = "pref, pref, 10px, fill:5cm:grow, 10px, pref, 10px, fill:3cm:grow";
    StringBuilder rowBuilder = new StringBuilder("");
    for (int i = 0; i < joint.size(); i++) {
      rowBuilder.append("pref, ");
    }
    rowBuilder.append("pref");

    FormLayout mainLayout = new FormLayout(colSpecMain, rowSpec);
    FormLayout mergeLayout = new FormLayout(colSpecMerge, rowBuilder.toString());
    mainPanel.setLayout(mainLayout);
    mergePanel.setLayout(mergeLayout);

    JLabel label = new JLabel(Localization.lang("Use"));
    Font font = label.getFont();
    label.setFont(font.deriveFont(font.getStyle() | Font.BOLD));

    mainPanel.add(label, cc.xyw(4, 1, 7, "center, bottom"));

    // Set headings
    JLabel headingLabels[] = new JLabel[6];
    for (int i = 0; i < 6; i++) {
      headingLabels[i] = new JLabel(columnHeadings[i]);
      font = headingLabels[i].getFont();
      headingLabels[i].setFont(font.deriveFont(font.getStyle() | Font.BOLD));
      mainPanel.add(headingLabels[i], cc.xy(1 + (i * 2), 2));
    }

    mainPanel.add(new JSeparator(), cc.xyw(1, 3, 11));

    // Start with entry type
    EntryType type1 = one.getType();
    EntryType type2 = two.getType();

    mergedEntry.setType(type1);
    label = new JLabel(Localization.lang("Entry type"));
    font = label.getFont();
    label.setFont(font.deriveFont(font.getStyle() | Font.BOLD));
    mergePanel.add(label, cc.xy(1, 1));

    JTextArea type1ta = new JTextArea(type1.getName());
    type1ta.setEditable(false);
    mergePanel.add(type1ta, cc.xy(3, 1));
    if (type1.compareTo(type2) != 0) {
      identical[0] = false;
      rbg[0] = new ButtonGroup();
      for (int k = 0; k < 3; k += 2) {
        rb[k][0] = new JRadioButton();
        rbg[0].add(rb[k][0]);
        mergePanel.add(rb[k][0], cc.xy(5 + (k * 2), 1));
        rb[k][0].addChangeListener(
            new ChangeListener() {

              @Override
              public void stateChanged(ChangeEvent e) {
                updateAll();
              }
            });
      }
      rb[0][0].setSelected(true);
    } else {
      identical[0] = true;
    }
    JTextArea type2ta = new JTextArea(type2.getName());
    type2ta.setEditable(false);
    mergePanel.add(type2ta, cc.xy(11, 1));

    // For all fields in joint add a row and possibly radio buttons
    int row = 2;
    int maxLabelWidth = -1;
    int tmpLabelWidth = 0;
    for (String field : joint) {
      jointStrings[row - 2] = field;
      label = new JLabel(CaseChangers.UPPER_FIRST.format(field));
      font = label.getFont();
      label.setFont(font.deriveFont(font.getStyle() | Font.BOLD));
      mergePanel.add(label, cc.xy(1, row));
      String string1 = one.getField(field);
      String string2 = two.getField(field);
      identical[row - 1] = false;
      if ((string1 != null) && (string2 != null)) {
        if (string1.equals(string2)) {
          identical[row - 1] = true;
        }
      }

      tmpLabelWidth = label.getPreferredSize().width;
      if (tmpLabelWidth > maxLabelWidth) {
        maxLabelWidth = tmpLabelWidth;
      }

      if ("abstract".equals(field) || "review".equals(field)) {
        // Treat the abstract and review fields special
        JTextArea tf = new JTextArea();
        tf.setLineWrap(true);
        tf.setEditable(false);
        JScrollPane jsptf = new JScrollPane(tf);

        mergeLayout.setRowSpec(row, RowSpec.decode("center:2cm:grow"));
        mergePanel.add(jsptf, cc.xy(3, row, "f, f"));
        tf.setText(string1);
        tf.setCaretPosition(0);

      } else {
        JTextArea tf = new JTextArea(string1);
        mergePanel.add(tf, cc.xy(3, row));
        tf.setCaretPosition(0);
        tf.setEditable(false);
      }

      // Add radio buttons if the two entries do not have identical fields
      if (!identical[row - 1]) {
        rbg[row - 1] = new ButtonGroup();
        for (int k = 0; k < 3; k++) {
          rb[k][row - 1] = new JRadioButton();
          rbg[row - 1].add(rb[k][row - 1]);
          mergePanel.add(rb[k][row - 1], cc.xy(5 + (k * 2), row));
          rb[k][row - 1].addChangeListener(
              new ChangeListener() {

                @Override
                public void stateChanged(ChangeEvent e) {
                  updateAll();
                }
              });
        }
        if (string1 != null) {
          mergedEntry.setField(field, string1);
          rb[0][row - 1].setSelected(true);
          if (string2 == null) {
            rb[2][row - 1].setEnabled(false);
          }
        } else {
          rb[0][row - 1].setEnabled(false);
          mergedEntry.setField(field, string2);
          rb[2][row - 1].setSelected(true);
        }
      } else {
        mergedEntry.setField(field, string1);
      }
      if ("abstract".equals(field) || "review".equals(field)) {
        // Again, treat abstract and review special
        JTextArea tf = new JTextArea();
        tf.setLineWrap(true);
        tf.setEditable(false);
        JScrollPane jsptf = new JScrollPane(tf);

        mergePanel.add(jsptf, cc.xy(11, row, "f, f"));
        tf.setText(string2);
        tf.setCaretPosition(0);

      } else {
        JTextArea tf = new JTextArea(string2);
        mergePanel.add(tf, cc.xy(11, row));
        tf.setCaretPosition(0);
        tf.setEditable(false);
      }

      row++;
    }

    JScrollPane scrollPane =
        new JScrollPane(
            mergePanel,
            JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.setBorder(BorderFactory.createEmptyBorder());
    mainPanel.add(scrollPane, cc.xyw(1, 4, 11));
    mainPanel.add(new JSeparator(), cc.xyw(1, 5, 11));

    // Synchronize column widths
    String rbAlign[] = {"right", "center", "left"};
    mainLayout.setColumnSpec(1, ColumnSpec.decode(Integer.toString(maxLabelWidth) + "px"));
    Integer maxRBWidth = -1;
    Integer tmpRBWidth;
    for (int k = 0; k < 3; k++) {
      tmpRBWidth = headingLabels[k + 2].getPreferredSize().width;
      if (tmpRBWidth > maxRBWidth) {
        maxRBWidth = tmpRBWidth;
      }
    }
    for (int k = 0; k < 3; k++) {
      mergeLayout.setColumnSpec(
          5 + (k * 2), ColumnSpec.decode(rbAlign[k] + ":" + maxRBWidth + "px"));
    }

    // Setup a PreviewPanel and a Bibtex source box for the merged entry
    label = new JLabel(Localization.lang("Merged entry"));
    font = label.getFont();
    label.setFont(font.deriveFont(font.getStyle() | Font.BOLD));
    mainPanel.add(label, cc.xyw(1, 6, 6));

    String layoutString = Globals.prefs.get(JabRefPreferences.PREVIEW_0);
    pp = new PreviewPanel(null, mergedEntry, null, new MetaData(), layoutString);
    // JScrollPane jsppp = new JScrollPane(pp, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
    // JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    mainPanel.add(pp, cc.xyw(1, 8, 6));

    label = new JLabel(Localization.lang("Merged BibTeX source code"));
    font = label.getFont();
    label.setFont(font.deriveFont(font.getStyle() | Font.BOLD));
    mainPanel.add(label, cc.xyw(8, 6, 4));

    jta = new JTextArea();
    jta.setLineWrap(true);
    JScrollPane jspta = new JScrollPane(jta);
    mainPanel.add(jspta, cc.xyw(8, 8, 4));
    jta.setEditable(false);
    StringWriter sw = new StringWriter();
    try {
      new BibtexEntryWriter(new LatexFieldFormatter(), false).write(mergedEntry, sw);
    } catch (IOException ex) {
      LOGGER.error("Error in entry" + ": " + ex.getMessage(), ex);
    }
    jta.setText(sw.getBuffer().toString());
    jta.setCaretPosition(0);

    // Add some margin around the layout
    mainLayout.appendRow(RowSpec.decode("10px"));
    mainLayout.appendColumn(ColumnSpec.decode("10px"));
    mainLayout.insertRow(1, RowSpec.decode("10px"));
    mainLayout.insertColumn(1, ColumnSpec.decode("10px"));

    if (mainPanel.getHeight() > DIM.height) {
      mainPanel.setSize(new Dimension(mergePanel.getWidth(), DIM.height));
    }
    if (mainPanel.getWidth() > DIM.width) {
      mainPanel.setSize(new Dimension(DIM.width, mergePanel.getHeight()));
    }

    // Everything done, allow any action to actually update the merged entry
    doneBuilding = true;

    // Show what we've got
    mainPanel.setVisible(true);
    javax.swing.SwingUtilities.invokeLater(
        new Runnable() {
          @Override
          public void run() {
            scrollPane.getVerticalScrollBar().setValue(0);
          }
        });
  }
예제 #17
0
  /**
   * Creates the dialog.
   *
   * @param main
   */
  public NewGameDialog(MainInterfaceForDialogs main) {
    this.main = main;

    setTitle("Let's get drunk");
    setBounds(100, 100, 450, 300);
    getContentPane().setLayout(new BorderLayout());
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.NORTH);
    contentPanel.setLayout(
        new FormLayout(
            new ColumnSpec[] {
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("default:grow"),
              FormFactory.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("default:grow"),
              FormFactory.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("default:grow"),
            },
            new RowSpec[] {
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              RowSpec.decode("default:grow"),
              FormFactory.RELATED_GAP_ROWSPEC,
              RowSpec.decode("default:grow"),
            }));
    {
      JLabel lblName = new JLabel("Name:");
      contentPanel.add(lblName, "6, 4, left, default");
    }
    {
      name = new JTextField();
      name.addKeyListener(
          new KeyAdapter() {
            @Override
            public void keyReleased(KeyEvent e) {
              checkIfOK();
            }
          });
      contentPanel.add(name, "8, 4, left, default");
      name.setColumns(15);
    }
    {
      JLabel lblSex = new JLabel("Sex:");
      contentPanel.add(lblSex, "6, 6");
    }
    {
      ButtonGroup sex = new ButtonGroup();

      rdbtnMale.addMouseListener(
          new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent arg0) {
              checkIfOK();
            }
          });
      contentPanel.add(rdbtnMale, "8, 6");

      rdbtnFemale.addMouseListener(
          new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent arg0) {
              JOptionPane.showMessageDialog(
                  null, "Looking for a real man? I'd check the coderteam right away!");
              checkIfOK();
            }
          });
      contentPanel.add(rdbtnFemale, "8, 8");

      sex.add(rdbtnMale);
      sex.add(rdbtnFemale);
    }
    {
      JLabel lblNewLabel = new JLabel("Height:");
      contentPanel.add(lblNewLabel, "6, 10, left, default");
    }
    {
      JPanel panel = new JPanel();
      contentPanel.add(panel, "8, 10, left, default");
      panel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
      {
        height = new JTextField();
        height.addKeyListener(
            new KeyAdapter() {
              @Override
              public void keyReleased(KeyEvent e) {
                if (height.getText().matches("[1-2][0-9][0-9]"))
                  if (Integer.parseInt(height.getText()) > 190)
                    JOptionPane.showMessageDialog(null, "Have you considered playing basketball?");
                checkIfOK();
              }
            });
        height.setHorizontalAlignment(SwingConstants.RIGHT);
        height.setPreferredSize(new Dimension(5, 20));
        height.setMinimumSize(new Dimension(5, 20));
        panel.add(height);
        height.setColumns(3);
      }
      {
        JLabel lblCm = new JLabel("cm");
        panel.add(lblCm);
      }
    }
    {
      JLabel lblWeight = new JLabel("Weight:");
      contentPanel.add(lblWeight, "6, 12, right, default");
    }
    {
      JPanel panel = new JPanel();
      contentPanel.add(panel, "8, 12, left, fill");
      panel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
      {
        weight = new JTextField();
        weight.addKeyListener(
            new KeyAdapter() {
              @Override
              public void keyReleased(KeyEvent e) {
                if (weight.getText().matches("[1-2]?[0-9][0-9]"))
                  if (Integer.parseInt(weight.getText()) > 100)
                    JOptionPane.showMessageDialog(
                        null, "A little workout now and then shouldn't heart that much.");
                checkIfOK();
              }
            });
        weight.setHorizontalAlignment(SwingConstants.RIGHT);
        panel.add(weight);
        weight.setColumns(3);
      }
      {
        JLabel lblKg = new JLabel("kg");
        panel.add(lblKg);
      }
    }
    {
      JPanel buttonPane = new JPanel();
      buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
      getContentPane().add(buttonPane, BorderLayout.SOUTH);
      {
        okButton.setAction(new OkAction(this, this.main));
        okButton.setEnabled(false);
        okButton.setActionCommand("OK");
        buttonPane.add(okButton);
        getRootPane().setDefaultButton(okButton);
      }
      {
        JButton cancelButton = new JButton("Cancel");
        cancelButton.setAction(new CancelAction(this));
        cancelButton.setActionCommand("Cancel");
        buttonPane.add(cancelButton);
      }
    }
  }
예제 #18
0
 /** Create the dialog. */
 public ResizeSelectGUI() {
   addWindowListener(
       new WindowAdapter() {
         public void windowClosing(WindowEvent e) {
           result = "";
           dispose();
         }
       });
   setResizable(false);
   setModalityType(ModalityType.APPLICATION_MODAL);
   setTitle("Unit resize");
   setBounds(100, 100, 187, 132);
   getContentPane()
       .setLayout(
           new FormLayout(
               new ColumnSpec[] {
                 FormFactory.RELATED_GAP_COLSPEC,
                 FormFactory.RELATED_GAP_COLSPEC,
                 FormFactory.DEFAULT_COLSPEC,
                 FormFactory.RELATED_GAP_COLSPEC,
                 ColumnSpec.decode("max(91dlu;default)"),
                 FormFactory.RELATED_GAP_COLSPEC,
                 FormFactory.RELATED_GAP_COLSPEC,
               },
               new RowSpec[] {
                 FormFactory.RELATED_GAP_ROWSPEC,
                 FormFactory.RELATED_GAP_ROWSPEC,
                 FormFactory.DEFAULT_ROWSPEC,
                 FormFactory.RELATED_GAP_ROWSPEC,
                 RowSpec.decode("32px"),
                 RowSpec.decode("33px"),
               }));
   {
     lblNewLabel = new JLabel("Enter new size");
     getContentPane().add(lblNewLabel, "3, 3, 3, 1");
   }
   {
     textField = new JTextField();
     getContentPane().add(textField, "3, 5, 3, 1, fill, default");
     textField.setColumns(10);
   }
   {
     JPanel buttonPane = new JPanel();
     buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
     getContentPane().add(buttonPane, "1, 6, 5, 1, fill, top");
     {
       okButton = new JButton("OK");
       okButton.addActionListener(
           new ActionListener() {
             public void actionPerformed(ActionEvent arg0) {
               try {
                 int resultint = Integer.parseInt(textField.getText());
                 if (textField.getText().length() > 0) {
                   result = textField.getText();
                   dispose();
                 } else {
                   AskBox.showOKbox("You must enter a value. Otherwise, cancel");
                 }
               } catch (Exception e) {
                 AskBox.showOKbox("Size must be an integer");
               }
             }
           });
       okButton.setActionCommand("OK");
       buttonPane.add(okButton);
       getRootPane().setDefaultButton(okButton);
     }
     {
       cancelButton = new JButton("Cancel");
       cancelButton.addActionListener(
           new ActionListener() {
             public void actionPerformed(ActionEvent e) {
               result = "";
               dispose();
             }
           });
       cancelButton.setActionCommand("Cancel");
       buttonPane.add(cancelButton);
     }
   }
 }
예제 #19
0
  /** Create the dialog. */
  public TaEditor(X10flash flash, Vector<TaEntry> v) {
    _flash = flash;
    setModalityType(ModalityType.APPLICATION_MODAL);
    setTitle("TA Editor");
    setBounds(100, 100, 715, 450);
    getContentPane().setLayout(new BorderLayout());
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.CENTER);
    contentPanel.setLayout(
        new FormLayout(
            new ColumnSpec[] {
              FormFactory.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("max(63dlu;min)"),
              FormFactory.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("default:grow"),
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
            },
            new RowSpec[] {
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              RowSpec.decode("default:grow"),
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              RowSpec.decode("default:grow"),
            }));
    {
      JScrollPane scrollPane = new JScrollPane();
      contentPanel.add(scrollPane, "2, 2, 1, 7, fill, fill");
      {
        tablePartition =
            new JTable() {
              /** */
              private static final long serialVersionUID = 1L;

              public boolean isCellEditable(int rowIndex, int vColIndex) {
                return false;
              }
            };
        tablePartition.addKeyListener(
            new KeyAdapter() {
              @Override
              public void keyReleased(KeyEvent arg0) {
                reloadUnit();
              }
            });
        tablePartition.addMouseListener(
            new MouseAdapter() {
              @Override
              public void mouseReleased(MouseEvent arg0) {
                String result =
                    (String) modelPartition.getValueAt(tablePartition.getSelectedRow(), 0);
                try {
                  if (ta != null) ta.setData(hex.getByteContent());
                  ta = (TaEntry) content.get(result);
                  hex.setByteContent(ta.getDataString().getBytes());
                } catch (Exception e) {
                }
              }
            });
        JMenuItem mntmResize = new JMenuItem("Resize Unit");
        mntmResize.addActionListener(
            new ActionListener() {
              public void actionPerformed(ActionEvent arg0) {
                TAUnitResizeGUI resize = new TAUnitResizeGUI();
                String newsize = resize.getUnitSize();
                if (newsize.length() > 0) {
                  ta.resize(Integer.parseInt(newsize));
                  hex.setByteContent(ta.getDataString().getBytes());
                }
              }
            });
        popupMenu.add(mntmResize);
        JMenuItem mntmLoad = new JMenuItem("Load from file");
        mntmLoad.addActionListener(
            new ActionListener() {
              public void actionPerformed(ActionEvent arg0) {
                TaSelectGUI tasel =
                    new TaSelectGUI(
                        ".bin",
                        _flash.getPhoneProperty("MSN")
                            + "_"
                            + (String)
                                modelPartition.getValueAt(tablePartition.getSelectedRow(), 0));
                String result = tasel.getTa();
                if (result.length() > 0) {
                  String path = OS.getWorkDir() + "/custom/ta/" + result;
                  try {
                    byte[] array = BytesUtil.getBytesFromFile(new File(path));
                    ta.setData(array);
                    hex.setByteContent(array);
                  } catch (Exception e) {
                    MyLogger.getLogger().error(e.getMessage());
                  }
                }
              }
            });
        popupMenu.add(mntmLoad);
        JMenuItem mntmWriteFile = new JMenuItem("Write to file");
        mntmWriteFile.addActionListener(
            new ActionListener() {
              public void actionPerformed(ActionEvent arg0) {
                String rootpath = OS.getWorkDir() + "/custom/ta/";
                String path =
                    _flash.getPhoneProperty("MSN")
                        + "_"
                        + (String) modelPartition.getValueAt(tablePartition.getSelectedRow(), 0)
                        + "-"
                        + org.logger.TextAreaAppender.timestamp
                        + ".bin";
                File f = new File(rootpath + path);
                try {
                  FileOutputStream fos = new FileOutputStream(f);
                  fos.write(hex.getByteContent());
                  fos.flush();
                  fos.close();
                  JOptionPane.showMessageDialog(null, "Unit saved to \n" + path);
                } catch (Exception e) {
                }
              }
            });
        popupMenu.add(mntmWriteFile);
        JMenuItem mntmWrite = new JMenuItem("Write to phone");
        mntmWrite.addActionListener(
            new ActionListener() {
              public void actionPerformed(ActionEvent arg0) {
                reloadUnit();
                try {
                  _flash.sendTAUnit(ta);
                } catch (Exception e) {
                  MyLogger.getLogger().error(e.getMessage());
                }
              }
            });
        popupMenu.add(mntmWrite);
        MouseListener popupListener = new PopupListener();
        tablePartition.addMouseListener(popupListener);
        tablePartition.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        scrollPane.setViewportView(tablePartition);
      }
    }
    {
      JPanel buttonPane = new JPanel();
      buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
      getContentPane().add(buttonPane, BorderLayout.SOUTH);
      {
        JButton cancelButton = new JButton("Close");
        cancelButton.addActionListener(
            new ActionListener() {
              public void actionPerformed(ActionEvent arg0) {
                dispose();
              }
            });
        cancelButton.setActionCommand("Cancel");
        buttonPane.add(cancelButton);
      }
    }
    contentPanel.add(hex, "4, 2, 1, 7");
    hex.setColorBorderBackGround(Color.LIGHT_GRAY);
    {
      JMenuBar menuBar = new JMenuBar();
      setJMenuBar(menuBar);
      {
        JMenu mnFile = new JMenu("File");
        menuBar.add(mnFile);
        {
          JMenuItem mntmLoad_1 = new JMenuItem("Load");
          mntmLoad_1.addActionListener(
              new ActionListener() {
                public void actionPerformed(ActionEvent arg0) {
                  TaSelectGUI tasel = new TaSelectGUI(".ta", _flash.getPhoneProperty("MSN"));
                  String result = tasel.getTa();
                  if (result.length() > 0) {
                    String tafile = OS.getWorkDir() + "/custom/ta/" + result;
                    try {
                      TaFile ta = new TaFile(new FileInputStream(new File(tafile)));
                      Vector<TaEntry> entries = ta.entries();
                      fill(entries);
                    } catch (Exception e1) {
                    }
                  }
                }
              });
          mnFile.add(mntmLoad_1);
        }
        {
          JMenuItem mntmSave = new JMenuItem("Save");
          mntmSave.addActionListener(
              new ActionListener() {
                public void actionPerformed(ActionEvent arg0) {
                  try {
                    String rootpath = OS.getWorkDir() + "/custom/ta/";
                    String path =
                        _flash.getPhoneProperty("MSN")
                            + "-"
                            + org.logger.TextAreaAppender.timestamp
                            + ".ta";
                    TextFile tazone = new TextFile(rootpath + path, "ISO8859-1");
                    tazone.open(false);
                    Iterator i = content.values().iterator();
                    while (i.hasNext()) {
                      tazone.writeln(i.next().toString());
                    }
                    tazone.close();
                    JOptionPane.showMessageDialog(null, "TA saved to \n" + path);
                  } catch (Exception e) {
                    MyLogger.getLogger().error(e.getMessage());
                  }
                }
              });
          mnFile.add(mntmSave);
        }
      }
    }
    fill(v);
  }
예제 #20
0
 /** Create the dialog. */
 public ElfUnpacker() {
   setTitle("ELF Unpacker");
   setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
   setBounds(100, 100, 450, 220);
   getContentPane().setLayout(new BorderLayout());
   contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
   getContentPane().add(contentPanel, BorderLayout.CENTER);
   contentPanel.setLayout(
       new FormLayout(
           new ColumnSpec[] {
             FormFactory.RELATED_GAP_COLSPEC,
             ColumnSpec.decode("default:grow"),
             FormFactory.RELATED_GAP_COLSPEC,
             ColumnSpec.decode("default:grow"),
             FormFactory.RELATED_GAP_COLSPEC,
             FormFactory.DEFAULT_COLSPEC,
           },
           new RowSpec[] {
             FormFactory.RELATED_GAP_ROWSPEC,
             FormFactory.DEFAULT_ROWSPEC,
             FormFactory.RELATED_GAP_ROWSPEC,
             FormFactory.DEFAULT_ROWSPEC,
             FormFactory.RELATED_GAP_ROWSPEC,
             FormFactory.DEFAULT_ROWSPEC,
             FormFactory.RELATED_GAP_ROWSPEC,
             FormFactory.DEFAULT_ROWSPEC,
             FormFactory.RELATED_GAP_ROWSPEC,
             FormFactory.DEFAULT_ROWSPEC,
           }));
   {
     JLabel lblElfFile = new JLabel("Elf File :");
     contentPanel.add(lblElfFile, "2, 2, 3, 1");
   }
   {
     textElf = new JTextField();
     contentPanel.add(textElf, "2, 4, 3, 1, fill, default");
     textElf.setColumns(10);
   }
   {
     JButton button = new JButton("...");
     button.addActionListener(
         new ActionListener() {
           public void actionPerformed(ActionEvent arg0) {
             String file = chooseElf();
             if (!file.equals("ERROR")) {
               try {
                 if (file.toLowerCase().endsWith("sin")) {
                   SinFile sin = new SinFile(file);
                   if (sin.getIdent().equals("elf")) {
                     sin.dumpImage();
                     file = sin.getImage();
                     elf = new ElfParser(sin.getImage());
                     textElf.setText(file);
                     textParts.setText(Integer.toString(elf.getNbParts()));
                     btnDumpData.setEnabled(true);
                   } else {
                     textElf.setText("");
                     textParts.setText("");
                     btnDumpData.setEnabled(false);
                     MyLogger.getLogger().error(sin.getFile() + " does not contain elf data");
                   }
                 } else {
                   elf = new ElfParser(file);
                   textElf.setText(file);
                   textParts.setText(Integer.toString(elf.getNbParts()));
                   btnDumpData.setEnabled(true);
                 }
               } catch (Exception e) {
                 e.printStackTrace();
               }
             }
           }
         });
     contentPanel.add(button, "6, 4");
   }
   {
     JLabel lblPartitionInfo = new JLabel("Number of parts :");
     contentPanel.add(lblPartitionInfo, "2, 6, 3, 1");
   }
   {
     textParts = new JTextField();
     contentPanel.add(textParts, "2, 8, 3, 1, fill, default");
     textParts.setColumns(10);
   }
   {
     btnDumpData = new JButton("Unpack");
     btnDumpData.addActionListener(
         new ActionListener() {
           public void actionPerformed(ActionEvent arg0) {
             try {
               elf.unpack();
             } catch (Exception e) {
               MyLogger.getLogger().error(e.getMessage());
             }
           }
         });
     btnDumpData.setEnabled(false);
     contentPanel.add(btnDumpData, "2, 10, center, center");
   }
   {
     JPanel buttonPane = new JPanel();
     buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
     getContentPane().add(buttonPane, BorderLayout.SOUTH);
     {
       JButton okButton = new JButton("Close");
       okButton.addActionListener(
           new ActionListener() {
             public void actionPerformed(ActionEvent arg0) {
               dispose();
             }
           });
       okButton.setActionCommand("OK");
       buttonPane.add(okButton);
       getRootPane().setDefaultButton(okButton);
     }
   }
 }
예제 #21
0
  /** Wielka litania do Pana naszego Swing'a. */
  private void createGUI() {
    GridBagLayout gridBagLayout = new GridBagLayout();
    gridBagLayout.columnWidths = new int[] {0, 0, 0, 0, 0};
    gridBagLayout.rowHeights = new int[] {0, 0, 0, 0};
    gridBagLayout.columnWeights = new double[] {1.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
    gridBagLayout.rowWeights = new double[] {0.0, 1.0, 0.0, Double.MIN_VALUE};
    setLayout(gridBagLayout);

    cBox_accountList = new JComboBox<String>();
    GridBagConstraints gbc_cBox_accountList = new GridBagConstraints();
    gbc_cBox_accountList.fill = GridBagConstraints.HORIZONTAL;
    gbc_cBox_accountList.insets = new Insets(0, 0, 5, 5);
    gbc_cBox_accountList.gridx = 0;
    gbc_cBox_accountList.gridy = 0;
    add(cBox_accountList, gbc_cBox_accountList);

    cBox_accountList.addActionListener(this);

    btn_edit = new JButton("Edytuj");
    GridBagConstraints gbc_btn_edit = new GridBagConstraints();
    gbc_btn_edit.insets = new Insets(0, 0, 5, 5);
    gbc_btn_edit.gridx = 1;
    gbc_btn_edit.gridy = 0;
    add(btn_edit, gbc_btn_edit);

    btn_rmv = new JButton("Usuń");
    GridBagConstraints gbc_btn_rmv = new GridBagConstraints();
    gbc_btn_rmv.insets = new Insets(0, 0, 5, 5);
    gbc_btn_rmv.gridx = 2;
    gbc_btn_rmv.gridy = 0;
    add(btn_rmv, gbc_btn_rmv);

    btn_add = new JButton("Dodaj");
    GridBagConstraints gbc_btn_add = new GridBagConstraints();
    gbc_btn_add.insets = new Insets(0, 0, 5, 0);
    gbc_btn_add.gridx = 3;
    gbc_btn_add.gridy = 0;
    add(btn_add, gbc_btn_add);

    JPanel panel_accountData = new JPanel();
    GridBagConstraints gbc_panel_accountData = new GridBagConstraints();
    gbc_panel_accountData.insets = new Insets(0, 0, 5, 0);
    gbc_panel_accountData.gridwidth = 4;
    gbc_panel_accountData.fill = GridBagConstraints.BOTH;
    gbc_panel_accountData.gridx = 0;
    gbc_panel_accountData.gridy = 1;
    add(panel_accountData, gbc_panel_accountData);

    panel_accountData.setLayout(
        new FormLayout(
            new ColumnSpec[] {
              FormSpecs.RELATED_GAP_COLSPEC,
              FormSpecs.DEFAULT_COLSPEC,
              FormSpecs.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("default:grow"),
            },
            new RowSpec[] {
              FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
              FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
              FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
              FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
              FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
            }));

    lbl_name = new JLabel("Imię");
    panel_accountData.add(lbl_name, "2, 2, right, default");

    txt_name = new JTextField();
    txt_name.setEditable(false);
    panel_accountData.add(txt_name, "4, 2, fill, default");
    txt_name.setColumns(10);

    lbl_surname = new JLabel("Nazwisko");
    panel_accountData.add(lbl_surname, "2, 4, right, default");

    txt_surname = new JTextField();
    txt_surname.setEditable(false);
    panel_accountData.add(txt_surname, "4, 4, fill, default");
    txt_surname.setColumns(10);

    lbl_password = new JLabel("Hasło");
    panel_accountData.add(lbl_password, "2, 6, right, default");

    lbl_login = new JLabel("Login");
    panel_accountData.add(lbl_login, "2, 8, right, default");

    txt_password = new JTextField();
    txt_password.setEditable(false);
    panel_accountData.add(txt_password, "4, 6, fill, default");
    txt_password.setColumns(10);

    txt_login = new JTextField();
    txt_login.setEditable(false);
    panel_accountData.add(txt_login, "4, 8, fill, default");
    txt_login.setColumns(10);

    lbl_gmail = new JLabel("Gmail");
    panel_accountData.add(lbl_gmail, "2, 10, right, default");

    txt_gmail = new JTextField();
    txt_gmail.setEditable(false);
    panel_accountData.add(txt_gmail, "4, 10, fill, default");
    txt_gmail.setColumns(10);

    btn_add.setActionCommand("add");
    btn_rmv.setActionCommand("rmv");
    btn_edit.setActionCommand("edit");

    btn_add.addActionListener(this);
    btn_rmv.addActionListener(this);
    btn_edit.addActionListener(this);

    lbl_result = new JLabel(actionNumber + "");
    GridBagConstraints gbc_lbl_result = new GridBagConstraints();
    gbc_lbl_result.gridwidth = 4;
    gbc_lbl_result.fill = GridBagConstraints.HORIZONTAL;
    gbc_lbl_result.insets = new Insets(0, 0, 0, 5);
    gbc_lbl_result.gridx = 0;
    gbc_lbl_result.gridy = 2;
    add(lbl_result, gbc_lbl_result);
  }
예제 #22
0
  public UsuarioDialog(UsuarioGerenciador gerenciador, List<Profile> profiles) {
    setTitle("Novo usuario");
    setResizable(false);
    setModal(true);
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);

    this.gerenciador = gerenciador;
    this.profiles = profiles;
    this.usuario = new Usuario();
    this.nomeFl = new JTextField();
    this.senhaFl = new JPasswordField();
    this.cbProfiles = new JComboBox<String>();
    this.btnOK = new JButton("Salvar");
    this.btnCancela = new JButton("Cancelar");

    this.btnOK.addActionListener(this);
    this.btnCancela.addActionListener(this);

    JPanel infoPanel = new JPanel();
    infoPanel.setLayout(
        new FormLayout(
            new ColumnSpec[] {
              FormSpecs.LABEL_COMPONENT_GAP_COLSPEC,
              FormSpecs.DEFAULT_COLSPEC,
              FormSpecs.LABEL_COMPONENT_GAP_COLSPEC,
              ColumnSpec.decode("406px:grow"),
            },
            new RowSpec[] {
              FormSpecs.LINE_GAP_ROWSPEC,
              RowSpec.decode("20px"),
              FormSpecs.RELATED_GAP_ROWSPEC,
              FormSpecs.DEFAULT_ROWSPEC,
              RowSpec.decode("max(9dlu;default)"),
              FormSpecs.RELATED_GAP_ROWSPEC,
              FormSpecs.DEFAULT_ROWSPEC,
            }));

    JPanel buttonPanel = new JPanel();
    buttonPanel.add(this.btnOK);
    buttonPanel.add(this.btnCancela);

    JLabel lblNewLabel = new JLabel("*A senha dever\u00E1 ser trocada no pr\u00F3ximo login.");
    lblNewLabel.setVerticalAlignment(SwingConstants.BOTTOM);
    lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 8));
    lblNewLabel.setForeground(Color.RED);

    infoPanel.add(new JLabel("Nome: "), "2, 2, left, center");
    infoPanel.add(this.nomeFl, "4, 2, fill, default");
    infoPanel.add(new JLabel("Senha:"), "2, 4, right, default");
    infoPanel.add(this.senhaFl, "4, 4, fill, default");
    infoPanel.add(lblNewLabel, "3, 5, 2, 1");
    infoPanel.add(new JLabel("Profile:"), "2, 7, right, default");
    infoPanel.add(cbProfiles, "4, 7, fill, default");

    getContentPane().add(buttonPanel, BorderLayout.SOUTH);
    getContentPane().add(infoPanel, BorderLayout.CENTER);

    this.setCombos();

    pack();

    this.setPreferredSize(new Dimension(456, 155));
    this.setMinimumSize(new Dimension(456, 155));

    this.centerScreen();
  }
예제 #23
0
 /** Create the dialog. */
 public EncDecGUI() {
   setName("EncDecGUI");
   setResizable(false);
   setModal(true);
   setTitle("Decryption wizard");
   setBounds(100, 100, 615, 300);
   getContentPane().setLayout(new BorderLayout());
   contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
   getContentPane().add(contentPanel, BorderLayout.CENTER);
   contentPanel.setLayout(
       new FormLayout(
           new ColumnSpec[] {
             FormFactory.RELATED_GAP_COLSPEC,
             ColumnSpec.decode("50dlu"),
             FormFactory.RELATED_GAP_COLSPEC,
             ColumnSpec.decode("51dlu:grow"),
             FormFactory.RELATED_GAP_COLSPEC,
             ColumnSpec.decode("max(48dlu;default)"),
             FormFactory.RELATED_GAP_COLSPEC,
             ColumnSpec.decode("42dlu"),
             FormFactory.RELATED_GAP_COLSPEC,
             ColumnSpec.decode("53dlu:grow"),
           },
           new RowSpec[] {
             FormFactory.RELATED_GAP_ROWSPEC,
             FormFactory.DEFAULT_ROWSPEC,
             FormFactory.RELATED_GAP_ROWSPEC,
             FormFactory.DEFAULT_ROWSPEC,
             FormFactory.RELATED_GAP_ROWSPEC,
             FormFactory.DEFAULT_ROWSPEC,
             FormFactory.RELATED_GAP_ROWSPEC,
             FormFactory.DEFAULT_ROWSPEC,
             FormFactory.RELATED_GAP_ROWSPEC,
             FormFactory.DEFAULT_ROWSPEC,
             FormFactory.RELATED_GAP_ROWSPEC,
             RowSpec.decode("max(24dlu;default)"),
             FormFactory.RELATED_GAP_ROWSPEC,
             RowSpec.decode("default:grow"),
             FormFactory.RELATED_GAP_ROWSPEC,
             RowSpec.decode("default:grow"),
           }));
   addWindowListener(
       new WindowAdapter() {
         public void windowClosing(WindowEvent e) {
           listToConvertModel.removeAllElements();
           dispose();
         }
       });
   {
     JLabel lblSourceFolder = new JLabel("Source folder :");
     lblSourceFolder.setName("lblSourceFolder");
     contentPanel.add(lblSourceFolder, "2, 2, 3, 1, left, default");
   }
   {
     textField = new JTextField();
     textField.setEditable(false);
     contentPanel.add(textField, "2, 4, 7, 1, fill, default");
     textField.setColumns(10);
   }
   {
     JButton button = new JButton("...");
     button.addActionListener(
         new ActionListener() {
           public void actionPerformed(ActionEvent e) {
             doChoose();
           }
         });
     contentPanel.add(button, "10, 4, right, center");
   }
   {
     JLabel lblFiles = new JLabel("Files");
     lblFiles.setName("lblFiles");
     contentPanel.add(lblFiles, "2, 8, 3, 1, center, default");
   }
   {
     JLabel lblFilesToConvert = new JLabel("Files to convert");
     lblFilesToConvert.setName("lblFilesToConvert");
     contentPanel.add(lblFilesToConvert, "8, 8, 3, 1, center, default");
   }
   {
     JScrollPane scrollPane = new JScrollPane();
     contentPanel.add(scrollPane, "2, 10, 3, 7, fill, fill");
     {
       listFiles = new JList();
       listFiles.setModel(sortedFilesModel);
       scrollPane.setViewportView(listFiles);
     }
   }
   {
     JScrollPane scrollPane = new JScrollPane();
     contentPanel.add(scrollPane, "8, 10, 3, 7, fill, fill");
     {
       listToConvert = new JList();
       listToConvert.setModel(sortedToConvertModel);
       scrollPane.setViewportView(listToConvert);
     }
   }
   {
     JButton button = new JButton("->");
     button.addActionListener(
         new ActionListener() {
           public void actionPerformed(ActionEvent e) {
             Object[] values = listFiles.getSelectedValues();
             for (int i = 0; i < values.length; i++) {
               listToConvertModel.addElement(values[i]);
               listFilesModel.removeElement(values[i]);
             }
           }
         });
     contentPanel.add(button, "6, 12, center, center");
   }
   {
     JButton button = new JButton("<-");
     button.addActionListener(
         new ActionListener() {
           public void actionPerformed(ActionEvent e) {
             Object[] values = listToConvert.getSelectedValues();
             for (int i = 0; i < values.length; i++) {
               listToConvertModel.removeElement(values[i]);
               listFilesModel.addElement(values[i]);
             }
           }
         });
     contentPanel.add(button, "6, 14, center, center");
   }
   {
     JPanel buttonPane = new JPanel();
     buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
     getContentPane().add(buttonPane, BorderLayout.SOUTH);
     {
       JButton okButton = new JButton("OK");
       okButton.setName("okButton");
       okButton.addActionListener(
           new ActionListener() {
             public void actionPerformed(ActionEvent arg0) {
               dispose();
             }
           });
       okButton.setActionCommand("OK");
       buttonPane.add(okButton);
       getRootPane().setDefaultButton(okButton);
     }
     {
       JButton cancelButton = new JButton("Cancel");
       cancelButton.setName("cancelButton");
       cancelButton.addActionListener(
           new ActionListener() {
             public void actionPerformed(ActionEvent arg0) {
               listToConvertModel.removeAllElements();
               dispose();
             }
           });
       cancelButton.setActionCommand("Cancel");
       buttonPane.add(cancelButton);
     }
   }
   setLanguage();
 }
예제 #24
0
  private void initializeGUIComponents() {
    setLayout(
        new FormLayout(
            new ColumnSpec[] {
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("max(37dlu;default):grow"),
              FormFactory.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("default:grow"),
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("default:grow"),
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("max(15dlu;default)"),
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("max(0dlu;default):grow"),
              FormFactory.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("default:grow"),
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
            },
            new RowSpec[] {
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
            }));

    JLabel lblType = new JLabel("Type:");
    add(lblType, "4, 4");

    cbType = new JComboBox<Address>();
    cbType.addActionListener(cbController);
    cbTypeModel = new DefaultComboBoxModel<Address>();
    add(cbType, "6, 4, 7, 1, fill, default");

    JLabel lblStreet = new JLabel("Street 1:");
    add(lblStreet, "6, 6, right, default");

    tfStreet1 = new JTextField();
    tfStreet1.setEditable(false);
    add(tfStreet1, "8, 6, 13, 1, fill, default");
    tfStreet1.setColumns(10);

    JLabel lblStreet_1 = new JLabel("Street 2:");
    add(lblStreet_1, "6, 8, right, default");

    tfStreet2 = new JTextField();
    tfStreet2.setEditable(false);
    add(tfStreet2, "8, 8, 13, 1, fill, default");
    tfStreet2.setColumns(10);

    JLabel lblCity = new JLabel("City:");
    add(lblCity, "6, 10, right, default");

    tfCity = new JTextField();
    tfCity.setEditable(false);
    add(tfCity, "8, 10, 13, 1, fill, top");
    tfCity.setColumns(10);

    JLabel lblZipcode = new JLabel("Zipcode:");
    add(lblZipcode, "6, 12, right, default");

    tfZipcode = new JTextField();
    tfZipcode.setEditable(false);
    add(tfZipcode, "8, 12, 7, 1, fill, top");
    tfZipcode.setColumns(10);

    JButton btnEdit = new JButton("Edit");
    add(btnEdit, "20, 12");
  }
  /**
   * Instantiates a new movie information panel.
   *
   * @param movieSelectionModel the movie selection model
   */
  public MovieInformationPanel(MovieSelectionModel movieSelectionModel) {
    this.movieSelectionModel = movieSelectionModel;

    setLayout(
        new FormLayout(
            new ColumnSpec[] {
              ColumnSpec.decode("450px:grow"),
            },
            new RowSpec[] {
              RowSpec.decode("fill:default:grow"),
            }));

    splitPaneVertical = new JSplitPane();
    splitPaneVertical.setBorder(null);
    splitPaneVertical.setResizeWeight(0.9);
    splitPaneVertical.setContinuousLayout(true);
    splitPaneVertical.setOneTouchExpandable(true);
    splitPaneVertical.setOrientation(JSplitPane.VERTICAL_SPLIT);
    add(splitPaneVertical, "1, 1, fill, fill");

    panelTop = new JPanel();
    panelTop.setBorder(null);
    splitPaneVertical.setTopComponent(panelTop);
    panelTop.setLayout(
        new FormLayout(
            new ColumnSpec[] {
              FormFactory.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("200px:grow"),
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
            },
            new RowSpec[] {
              RowSpec.decode("fill:default"), RowSpec.decode("top:pref:grow"),
            }));

    JPanel panelMovieHeader = new JPanel();
    panelTop.add(panelMovieHeader, "2, 1, 3, 1, fill, top");
    panelMovieHeader.setBorder(null);
    panelMovieHeader.setLayout(new BorderLayout(0, 0));

    JPanel panelMovieTitle = new JPanel();
    panelMovieHeader.add(panelMovieTitle, BorderLayout.NORTH);
    panelMovieTitle.setLayout(new BorderLayout(0, 0));
    lblMovieName = new JLabel("");
    TmmFontHelper.changeFont(lblMovieName, 1.33, Font.BOLD);
    panelMovieTitle.add(lblMovieName);

    JPanel panelRatingTagline = new JPanel();
    panelMovieHeader.add(panelRatingTagline, BorderLayout.CENTER);
    panelRatingTagline.setLayout(
        new FormLayout(
            new ColumnSpec[] {
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.UNRELATED_GAP_COLSPEC,
              ColumnSpec.decode("25px:grow"),
            },
            new RowSpec[] {
              FormFactory.LINE_GAP_ROWSPEC, RowSpec.decode("24px"), FormFactory.DEFAULT_ROWSPEC,
            }));

    lblRating = new JLabel("");
    panelRatingTagline.add(lblRating, "2, 2, left, center");

    lblVoteCount = new JLabel("");
    panelRatingTagline.add(lblVoteCount, "3, 2, left, center");

    panelRatingStars = new StarRater(10, 1);
    panelRatingTagline.add(panelRatingStars, "1, 2, left, top");
    panelRatingStars.setEnabled(false);

    lblTop250 = new JLabel("");
    panelRatingTagline.add(lblTop250, "5, 2, left, default");

    lblTagline = new JLabel();
    panelRatingTagline.add(lblTagline, "1, 3, 5, 1, default, center");

    panelMovieLogos = new JPanel();
    panelMovieHeader.add(panelMovieLogos, BorderLayout.EAST);

    lblCertificationImage = new JLabel();
    panelMovieLogos.add(lblCertificationImage);

    JLayeredPane layeredPaneImages = new JLayeredPane();
    panelTop.add(layeredPaneImages, "1, 2, 4, 1, fill, fill");
    layeredPaneImages.setLayout(
        new FormLayout(
            new ColumnSpec[] {
              ColumnSpec.decode("max(10px;default)"),
              ColumnSpec.decode("left:120px:grow"),
              ColumnSpec.decode("default:grow(10)"),
            },
            new RowSpec[] {
              RowSpec.decode("max(10px;default)"),
              RowSpec.decode("top:180px:grow"),
              RowSpec.decode("fill:80px:grow(3)"),
            }));

    lblMovieBackground = new ImageLabel(false, true);
    lblMovieBackground.setAlternativeText(BUNDLE.getString("image.notfound.fanart")); // $NON-NLS-1$
    lblMovieBackground.enableLightbox();
    layeredPaneImages.add(lblMovieBackground, "1, 1, 3, 3, fill, fill");

    lblMoviePoster = new ImageLabel();
    lblMoviePoster.setAlternativeText(BUNDLE.getString("image.notfound.poster")); // $NON-NLS-1$
    lblMoviePoster.enableLightbox();
    layeredPaneImages.setLayer(lblMoviePoster, 1);
    layeredPaneImages.add(lblMoviePoster, "2, 2, fill, fill");

    lblWatchedImage = new JLabel();
    lblWatchedImage.setOpaque(false);
    layeredPaneImages.setLayer(lblWatchedImage, 2);
    layeredPaneImages.add(lblWatchedImage, "2, 2, left, top");

    JPanel panelGenres = new MovieGenresPanel(movieSelectionModel);
    layeredPaneImages.setLayer(panelGenres, 2);
    layeredPaneImages.add(panelGenres, "2, 2, 2, 2, right, bottom");

    JPanel panelLogos = new JPanel();
    panelLogos.setOpaque(false);
    layeredPaneImages.setLayer(panelLogos, 2);
    layeredPaneImages.add(panelLogos, "2, 2, 2, 2, right, top");
    panelLogos.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));

    lblMediaLogoResolution = new JLabel("");
    panelLogos.add(lblMediaLogoResolution);

    lblMediaLogoVideoCodec = new JLabel("");
    panelLogos.add(lblMediaLogoVideoCodec);

    lblMediaLogoAudio = new JLabel("");
    panelLogos.add(lblMediaLogoAudio);

    JPanel panelBottom = new JPanel();
    panelBottom.setLayout(
        new FormLayout(
            new ColumnSpec[] {
              ColumnSpec.decode("300px:grow"),
            },
            new RowSpec[] {
              FormFactory.LINE_GAP_ROWSPEC, RowSpec.decode("fill:min:grow"),
            }));

    tabbedPaneMovieDetails = new JTabbedPane(JTabbedPane.TOP);
    panelBottom.add(tabbedPaneMovieDetails, "1, 2, fill, fill");
    splitPaneVertical.setBottomComponent(panelBottom);

    panelDetails = new MovieDetailsPanel(movieSelectionModel);
    tabbedPaneMovieDetails.addTab(
        BUNDLE.getString("metatag.details"), null, panelDetails, null); // $NON-NLS-1$

    panelOverview = new JPanel();
    tabbedPaneMovieDetails.addTab(
        BUNDLE.getString("metatag.plot"), null, panelOverview, null); // $NON-NLS-1$
    panelOverview.setLayout(
        new FormLayout(
            new ColumnSpec[] {
              ColumnSpec.decode("200px:grow"),
            },
            new RowSpec[] {
              FormFactory.LINE_GAP_ROWSPEC, RowSpec.decode("fill:default:grow"),
            }));
    // panelMovieDetails.add(tabbedPaneMovieDetails, "2, 3, fill, fill");

    JScrollPane scrollPaneOverview = new JScrollPane();
    scrollPaneOverview.setBorder(null);
    panelOverview.add(scrollPaneOverview, "1, 2, fill, fill");

    tpOverview = new JTextPane();
    tpOverview.setOpaque(false);
    tpOverview.setEditable(false);
    scrollPaneOverview.setViewportView(tpOverview);

    panelMovieCrew = new MovieCrewPanel(movieSelectionModel);
    tabbedPaneMovieDetails.addTab(
        BUNDLE.getString("metatag.crew"), null, panelMovieCrew, null); // $NON-NLS-1$

    MovieActorPanel panelMovieActors = new MovieActorPanel(movieSelectionModel);
    tabbedPaneMovieDetails.addTab(
        BUNDLE.getString("metatag.cast"), null, panelMovieActors, null); // $NON-NLS-1$

    panelMediaInformation = new MovieMediaInformationPanel(movieSelectionModel);
    tabbedPaneMovieDetails.addTab(
        BUNDLE.getString("metatag.mediainformation"),
        null,
        panelMediaInformation,
        null); //$NON-NLS-1$

    panelMediaFiles = new MovieMediaFilesPanel(movieSelectionModel);
    tabbedPaneMovieDetails.addTab(
        BUNDLE.getString("metatag.mediafiles"), null, panelMediaFiles, null); // $NON-NLS-1$

    final List<MediaFile> mediaFiles = new ArrayList<MediaFile>();
    final ImagePanel panelArtwork = new ImagePanel(mediaFiles);
    tabbedPaneMovieDetails.addTab(
        BUNDLE.getString("metatag.artwork"), null, panelArtwork, null); // $NON-NLS-1$

    panelMovieTrailer = new MovieTrailerPanel(movieSelectionModel);
    tabbedPaneMovieDetails.addTab(
        BUNDLE.getString("metatag.trailer"), null, panelMovieTrailer, null); // $NON-NLS-1$

    // beansbinding init
    initDataBindings();

    // manual coded binding
    PropertyChangeListener propertyChangeListener =
        new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent propertyChangeEvent) {
            String property = propertyChangeEvent.getPropertyName();
            Object source = propertyChangeEvent.getSource();
            // react on selection of a movie and change of a movie
            if (source instanceof MovieSelectionModel
                || (source instanceof Movie && MEDIA_FILES.equals(property))) {
              Movie movie = null;
              if (source instanceof MovieSelectionModel) {
                movie = ((MovieSelectionModel) source).getSelectedMovie();
              }
              if (source instanceof Movie) {
                movie = (Movie) source;
              }

              if (movie != null) {
                if (movie.getTop250() > 0) {
                  lblTop250.setText("Top 250: #" + movie.getTop250());
                } else {
                  lblTop250.setText("");
                }
                lblMovieBackground.setImagePath(movie.getArtworkFilename(MediaFileType.FANART));
                lblMoviePoster.setImagePath(movie.getArtworkFilename(MediaFileType.POSTER));

                synchronized (mediaFiles) {
                  mediaFiles.clear();
                  for (MediaFile mediafile : movie.getMediaFiles()) {
                    if (mediafile.isGraphic()) {
                      mediaFiles.add(mediafile);
                    }
                  }
                  panelArtwork.rebuildPanel();
                }
              }
            }
            if ((source.getClass() == Movie.class && FANART.equals(property))) {
              Movie movie = (Movie) source;
              lblMovieBackground.clearImage();
              lblMovieBackground.setImagePath(movie.getArtworkFilename(MediaFileType.FANART));
            }
            if ((source.getClass() == Movie.class && POSTER.equals(property))) {
              Movie movie = (Movie) source;
              lblMoviePoster.clearImage();
              lblMoviePoster.setImagePath(movie.getArtworkFilename(MediaFileType.POSTER));
            }
            if ((source.getClass() == Movie.class && TOP250.equals(property))) {
              Movie movie = (Movie) source;
              if (movie.getTop250() > 0) {
                lblTop250.setText(
                    BUNDLE.getString("metatag.top250") + ": #" + movie.getTop250()); // $NON-NLS-1$
              } else {
                lblTop250.setText("");
              }
            }
          }
        };

    movieSelectionModel.addPropertyChangeListener(propertyChangeListener);
  }
예제 #26
0
  private void initComponent() {
    setBackground(Color.WHITE);
    setForeground(Color.WHITE);
    setBounds(100, 100, 400, 300);
    contentPane = new JPanel();
    contentPane.setBackground(Color.WHITE);
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(
        new FormLayout(
            new ColumnSpec[] {
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("default:grow"),
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("default:grow"),
            },
            new RowSpec[] {
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              RowSpec.decode("default:grow"),
            }));

    JLabel lblCriteriaName = new JLabel("Criteria Name : ");
    lblCriteriaName.setBackground(Color.WHITE);
    lblCriteriaName.setFont(new Font("Tahoma", Font.BOLD, 18));
    contentPane.add(lblCriteriaName, "6, 8, right, default");

    txtCriteriaName = new JTextField();
    txtCriteriaName.setFont(new Font("Tahoma", Font.PLAIN, 18));
    txtCriteriaName.setText("criteria name");
    contentPane.add(txtCriteriaName, "8, 8, fill, default");
    txtCriteriaName.setColumns(10);

    panel = new JPanel();
    panel.setBackground(Color.WHITE);
    contentPane.add(panel, "6, 14, 3, 1, fill, fill");

    btnDelete = new JButton("Delete");
    panel.add(btnDelete);

    btnSave = new JButton("Save");
    panel.add(btnSave);
  }
예제 #27
0
  private void initConfigPanel(JFrame parent) {
    JPanel configPanel = new JPanel();
    configPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
    getContentPane().add(configPanel, BorderLayout.CENTER);
    configPanel.setLayout(
        new FormLayout(
            new ColumnSpec[] {
              ColumnSpec.decode("default:grow"),
              ColumnSpec.decode("default:grow"),
              ColumnSpec.decode("default:grow"),
              ColumnSpec.decode("right:default"),
              ColumnSpec.decode("right:default"),
              ColumnSpec.decode("right:default")
            },
            new RowSpec[] {
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              RowSpec.decode("default:grow"),
            }));

    StringSeparator lafSeparator = new StringSeparator(MESSAGES.get("laf"));
    configPanel.add(lafSeparator, "1, 7, 5, 1");

    LookAndFeel[] allLafs = LookAndFeel.getAll();
    lafComboBox = new JComboBox<>(allLafs);
    LookAndFeel selectedLaf =
        Arrays.stream(allLafs)
            .filter(l -> l.getName().equals(PROPERTIES.getLaf()))
            .findFirst()
            .get();
    lafComboBox.setSelectedItem(selectedLaf);
    configPanel.add(lafComboBox, "3, 9, 3, 1");

    StringSeparator splashScreenSeparator = new StringSeparator(MESSAGES.get("splash_screen"));
    configPanel.add(splashScreenSeparator, "1, 7, 5, 1");

    JLabel lblSplashScreenEnabled = new JLabel(MESSAGES.get("enabled"));
    configPanel.add(lblSplashScreenEnabled, "3, 9");

    chckbxSplashScreenEnabled = new JCheckBox();
    chckbxSplashScreenEnabled.setSelected(PROPERTIES.isSplashScreenEnabled());
    configPanel.add(chckbxSplashScreenEnabled, "4, 9");

    StringSeparator welcomeScreenSeparator = new StringSeparator(MESSAGES.get("welcome_screen"));
    configPanel.add(welcomeScreenSeparator, "1, 11, 5, 1");

    JLabel lblShowWelcomeScreen = new JLabel(MESSAGES.get("enabled"));
    configPanel.add(lblShowWelcomeScreen, "4, 13");

    chckbxWelcomeScreenEnabled = new JCheckBox();
    chckbxWelcomeScreenEnabled.setSelected(PROPERTIES.isWelcomeScreenEnabled());
    configPanel.add(chckbxWelcomeScreenEnabled, "5, 13");

    StringSeparator startMinimizedSeparator = new StringSeparator(MESSAGES.get("start_minimized"));
    configPanel.add(startMinimizedSeparator, "1, 15, 5, 1");

    JLabel lblStartMinized = new JLabel(MESSAGES.get("enabled"));
    configPanel.add(lblStartMinized, "4, 17");

    chckbxStartMinimized = new JCheckBox();
    chckbxStartMinimized.setSelected(PROPERTIES.isStartMinimized());
    configPanel.add(chckbxStartMinimized, "5, 17");

    StringSeparator nativeHookSeparator = new StringSeparator(MESSAGES.get("native_hook"));
    configPanel.add(nativeHookSeparator, "1, 19, 5, 1");

    nativeHookLabel = new JLabel(getNativeHookText(nativeHookKeyCodes));
    configPanel.add(nativeHookLabel, "2, 23");

    JButton btnRecordNativeHook = new JButton(Icon.getIcon("/icons/pencil.png"));
    configPanel.add(btnRecordNativeHook, "4, 23, 2, 1, fill, default");
    btnRecordNativeHook.addActionListener(
        e -> {
          RecordNativeHookDialog dialog = new RecordNativeHookDialog(parent);
          dialog.setVisible(true);
          if (dialog.isOkButtonPressed()) {
            nativeHookKeyCodes = dialog.getNativeHookKeyCodes();
            nativeHookLabel.setText(getNativeHookText(nativeHookKeyCodes));
          }
          dialog.dispose();
        });

    StringSeparator suggestionsSeparator = new StringSeparator(MESSAGES.get("suggestions"));
    configPanel.add(suggestionsSeparator, "1, 25, 5, 1");

    JLabel lblSuggestions = new JLabel(MESSAGES.get("enabled"));
    configPanel.add(lblSuggestions, "2, 27, 3, 1, right, center");

    chckbxShowSuggestions = new JCheckBox();
    chckbxShowSuggestions.setSelected(PROPERTIES.isSuggestionsEnabled());
    configPanel.add(chckbxShowSuggestions, "5, 27");
  }
예제 #28
0
  AuctionClientPanel() {
    super();
    this.setPreferredSize(new Dimension(500, 700));
    this.setLayout(
        new FormLayout(
            new ColumnSpec[] {
              FormFactory.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("default:grow"),
              ColumnSpec.decode("165px:grow"),
              FormFactory.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("max(70dlu;default):grow"),
              FormFactory.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("max(18dlu;default):grow"),
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
            },
            new RowSpec[] {
              FormFactory.MIN_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.LINE_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              RowSpec.decode("top:default"),
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              RowSpec.decode("max(50dlu;default)"),
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              RowSpec.decode("max(50dlu;default):grow"),
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
            }));

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

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

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

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

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

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

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

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

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

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

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

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

    sellListModel = new DefaultListModel();

    bidListModel = new DefaultListModel();

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    this.setVisible(true);
  }
  /**
   * Instantiates a new movie extended search
   *
   * @param model the model
   */
  public MovieExtendedSearchPanel(MovieSelectionModel model) {
    super();
    setOpaque(false);
    shadowAlpha = 100;
    arcs = new Dimension(10, 10);

    this.movieSelectionModel = model;
    Map<MovieSearchOptions, Object> savedSearchOptions =
        MovieModuleManager.MOVIE_SETTINGS.getUiFilters();

    // add a dummy mouse listener to prevent clicking through
    addMouseListener(new MouseAdapter() {});

    setLayout(
        new FormLayout(
            new ColumnSpec[] {
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("default:grow"),
              FormFactory.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("default:grow"),
              FormFactory.UNRELATED_GAP_COLSPEC,
            },
            new RowSpec[] {
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.NARROW_LINE_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.NARROW_LINE_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.NARROW_LINE_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.NARROW_LINE_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.UNRELATED_GAP_ROWSPEC,
            }));

    JLabel lblFilterBy =
        new JLabel(BUNDLE.getString("movieextendedsearch.filterby")); // $NON-NLS-1$
    setComponentFont(lblFilterBy);
    add(lblFilterBy, "2, 2, 3, 1");

    cbFilterDuplicates = new JCheckBox("");
    cbFilterDuplicates.setUI(CHECKBOX_UI); // $hide$
    cbFilterDuplicates.setSelected(savedSearchOptions.containsKey(MovieSearchOptions.DUPLICATES));
    cbFilterDuplicates.setAction(actionFilter);
    add(cbFilterDuplicates, "2, 4");

    JLabel lblShowDuplicates =
        new JLabel(BUNDLE.getString("movieextendedsearch.duplicates")); // $NON-NLS-1$
    setComponentFont(lblShowDuplicates);
    add(lblShowDuplicates, "4, 4, right, default");

    cbFilterWatched = new JCheckBox("");
    cbFilterWatched.setUI(CHECKBOX_UI); // $hide$
    cbFilterWatched.setSelected(savedSearchOptions.containsKey(MovieSearchOptions.WATCHED));
    cbFilterWatched.setAction(actionFilter);
    add(cbFilterWatched, "2, 5");

    JLabel lblWatchedFlag =
        new JLabel(BUNDLE.getString("movieextendedsearch.watched")); // $NON-NLS-1$
    setComponentFont(lblWatchedFlag);
    add(lblWatchedFlag, "4, 5, right, default");

    cbWatched = new SmallComboBox(WatchedFlag.values());
    setComponentFont(cbWatched);
    cbWatched.setAction(actionFilter);
    add(cbWatched, "6, 5, fill, default");

    cbFilterGenre = new JCheckBox("");
    cbFilterGenre.setUI(CHECKBOX_UI); // $hide$
    cbFilterGenre.setSelected(savedSearchOptions.containsKey(MovieSearchOptions.GENRE));
    cbFilterGenre.setAction(actionFilter);
    add(cbFilterGenre, "2, 6");

    JLabel lblGenre = new JLabel(BUNDLE.getString("movieextendedsearch.genre")); // $NON-NLS-1$
    setComponentFont(lblGenre);
    add(lblGenre, "4, 6, right, default");

    cbGenre = new SmallComboBox(MediaGenres.values());
    setComponentFont(cbGenre);
    cbGenre.setAction(actionFilter);
    add(cbGenre, "6, 6, fill, default");

    cbFilterCertification = new JCheckBox("");
    cbFilterCertification.setUI(CHECKBOX_UI); // $hide$
    cbFilterCertification.setSelected(
        savedSearchOptions.containsKey(MovieSearchOptions.CERTIFICATION));
    cbFilterCertification.setAction(actionFilter);
    add(cbFilterCertification, "2, 7");

    lblCertification = new JLabel(BUNDLE.getString("metatag.certification")); // $NON-NLS-1$
    setComponentFont(lblCertification);
    add(lblCertification, "4, 7, right, default");

    cbCertification = new SmallComboBox();
    setComponentFont(cbCertification);
    cbCertification.setAction(actionFilter);
    add(cbCertification, "6, 7, fill, default");

    cbFilterYear = new JCheckBox("");
    cbFilterYear.setUI(CHECKBOX_UI); // $hide$
    cbFilterYear.setSelected(savedSearchOptions.containsKey(MovieSearchOptions.YEAR));
    cbFilterYear.setAction(actionFilter);
    add(cbFilterYear, "2, 8");

    lblYear = new JLabel(BUNDLE.getString("metatag.year")); // $NON-NLS-1$
    setComponentFont(lblYear);
    add(lblYear, "4, 8, right, default");

    int year = Calendar.getInstance().get(Calendar.YEAR);
    spYear = new JSpinner();
    setComponentFont(spYear);
    spYear.setUI(new SmallSpinnerUI());
    spYear.setModel(new SpinnerNumberModel(year, 0, 3000, 1));
    spYear.setEditor(new JSpinner.NumberEditor(spYear, "#"));
    spYear.addChangeListener(
        new ChangeListener() {
          @Override
          public void stateChanged(ChangeEvent e) {
            actionFilter.actionPerformed(null);
          }
        });
    add(spYear, "6, 8");

    cbFilterCast = new JCheckBox("");
    cbFilterCast.setUI(CHECKBOX_UI); // $hide$
    cbFilterCast.setSelected(savedSearchOptions.containsKey(MovieSearchOptions.CAST));
    cbFilterCast.setAction(actionFilter);
    add(cbFilterCast, "2, 9");

    JLabel lblCastMember = new JLabel(BUNDLE.getString("movieextendedsearch.cast")); // $NON-NLS-1$
    setComponentFont(lblCastMember);
    add(lblCastMember, "4, 9, right, default");

    tfCastMember = new JTextField();
    setComponentFont(tfCastMember);
    tfCastMember.setBorder(new SmallTextFieldBorder());
    add(tfCastMember, "6, 9, fill, default");
    tfCastMember.setColumns(10);
    tfCastMember
        .getDocument()
        .addDocumentListener(
            new DocumentListener() {
              public void changedUpdate(DocumentEvent e) {
                actionFilter.actionPerformed(null);
              }

              public void insertUpdate(DocumentEvent e) {
                actionFilter.actionPerformed(null);
              }

              public void removeUpdate(DocumentEvent e) {
                actionFilter.actionPerformed(null);
              }
            });

    cbFilterTag = new JCheckBox("");
    cbFilterTag.setUI(CHECKBOX_UI); // $hide$
    cbFilterTag.setSelected(savedSearchOptions.containsKey(MovieSearchOptions.TAG));
    cbFilterTag.setAction(actionFilter);
    add(cbFilterTag, "2, 10");

    JLabel lblTag = new JLabel(BUNDLE.getString("movieextendedsearch.tag")); // $NON-NLS-1$
    setComponentFont(lblTag);
    add(lblTag, "4, 10, right, default");

    cbTag = new SmallComboBox();
    setComponentFont(cbTag);
    cbTag.setAction(actionFilter);

    add(cbTag, "6, 10, fill, default");

    cbFilterMovieset = new JCheckBox("");
    cbFilterMovieset.setUI(CHECKBOX_UI); // $hide$
    cbFilterMovieset.setSelected(savedSearchOptions.containsKey(MovieSearchOptions.MOVIESET));
    cbFilterMovieset.setAction(actionFilter);
    add(cbFilterMovieset, "2, 11");

    JLabel lblMoviesInMovieset =
        new JLabel(BUNDLE.getString("movieextendedsearch.movieset")); // $NON-NLS-1$
    setComponentFont(lblMoviesInMovieset);
    add(lblMoviesInMovieset, "4, 11, right, default");

    cbMovieset = new SmallComboBox(MovieInMovieSet.values());
    setComponentFont(cbMovieset);
    cbMovieset.setAction(actionFilter);
    add(cbMovieset, "6, 11, fill, default");

    cbFilterVideoFormat = new JCheckBox("");
    cbFilterVideoFormat.setUI(CHECKBOX_UI); // $hide$
    cbFilterVideoFormat.setSelected(
        savedSearchOptions.containsKey(MovieSearchOptions.VIDEO_FORMAT));
    cbFilterVideoFormat.setAction(actionFilter);
    add(cbFilterVideoFormat, "2, 12");

    JLabel lblVideoFormat = new JLabel(BUNDLE.getString("metatag.resolution")); // $NON-NLS-1$
    setComponentFont(lblVideoFormat);
    add(lblVideoFormat, "4, 12, right, default");

    cbVideoFormat = new SmallComboBox(getVideoFormats());
    setComponentFont(cbVideoFormat);
    cbVideoFormat.setAction(actionFilter);
    add(cbVideoFormat, "6, 12, fill, default");

    cbFilterVideoCodec = new JCheckBox("");
    cbFilterVideoCodec.setUI(CHECKBOX_UI); // $hide$
    cbFilterVideoCodec.setSelected(savedSearchOptions.containsKey(MovieSearchOptions.VIDEO_CODEC));
    cbFilterVideoCodec.setAction(actionFilter);
    add(cbFilterVideoCodec, "2, 13");

    JLabel lblVideoCodec = new JLabel(BUNDLE.getString("metatag.videocodec")); // $NON-NLS-1$
    setComponentFont(lblVideoCodec);
    add(lblVideoCodec, "4, 13, right, default");

    cbVideoCodec = new SmallComboBox();
    setComponentFont(cbVideoCodec);
    cbVideoCodec.setAction(actionFilter);
    add(cbVideoCodec, "6, 13, fill, default");

    cbFilterAudioCodec = new JCheckBox("");
    cbFilterAudioCodec.setUI(CHECKBOX_UI); // $hide$
    cbFilterAudioCodec.setSelected(savedSearchOptions.containsKey(MovieSearchOptions.AUDIO_CODEC));
    cbFilterAudioCodec.setAction(actionFilter);
    add(cbFilterAudioCodec, "2, 14");

    JLabel lblAudioCodec = new JLabel(BUNDLE.getString("metatag.audiocodec")); // $NON-NLS-1$
    setComponentFont(lblAudioCodec);
    add(lblAudioCodec, "4, 14, right, default");

    cbAudioCodec = new SmallComboBox();
    setComponentFont(cbAudioCodec);
    cbAudioCodec.setAction(actionFilter);
    add(cbAudioCodec, "6, 14, fill, default");

    cbFilterDatasource = new JCheckBox("");
    cbFilterDatasource.setUI(CHECKBOX_UI); // $hide$
    cbFilterDatasource.setSelected(savedSearchOptions.containsKey(MovieSearchOptions.DATASOURCE));
    cbFilterDatasource.setAction(actionFilter);
    add(cbFilterDatasource, "2, 15");

    JLabel lblDatasource = new JLabel(BUNDLE.getString("metatag.datasource")); // $NON-NLS-1$
    setComponentFont(lblDatasource);
    add(lblDatasource, "4, 15, right, default");

    cbDatasource = new SmallComboBox();
    setComponentFont(cbDatasource);
    cbDatasource.setAction(actionFilter);
    add(cbDatasource, "6, 15, fill, default");

    cbFilterMediaSource = new JCheckBox("");
    cbFilterMediaSource.setUI(CHECKBOX_UI); // $hide$
    cbFilterMediaSource.setSelected(
        savedSearchOptions.containsKey(MovieSearchOptions.MEDIA_SOURCE));
    cbFilterMediaSource.addActionListener(actionFilter);
    add(cbFilterMediaSource, "2, 16");

    JLabel lblMediaSource = new JLabel(BUNDLE.getString("metatag.source")); // $NON-NLS-1$
    setComponentFont(lblMediaSource);
    add(lblMediaSource, "4, 16, right, default");

    cbMediaSource = new SmallComboBox(MovieMediaSource.values());
    setComponentFont(cbMediaSource);
    cbMediaSource.setAction(actionFilter);
    add(cbMediaSource, "6, 16, fill, default");

    cbFilterMissingMetadata = new JCheckBox("");
    cbFilterMissingMetadata.setUI(CHECKBOX_UI); // $hide$
    cbFilterMissingMetadata.setSelected(
        savedSearchOptions.containsKey(MovieSearchOptions.MISSING_METADATA));
    cbFilterMissingMetadata.setAction(actionFilter);
    add(cbFilterMissingMetadata, "2, 17");

    JLabel lblMissingMetadata =
        new JLabel(BUNDLE.getString("movieextendedsearch.missingmetadata")); // $NON-NLS-1$
    setComponentFont(lblMissingMetadata);
    add(lblMissingMetadata, "4, 17, right, default");

    cbFilterMissingArtwork = new JCheckBox("");
    cbFilterMissingArtwork.setUI(CHECKBOX_UI); // $hide$
    cbFilterMissingArtwork.setSelected(
        savedSearchOptions.containsKey(MovieSearchOptions.MISSING_ARTWORK));
    cbFilterMissingArtwork.setAction(actionFilter);
    add(cbFilterMissingArtwork, "2, 18");

    JLabel lblMissingArtwork =
        new JLabel(BUNDLE.getString("movieextendedsearch.missingartwork")); // $NON-NLS-1$
    setComponentFont(lblMissingArtwork);
    add(lblMissingArtwork, "4, 18, right, default");

    cbFilterMissingSubtitles = new JCheckBox("");
    cbFilterMissingSubtitles.setUI(CHECKBOX_UI); // $hide$
    cbFilterMissingSubtitles.setSelected(
        savedSearchOptions.containsKey(MovieSearchOptions.MISSING_SUBTITLES));
    cbFilterMissingSubtitles.setAction(actionFilter);
    add(cbFilterMissingSubtitles, "2, 19");

    JLabel lblMissingSubtitles =
        new JLabel(BUNDLE.getString("movieextendedsearch.missingsubtitles")); // $NON-NLS-1$
    setComponentFont(lblMissingSubtitles);
    add(lblMissingSubtitles, "4, 19, right, default");

    cbFilterNewMovies = new JCheckBox("");
    cbFilterNewMovies.setUI(CHECKBOX_UI); // $hide$
    cbFilterNewMovies.setSelected(savedSearchOptions.containsKey(MovieSearchOptions.NEW_MOVIES));
    cbFilterNewMovies.setAction(actionFilter);
    add(cbFilterNewMovies, "2, 20");

    lblNewMovies = new JLabel(BUNDLE.getString("movieextendedsearch.newmovies")); // $NON-NLS-1$
    setComponentFont(lblNewMovies);
    add(lblNewMovies, "4, 20, right, default");

    JSeparator separator = new JSeparator();
    add(separator, "2, 22, 5, 1");

    JLabel lblSortBy = new JLabel(BUNDLE.getString("movieextendedsearch.sortby")); // $NON-NLS-1$
    setComponentFont(lblSortBy);
    add(lblSortBy, "2, 24, 3, 1");

    cbSortColumn = new SmallComboBox(SortColumn.values());
    setComponentFont(cbSortColumn);
    cbSortColumn.setAction(actionSort);
    add(cbSortColumn, "2, 26, 3, 1, fill, default");

    cbSortOrder = new SmallComboBox(SortOrder.values());
    setComponentFont(cbSortOrder);
    cbSortOrder.setAction(actionSort);
    add(cbSortOrder, "6, 26, fill, default");

    PropertyChangeListener propertyChangeListener =
        new PropertyChangeListener() {
          @Override
          public void propertyChange(PropertyChangeEvent evt) {
            if (evt.getSource() instanceof MovieList && "tag".equals(evt.getPropertyName())) {
              buildAndInstallTagsArray();
            }
            if (evt.getSource() instanceof MovieList
                && "videoCodec".equals(evt.getPropertyName())) {
              buildAndInstallCodecArray();
            }
            if (evt.getSource() instanceof MovieList
                && "audioCodec".equals(evt.getPropertyName())) {
              buildAndInstallCodecArray();
            }
            if (evt.getSource() instanceof MovieSettings
                && "movieDataSource".equals(evt.getPropertyName())) {
              buildAndInstallDatasourceArray();
            }
            if (evt.getSource() instanceof MovieList
                && "certification".equals(evt.getPropertyName())) {
              buildAndInstallCertificationArray();
            }
          }
        };
    movieList.addPropertyChangeListener(propertyChangeListener);
    Settings.getInstance().getMovieSettings().addPropertyChangeListener(propertyChangeListener);
    buildAndInstallTagsArray();
    buildAndInstallCodecArray();
    buildAndInstallDatasourceArray();
    buildAndInstallCertificationArray();
  }