| 1. |
How Would You Create A Button With Rounded Edges? |
|
Answer» There’s 2 ways. The first thing is to know that a JButton’s EDGES are drawn by a Border. so you can override the Button’s PAINTCOMPONENT(Graphics) METHOD and draw a circle or rounded rectangle (whatever), and TURN off the border. Or you can create a custom border that draws a circle or rounded rectangle around any COMPONENT and set the button’s border to it. There’s 2 ways. The first thing is to know that a JButton’s edges are drawn by a Border. so you can override the Button’s paintComponent(Graphics) method and draw a circle or rounded rectangle (whatever), and turn off the border. Or you can create a custom border that draws a circle or rounded rectangle around any component and set the button’s border to it. |
|