public JInternalFramePalletSplit(String sscc) { super(); this.setTitle("Split Pallet"); int copies = Integer.valueOf( ctrl.getKeyValueWithDefault( "DEFAULT_LABELS_TO_PRINT", "2", "Default No of Labels to print")); copiesnumbermodel = new SpinnerNumberModel(copies, 1, 100, 1); initGUI(); final JHelp help = new JHelp(); help.enableHelpOnButton(jButtonHelp, JUtility.getHelpSetIDforModule("FRM_PAL_SPLIT")); lsscc = sscc; jTextFieldSSCC.setText(lsscc); jTextFieldSSCC.setEnabled(false); refresh(); SwingUtilities.invokeLater( new Runnable() { public void run() { jFormattedTextFieldSplitQuantity.requestFocus(); jFormattedTextFieldSplitQuantity.setCaretPosition( jFormattedTextFieldSplitQuantity.getText().length()); } }); }
private void initGUI() { try { this.setPreferredSize(new java.awt.Dimension(471, 531)); this.setBounds(0, 0, 642, 304); setVisible(true); this.setIconifiable(true); this.setClosable(true); { jDesktopPane1 = new JDesktopPane(); jDesktopPane1.setBackground(Color.WHITE); this.getContentPane().add(jDesktopPane1, BorderLayout.CENTER); jDesktopPane1.setPreferredSize(new java.awt.Dimension(462, 497)); jDesktopPane1.setLayout(null); jTextFieldSSCC = new JTextField4j(); AbstractDocument doc = (AbstractDocument) jTextFieldSSCC.getDocument(); doc.setDocumentFilter(new JFixedSizeFilter(JDBPallet.field_sscc)); jTextFieldSSCC.addKeyListener( new KeyAdapter() { @Override public void keyReleased(KeyEvent arg0) { refresh(); } }); jTextFieldSSCC.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { refresh(); } }); jDesktopPane1.add(jTextFieldSSCC); jTextFieldSSCC.setBounds(121, 24, 134, 21); jTextFieldNewSSCC = new JTextField4j(); jDesktopPane1.add(jTextFieldNewSSCC); jTextFieldNewSSCC.setEditable(false); jTextFieldNewSSCC.setEnabled(false); jTextFieldNewSSCC.setBounds(121, 53, 134, 21); jFormattedTextFieldQuantity = new JQuantityInput(new BigDecimal("0")); jDesktopPane1.add(jFormattedTextFieldQuantity); jFormattedTextFieldQuantity.setFont(Common.font_std); jFormattedTextFieldQuantity.setHorizontalAlignment(SwingConstants.TRAILING); jFormattedTextFieldQuantity.setBounds(464, 24, 91, 21); jFormattedTextFieldQuantity.setVerifyInputWhenFocusTarget(false); jFormattedTextFieldQuantity.setEnabled(false); jFormattedTextFieldNewQuantity = new JQuantityInput(new BigDecimal("0")); jDesktopPane1.add(jFormattedTextFieldNewQuantity); jFormattedTextFieldNewQuantity.setFont(Common.font_std); jFormattedTextFieldNewQuantity.setHorizontalAlignment(SwingConstants.TRAILING); jFormattedTextFieldNewQuantity.setBounds(464, 53, 91, 21); jFormattedTextFieldNewQuantity.setVerifyInputWhenFocusTarget(false); jFormattedTextFieldNewQuantity.setEnabled(false); jFormattedTextFieldSplitQuantity = new JQuantityInput(new BigDecimal("0")); jDesktopPane1.add(jFormattedTextFieldSplitQuantity); jFormattedTextFieldSplitQuantity.setFont(Common.font_std); jFormattedTextFieldSplitQuantity.setHorizontalAlignment(SwingConstants.TRAILING); jFormattedTextFieldSplitQuantity.setBounds(269, 87, 91, 21); jFormattedTextFieldSplitQuantity.setVerifyInputWhenFocusTarget(false); labelSSCCQuantity = new JLabel4j_std(); jDesktopPane1.add(labelSSCCQuantity); labelSSCCQuantity.setText(lang.get("lbl_Pallet_Quantity")); labelSSCCQuantity.setHorizontalAlignment(SwingConstants.TRAILING); labelSSCCQuantity.setBounds(369, 24, 88, 21); labelSSCCNewQuantity = new JLabel4j_std(); jDesktopPane1.add(labelSSCCNewQuantity); labelSSCCNewQuantity.setText(lang.get("lbl_Pallet_Quantity")); labelSSCCNewQuantity.setHorizontalAlignment(SwingConstants.TRAILING); labelSSCCNewQuantity.setBounds(369, 53, 88, 21); labelNewSSCCQuantity = new JLabel4j_std(); jDesktopPane1.add(labelNewSSCCQuantity); labelNewSSCCQuantity.setText(lang.get("lbl_Required_Quantity")); labelNewSSCCQuantity.setHorizontalAlignment(SwingConstants.TRAILING); labelNewSSCCQuantity.setBounds(137, 86, 125, 21); jButtonSplit = new JButton4j(Common.icon_split); jButtonSplit.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { String splitSSCC = pal.splitPallet( jTextFieldSSCC.getText(), new BigDecimal(jFormattedTextFieldSplitQuantity.getValue().toString())); if (splitSSCC.equals("") == false) { lblStatus.setText( "SSCC " + jTextFieldSSCC.getText() + " updated, SSCC " + splitSSCC + " created."); jTextFieldNewSSCC.setText(splitSSCC); jFormattedTextFieldNewQuantity.setValue( jFormattedTextFieldSplitQuantity.getValue()); String pq = comboBoxPrintQueue.getSelectedItem().toString(); if (checkBoxPrintOldSSCC.isSelected()) { buildSQL1Record(jTextFieldSSCC.getText()); JLaunchReport.runReport( "RPT_PALLET_LABEL", listStatement, jCheckBoxAutoPreview.isSelected(), pq, Integer.valueOf(jSpinnerCopies.getValue().toString()), checkBoxIncHeaderText.isSelected()); } if (checkBoxPrintNewSSCC.isSelected()) { buildSQL1Record(jTextFieldNewSSCC.getText()); JLaunchReport.runReport( "RPT_PALLET_LABEL", listStatement, jCheckBoxAutoPreview.isSelected(), pq, Integer.valueOf(jSpinnerCopies.getValue().toString()), checkBoxIncHeaderText.isSelected()); } } else { JUtility.errorBeep(); JOptionPane.showMessageDialog( Common.mainForm, pal.getErrorMessage(), lang.get("dlg_Error"), JOptionPane.WARNING_MESSAGE); } } }); jDesktopPane1.add(jButtonSplit); jButtonSplit.setText(lang.get("btn_Split")); jButtonSplit.setMnemonic(lang.getMnemonicChar()); jButtonSplit.setBounds(151, 205, 111, 28); jButtonHelp = new JButton4j(Common.icon_help); jDesktopPane1.add(jButtonHelp); jButtonHelp.setText(lang.get("btn_Help")); jButtonHelp.setMnemonic(lang.getMnemonicChar()); jButtonHelp.setBounds(265, 205, 111, 28); jButtonCancel = new JButton4j(Common.icon_close); jDesktopPane1.add(jButtonCancel); jButtonCancel.setText(lang.get("btn_Close")); jButtonCancel.setMnemonic(lang.getMnemonicChar()); jButtonCancel.setBounds(378, 205, 111, 28); jButtonCancel.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { dispose(); } }); labelSSCC = new JLabel4j_std(); jDesktopPane1.add(labelSSCC); labelSSCC.setText(lang.get("lbl_Source_SSCC")); labelSSCC.setBounds(6, 24, 103, 21); labelSSCC.setHorizontalAlignment(SwingConstants.TRAILING); labelNewSSCC = new JLabel4j_std(); jDesktopPane1.add(labelNewSSCC); labelNewSSCC.setText(lang.get("lbl_Destination_SSCC")); labelNewSSCC.setBounds(18, 53, 91, 21); labelNewSSCC.setHorizontalAlignment(SwingConstants.TRAILING); JLabel4j_std labelHeader = new JLabel4j_std(); labelHeader.setHorizontalAlignment(SwingConstants.TRAILING); labelHeader.setText(lang.get("lbl_Label_Header_Text")); labelHeader.setBounds(18, 112, 91, 21); jDesktopPane1.add(labelHeader); checkBoxIncHeaderText.setText("New JCheckBox"); checkBoxIncHeaderText.setSelected(true); checkBoxIncHeaderText.setBackground(Color.WHITE); checkBoxIncHeaderText.setBounds(121, 112, 21, 21); jDesktopPane1.add(checkBoxIncHeaderText); JLabel4j_std labelQuantity = new JLabel4j_std(); labelQuantity.setBounds(248, 112, 182, 21); labelQuantity.setHorizontalAlignment(SwingConstants.RIGHT); labelQuantity.setText(lang.get("lbl_Number_of_SSCCs")); jDesktopPane1.add(labelQuantity); JLabel4j_std labelCopies = new JLabel4j_std(); labelCopies.setHorizontalAlignment(SwingConstants.RIGHT); labelCopies.setBounds(248, 141, 182, 21); labelCopies.setText(lang.get("lbl_Labels_Per_SSCC")); jDesktopPane1.add(labelCopies); jSpinnerQuantity.setEnabled(false); jSpinnerQuantity.setModel( new SpinnerNumberModel(new Integer(1), null, null, new Integer(1))); jSpinnerQuantity.setFont(Common.font_std); jSpinnerQuantity.setBounds(437, 112, 39, 21); JSpinner.NumberEditor ne = new JSpinner.NumberEditor(jSpinnerQuantity); ne.getTextField().setFont(Common.font_std); jSpinnerQuantity.setEditor(ne); jDesktopPane1.add(jSpinnerQuantity); jSpinnerCopies.setFont(Common.font_std); jSpinnerCopies.setBounds(437, 141, 39, 21); jSpinnerCopies.setInputVerifier(null); jSpinnerCopies.setModel(copiesnumbermodel); JSpinner.NumberEditor nec2 = new JSpinner.NumberEditor(jSpinnerCopies); nec2.getTextField().setFont(Common.font_std); jSpinnerCopies.setEditor(nec2); jDesktopPane1.add(jSpinnerCopies); JLabel4j_std label_3 = new JLabel4j_std(lang.get("lbl_Print_Queue")); label_3.setHorizontalAlignment(SwingConstants.TRAILING); label_3.setBounds(18, 174, 91, 21); jDesktopPane1.add(label_3); comboBoxPrintQueue.setSelectedIndex(-1); comboBoxPrintQueue.setBounds(121, 170, 471, 23); jDesktopPane1.add(comboBoxPrintQueue); jCheckBoxAutoPreview = new JCheckBox(); jCheckBoxAutoPreview.setToolTipText("Auto SSCC"); jCheckBoxAutoPreview.setText("New JCheckBox"); jCheckBoxAutoPreview.setSelected(true); jCheckBoxAutoPreview.setEnabled(false); jCheckBoxAutoPreview.setBackground(Color.WHITE); jCheckBoxAutoPreview.setBounds(121, 141, 21, 21); jCheckBoxAutoPreview.setEnabled( Common.userList.getUser(Common.sessionID).isModuleAllowed("FRM_PRODDEC_PREVIEW")); jDesktopPane1.add(jCheckBoxAutoPreview); labelPreview = new JLabel4j_std(); labelPreview.setBounds(18, 141, 91, 21); labelPreview.setHorizontalTextPosition(SwingConstants.CENTER); labelPreview.setHorizontalAlignment(SwingConstants.TRAILING); labelPreview.setText(lang.get("lbl_Preview")); jDesktopPane1.add(labelPreview); lblStatus.setForeground(Color.RED); lblStatus.setBackground(Color.GRAY); lblStatus.setBounds(2, 235, 610, 21); jDesktopPane1.add(lblStatus); JPanel panel = new JPanel(); panel.setBackground(Color.WHITE); panel.setBorder( new TitledBorder( null, lang.get("btn_Print"), TitledBorder.CENTER, TitledBorder.TOP, null, null)); panel.setBounds(270, 6, 90, 75); jDesktopPane1.add(panel); panel.setLayout(null); checkBoxPrintOldSSCC.setSelected(true); checkBoxPrintOldSSCC.setBounds(32, 17, 28, 23); panel.add(checkBoxPrintOldSSCC); checkBoxPrintNewSSCC.setSelected(true); checkBoxPrintNewSSCC.setBounds(32, 46, 28, 23); panel.add(checkBoxPrintNewSSCC); mod.setModuleId("RPT_PALLET_LABEL"); mod.getModuleProperties(); if (mod.getReportType().equals("Label")) { jCheckBoxAutoPreview.setSelected(false); jCheckBoxAutoPreview.setEnabled(false); } else { jSpinnerCopies.setVisible(false); labelCopies.setVisible(false); } populatePrinterList(JPrint.getDefaultPrinterQueueName()); } } catch (Exception e) { e.printStackTrace(); } }