## SwingOSC – Java-based cross-platform replacements for Cocoa GUI classes

This document lists most of the available classes. last mod: 17-jul-09 sciss

# Cocoa vs. Java GUI classes

SuperCollider Language on Mac OS comes with a large set of GUI classes that create windows and gadgets to control a synth, a performance or an application. Unlike the language itself and the server, these class are deeply connected to the Mac OS Cocoa API and have not been ported to other platforms. Alternative controls include SCUM and Emacs for Linux, and of course all OSC aware applications, like Max for example. However the crucial point is to have ready language classes to build GUIs. In SwingOSC GUI (Java based GUI) we have started to create classes very similar to the original SuperCollider Mac classes with the aim of being able to write almost usual syntax and run it on different platforms.

- See GUI ! to learn about the preferred (kit-independant) way of building a GUI.
- See SwingOSC to learn how to boot a GUI server.
- See SwingGUI for a full list of available views.

## Translated Classes

Most of the Mac OS only GUI elements have been converted, with some functionality still missing. To switch from Cocoa to Java GUI, you should use the GUI class if possible. You can also use SwingOSC classes directly, by using its replacement classes which have the same name but an additional initial J character. So instead of the Cocoa SCWindow class, SwingOSC provides you with JSCWindow, and SCButton becomes JSCButton, etc.

Views that only exists in Cocoa at the moment:

- SCQuartzComposerView : a view to play back QuartzComposer composition. QC is only available on Mac OS X, so it is not possible to have this view on other platforms.
- SC2DTabletSlider : this view is rather superfluous since you can create something similar with JSCTabletView, using a `drawFunc` or layering it on top of a JSC2DSlider.
- SCLevelIndicator : you might want to look at JSCPeakMeter though.

Helper classes that do not work with SwingOSC at the moment:

- HiliteGradient : two-point gradient for background textures.

Views that only exists in Swing at the moment:

- JSCCheckBox : checkmark toggle button
- JSCTabbedPane : hosts multiple containers that can be switched through tabs
- JSCScrollBar : slider to navigate virtual viewports
- JSCPeakMeter : a volume meter (peak and RMS) for audio busses

Besides, there is few missing methods or additional methods in the existing views. The compatibility is documented with each individual view's help file.

## Helper Classes

Some helper classes work in both contexts : EZSlider, EZNumber, EZRanger, Color, FlowLayout, Gradient

## UGen Replacements

There are replacements for the Mac-only Mouse UGens:

Cocoa | Java (SwingOSC)
MouseX | JMouseX | track horizontal mouse position
MouseY | JMouseY | track vertical mouse position
MouseButton | JMouseButton | track mouse button pressing
KeyState | JKeyState | track keyboard typing

## Other Platform Specific Classes

Cocoa | Java (SwingOSC)
Speech | JSpeech | text-to-speech synthesizer