You have to write your own Knob class to work this out. You can start with a custom drawn component that's based on JButton
. The tuner however must be drawn on a JPanel
separately. There will be a lot of custom-code that will be implemented. Good luck :-)
You will have to look into :
JPanel
and its paintComponent(Graphics g)
method
JButton
and its paintComponent(Graphics g)
method
Graphics2D
class.
For the knob, you can start with a custom drawn, image based JButton, implement actionPerformed()
method for it, and Graphics2D.rotate()
it. Design it with MVC pattern, where you set the angle of rotation and rotate it with the paintComponent()
. That will set the necessary calibration for the model.
For the tuner, however, you can start with a .png based background, and a rectangle that can move around using methods from Graphics2D. This will be tied to the Radio-tuner model.
Its hard to explain in words. But I think you get the point.
Good luck.