Olah jean,
peguei um dos exemplos enviados pelos colegas javaneses e dei uma
modificada..... pelo menos achei q ficou legal, quem quiser :)

                       import java.awt.event.*;
                           import java.awt.geom.*;
                       import javax.swing.*;
                       import java.awt.*;
                          /*
                                                  Eder Luis Jorge
                                                  29/05/2001
                                                 
[EMAIL PROTECTED]
                                                  */
                       public class BotaoRedondo extends JFrame{
                          public BotaoRedondo() 
                                                  {
                             getContentPane().setLayout(new
FlowLayout());
                        
                             RoundButton rbutton = new
RoundButton("Botao redondo  0", 0);
                                                        
rbutton.setBackground(new Color(150,150,255));
                                                        
rbutton.setForeground(new Color(100,100,255));

                                                        
getContentPane().add(rbutton);
                                                        
getContentPane().add(new RoundButton("Botao redondo .1", .1));
                                                        
getContentPane().add(new RoundButton("Botao redondo .2", .2));
                                                        
getContentPane().add(new RoundButton("Botao redondo .3", .3));
                                                        
getContentPane().add(new RoundButton("Botao redondo .4", .4));
                                                        
getContentPane().add(new RoundButton("Botao redondo .5", .5));
                                                        
getContentPane().add(new RoundButton("Botao redondo .6", .6));
                                                        
getContentPane().add(new RoundButton("Botao redondo .7", .7));
                                                        
getContentPane().add(new RoundButton("Botao redondo .8", .8));
                                                        
getContentPane().add(new RoundButton("Botao redondo .9", .9));
                                                        
getContentPane().add(new RoundButton("Botao redondo  1", 1));
                                                        
getContentPane().add(new JButton("Botao JButton"));

                                                        
addWindowListener(new WindowAdapter() 
                                                                       
{
                                                                               
public void windowClosing(WindowEvent
event) 
                                                                               
{
                                                                                       
System.exit(0);   
                                                                               
}      
                                                                       
}
                                                                );
                        
                             setSize(120, 500);
                          }
                        
                          public static void main(String[] args) {
                             new BotaoRedondo().show();
                          }
                       }
                        




                                                /*
                                                Classe RoundButton que
contem as caracteristica do botao
                                                */      
                       class RoundButton extends JButton

                                           {
                          // for mouse detection purposes
                          Shape shape;
                                                  String titulo;
                                                  double canto = 0.0;
                                                  Graphics2D g2d;
                                                  FontMetrics tamString;

                                                  /*
                                                        Os parametros do
construtor sao:
                                                    titulo do botao e,
                                                    curvatura do canto
                                                  */
                          public RoundButton(String label, double
pCanto) {
                             super(label);
                                                         titulo = label;
                                                         canto = pCanto;
                                                         
                                                         // retira o
formato padrao do botao
                             setContentAreaFilled(false);
                                                         
                          }
                        
                          protected void paintComponent(Graphics g) {
                                                        
                                                        /*
                                                                Cria uma
instancia da classe Graphics2D
                                                                para
aumentar a largura da caneta
                                                        */
                                                        g2d = (
Graphics2D ) g;
                                                        g2d.setStroke(
new BasicStroke(2.0f) ); 

                                                        // Pega o
tamanho em pixels da largura do titulo
                                                        tamString =
g.getFontMetrics();

                             if (getModel().isPressed())
                                                         { // Qdo o
botao estiver pressionado
                                                               
g.setColor(Color.black);
                                                               
g.drawRoundRect(2, 2, getSize().width-4,
getSize().height-4,(int)(getSize().width * canto),(int)(getSize().height
* canto));
                                                               
g.setColor(Color.lightGray);
                                                               
g.drawRoundRect(1, 1, getSize().width-3,
getSize().height-3,(int)(getSize().width * canto),(int)(getSize().height
* canto));
                                                               
g.setColor( getForeground() );
                                                               
g.drawString( getText(),
(getWidth()-tamString.stringWidth(getText()))/2 + 1, getHeight() / 2 + 6
);
                             }
                                                         else
                                                     { // Qdo o botao
nao estiver pressionado
                                                                if
(getModel().isArmed()) { // Mouse sobre o botao
                                                                       
g.setColor(getBackground());
                                                                       
g.drawRoundRect(1, 1, getSize().width-2,
getSize().height-2,(int)(getSize().width * canto),(int)(getSize().height
* canto));
                                                                } 
                                                               
g.setColor(Color.black);
                                                               
g.drawRoundRect(1, 1, getSize().width-3,
getSize().height-3,(int)(getSize().width * canto),(int)(getSize().height
* canto));
                                                               
g.setColor(Color.lightGray);
                                                               
g.drawRoundRect(1, 1, getSize().width-4,
getSize().height-4,(int)(getSize().width * canto),(int)(getSize().height
* canto));
                                                               
g.setColor( getForeground() );
                                                               
g.drawString( getText(),
(getWidth()-tamString.stringWidth(getText()))/2, getHeight() / 2 + 5 );
                                                         }

                             //super.paintComponent(g);
                                                         // Caso nao
queira escrever a string no botao, descomentar a
linha acima
                          }
                        

                                                        /*
                                                                Evento
para polimorfismo da borda padrao do botao
                                                                caso
deseje fazer um grafico fixo, faze-lo aqui
                                                        */
                                                  protected void
paintBorder(Graphics g) {

                                                  }
                        
                                                        /* Retorna a
area util do botao, definindo onde o 
                                                           usuario
podera clicar, moder o mouse, etc...
                                                        */
                          public boolean contains(int x, int y) {
                             if (shape == null ||
!shape.getBounds().equals(getBounds())) {
                                shape = new RoundRectangle2D.Float(0, 0,
getWidth(), getHeight(),5,5);
                             }
                        
                             return shape.contains(x, y);
                          }
                       }


[]s, Eder



JEAN BARROS wrote:
> 
> Ola!
> 
> Soh por curiosidade, alguem tem algum exemplo de botao redondo, ou outra forma
> nao "comum" em Swing?
> 
> Abracos
> Jean Fabio
> 
> ____________________________________________________________________
> Get free email and a permanent address at http://www.netaddress.com/?N=1
> 
> ------------------------------ LISTA SOUJAVA ----------------------------
> http://www.soujava.org.br  -  Sociedade de Usuários Java da Sucesu-SP
> dúvidas mais comuns: http://www.soujava.org.br/faq.htm
> regras da lista: http://www.soujava.org.br/regras.htm
> para sair da lista: envie email para [EMAIL PROTECTED]
> -------------------------------------------------------------------------

------------------------------ LISTA SOUJAVA ----------------------------
http://www.soujava.org.br  -  Sociedade de Usuários Java da Sucesu-SP
dúvidas mais comuns: http://www.soujava.org.br/faq.htm
regras da lista: http://www.soujava.org.br/regras.htm
para sair da lista: envie email para [EMAIL PROTECTED]
-------------------------------------------------------------------------

Responder a