List of usage examples for javax.swing JOptionPane OK_OPTION
int OK_OPTION
To view the source code for javax.swing JOptionPane OK_OPTION.
Click Source Link
From source file:com.cch.aj.entryrecorder.frame.MainJFrame.java
private void btnTapActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnTapActionPerformed Boolean isSave = false;// w w w . j a v a2 s. com String staff = ""; String pass = "NO"; if (this.currentEntry != null) { if (this.cbTap.getSelectedIndex() != 0) { if (recordValidationService.Validate(currentEntry, RecordKey.TAP_POSITION, (float) this.cbTap.getSelectedIndex())) { isSave = true; pass = "YES"; } else { String checker = JOptionPane.showInputDialog(this, "the value is not within the range, please entry technician name.", "Warning", JOptionPane.OK_OPTION); pass = "NO(" + checker + ")"; if (!checker.equals("")) { isSave = true; } } staff = txtTapStaff.getText(); this.txtTapStaff.setText(""); } else { JOptionPane.showMessageDialog(this, "Please select the tap position.", "Warning", JOptionPane.OK_OPTION); } if (isSave) { DefaultTableModel model = (DefaultTableModel) this.tblTap.getModel(); Date now = new Date(); String time = new SimpleDateFormat("HH:mm").format(now); Float value = (float) this.cbTap.getSelectedIndex(); String stringValue = this.cbTap.getSelectedItem().toString(); model.addRow(new Object[] { time, stringValue, pass, staff }); ((AbstractTableModel) this.tblTap.getModel()).fireTableDataChanged(); datasetTap.addValue(value, "Tap", time); this.cbTap.setSelectedIndex(0); UpdateEntryData(now, value, RecordKey.TAP_POSITION, staff, pass, stringValue); } } }
From source file:com.cch.aj.entryrecorder.frame.MainJFrame.java
private void btnBoreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBoreActionPerformed Boolean isSave = false;/* w w w. jav a 2 s . co m*/ String staff = ""; String pass = "NO"; String checker = ""; if (this.currentEntry != null) { if (AppHelper.CheckTwoDigit(this.txtBore1.getText()) && AppHelper.CheckTwoDigit(this.txtBore2.getText()) && AppHelper.CheckTwoDigit(this.txtNeck.getText())) { if (recordValidationService.Validate(currentEntry, RecordKey.THREAD_BORE1, Float.parseFloat(this.txtBore1.getText())) && recordValidationService.Validate(currentEntry, RecordKey.THREAD_BORE2, Float.parseFloat(this.txtBore2.getText())) && recordValidationService.Validate(currentEntry, RecordKey.THREAD_NECK, Float.parseFloat(this.txtNeck.getText()))) { isSave = true; } else { checker = JOptionPane.showInputDialog(this, "the value is not within the range, please entry technician name.", "Warning", JOptionPane.OK_OPTION); if (!checker.equals("")) { isSave = true; } } staff = this.txtBoreStaff.getText(); this.txtBoreStaff.setText(""); } else { JOptionPane.showMessageDialog(this, "Please entry the valid number like (123.45).", "Warning", JOptionPane.OK_OPTION); } if (isSave) { DefaultTableModel model = (DefaultTableModel) this.tblBore.getModel(); Date now = new Date(); String time = new SimpleDateFormat("HH:mm").format(now); Float valueBore1 = Float.parseFloat(this.txtBore1.getText()); Float valueBore2 = Float.parseFloat(this.txtBore2.getText()); Float valueNeck = Float.parseFloat(this.txtNeck.getText()); if (recordValidationService.Validate(currentEntry, RecordKey.THREAD_BORE1, valueBore1)) { pass = "YES"; } else { pass = "NO(" + checker + ")"; } model.addRow(new Object[] { time, RecordKey.THREAD_BORE1, valueBore1, pass, staff }); UpdateEntryData(now, valueBore1, RecordKey.THREAD_BORE1, staff, pass, ""); if (recordValidationService.Validate(currentEntry, RecordKey.THREAD_BORE2, valueBore2)) { pass = "YES"; } else { pass = "NO(" + checker + ")"; } model.addRow(new Object[] { time, RecordKey.THREAD_BORE2, valueBore2, pass, staff }); UpdateEntryData(now, valueBore2, RecordKey.THREAD_BORE2, staff, pass, ""); if (recordValidationService.Validate(currentEntry, RecordKey.THREAD_NECK, valueNeck)) { pass = "YES"; } else { pass = "NO(" + checker + ")"; } model.addRow(new Object[] { time, RecordKey.THREAD_NECK, valueNeck, pass, staff }); UpdateEntryData(now, valueNeck, RecordKey.THREAD_NECK, staff, pass, ""); ((AbstractTableModel) this.tblBore.getModel()).fireTableDataChanged(); this.txtBore1.setText(""); this.txtBore2.setText(""); this.txtNeck.setText(""); // } } }
From source file:com.cch.aj.entryrecorder.frame.MainJFrame.java
private void btnCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCheckActionPerformed Boolean isSave = false;/* www. j a v a 2s .com*/ String staff = ""; String pass = "NO"; if (this.currentEntry != null) { if (this.cbNeckRound.getSelectedIndex() != 0 && this.cbNeckComplete.getSelectedIndex() != 0 && this.cbUnderTheHandle.getSelectedIndex() != 0 && this.cbBungIfDrilled.getSelectedIndex() != 0 && this.cbBase.getSelectedIndex() != 0 && this.cbStrengthOfDrum.getSelectedIndex() != 0 && this.cbWeightWithinRange.getSelectedIndex() != 0 && this.cbColourTexture.getSelectedIndex() != 0 && this.cbBungProvision.getSelectedIndex() != 0) { if (this.cbNeckRound.getSelectedIndex() != 2 && this.cbNeckComplete.getSelectedIndex() != 2 && this.cbUnderTheHandle.getSelectedIndex() != 2 && this.cbBungIfDrilled.getSelectedIndex() != 2 && this.cbBase.getSelectedIndex() != 2 && this.cbStrengthOfDrum.getSelectedIndex() != 2 && this.cbWeightWithinRange.getSelectedIndex() != 2 && this.cbColourTexture.getSelectedIndex() != 2 && this.cbBungProvision.getSelectedIndex() != 2) { isSave = true; pass = "YES"; } else { String checker = JOptionPane.showInputDialog(this, "the value is not within the range, please entry technician name.", "Warning", JOptionPane.OK_OPTION); pass = "NO(" + checker + ")"; if (!checker.equals("")) { isSave = true; } } staff = this.txtCheckStaff.getText(); this.txtCheckStaff.setText(""); } else { JOptionPane.showMessageDialog(this, "Please complete all the checks.", "Warning", JOptionPane.OK_OPTION); } if (isSave) { DefaultTableModel model = (DefaultTableModel) this.tblCheck.getModel(); Date now = new Date(); String time = new SimpleDateFormat("HH:mm").format(now); model.addRow(new Object[] { time, RecordKey.CHECK_NECK_ROUND, this.cbNeckRound.getSelectedItem(), pass, staff }); model.addRow(new Object[] { time, RecordKey.CHECK_NECK_COMPLETE, this.cbNeckComplete.getSelectedItem(), pass, staff }); model.addRow(new Object[] { time, RecordKey.CHECK_UNDER_THE_HANDLE, this.cbUnderTheHandle.getSelectedItem(), pass, staff }); model.addRow(new Object[] { time, RecordKey.CHECK_BUNG_IF_DRILLED, this.cbBungIfDrilled.getSelectedItem(), pass, staff }); model.addRow( new Object[] { time, RecordKey.CHECK_BASE, this.cbBase.getSelectedItem(), pass, staff }); model.addRow(new Object[] { time, RecordKey.CHECK_STRENGTH_OF_DRUM, this.cbStrengthOfDrum.getSelectedItem(), pass, staff }); model.addRow(new Object[] { time, RecordKey.CHECK_WEIGHT_WITHIN_RANGE, this.cbWeightWithinRange.getSelectedItem(), pass, staff }); model.addRow(new Object[] { time, RecordKey.CHECK_COLOUR_TEXTURE, this.cbColourTexture.getSelectedItem(), pass, staff }); model.addRow(new Object[] { time, RecordKey.CHECK_BUNG_PROVISION, this.cbBungProvision.getSelectedItem(), pass, staff }); ((AbstractTableModel) this.tblCheck.getModel()).fireTableDataChanged(); // UpdateEntryData(now, (float) this.cbNeckRound.getSelectedIndex(), RecordKey.CHECK_NECK_ROUND, staff, pass, this.cbNeckRound.getSelectedItem().toString()); UpdateEntryData(now, (float) this.cbNeckComplete.getSelectedIndex(), RecordKey.CHECK_NECK_COMPLETE, staff, pass, this.cbNeckComplete.getSelectedItem().toString()); UpdateEntryData(now, (float) this.cbUnderTheHandle.getSelectedIndex(), RecordKey.CHECK_UNDER_THE_HANDLE, staff, pass, this.cbUnderTheHandle.getSelectedItem().toString()); UpdateEntryData(now, (float) this.cbBungIfDrilled.getSelectedIndex(), RecordKey.CHECK_BUNG_IF_DRILLED, staff, pass, this.cbBungIfDrilled.getSelectedItem().toString()); UpdateEntryData(now, (float) this.cbBase.getSelectedIndex(), RecordKey.CHECK_BASE, staff, pass, this.cbBase.getSelectedItem().toString()); UpdateEntryData(now, (float) this.cbStrengthOfDrum.getSelectedIndex(), RecordKey.CHECK_STRENGTH_OF_DRUM, staff, pass, this.cbStrengthOfDrum.getSelectedItem().toString()); UpdateEntryData(now, (float) this.cbWeightWithinRange.getSelectedIndex(), RecordKey.CHECK_WEIGHT_WITHIN_RANGE, staff, pass, this.cbWeightWithinRange.getSelectedItem().toString()); UpdateEntryData(now, (float) this.cbColourTexture.getSelectedIndex(), RecordKey.CHECK_COLOUR_TEXTURE, staff, pass, this.cbColourTexture.getSelectedItem().toString()); UpdateEntryData(now, (float) this.cbBungProvision.getSelectedIndex(), RecordKey.CHECK_BUNG_PROVISION, staff, pass, this.cbBungProvision.getSelectedItem().toString()); this.cbNeckRound.setSelectedIndex(0); this.cbNeckComplete.setSelectedIndex(0); this.cbUnderTheHandle.setSelectedIndex(0); this.cbBungIfDrilled.setSelectedIndex(0); this.cbBase.setSelectedIndex(0); this.cbStrengthOfDrum.setSelectedIndex(0); this.cbWeightWithinRange.setSelectedIndex(0); this.cbColourTexture.setSelectedIndex(0); this.cbBungProvision.setSelectedIndex(0); } } }
From source file:com.cch.aj.entryrecorder.frame.MainJFrame.java
private void btnDropActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDropActionPerformed Boolean isSave = false;/*from w w w . j a v a2 s . com*/ String staff = ""; String pass = "NO"; if (this.currentEntry != null) { if (this.cbDrop1.getSelectedIndex() != 0 && this.cbDrop2.getSelectedIndex() != 0 && this.cbDrop3.getSelectedIndex() != 0 && this.cbDrop4.getSelectedIndex() != 0 && this.cbDrop5.getSelectedIndex() != 0 && this.cbDrop6.getSelectedIndex() != 0 && this.cbDrop7.getSelectedIndex() != 0 && this.cbDrop8.getSelectedIndex() != 0) { if (this.cbDrop1.getSelectedIndex() != 2 && this.cbDrop2.getSelectedIndex() != 2 && this.cbDrop3.getSelectedIndex() != 2 && this.cbDrop4.getSelectedIndex() != 2 && this.cbDrop5.getSelectedIndex() != 2 && this.cbDrop6.getSelectedIndex() != 2 && this.cbDrop7.getSelectedIndex() != 2 && this.cbDrop8.getSelectedIndex() != 2) { isSave = true; pass = "YES"; } else { String checker = JOptionPane.showInputDialog(this, "the value is not within the range, please entry technician name.", "Warning", JOptionPane.OK_OPTION); pass = "NO(" + checker + ")"; if (!checker.equals("")) { isSave = true; } } staff = this.txtDropStaff.getText(); this.txtDropStaff.setText(""); } else { JOptionPane.showMessageDialog(this, "Please complete all the tests.", "Warning", JOptionPane.OK_OPTION); } if (isSave) { DefaultTableModel model = (DefaultTableModel) this.tblDrop.getModel(); Date now = new Date(); String time = new SimpleDateFormat("HH:mm").format(now); model.addRow( new Object[] { time, RecordKey.DROP_TEST_1, this.cbDrop1.getSelectedItem(), pass, staff }); model.addRow( new Object[] { time, RecordKey.DROP_TEST_2, this.cbDrop2.getSelectedItem(), pass, staff }); model.addRow( new Object[] { time, RecordKey.DROP_TEST_3, this.cbDrop3.getSelectedItem(), pass, staff }); model.addRow( new Object[] { time, RecordKey.DROP_TEST_4, this.cbDrop4.getSelectedItem(), pass, staff }); model.addRow( new Object[] { time, RecordKey.DROP_TEST_5, this.cbDrop5.getSelectedItem(), pass, staff }); model.addRow( new Object[] { time, RecordKey.DROP_TEST_6, this.cbDrop6.getSelectedItem(), pass, staff }); model.addRow( new Object[] { time, RecordKey.DROP_TEST_7, this.cbDrop7.getSelectedItem(), pass, staff }); model.addRow( new Object[] { time, RecordKey.DROP_TEST_8, this.cbDrop8.getSelectedItem(), pass, staff }); ((AbstractTableModel) this.tblDrop.getModel()).fireTableDataChanged(); // UpdateEntryData(now, (float) this.cbDrop1.getSelectedIndex(), RecordKey.DROP_TEST_1, pass, staff, this.cbDrop1.getSelectedItem().toString()); UpdateEntryData(now, (float) this.cbDrop2.getSelectedIndex(), RecordKey.DROP_TEST_2, pass, staff, this.cbDrop2.getSelectedItem().toString()); UpdateEntryData(now, (float) this.cbDrop3.getSelectedIndex(), RecordKey.DROP_TEST_3, pass, staff, this.cbDrop3.getSelectedItem().toString()); UpdateEntryData(now, (float) this.cbDrop4.getSelectedIndex(), RecordKey.DROP_TEST_4, pass, staff, this.cbDrop4.getSelectedItem().toString()); UpdateEntryData(now, (float) this.cbDrop5.getSelectedIndex(), RecordKey.DROP_TEST_5, pass, staff, this.cbDrop5.getSelectedItem().toString()); UpdateEntryData(now, (float) this.cbDrop6.getSelectedIndex(), RecordKey.DROP_TEST_6, pass, staff, this.cbDrop6.getSelectedItem().toString()); UpdateEntryData(now, (float) this.cbDrop7.getSelectedIndex(), RecordKey.DROP_TEST_7, pass, staff, this.cbDrop7.getSelectedItem().toString()); UpdateEntryData(now, (float) this.cbDrop8.getSelectedIndex(), RecordKey.DROP_TEST_8, pass, staff, this.cbDrop8.getSelectedItem().toString()); this.cbDrop1.setSelectedIndex(0); this.cbDrop2.setSelectedIndex(0); this.cbDrop3.setSelectedIndex(0); this.cbDrop4.setSelectedIndex(0); this.cbDrop5.setSelectedIndex(0); this.cbDrop6.setSelectedIndex(0); this.cbDrop7.setSelectedIndex(0); this.cbDrop8.setSelectedIndex(0); } } }
From source file:com.cch.aj.entryrecorder.frame.MainJFrame.java
private void btnBungActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBungActionPerformed Boolean isSave = false;//from w w w . j a v a2 s.co m String staff = ""; String pass = "NO"; if (this.currentEntry != null) { if (this.cbBung.getSelectedIndex() != 0) { if (this.cbBung.getSelectedIndex() != 1) { isSave = true; pass = "YES"; } else { String checker = JOptionPane.showInputDialog(this, "the value is not within the range, please entry technician name.", "Warning", JOptionPane.OK_OPTION); pass = "NO(" + checker + ")"; if (!checker.equals("")) { isSave = true; } } staff = txtBungStaff.getText(); this.txtBungStaff.setText(""); } else { JOptionPane.showMessageDialog(this, "Please select the tap position.", "Warning", JOptionPane.OK_OPTION); } if (isSave) { DefaultTableModel model = (DefaultTableModel) this.tblBung.getModel(); Date now = new Date(); String time = new SimpleDateFormat("HH:mm").format(now); Float value = (float) this.cbBung.getSelectedIndex(); String stringValue = this.cbBung.getSelectedItem().toString(); model.addRow(new Object[] { time, stringValue, pass, staff }); ((AbstractTableModel) this.tblBung.getModel()).fireTableDataChanged(); this.cbBung.setSelectedIndex(0); UpdateEntryData(now, value, RecordKey.BUNG, staff, pass, stringValue); } } }
From source file:com.cch.aj.entryrecorder.frame.MainJFrame.java
private void btnRejectsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRejectsActionPerformed Boolean isSave = false;/* w ww . j ava 2 s . com*/ String staff = ""; String pass = "NO"; if (this.currentEntry != null) { if (!this.txtRejects.getText().equals("")) { isSave = true; pass = "YES"; } else { JOptionPane.showMessageDialog(this, "Please entry the mount of the rejects.", "Warning", JOptionPane.OK_OPTION); } if (isSave) { DefaultTableModel model = (DefaultTableModel) this.tblRejects.getModel(); Date now = new Date(); String time = new SimpleDateFormat("HH:mm").format(now); Float value = Float.parseFloat(this.txtRejects.getText()); model.addRow(new Object[] { time, value }); ((AbstractTableModel) this.tblRejects.getModel()).fireTableDataChanged(); this.txtRejects.setText(""); UpdateEntryData(now, value, RecordKey.BUNG, staff, pass, ""); } } }
From source file:com.cch.aj.entryrecorder.frame.MainJFrame.java
private void btnSecondsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSecondsActionPerformed Boolean isSave = false;//from w w w. ja v a 2 s .co m String staff = ""; String pass = "NO"; if (this.currentEntry != null) { if (!this.txtSeconds.getText().equals("")) { isSave = true; pass = "YES"; } else { JOptionPane.showMessageDialog(this, "Please entry the mount of the seconds.", "Warning", JOptionPane.OK_OPTION); } if (isSave) { DefaultTableModel model = (DefaultTableModel) this.tblSeconds.getModel(); Date now = new Date(); String time = new SimpleDateFormat("HH:mm").format(now); Float value = Float.parseFloat(this.txtSeconds.getText()); model.addRow(new Object[] { time, value }); ((AbstractTableModel) this.tblSeconds.getModel()).fireTableDataChanged(); this.txtSeconds.setText(""); UpdateEntryData(now, value, RecordKey.BUNG, staff, pass, ""); } } }
From source file:com.cch.aj.entryrecorder.frame.MainJFrame.java
private void btnCycleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCycleActionPerformed Boolean isSave = false;/*ww w . j av a2 s. com*/ String staff = ""; String pass = "NO"; if (this.currentEntry != null) { if (!this.txtCycle.getText().equals("")) { isSave = true; pass = "YES"; staff = txtCycleStaff.getText(); this.txtCycleStaff.setText(""); } else { JOptionPane.showMessageDialog(this, "Please entry the value of cycle time.", "Warning", JOptionPane.OK_OPTION); } if (isSave) { DefaultTableModel model = (DefaultTableModel) this.tblCycle.getModel(); Date now = new Date(); String time = new SimpleDateFormat("HH:mm").format(now); Float value = (float) 0; String stringValue = this.txtCycle.getText(); model.addRow(new Object[] { time, stringValue, staff }); ((AbstractTableModel) this.tblCycle.getModel()).fireTableDataChanged(); this.txtCycle.setText(""); UpdateEntryData(now, value, RecordKey.CYCLE, staff, pass, stringValue); } } }
From source file:com.cch.aj.entryrecorder.frame.MainJFrame.java
private void btnLeakFillActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLeakFillActionPerformed Boolean isSave = false;//from w w w .j a va 2 s . c o m if (this.currentEntry != null) { if (!this.txtLeakFill.getText().equals("")) { isSave = true; } else { JOptionPane.showMessageDialog(this, "Please entry the data.", "Warning", JOptionPane.OK_OPTION); } if (isSave) { DefaultTableModel model = (DefaultTableModel) this.tblLeak.getModel(); Date now = new Date(); String time = new SimpleDateFormat("HH:mm").format(now); String stringValue = this.txtLeakFill.getText(); model.addRow(new Object[] { time, RecordKey.LEAK_FILL, stringValue }); ((AbstractTableModel) this.tblLeak.getModel()).fireTableDataChanged(); this.txtLeakFill.setText(""); UpdateEntryData(now, 0f, RecordKey.LEAK_FILL, "", "", stringValue); this.labLeakTime.setText(time); } } }
From source file:com.cch.aj.entryrecorder.frame.MainJFrame.java
private void btnLeakCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLeakCheckActionPerformed Boolean isSave = false;// w w w . ja v a2 s . co m if (this.currentEntry != null) { if (!this.txtLeakCheck.getText().equals("")) { isSave = true; } else { JOptionPane.showMessageDialog(this, "Please entry the data.", "Warning", JOptionPane.OK_OPTION); } if (isSave) { DefaultTableModel model = (DefaultTableModel) this.tblLeak.getModel(); Date now = new Date(); String time = new SimpleDateFormat("HH:mm").format(now); String stringValue = this.txtLeakCheck.getText(); model.addRow(new Object[] { time, RecordKey.LEAK_CHECK, stringValue }); this.txtLeakCheck.setText(""); UpdateEntryData(now, 0f, RecordKey.LEAK_CHECK, "", "", stringValue); // stringValue = this.cbLeak.getSelectedItem().toString(); model.addRow(new Object[] { time, RecordKey.ANY_LEAK, stringValue }); this.cbLeak.setSelectedIndex(0); UpdateEntryData(now, 0f, RecordKey.ANY_LEAK, "", "", stringValue); // if (!this.txtLeakNotes.getText().equals("")) { stringValue = this.txtLeakNotes.getText(); model.addRow(new Object[] { time, RecordKey.LEAK_NOTES, stringValue }); this.txtLeakNotes.setText(""); UpdateEntryData(now, 0f, RecordKey.LEAK_NOTES, "", "", stringValue); } // ((AbstractTableModel) this.tblLeak.getModel()).fireTableDataChanged(); } } }