简体   繁体   中英

creating a radio interface using java swing gui

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:

  1. JPanel and its paintComponent(Graphics g) method
  2. JButton and its paintComponent(Graphics g) method
  3. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM