-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSousTitre.java
More file actions
60 lines (44 loc) · 1.45 KB
/
SousTitre.java
File metadata and controls
60 lines (44 loc) · 1.45 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
56
57
58
59
60
import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class SousTitre extends JFrame implements ActionListener {
private static final long serialVersionUID = 1L;
private JLabel labNomSousTitre;
private JTextField tfSousTitre;
private JButton valid;
private JEditorPane editPane;
public SousTitre(JEditorPane ep) {
this.setTitle("Nouveau sous-titre");
this.setLayout(new GridLayout(3,1));
this.setSize(400, 100);
this.setLocationRelativeTo(null);
this.setResizable(false);
this.editPane = ep;
JPanel pBas = new JPanel(new BorderLayout());
this.labNomSousTitre = new JLabel("Entrez le nom du sous-titre");
add(this.labNomSousTitre, BorderLayout.NORTH);
this.tfSousTitre = new JTextField();
add(this.tfSousTitre);
this.valid = new JButton("Valider");
this.valid.addActionListener(this);
pBas.add(this.valid, BorderLayout.EAST);
add(pBas, BorderLayout.SOUTH);
setVisible(true);
}
public String getTitre() {
return this.tfSousTitre.getText();
}
public void actionPerformed(ActionEvent e) {
if(e.getSource() == this.valid) {
this.editPane.setText(this.tfSousTitre.getText().concat("\n\n").concat(this.editPane.getText()));
this.dispose();
}
}
}