-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFill.java
More file actions
55 lines (46 loc) · 1.63 KB
/
Copy pathFill.java
File metadata and controls
55 lines (46 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package java2d;
import java.awt.Color;
import javax.swing.JColorChooser;
public class Fill extends Transformation {
private final javax.swing.JRadioButton jrbActive;
private boolean isActiveFill = false;
public Fill(java.awt.Shape shp) {
shpFigura = shp;
javax.swing.JPanel jpnOpc = new javax.swing.JPanel();
javax.swing.JButton jbtCambiarColor = new javax.swing.JButton("Cambiar Color de relleno");
jpnOpc.add(jbtCambiarColor);
jpnOpc.add(jrbActive = new javax.swing.JRadioButton("Mantener rellono para las transformaciones", isActiveFill));
jrbActive.addItemListener((java.awt.event.ItemEvent e) -> {
if (e.getStateChange() == java.awt.event.ItemEvent.SELECTED) {
isActiveFill = true;
apariencia = 1;
} else if (isActiveFill) {
apariencia = 0;
}
});
jbtCambiarColor.addActionListener((java.awt.event.ActionEvent e) -> {
Color color = JColorChooser.showDialog(Fill.this, "Selecciona un color", clrR);
if (color != null) {
clrR = color;
jpnAreaDibujo.repaint();
}
});
add(jpnOpc, java.awt.BorderLayout.NORTH);
}
@Override
public void cambiarFigura(java.awt.Shape shp) {
shpFigura = shp;
jpnAreaDibujo.repaint();
}
@Override
public void dibujarFigura(java.awt.Graphics2D g2d) {
if (apariencia != 1) {
isActiveFill = false;
jrbActive.setSelected(isActiveFill);
}
relleno(g2d);
}
@Override
public void reiniciar() {
}
}