Plz anybody tell me how to change the shape of a Button or JButton in Java.For instance tell me how create and add some circle buttons.This is urgent............
Vinod Venugopal
Ranch Hand
Joined: Dec 06, 2000
Posts: 148
posted
0
You can use customize your button by adding a border which will change its shape such as rounded or circular..the following code creates a rounded border..you can draw a circle to get a circular button class RoundedBorder extends AbstractBorder { public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { g.setColor ( buttonColor ) ; g.drawRoundRect ( x , y , width , height , 4, 10) ; g.fillRoundRect ( x , y , width , height , 4, 10) ; //g.draw3DRect ( x , y , width , height , true) ; } public Insets getBorderInsets ( ) { return new Insets ( 0,0,0,0) ; } }