public void actionPerformed(java.awt.event.ActionEvent event) { Object object = event.getSource(); if (object == cancelButton) cancelButton_actionPerformed(event); else if (object == okButton) okButton_actionPerformed(event); else if (object == applyButton) applyButton_actionPerformed(event); else if (object == markEditor) markEditor_actionPerformed(event); }
private void remainderComBoxActionPerformed(java.awt.event.ActionEvent evt) { int selected = ((JComboBox) evt.getSource()).getSelectedIndex(); String remType = ""; String param = round.getGenerator().getParam(); if (round.getGenerator().getClass() != DivisionGenerator.class) { param = '/' + param.substring(1) + ".0n"; } switch (selected) { case 0: remType = "n"; ansDecPlacesText.setEnabled(false); remainder = false; break; case 1: remType = "i"; ansDecPlacesText.setEnabled(false); remainder = true; break; case 2: remType = "d"; ansDecPlacesText.setEnabled(true); remainder = false; break; } round = new Round( new DivisionGenerator( param.substring(0, param.length()) + remType, new ValidDivisionChecker()), round.getNumProblems()); resetProblems(); }
private void numOfProblemsTextActionPerformed(java.awt.event.ActionEvent evt) { round = new Round( round.getGenerator(), Integer.parseInt( ((Long) ((JFormattedTextField) evt.getSource()).getValue()).toString())); resetProblems(); }
private void operationComBoxActionPerformed(java.awt.event.ActionEvent evt) { int selected = ((JComboBox) evt.getSource()).getSelectedIndex(); String operator = ""; switch (selected) { case 0: operator = "+"; addCarrying.setVisible(true); subBorrowing.setVisible(false); divPanel.setVisible(false); remainder = false; break; case 1: operator = "-"; addCarrying.setVisible(false); subBorrowing.setVisible(true); divPanel.setVisible(false); remainder = false; break; case 2: operator = "*"; addCarrying.setVisible(false); subBorrowing.setVisible(false); divPanel.setVisible(false); remainder = false; break; default: break; } String param; if (round.getGenerator().getClass() == DivisionGenerator.class) { param = operator + ((DivisionGenerator) round.getGenerator()).getGeneralParam().substring(1); } else { param = operator + round.getGenerator().getParam().substring(1); } round = new Round(new Generator(param, new EmptyChecker()), round.getNumProblems()); if (selected == 3) { round = new Round( new DivisionGenerator( ("/" + round.getGenerator().getParam().substring(1) + ".0n"), new ValidDivisionChecker()), round.getNumProblems()); addCarrying.setVisible(false); subBorrowing.setVisible(false); divPanel.setVisible(true); remainder = false; remainderComBox.setSelectedIndex(0); ansDecPlacesText.setEnabled( ((DivisionGenerator) round.getGenerator()).getRemainderType() == 'd'); pack(); setSize(getSize().width, getSize().height + 60); } resetProblems(); }
private void subBorrowingActionPerformed(java.awt.event.ActionEvent evt) { if (((JCheckBox) evt.getSource()).isSelected()) round = new Round( new Generator(round.getGenerator().getParam(), new SubCarryChecker()), round.getNumProblems()); else round = new Round( new Generator(round.getGenerator().getParam(), new EmptyChecker()), round.getNumProblems()); resetProblems(); }
private void ansDecPlacesTextActionPerformed(java.awt.event.ActionEvent evt) { ((DivisionGenerator) round.getGenerator()) .setAnsDecPlaces((int) ((JFormattedTextField) evt.getSource()).getValue()); round = new Round(round.getGenerator(), round.getNumProblems()); resetProblems(); }