bonjour,
comment peut on creer un bouton rond en java jdk1.3.1_01 sous windows xp?
merci d'avence.
public JMyButton() extends JButton
{
super();
this.setBorder( BorderFactory.createEmptyBorder() );
}
public paint( Graphics g )
{
super(g);
Graphics2D g2d = (Graphics2D) g;
g2d.drawEllipse( this.getX(), this.getY().... )
.....
}
import java.awt.*;
import javax.swing.*;
public class BoutonRond extends JButton
{
public BoutonRond (String label)
{
super(label);
this.setContentAreaFilled(false);
}
protected void paintComponent(Graphics g)
{
g.setColor(getBackground());
g.fillOval(0, 0, this.getSize().width-1, this getSize().height-1);
super.paintComponent(g);
}
public static void main(String[] args)
{
JFrame frame = new JFrame();
JButton button = new BoutonRond ("Boutton");
button.setBackground(Color.BLUE);
frame.getContentPane().add(button);
frame.setSize(200, 200);
frame.setVisible(true);
}
}
Vous n'aimez pas le lifting de Facebook ? Le site Mashable propose cinq étapes pour revenir à l'ancienne présentation du réseau social.