Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Timer timer= new Timer(60000, new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- label.setText("Running...");
- // create a worker that returns no interim or final result
- SwingWorker<Void, Void> worker = new SwingWorker<>() {
- @Override
- protected Void doInBackground() throws Exception {
- // long-running selenium code goes here
- }
- @Override
- protected void done() {
- try {
- label.setText("Paused");
- get(); // exposes exceptions that might have occurred
- } catch (Exception e) {
- // handle selenium code exceptions here
- }
- }
- }
- // run the worker
- worker.execute();
- }
- });
Add Comment
Please, Sign In to add comment