Does Java allow you to use native UI widgets on Mac OS X?

前端 未结 3 1386
感动是毒
感动是毒 2021-01-12 08:50

If I write an application in java, does it use native widgets if run on Mac OS X? Or does it use \"lookalike\" widgets provided by the java runtime?

Thanks.

3条回答
  •  逝去的感伤
    2021-01-12 09:33

    All Java Swing components are look-alike, not native widgets.

    Swing's configurability is a result of a choice not to use the native host OS's GUI controls for displaying itself. Swing "paints" its controls programmatically through the use of Java 2D APIs, rather than calling into a native user interface toolkit.

    There is an OSX look and feel, provided by the Apple JVM, but it is never actually native controls. The other approach is SWT, but I honestly haven't seen many applications other than Eclipse using it, and I never really find that they look very good.

提交回复
热议问题