Ejemplo n.º 1
0
  private void addTextField() {
    messageArea = new JTextArea();
    messageArea.setEnabled(false);
    messageArea.setDisabledTextColor(Color.BLACK);

    listArea = new JTextArea();
    listArea.setEnabled(false);
    listArea.setDisabledTextColor(Color.BLACK);
    listArea.setBounds(275, 18, 70, 340);
    contentPane.add(listArea);

    textField = new JTextField();
    textField.setBounds(0, 312, 155, 42);
    textField.addKeyListener(this);
    contentPane.add(textField);
    textField.setColumns(10);
  }
Ejemplo n.º 2
0
  public AboutWindow() {
    this.setIconImages(Resources.iconList);
    setSize(Toolkit.getDefaultToolkit().getScreenSize());
    setType(Type.UTILITY);
    setTitle("Bytecode Viewer - About - https://bytecodeviewer.com | https://the.bytecode.club");
    getContentPane().setLayout(new CardLayout(0, 0));

    txtrBytecodeViewerIs.setDisabledTextColor(Color.BLACK);
    txtrBytecodeViewerIs.setWrapStyleWord(true);
    getContentPane().add(txtrBytecodeViewerIs, "name_140466526081695");
    txtrBytecodeViewerIs.setEnabled(false);
    this.setResizable(false);
    this.setLocationRelativeTo(null);
  }
  private void layoutComponents() {

    setJMenuBar(createMenuBar());

    closeButton = new JButton("Close");
    noteField = new JTextArea(2, 50);
    noteField.setLineWrap(true);
    noteField.setEnabled(false);
    noteField.setDisabledTextColor(Color.BLACK);
    AccountInterface account = null;

    try {
      switch (transactionType) {
        case "Rent Account":
          account = client.getRentAccount(transaction.getAccountRef());
          break;

        case "Lease Account":
          account = client.getLeaseAccount(transaction.getAccountRef());
          break;

        case "Employee Account":
          account = client.getEmployeeAccount(transaction.getAccountRef());
          break;
      }

      PersonInterface toPerson = client.getPerson(transaction.getToRef());

      PersonInterface fromPerson = client.getPerson(transaction.getFromRef());

      closeButton.addActionListener(
          new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent ev) {
              setVisible(false);
              dispose();
            }
          });

      try {
        noteField.setText(transaction.getNote().getNote());

        this.setMinimumSize(new Dimension(650, 450));
        this.setSize(650, 450);
        Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
        this.setLocation(
            dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2);

        ///////// DETAILS PANEL ////////////
        detailsPanel = new JPanel();
        // detailsPanel.setSize(450, 200);
        detailsPanel.setLayout(new GridBagLayout());

        GridBagConstraints gc = new GridBagConstraints();

        ////////// FIRST ROW //////////

        gc.gridx = 0;
        gc.gridy++;

        gc.weightx = 1;
        gc.weighty = 1;

        JLabel tranRefLabel = new JLabel("Transaction Ref  ");
        Font font = tranRefLabel.getFont();
        Font boldFont = new Font(font.getName(), Font.BOLD, 17);
        Font plainFont = new Font(font.getName(), Font.PLAIN, 17);

        tranRefLabel.setFont(boldFont);

        gc.fill = GridBagConstraints.NONE;
        gc.anchor = GridBagConstraints.EAST;
        gc.insets = new Insets(0, 0, 0, 0);
        detailsPanel.add(tranRefLabel, gc);

        tranRefField = new JLabel(String.valueOf(transaction.getTransactionRef()));
        tranRefField.setFont(plainFont);

        gc.gridx++;
        gc.anchor = GridBagConstraints.WEST;
        gc.insets = new Insets(0, 0, 0, 5);
        detailsPanel.add(tranRefField, gc);

        ////////// NEXT ROW ///////////

        gc.gridx = 0;
        gc.gridy++;

        gc.weightx = 1;
        gc.weighty = 1;

        JLabel accRefLabel = new JLabel("Account Ref  ");

        accRefLabel.setFont(boldFont);

        gc.fill = GridBagConstraints.NONE;
        gc.anchor = GridBagConstraints.EAST;
        gc.insets = new Insets(0, 0, 0, 0);
        detailsPanel.add(accRefLabel, gc);

        accRefField = new JLabel(String.valueOf(transaction.getAccountRef()));
        accRefField.setFont(plainFont);

        gc.gridx++;
        gc.anchor = GridBagConstraints.WEST;
        gc.insets = new Insets(0, 0, 0, 5);
        detailsPanel.add(accRefField, gc);

        if (account != null) {
          accNameField = new JLabel(account.getAccName());
        } else {
          accNameField = new JLabel("");
        }
        accNameField.setFont(plainFont);

        gc.gridx++;
        gc.gridwidth = 2;
        gc.anchor = GridBagConstraints.WEST;
        gc.insets = new Insets(0, 0, 0, 0);
        detailsPanel.add(accNameField, gc);

        //////////// NEXT ROW //////////////

        JLabel toRefLabel = new JLabel("To Ref  ");
        toRefLabel.setFont(boldFont);

        gc.gridx = 0;
        gc.gridy++;

        gc.gridwidth = 1;
        gc.fill = GridBagConstraints.NONE;
        gc.anchor = GridBagConstraints.EAST;
        gc.insets = new Insets(0, 0, 0, 0);
        detailsPanel.add(toRefLabel, gc);

        toField = new JLabel(String.valueOf(transaction.getToRef()));
        toField.setFont(plainFont);

        gc.gridx++;
        gc.anchor = GridBagConstraints.WEST;
        gc.insets = new Insets(0, 0, 0, 5);
        detailsPanel.add(toField, gc);

        if (toPerson != null) {
          toNameField = new JLabel(toPerson.getName());
        } else {
          toNameField = new JLabel("");
        }
        toNameField.setFont(plainFont);

        gc.gridx++;
        gc.gridwidth = 2;
        gc.anchor = GridBagConstraints.WEST;
        gc.insets = new Insets(0, 0, 0, 5);
        detailsPanel.add(toNameField, gc);

        ////////////// NEXT ROW ////////////////

        JLabel fromRefLabel = new JLabel("From Ref  ");
        fromRefLabel.setFont(boldFont);

        gc.gridx = 0;
        gc.gridy++;

        gc.gridwidth = 1;
        gc.fill = GridBagConstraints.NONE;
        gc.anchor = GridBagConstraints.EAST;
        gc.insets = new Insets(0, 0, 0, 0);
        detailsPanel.add(fromRefLabel, gc);

        fromField = new JLabel(String.valueOf(transaction.getFromRef()));
        fromField.setFont(plainFont);

        gc.gridx++;
        gc.anchor = GridBagConstraints.WEST;
        gc.insets = new Insets(0, 0, 0, 5);
        detailsPanel.add(fromField, gc);

        if (fromPerson != null) {
          fromNameField = new JLabel(fromPerson.getName());
        } else {
          fromNameField = new JLabel("");
        }
        fromNameField.setFont(plainFont);

        gc.gridx++;
        gc.gridwidth = 2;
        gc.anchor = GridBagConstraints.WEST;
        gc.insets = new Insets(0, 0, 0, 5);
        detailsPanel.add(fromNameField, gc);

        ////////// NEXT ROW //////////

        gc.gridx = 0;
        gc.gridy++;

        JLabel amountLabel = new JLabel("Amount  ");
        amountLabel.setFont(boldFont);

        gc.gridwidth = 1;
        gc.fill = GridBagConstraints.NONE;
        gc.anchor = GridBagConstraints.EAST;
        gc.insets = new Insets(0, 0, 0, 0);
        detailsPanel.add(amountLabel, gc);

        amountField = new JLabel(String.valueOf(transaction.getAmount()));
        amountField.setFont(plainFont);

        gc.gridx++;
        gc.anchor = GridBagConstraints.WEST;
        gc.insets = new Insets(0, 0, 0, 5);
        detailsPanel.add(amountField, gc);

        JLabel isDebitLabel = new JLabel("Debit  ");
        isDebitLabel.setFont(boldFont);

        gc.gridx++;
        gc.anchor = GridBagConstraints.EAST;
        gc.insets = new Insets(0, 0, 0, 0);
        detailsPanel.add(isDebitLabel, gc);

        isDebitField = new JCheckBox();
        isDebitField.setSelected(transaction.isDebit());
        isDebitField.setEnabled(false);

        gc.gridx++;
        gc.anchor = GridBagConstraints.WEST;
        gc.insets = new Insets(0, 0, 0, 5);
        detailsPanel.add(isDebitField, gc);

        ////////// NEXT ROW //////////
        gc.gridx = 0;
        gc.gridy++;

        JLabel commentLabel = new JLabel("Comment  ");
        commentLabel.setFont(boldFont);

        gc.fill = GridBagConstraints.NONE;
        gc.anchor = GridBagConstraints.EAST;
        gc.insets = new Insets(0, 0, 0, 0);
        detailsPanel.add(commentLabel, gc);

        noteField = new JTextArea(3, 30);
        noteField.setText(transaction.getComment());
        noteField.setEnabled(false);

        gc.gridx++;
        gc.gridwidth = 3;
        gc.anchor = GridBagConstraints.WEST;
        gc.insets = new Insets(0, 0, 0, 5);
        detailsPanel.add(noteField, gc);

        JPanel buttonsPanel = new JPanel();

        int space = 15;
        Border spaceBorder = BorderFactory.createEmptyBorder(space, space, space, space);
        Border titleBorder = BorderFactory.createTitledBorder("View Transaction");

        mainPanel = new JPanel();

        mainPanel.setBorder(BorderFactory.createCompoundBorder(spaceBorder, titleBorder));
        buttonsPanel.setBorder(BorderFactory.createEmptyBorder());

        mainPanel.setLayout(new BorderLayout());
        mainPanel.add(detailsPanel, BorderLayout.CENTER);

        try {
          JPanel mods =
              new DetailsPanel(
                  transaction.getCreatedBy(), transaction.getCreatedDate(), null, null);
          mainPanel.add(mods, BorderLayout.SOUTH);
        } catch (RemoteException ex) {
          Logger.getLogger(TransactionDetails.class.getName()).log(Level.SEVERE, null, ex);
        }

        ////////// BUTTONS PANEL //////////
        buttonsPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
        buttonsPanel.add(closeButton);

        // Add sub panels to dialog
        setLayout(new BorderLayout());
        add(mainPanel, BorderLayout.CENTER);
        add(buttonsPanel, BorderLayout.SOUTH);
      } catch (RemoteException ex) {
        Logger.getLogger(TransactionDetails.class.getName()).log(Level.SEVERE, null, ex);
      }
    } catch (RemoteException ex) {
      Logger.getLogger(TransactionDetails.class.getName()).log(Level.SEVERE, null, ex);
    }
  }