Merge branch 'master' of https://git.xdrm.io/MTI/javafx-p1
This commit is contained in:
commit
ee956629ea
|
@ -13,10 +13,16 @@ import Classes.css.user.SubMenuStyleSheet;
|
|||
import Interfaces.Event;
|
||||
import Interfaces.EventObserver;
|
||||
import javafx.application.Application;
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.FlowPane;
|
||||
|
@ -144,6 +150,31 @@ public class RootLayout extends Application implements EventObserver {
|
|||
|
||||
this.articles.clearContent();
|
||||
|
||||
TextField tx = new TextField();
|
||||
tx.setPromptText("search...");
|
||||
tx.setId("mag_searchbar");
|
||||
tx.setOnKeyPressed(new EventHandler<KeyEvent>() {
|
||||
|
||||
@Override
|
||||
public void handle(KeyEvent arg0) {
|
||||
if(arg0.getCode() == KeyCode.ENTER) {
|
||||
NewsListModel.getInstance().query(tx.textProperty().get());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Platform.runLater(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
RootLayout.this.main_container.getChildren().add(tx);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// For each news
|
||||
for( NewsModel news : NewsListModel.getInstance().getNews() ){
|
||||
|
||||
|
|
Loading…
Reference in New Issue