Loading skill
Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Build JavaFX piano-keyboard controls that map MIDI notes to white and black keys and show note state clearly.
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-11 | ✓→✗ | ▼ Worse | -14% | 0% |
| case-01 | ✓→✓ | = Same ✓ | -9% | 0% |
| case-02 | ✓→✓ | = Same ✓ | 29% | 0% |
| case-03 | ✓→✓ | = Same ✓ | 7% | 0% |
| case-04 | ✓→✓ | = Same ✓ | -21% | 0% |
Use this skill when a JavaFX app needs a virtual piano, a MIDI-driven note visualizer, or a custom keyboard control that tracks pressed and released notes.
javaimport java.util.HashMap; import java.util.Map; import javafx.scene.layout.Pane; import javafx.scene.paint.Color; import javafx.scene.shape.Rectangle; public class PianoKeyboard extends Pane { private final Map<Integer, Rectangle> whiteKeys = new HashMap<>(); public PianoKeyboard() { double whiteKeyWidth = 24; int[] midiNotes = {60, 62, 64, 65, 67, 69, 71, 72}; for (int i = 0; i < midiNotes.length; i++) { Rectangle key = new Rectangle(i * whiteKeyWidth, 0, whiteKeyWidth, 120); key.setFill(Color.WHITE); key.setStroke(Color.BLACK); whiteKeys.put(midiNotes[i], key); getChildren().add(key); } } public void press(int note) { Rectangle key = whiteKeys.get(note); if (key != null) { key.setFill(Color.CORNFLOWERBLUE); } } public void release(int note) { Rectangle key = whiteKeys.get(note); if (key != null) { key.setFill(Color.WHITE); } } }
javafx-midi-device-integration when the keyboard reacts to external MIDI input.Other measured skills in the registry, with their headline benchmark lift.