A voir également:
- [Java] swing : Survol d'un bouton
- Waptrick java football - Télécharger - Jeux vidéo
- Jeux java itel football - Télécharger - Jeux vidéo
- Java apk - Télécharger - Langages
- Java décompiler - Télécharger - Langages
- Waptrick jeux pes 2016 java - Forum logiciel systeme
3 réponses
Utilisateur anonyme
3 mai 2006 à 08:51
3 mai 2006 à 08:51
import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.BevelBorder; public class OverButtonDemo extends JFrame { private JButton overButton; public OverButtonDemo(String title) { super(title); initialize(); } private void initialize() { JPanel buttonPanel = new JPanel(); buttonPanel.setSize(320,200); overButton = new JButton("Survolez-moi"); overButton.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED)); overButton.addMouseListener(new MouseListener() { public void mouseClicked(MouseEvent e) {} public void mouseEntered(MouseEvent e) { JButton source = (JButton)e.getSource(); source.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); } public void mouseExited(MouseEvent e) { JButton source = (JButton)e.getSource(); source.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED)); } public void mousePressed(MouseEvent e) {} public void mouseReleased(MouseEvent e) {} }); buttonPanel.add(overButton); getContentPane().add(buttonPanel); } public static void main(String[] args) { OverButtonDemo demo = new OverButtonDemo("Démo de survol de bouton"); demo.pack(); demo.setVisible(true); } }
HackTrack