Ver Mensaje Individual
  #4 (permalink)  
Antiguo 25/10/2011, 10:53
javierdosa_777
 
Fecha de Ingreso: septiembre-2011
Mensajes: 22
Antigüedad: 13 años, 5 meses
Puntos: 0
Respuesta: colocar texto en un boton... mas bien la hora dentro del boton

AQUI pongo algo mas de mi codigo...


public MyWindow(){

super ("Drag Test");

Container container = getContentPane();

container.setLayout(null);

hora = new Reloj.Hora();
hora.setFont(new Font("Trebuchet MS",java.awt.Font.BOLD, 20));
MyButton boton1= new MyButton("");
boton1.setBounds(10, 10, 100, 30);
this.add(hora);
container.add(boton1);

}

}

class MyButton extends JButton implements MouseMotionListener{

public MyButton(String text){

super.setText(text);

addMouseMotionListener(this);

}





public void mouseDragged(MouseEvent mme) {

setLocation(

this.getX() + mme.getX() - this.getWidth() / 2,

this.getY() + mme.getY() - this.getHeight() / 2

);

}

public void mouseMoved(MouseEvent mme) {}