Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7185817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:29:56+00:00 2026-05-28T18:29:56+00:00

In clojure you can create a SwingWorker proxy and implement doInBackground and do methods.

  • 0

In clojure you can create a SwingWorker proxy and implement doInBackground and do methods. How would you go on to invoke execute method of swingworker?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T18:29:57+00:00Added an answer on May 28, 2026 at 6:29 pm

    You can create and invoke a SwingWorker using standard Java interop, e.g.:

    ;; define a proxy that extends SwingWorker
    (def my-swing-worker 
      (proxy [SwingWorker] []
        (doInBackground []
          (reduce + (range 1000000)))))
    
    ;; run the SwingWorker
    (.execute my-swing-worker)
    
    ;; Get the result
    (.get my-swing-worker)
    => 499999500000
    

    However, normally in Clojure you wouldn’t use SwingWorkers directly. There is already a feature in Clojure that provides the functionaility of a SwingWorker: a future uses a separate thread to calculate a long running task and allows you to get the result later. Example usage:

    ;; define and launch a future
    (def my-future 
      (future 
        (reduce + (range 1000000))))
    
    ;; get the result (will wait for future to complete if needed)
    @my-future
    => 499999500000
    

    I think most people would agree the “pure Clojure” way is simpler and more idiomatic for running background tasks. The only reason I can think of to prefer SwingWorker is if you are using some of the specific GUI integration features it provides (e.g. the ability to fire property change events).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a Clojure macro that can read a file, when the
I would like to create/drop a database from clojure.java.jdbc. This fails: (require '[clojure.java.jdbc :as
Clojure structs can be arbitrarily extended, adding new fields. Is it possible to extend
in clojure i have vector [myfn1 myfn2 myfn3] how can i call functions named
Can someone please explain the major differences between Scala, Groovy and Clojure. I know
Simple question. I'm new to Clojure. How can I use one file from my
I am a Clojure n00b trying to create some XML strings. My goal is
So following on from Clojure macro to create a synonym for a function ,
I wish to create an abstraction which represents a database table, but which can
I'm presently gluing together ANTLR and Clojure, trying to create a Clojure zipper over

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.