Example #1
0
  public void actionPerformed(ActionEvent e) {
    String actionCommand = e.getActionCommand();

    if (POSConstants.CANCEL.equalsIgnoreCase(actionCommand)) {
      doCancel();
    } else if (POSConstants.OK.equalsIgnoreCase(actionCommand)) {
      doOk();
    } else if (actionCommand.equals(POSConstants.CLEAR_ALL)) {
      doClearAll();
    } else if (actionCommand.equals(POSConstants.CLEAR)) {
      doClear();
    } else if (actionCommand.equals(".")) { // $NON-NLS-1$
      doInsertDot();
    } else {
      doInsertNumber(actionCommand);
    }
  }
  // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
  private void initComponents() {

    transparentPanel2 = new com.floreantpos.swing.TransparentPanel();
    transparentPanel1 = new com.floreantpos.swing.TransparentPanel();
    numberSelectionView = new com.floreantpos.ui.views.NumberSelectionView();
    titlePanel1 = new com.floreantpos.ui.TitlePanel();
    jPanel1 = new javax.swing.JPanel();
    jSeparator1 = new javax.swing.JSeparator();
    jPanel2 = new javax.swing.JPanel();
    posButton1 = new com.floreantpos.swing.PosButton();
    posButton2 = new com.floreantpos.swing.PosButton();

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    setTitle(com.floreantpos.POSConstants.ENTER_AMOUNT);

    transparentPanel2.setBorder(javax.swing.BorderFactory.createEmptyBorder(10, 10, 10, 10));
    transparentPanel2.setLayout(new java.awt.BorderLayout(5, 10));

    transparentPanel1.setBorder(javax.swing.BorderFactory.createEmptyBorder(10, 0, 0, 0));
    transparentPanel1.setLayout(new java.awt.GridLayout(1, 0, 5, 5));
    transparentPanel2.add(transparentPanel1, java.awt.BorderLayout.EAST);

    numberSelectionView.setBorder(null);
    transparentPanel2.add(numberSelectionView, java.awt.BorderLayout.CENTER);
    transparentPanel2.add(titlePanel1, java.awt.BorderLayout.PAGE_START);

    jPanel1.setLayout(new java.awt.BorderLayout());
    jPanel1.add(jSeparator1, java.awt.BorderLayout.NORTH);

    posButton1.setText(com.floreantpos.POSConstants.OK.toUpperCase());
    posButton1.setPreferredSize(new java.awt.Dimension(120, 50));
    posButton1.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            doOk(evt);
          }
        });

    posButton2.setText(com.floreantpos.POSConstants.CANCEL.toUpperCase());
    posButton2.setPreferredSize(new java.awt.Dimension(120, 50));
    posButton2.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            doCancel(evt);
          }
        });

    org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2);
    jPanel2.setLayout(jPanel2Layout);
    jPanel2Layout.setHorizontalGroup(
        jPanel2Layout
            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(
                jPanel2Layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .add(
                        posButton1,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 58, Short.MAX_VALUE)
                    .add(
                        posButton2,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                        92,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)));
    jPanel2Layout.setVerticalGroup(
        jPanel2Layout
            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(
                jPanel2Layout
                    .createSequentialGroup()
                    .add(
                        posButton1,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .add(
                jPanel2Layout
                    .createSequentialGroup()
                    .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .add(
                        posButton2,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)));

    jPanel1.add(jPanel2, java.awt.BorderLayout.CENTER);

    transparentPanel2.add(jPanel1, java.awt.BorderLayout.PAGE_END);

    getContentPane().add(transparentPanel2, java.awt.BorderLayout.CENTER);

    java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
    setBounds((screenSize.width - 308) / 2, (screenSize.height - 490) / 2, 308, 490);
  } // </editor-fold>//GEN-END:initComponents
  // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
  private void initComponents() {
    JPanel contentPane = new JPanel(new MigLayout("fillx", "", ""));

    TitlePanel titlePanel = new TitlePanel();
    titlePanel.setTitle("Insert miscellaneous item");
    contentPane.add(titlePanel, "grow, span");

    JLabel lblName = new JLabel("Item name");
    contentPane.add(lblName, "newline,alignx trailing");

    tfItemName = new FixedLengthTextField(120);
    contentPane.add(tfItemName, "grow, span, h 40");

    JLabel lblPrice = new JLabel("Item price");
    contentPane.add(lblPrice, "newline,alignx trailing");

    tfItemPrice = new DoubleTextField();
    contentPane.add(tfItemPrice, "grow, w 120, h 40");

    contentPane.add(new JLabel("Tax"), "alignx trailing");

    PosComboRenderer comboRenderer = new PosComboRenderer();
    comboRenderer.setEnableDefaultValueShowing(false);

    cbTax = new JComboBox();
    cbTax.setRenderer(comboRenderer);
    contentPane.add(cbTax, "w 200!, h 40");

    contentPane.add(new JLabel("Printer group"), "alignx trailing");

    cbPrinterGroup = new JComboBox();
    cbPrinterGroup.setRenderer(comboRenderer);
    contentPane.add(cbPrinterGroup, "w 200!, h 40");

    QwertyKeyPad keyPad = new QwertyKeyPad();
    contentPane.add(keyPad, "newline, grow, span, h 300!, gaptop 10");

    contentPane.add(new JSeparator(JSeparator.HORIZONTAL), "newline, grow, span, gaptop 10px");

    btnOk = new com.floreantpos.swing.PosButton();
    btnOk.setText(com.floreantpos.POSConstants.OK.toUpperCase());
    btnOk.setPreferredSize(new java.awt.Dimension(120, 50));
    btnOk.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            doFinish(evt);
          }
        });

    btnCancel = new com.floreantpos.swing.PosButton();
    btnCancel.setText(com.floreantpos.POSConstants.CANCEL.toUpperCase());
    btnCancel.setPreferredSize(new java.awt.Dimension(120, 50));
    btnCancel.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            doCancel(evt);
          }
        });

    JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
    buttonPanel.add(btnOk);
    buttonPanel.add(btnCancel);

    contentPane.add(buttonPanel, "newline, grow, span");

    getContentPane().add(contentPane);

    initData();
  } // </editor-fold>//GEN-END:initComponents