private void myInit() { tf_branch.grabFocus(); init_key(); hover(); search(); init(); tf_branch_id.enable(false); tf_branch_id.setVisible(false); focus(); String where = ""; branches_list.clear(); branches_list = Branches.ret_where(where); init_tbl_branch_locations(); }
synchronized void checkDTG() { try { _theDTG = _dateF.parse(_theDate.getText()).getTime(); } catch (final ParseException e) { MWC.GUI.Dialogs.DialogFactory.showMessage( "Date Format Error", "Sorry, date incorrectly formatted (2001/1/21)"); } }
private void add_branch_locations() { if (tf_branch.getText().isEmpty()) { return; } Window p = (Window) this; Dlg_confirm_action nd = Dlg_confirm_action.create(p, true); nd.setTitle(""); nd.setCallback( new Dlg_confirm_action.Callback() { @Override public void ok(CloseDialog closeDialog, Dlg_confirm_action.OutputData data) { closeDialog.ok(); jProgressBar1.setString("Loading...Please wait..."); jProgressBar1.setIndeterminate(true); btn_new.setEnabled(false); btn_add.setEnabled(false); btn_edit.setEnabled(false); btn_delete.setEnabled(false); Thread t = new Thread( new Runnable() { @Override public void run() { int id = -1; String branch = tf_branch.getText(); String branch_id = tf_branch_id.getText(); String code = ""; String location = tf_location.getText(); String type = "USER"; int status = 0; to_branch_locations to = new to_branch_locations( id, branch, branch_id, code, location, type, status); S1_branch_locations.add_branch_locations(to); data_cols(); clear_branch_locations(); Alert.set(1, ""); jProgressBar1.setString("Finished..."); jProgressBar1.setIndeterminate(false); btn_new.setEnabled(true); btn_add.setEnabled(true); btn_edit.setEnabled(true); btn_delete.setEnabled(true); } }); t.start(); } }); nd.setLocationRelativeTo(this); nd.setVisible(true); }
private JPanel createSearchPanel(final FilteredJList classes) { JPanel search = new JPanel(); search.setLayout(new BorderLayout()); search.add(new JLabel("Choose a Demo to start: Find: "), BorderLayout.WEST); final javax.swing.JTextField jtf = new javax.swing.JTextField(); jtf.getDocument() .addDocumentListener( new DocumentListener() { public void removeUpdate(DocumentEvent e) { classes.setFilter(jtf.getText()); } public void insertUpdate(DocumentEvent e) { classes.setFilter(jtf.getText()); } public void changedUpdate(DocumentEvent e) { classes.setFilter(jtf.getText()); } }); jtf.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { selectedClass = classes.getSelectedValues(); startApp(selectedClass); } }); final JCheckBox showSettingCheck = new JCheckBox("Show Setting"); showSettingCheck.setSelected(true); showSettingCheck.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { showSetting = showSettingCheck.isSelected(); } }); jtf.setPreferredSize(new Dimension(100, 25)); search.add(jtf, BorderLayout.CENTER); search.add(showSettingCheck, BorderLayout.EAST); return search; }
protected final synchronized void refreshForm() { // set the location OriginLabel.setText( MWC.Utilities.TextFormatting.BriefFormatLocation.toString(ImportRangeDataPanel._theOrigin)); // set the filename FilenameLabel.setText(super._theFilename); // special case - in constructor we may get called before the _dateF // has been initialised if (_dateF != null) { // set the DTG _theDate.setText(_dateF.format(new Date(ImportRangeDataPanel._theDTG))); } }
private void edit_branch_locations() { if (tf_branch.getText().isEmpty()) { return; } jProgressBar1.setString("Loading...Please wait..."); jProgressBar1.setIndeterminate(true); btn_new.setEnabled(false); btn_add.setEnabled(false); btn_edit.setEnabled(false); btn_delete.setEnabled(false); Thread t = new Thread( new Runnable() { @Override public void run() { int row = tbl_branch_locations.getSelectedRow(); if (row < 0) { return; } to_branch_locations to = (to_branch_locations) tbl_branch_locations_ALM.get( tbl_branch_locations.convertRowIndexToModel(row)); int id = to.id; String branch = tf_branch.getText(); String branch_id = tf_branch_id.getText(); String code = ""; String location = tf_location.getText(); String type = "USER"; int status = 0; to_branch_locations to1 = new to_branch_locations(id, branch, branch_id, code, location, type, status); S1_branch_locations.edit_branch_locations(to1); data_cols(); clear_branch_locations(); Alert.set(2, ""); jProgressBar1.setString("Finished..."); jProgressBar1.setIndeterminate(false); btn_new.setEnabled(true); btn_add.setEnabled(true); btn_edit.setEnabled(true); btn_delete.setEnabled(true); } }); t.start(); }
public void calculaSumas() { try { TableModel tm = this.tablaPrincipal.getModel(); int tamTabla = tm.getRowCount(); double costo, cantidad, totalFila, sumaTotal; sumaTotal = 0.0; for (int i = 0; i < tamTabla; i++) { if (tm.getValueAt(i, 2) != null && tm.getValueAt(i, 3) != null) { costo = Double.valueOf(String.valueOf(tm.getValueAt(i, 2))); cantidad = Double.valueOf(String.valueOf(tm.getValueAt(i, 3))); totalFila = costo * cantidad; tm.setValueAt(totalFila, i, 4); sumaTotal += totalFila; } } txtSumaTotal.setText(String.valueOf(sumaTotal)); } catch (Exception e) { Dialogos.lanzarAlerta("Cantidades invalidas, puede que algun numero este mal escrito"); } }
private void clear_branch_locations() { tf_location.setText(""); }
private void data_cols() { String search = tf_branch_id.getText(); String location = tf_search.getText(); loadData_branch_locations(S1_branch_locations.ret_data_by_branch_id(search, location)); jLabel6.setText("" + tbl_branch_locations_ALM.size()); }
/////////////////////////////////// // member functions ////////////////////////////////// protected final void initForm() { thisPanel = new JPanel(); thisPanel.setName("Import Range Data"); thisPanel.setLayout(new java.awt.BorderLayout()); _thePanel.add(thisPanel); _theWarning = new JTextArea(); _theWarning.setEditable(false); String theMessage = "Warning, data imported through this panel has"; theMessage += " speed and course calculated as over the ground."; theMessage += System.getProperties().getProperty("line.separator"); theMessage += "Debrief recognises PC Argos (RAO) and PMRF (PRN) files."; theMessage += System.getProperties().getProperty("line.separator"); theMessage += "See Debrief Help File for file format and details."; _theWarning.setText(theMessage); _theWarning.setLineWrap(true); _theWarning.setBorder(BorderFactory.createLoweredBevelBorder()); _theWarning.setWrapStyleWord(true); thisPanel.add("North", _theWarning); //////////////////////////////////////////// // auto generated stuff //////////////////////////////////////////// ButtonPanel = new javax.swing.JPanel(); importBtn = new javax.swing.JButton(); closeBtn = new javax.swing.JButton(); PropertiesList = new javax.swing.JPanel(); FilenamePanel = new javax.swing.JPanel(); jLabel3 = new javax.swing.JLabel(); FilenameLabel = new javax.swing.JLabel(); selectFileBtn = new javax.swing.JButton(); FrequencyPanel = new javax.swing.JPanel(); FrequencyLabel = new javax.swing.JLabel(); FrequencyCombo = new TimeFrequencyCombo(); OriginPanel = new javax.swing.JPanel(); jLabel7 = new javax.swing.JLabel(); OriginLabel = new javax.swing.JLabel(); selectOriginBtn = new javax.swing.JButton(); DTGPanel = new javax.swing.JPanel(); jLabel9 = new javax.swing.JLabel(); _theDate = new javax.swing.JTextField("2001/01/30"); ///////////////////////////////////////////////// // button panel first ////////////////////////////////////////////////// importBtn.setText("Import"); ButtonPanel.add(importBtn); closeBtn.setText("Close"); ButtonPanel.add(closeBtn); thisPanel.add(ButtonPanel, java.awt.BorderLayout.SOUTH); closeBtn.addActionListener( new ActionListener() { public void actionPerformed(final ActionEvent e) { doClose(); } }); importBtn.addActionListener( new ActionListener() { public void actionPerformed(final ActionEvent e) { doImport(); } }); /////////////////////////////////////////////////// // now the properties panel /////////////////////////////////////////////////// PropertiesList.setLayout(new java.awt.GridLayout(0, 1)); jLabel3.setText("Filename:"); FilenamePanel.add(jLabel3); FilenameLabel.setText(" blank "); FilenamePanel.add(FilenameLabel); selectFileBtn.setPreferredSize(new java.awt.Dimension(33, 27)); selectFileBtn.setToolTipText("Select file"); selectFileBtn.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); selectFileBtn.setText("..."); selectFileBtn.addActionListener( new ActionListener() { public void actionPerformed(final ActionEvent e) { doEditFilename(); } }); FilenamePanel.add(selectFileBtn); PropertiesList.add(FilenamePanel); FrequencyLabel.setText("Frequency:"); FrequencyPanel.add(FrequencyLabel); FrequencyCombo.setPreferredSize(new java.awt.Dimension(100, 25)); FrequencyPanel.add(FrequencyCombo); PropertiesList.add(FrequencyPanel); jLabel7.setText("Origin:"); OriginPanel.add(jLabel7); OriginLabel.setText(" blank "); OriginPanel.add(OriginLabel); selectOriginBtn.setPreferredSize(new java.awt.Dimension(33, 27)); selectOriginBtn.setToolTipText("Select file"); selectOriginBtn.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); selectOriginBtn.setText("..."); selectOriginBtn.addActionListener( new ActionListener() { public void actionPerformed(final ActionEvent e) { editOrigin(); } }); OriginPanel.add(selectOriginBtn); PropertiesList.add(OriginPanel); ////////////////////////////////////////////////////// // DTG ///////////////////////////////////////////////////// jLabel9.setText("DTG (yyyy/mm/dd):"); _theDate.setText("2001/01/30"); _theDate.addFocusListener( new FocusAdapter() { public void focusLost(final FocusEvent e) { checkDTG(); } }); DTGPanel.add(jLabel9); DTGPanel.add(_theDate); PropertiesList.add(DTGPanel); final JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add(PropertiesList); thisPanel.add(jp, java.awt.BorderLayout.CENTER); }