1 | package com.jsql.view.swing.ui; | |
2 | ||
3 | import com.jsql.view.swing.util.UiUtil; | |
4 | ||
5 | import javax.swing.*; | |
6 | import java.awt.event.MouseAdapter; | |
7 | import java.awt.event.MouseEvent; | |
8 | ||
9 | /** | |
10 | * Define behavior to set on button. | |
11 | * Button's border is displayed on mouse hover, border is hidden on mouse out. | |
12 | */ | |
13 | public class FlatButtonMouseAdapter extends MouseAdapter { | |
14 | | |
15 | private final JButton buttonFlat; | |
16 | private boolean isVisible = false; | |
17 | ||
18 | public FlatButtonMouseAdapter(JButton buttonFlat) { | |
19 | this.buttonFlat = buttonFlat; | |
20 | } | |
21 | | |
22 | @Override | |
23 | public void mouseEntered(MouseEvent e) { | |
24 | | |
25 |
2
1. mouseEntered : negated conditional → NO_COVERAGE 2. mouseEntered : negated conditional → NO_COVERAGE |
if (this.buttonFlat.isEnabled() && !this.isVisible) { |
26 | | |
27 |
1
1. mouseEntered : removed call to javax/swing/JButton::setContentAreaFilled → NO_COVERAGE |
this.buttonFlat.setContentAreaFilled(true); |
28 |
1
1. mouseEntered : removed call to javax/swing/JButton::setBorder → NO_COVERAGE |
this.buttonFlat.setBorder(UiUtil.BORDER_ROUND_BLU); |
29 | } | |
30 | } | |
31 | ||
32 | @Override | |
33 | public void mouseExited(MouseEvent e) { | |
34 | | |
35 |
2
1. mouseExited : negated conditional → NO_COVERAGE 2. mouseExited : negated conditional → NO_COVERAGE |
if (this.buttonFlat.isEnabled() && !this.isVisible) { |
36 | | |
37 |
1
1. mouseExited : removed call to javax/swing/JButton::setContentAreaFilled → NO_COVERAGE |
this.buttonFlat.setContentAreaFilled(false); |
38 |
1
1. mouseExited : removed call to javax/swing/JButton::setBorder → NO_COVERAGE |
this.buttonFlat.setBorder(BorderFactory.createEmptyBorder(4, 8, 4, 8)); |
39 | } | |
40 | } | |
41 | | |
42 | public void setContentVisible(boolean isVisible) { | |
43 | this.isVisible = isVisible; | |
44 | } | |
45 | } | |
Mutations | ||
25 |
1.1 2.2 |
|
27 |
1.1 |
|
28 |
1.1 |
|
35 |
1.1 2.2 |
|
37 |
1.1 |
|
38 |
1.1 |