making a button - java

前端 未结 3 1425
旧巷少年郎
旧巷少年郎 2020-12-22 01:00

Ok, i know that this question has been asked before, but i just can\'t seem to get my application to work with the help from other peoples posts.

I am just trying to

3条回答
  •  南笙
    南笙 (楼主)
    2020-12-22 01:34

    As you want different buttons than Swing button, to make the things simpler, you can draw your buttons in a JPanel (using the paintComponent method and Java 2D). Each JPanel will be a button. Them, you will use some mouse events to detect clicks, etc. Another approach is do the same thing that you are doing with your background (several JLabels with images) and register mouse events in each label. You can also create your own Look And Feel for your buttons, but this is not so simple. Of course, you will need to change your layout manager to fit your buttons.

提交回复
热议问题