Reputation: 11
I have started working on a software synthesizer (or keyboard). I have decided to use Java because of the available Jfugue API. I am trying to figure out how to go about creating the actual keys (notes) of the keyboard user interface, but I am stuck. I have tried to create an interface by dragging/dropping black and white rectangular buttons onto the panel, but that doesn't seem to work. Could someone point me into the right direction?
Upvotes: 1
Views: 1967
Reputation: 20824
I think this is what you want to:
I'm the author of JFugue, and I've also wanted to start a side-effort, JFugueUI, that would provide things like graphical keyboards that people could include in their own applications - so, let me know if you're interested in contributing!
Upvotes: 0
Reputation: 324128
Check out reply 9 of this posting for a simple piano keyboard that should get you started. You may want to read the posting from the beginning for ideas on how to handle the note represented by each button.
Upvotes: 1
Reputation: 52185
I once had to do something similar... the best solution I found was to draw panels and set their border and background as keys. I then used mouse listeners to determine which panel was clicked and the duration of the click.
Upvotes: 0
Reputation: 56391
If you're using Java/swing, your best bet would be to draw an image of a keyboard and map click locations to the individual keyboard keys.
Upvotes: 0