public void startMappingTimer(@NotNull ActionListener actionListener) { final NumberOption timeoutLength = Options.getInstance().getNumberOption("timeoutlen"); if (timeoutLength != null) { myMappingTimer.setInitialDelay(timeoutLength.value()); } for (ActionListener listener : myMappingTimer.getActionListeners()) { myMappingTimer.removeActionListener(listener); } myMappingTimer.addActionListener(actionListener); myMappingTimer.start(); }
public void cleanUp() { draftPicks.cleanUp(); draftBooster.clear(); if (countdown != null) { countdown.stop(); for (ActionListener al : countdown.getActionListeners()) { countdown.removeActionListener(al); } } }
/** * Free resources so GC can remove unused objects from memory */ public void cleanUp() { saveDividerLocationsAndDeckAreaSettings(); if (updateDeckTask != null) { updateDeckTask.cancel(true); } if (countdown != null) { if (countdown.isRunning()) { countdown.stop(); } for (ActionListener al : countdown.getActionListeners()) { countdown.removeActionListener(al); } } this.cardSelector.cleanUp(); this.deckArea.cleanUp(); this.remove(bigCard); this.bigCard = null; }
private static void pushState(ElementManagerState state) { if(timer != null && timer.isRunning()) { for(ActionListener listener : timer.getActionListeners()) { listener.actionPerformed(null); } timer.stop(); timer = null; } pushManagerState(state); }
public static void pushStateDelayed(ElementManager manager, int id) { if(lastId != id) { if(timer != null && timer.isRunning()) { for(ActionListener listener : timer.getActionListeners()) { listener.actionPerformed(null); } timer.stop(); } } else { if(timer != null && timer.isRunning()) { timer.stop(); } } ElementManagerState state = manager.createState(); ActionListener listener = e -> pushManagerState(state); timer = new Timer(400, listener); timer.setRepeats(false); timer.start(); lastId = id; } }