I'm in a group assignment at university doing a swing GUI course and need some hints.
I have to develop and implement a user interface that represents the following below, knobs tuner slider and all.
but I have no idea where to start, note this image wasn't supplied by the lecturer but by other students in the group and are quite inflexible with the way it looks.
My 2 biggest problems are, the knobs, and the tuner.
Any idea's would be much appreciated.
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)
methodJButton
and its paintComponent(Graphics g)
methodGraphics2D
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.