Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // joga no git depois, vlw :D
- package view.external;
- import java.awt.Color;
- import java.awt.event.MouseEvent;
- import java.awt.event.MouseListener;
- import javax.swing.JButton;
- import javax.swing.border.LineBorder;
- public class SButton extends JButton implements MouseListener {
- private Color border;
- private Color hBorder;
- public SButton(String title, Color border, Color hBorder){
- super(title);
- this.border = border;
- this.hBorder = hBorder;
- setBorder(new LineBorder(border, 1, false));
- setContentAreaFilled(false);
- setFocusable(false);
- addMouseListener(this);
- }
- @Override
- public void mouseEntered(MouseEvent e) {
- if(e.getSource() == this && isEnabled())
- setBorder(new LineBorder(hBorder, 1, false));
- }
- @Override
- public void mouseExited(MouseEvent e) {
- if(e.getSource() == this)
- setBorder(new LineBorder(border, 1, false));
- }
- @Override public void mouseClicked(MouseEvent e) {}
- @Override public void mousePressed(MouseEvent e) {}
- @Override public void mouseReleased(MouseEvent e) {}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement