-
Notifications
You must be signed in to change notification settings - Fork 6
/
FindEvent.java
86 lines (73 loc) · 2.6 KB
/
FindEvent.java
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
package potplayer;
import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList;
import javafx.concurrent.Task;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.ListView;
import javafx.scene.control.Slider;
import javafx.scene.control.TextField;
import javafx.scene.effect.ColorAdjust;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.input.KeyEvent;
import javafx.scene.input.MouseDragEvent;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.VBox;
import javafx.scene.media.Media;
import javafx.scene.media.MediaPlayer;
import javafx.scene.media.MediaView;
import javafx.scene.paint.Color;
import javafx.util.Duration;
import potplayer.ButtonStyle;
public class FindEvent implements Initializable {
@FXML
private Button search = new Button();
@FXML
private TextField text = new TextField("text");
@FXML
private PotPlayerEvent pevent;
private ButtonStyle buttonStyle = new ButtonStyle();
@FXML
void textEvent(ActionEvent event) {
// key board enter key event
System.out.println(text.getText());
}
@FXML
void searchEvent(ActionEvent event) throws IOException {
buttonStyle.changeButtonColor(search);
// System.out.println(text.getText());
FXMLLoader loader = new FXMLLoader(getClass().getResource("potplayer.fxml"));
VBox vBox = loader.load();
pevent = (PotPlayerEvent)loader.getController();
pevent.printInfo(text.getText());
}
@Override
public void initialize(URL location, ResourceBundle resources) {
text.textProperty().addListener(new ChangeListener<String>() {
@Override
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
// Used to monitor character concent change
// System.out.println(newValue);
}
});
text.setOnKeyPressed(new EventHandler<KeyEvent>() {
@Override
public void handle(KeyEvent event) {
// Used to monitor key board key pressed
// System.out.println("KeyPressed");
}
});
}
}