0

How do I get screen size in Clojure?

I'm having trouble using Java interop. A demonstration of

Toolkit.getScreenSize() 

would be most useful to me.

I've tried

(.getScreenSize Toolkit) 

after importing the appropriate library and similar stuff but to no avail.

Pointo Senshi
  • 541
  • 5
  • 17
  • You can get the screen size the same way you would in Java http://stackoverflow.com/questions/3680221/how-can-i-get-the-monitor-size-in-java. – juan.facorro Jan 12 '15 at 17:58

1 Answers1

1

The problem is that I was trying variations of:

(.getScreenSize Toolkit)

and

(.getScreenSize (.getDefaultToolkit Toolkit))

It has to be:

(.getScreenSize (Toolkit/getDefaultToolkit))

Also for stackers that have no clue you need:

(import java.awt.Toolkit)
Pointo Senshi
  • 541
  • 5
  • 17
  • 1
    There's also the `..` form, which can be pretty nice for long chains of `a.b().c()` type things when you're in Java-land. For example `(.. Toolkit getDefaultToolkit getScreenSize)` – Magos Jan 12 '15 at 22:24