private void doCurrentMethodStep() { switch (type) { case 0: // bisectiei if (Math.abs(function.evaluate((Cn.lastElement()).x)) < err) { complete = true; theTimer.stop(); } else if (function.evaluate((An.lastElement()).x) * function.evaluate((Cn.lastElement()).x) < 0) { Bn.add(Cn.lastElement()); Cn.add(new PointDP(((An.lastElement()).x + (Bn.lastElement()).x) / 2, 0.0)); } else { An.add(Cn.lastElement()); Cn.add(new PointDP(((An.lastElement()).x + (Bn.lastElement()).x) / 2, 0.0)); } break; case 1: // coardei { double evn = function.evaluate((An.lastElement()).x); if (Math.abs(evn) < err) { complete = true; theTimer.stop(); } else { double ev0 = function.evaluate((An.firstElement()).x); double newVal = (An.firstElement().x * evn - An.lastElement().x * ev0) / (evn - ev0); An.add(new PointDP(newVal, 0.0)); } } break; case 2: // secantei { double exn = function.evaluate((An.lastElement()).x); if (Math.abs(exn) < err) { complete = true; theTimer.stop(); } else { double exn1 = function.evaluate((An.elementAt(An.size() - 2)).x); double newVal = (An.elementAt(An.size() - 2).x * exn - (An.lastElement()).x * exn1) / (exn - exn1); An.add(new PointDP(newVal, 0.0)); } } break; case 3: // newton double xn = An.lastElement().x; if (Math.abs(function.evaluate(xn)) < err) { complete = true; theTimer.stop(); } An.add(new PointDP(xn - function.evaluate(xn) / function.evaluate_1(xn), 0.0)); break; } }
public void victory() { battleWon = true; player.expGain(totalExperience); enemies.removeAll(enemies); spellsThrown.removeAll(spellsThrown); staminaTimer.stop(); }
public void paintComponent(Graphics g) { if (m.isPressed()) { t = colorCount - 1; g.setColor(pressed[t]); g.fillRect(0, 0, getSize().width - 1, getSize().height - 1); g.setColor(border[t]); } else { g.setColor(rollOver[t]); g.fillRect(0, 0, getSize().width - 1, getSize().height - 1); g.setColor(border[t]); if (m.isRollover()) { if (t < colorCount - 1 && !fadeIn.isRunning()) { fadeOut.stop(); fadeIn.start(); } } else { if (t > 0 && !fadeOut.isRunning()) { fadeIn.stop(); fadeOut.start(); } } } super.paintComponent(g); }
public void actionPerformed(ActionEvent evt) { long time = (System.currentTimeMillis() - startTime); if (time > 1000) { Main.running.compareAndSet(true, false); stop(); } }
private void jBFecharActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jBFecharActionPerformed // TODO add your handling code here: this.setVisible(false); timerPCP.start(); timer.stop(); } // GEN-LAST:event_jBFecharActionPerformed
/** * Stops an activate auto scroll. This must be called when the drag & drop operation is finished. * * @see #checkAutoScroll(de.matthiasmann.twl.Event) */ public void stopAutoScroll() { if (autoScrollTimer != null) { autoScrollTimer.stop(); } autoScrollDirection = 0; setAutoScrollMarker(); }
public void stop() { pauseGame(); synchronized (timer) { timer.stop(); } timer = null; }
public void dispose() { if (isInitialized()) { myTimer.stop(); disposeListeners(); } myScrollPane = null; }
/* * reads the value of the digital input of the specified channel * requires that the readArudiono() method has already been called * param 1: the channel to be read * return: value of the specified digital input */ public boolean getInput(int channelID) { byte temp; if (timer.get() > 2.0) { DriverStationLCD.getInstance() .println(DriverStationLCD.Line.kUser3, 1, " "); DriverStationLCD.getInstance().updateLCD(); timer.stop(); timer.reset(); } if (Math.abs(channelID - (13 / 2)) - (13 / 2) > 0) // returns true if less than zero or greater than thirteen { timer.start(); DriverStationLCD.getInstance().println(DriverStationLCD.Line.kUser3, 1, "Invalid ID"); DriverStationLCD.getInstance().updateLCD(); return false; } else if (channelID < 8) { temp = (byte) (loByte & (1 << channelID)); return temp != 0; } else { temp = (byte) (hiByte & (1 << channelID - 8)); return temp != 0; } }
@Override public void actionPerformed(ActionEvent e) { if (t > 0) { t--; repaint(); } else fadeOut.stop(); }
@Override public void actionPerformed(ActionEvent e) { if (t < colorCount - 1) { t++; repaint(); } else fadeIn.stop(); }
@Override public final void actionPerformed(ActionEvent e) { myAutoSelectionTimer.stop(); if (getStep().isAutoSelectionEnabled()) { onAutoSelectionTimer(); } }
/** * Attempts to search the mod website for the mod and pull the recent versions of the mod. * * @param mod The Mod to search for on the website. * @param modInfoList The JList to populate/alter. */ public void getRecentVersionsOfModAsync(Profile.Mod mod, JList modInfoList) { // Here we set a thread task to get the version numbers for the mod. This will look at the site // and search for the mod, then pull all versions from it. Runnable task = () -> Crawler.readVersionInfoOfMod(mod.nameWithoutVersion); Thread thread = new Thread(task); thread.start(); // Our timer that checks every 200ms if the thread has finished. Timer timer = new Timer(200, null); timer.addActionListener( ev -> { if (thread.getState() != Thread.State.TERMINATED) timer.restart(); else { timer.stop(); DefaultListModel listModel = (DefaultListModel) modInfoList.getModel(); // Get the modVersionInfo from the crawler. If not null, add to the list. String[][] modVersionInfo = Crawler.getModVersionInfo(); if (modVersionInfo != null) { listModel.addElement("Recent Versions:"); for (String[] info : modVersionInfo) { listModel.addElement(" v" + info[0] + " for " + info[1]); } } else { listModel.addElement("Couldn't find the mod on the website."); } modInfoList.setModel(listModel); } }); timer.start(); }
public void actionPerformed(ActionEvent ae) { if (ae.getActionCommand() == "timer") { if (counter >= imagePaths.length) { timer.stop(); counter = 0; PlayStopButton.setText("Play"); } else { try { // if the array contains URLs if (imagePaths[counter].contains("http://")) { scrollPane.setToolTipText(imagePaths[counter]); imageIcon = new ImageIcon((new URL(imagePaths[counter++]))); scrollPane.setViewportView(new JLabel(imageIcon)); } // if the array contains local images else { image.setIcon(new ImageIcon(imagePaths[counter])); image.setToolTipText(imagePaths[counter++]); } } catch (MalformedURLException ex) { Logger.getLogger(Slideshow.class.getName()).log(Level.SEVERE, null, ex); image = new JLabel("?" + imagePaths); } } } }
public void mouseExited(MouseEvent e) { if (!readOnly) { lastMouseExitTime = System.currentTimeMillis(); if (timer != null && timer.isRunning()) { timer.stop(); } } }
private void jBFecharActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jBFecharActionPerformed timerTelaExclusao.stop(); timer.start(); this.setVisible(false); atualizar.doClick(); } // GEN-LAST:event_jBFecharActionPerformed
@Override public void actionPerformed(ActionEvent e) { if (tcheck.isSelected()) { timer.start(); } else { timer.stop(); } }
public void defeat() { battleLost = true; staminaTimer.stop(); int loop; for (loop = 0; loop < enemies.size(); loop++) { enemies.get(loop).spellsThrown.removeAll(spellsThrown); } }
public void pause() { pause = true; moveTime.stop(); fallTime.stop(); bulletMoveTime.stop(); waterTime.stop(); bulletTime.stop(); grenadeTime.stop(); laserTime.stop(); shotgunTime.stop(); if (shapeAI.getAI()) { aiMove.stop(); } }
@Override public void setLocked(boolean isLocked) { super.setLocked(isLocked); if (isLocked) { timer.start(); } else { timer.stop(); } }
private void jBFecharKeyTyped(java.awt.event.KeyEvent evt) { // GEN-FIRST:event_jBFecharKeyTyped if (evt.getKeyChar() == KeyEvent.VK_ENTER) { if (evt.getSource() == jBFechar) { this.setVisible(false); timerPCP.start(); timer.stop(); } } } // GEN-LAST:event_jBFecharKeyTyped
public void actionPerformed(ActionEvent e) { _player.setTimer(_player.getTimer() - 1); if (_player.getTimer() >= 0) { _timerLabel.setText(normalizeTime(_player.getTimer())); } else { // The game ain't in me no mo' System.out.println(_player.getPlayer().getPseudo() + " is out of time."); _timer.stop(); } }
private void tabelaMouseClicked( java.awt.event.MouseEvent evt) { // GEN-FIRST:event_tabelaMouseClicked if (evt.getClickCount() == 2) { timer.stop(); JobLote job = modelo.getJob(tabela.convertRowIndexToModel(tabela.getSelectedRow())); ViewDGQPCP tela = new ViewDGQPCP(null, true, job, timer); tela.setVisible(true); } } // GEN-LAST:event_tabelaMouseClicked
/* * executado ao clicar no botao excluir */ private void jBExcluirLoteActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jBExcluirLoteActionPerformed timerTelaExclusao.stop(); this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); excluir(); this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); timerTelaExclusao.start(); jBAtualizar.doClick(); } // GEN-LAST:event_jBExcluirLoteActionPerformed
private void jBFecharKeyTyped(java.awt.event.KeyEvent evt) { // GEN-FIRST:event_jBFecharKeyTyped if (evt.getKeyChar() == KeyEvent.VK_ENTER) { if (evt.getSource() == jBFechar) { timerTelaExclusao.stop(); timer.start(); this.setVisible(false); atualizar.doClick(); } } } // GEN-LAST:event_jBFecharKeyTyped
/** * Sets the parameters controlling the animation * * @param params * @throws IllegalArgumentException if params is null */ private void setAnimationParams(AnimationParams params) { if (params == null) { throw new IllegalArgumentException("params can't be null"); } if (animateTimer != null) { animateTimer.stop(); } animationParams = params; animateTimer = new Timer(animationParams.waitTime, animator); animateTimer.setInitialDelay(0); }
private void tabelaKeyTyped(java.awt.event.KeyEvent evt) { // GEN-FIRST:event_tabelaKeyTyped if (evt.getKeyChar() == KeyEvent.VK_ENTER) { if (evt.getSource() == tabela) { timer.stop(); JobLote job = modelo.getJob(tabela.convertRowIndexToModel(tabela.getSelectedRow())); ViewDGQPCP tela = new ViewDGQPCP(null, true, job, timer); tela.setVisible(true); } } } // GEN-LAST:event_tabelaKeyTyped
@Override public void dispose() { myTimer.stop(); super.dispose(); if (myGraphics != null) { myGraphics.dispose(); } myImage = null; myPipetteImage = null; myMaskImage = null; }
@Override public void paintComponent(Graphics g) { g.setColor(Color.WHITE); super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; if (isDead) { g2.setColor(Color.BLACK); g2.setFont(new Font("Serif", Font.PLAIN, 30)); g2.drawString("Game Over!", 300, 300); g2.drawString("Your final score was " + score, 250, 330); moverTimer.stop(); scoreTimer.stop(); } else { topWall.paint(g2); bottomWall.paint(g2); bird.paint(g2); g2.setColor(Color.BLACK); g2.setFont(new Font("Serif", Font.PLAIN, 20)); g2.drawString("Score: " + score, 50, 50); } }
private void createRepaintTimer() { if (myRepaintTimer != null) { myRepaintTimer.stop(); } myRepaintTimer = new Timer(1000 / myMaxFPS, new WeakRedrawTimer(this)); myRepaintTimer.start(); }