use of com.jfoenix.controls.JFXTextField in project arquivoProject by fader-azevedo.
the class ListaEstanteController method configurarPainel.
private void configurarPainel(StackPane root) {
paneRegistarEstante = new VBox();
paneRegistarEstante.setPrefSize(boxBounds.getWidth(), boxBounds.getHeight());
paneRegistarEstante.setAlignment(Pos.TOP_RIGHT);
StackPane sp1 = new StackPane();
sp1.setPadding(new Insets(30, 10, 10, 10));
sp1.setAlignment(Pos.TOP_LEFT);
sp1.getStyleClass().add("paneAddNew");
sp1.setPrefSize(boxBounds.getWidth(), boxBounds.getHeight() - ACTION_BOX_HGT);
/*Criando campos de registo*/
JFXTextField txtCodiggo = new JFXTextField();
txtCodiggo.setPromptText("Código");
txtCodiggo.setFocusColor(Paint.valueOf("#a17878"));
txtCodiggo.setUnFocusColor(Paint.valueOf("#a17878"));
txtCodiggo.setLabelFloat(true);
JFXTextArea txtDesc = new JFXTextArea();
txtDesc.setPromptText("Descrição");
txtDesc.setPrefHeight(35);
txtDesc.setWrapText(true);
txtDesc.setPadding(new Insets(0, 5, 0, 5));
txtDesc.setFocusColor(Paint.valueOf("#a17878"));
txtDesc.setUnFocusColor(Paint.valueOf("#a17878"));
txtDesc.setLabelFloat(true);
JFXButton btnSalvar = new JFXButton("Salvar");
MaterialDesignIconView icon = new MaterialDesignIconView(MaterialDesignIcon.CONTENT_SAVE, "20");
icon.setFill(Paint.valueOf("#179e41"));
btnSalvar.setContentDisplay(ContentDisplay.LEFT);
btnSalvar.setGraphic(icon);
btnSalvar.getStyleClass().add("btns");
btnSalvar.setOnAction(e -> {
if (txtCodiggo.getText().isEmpty() || txtCodiggo.getText().isEmpty()) {
db.alertInfo("Preenche todos campos");
return;
}
Calendar c = Calendar.getInstance();
Estante est = new Estante(1, db.tratamento(txtCodiggo.getText().trim()), db.tratamento(txtDesc.getText().trim()), c.getTime());
db.salvar(est);
txtCodiggo.setText("");
txtDesc.setText("");
pnButoes.getChildren().clear();
pnButoes.getChildren().add(scrollBtsEstante());
});
HBox hboxBut = new HBox(btnSalvar);
hboxBut.setPadding(new Insets(12, 8, 0, 0));
hboxBut.setAlignment(Pos.CENTER_RIGHT);
VBox txts = new VBox(txtCodiggo, txtDesc, hboxBut);
txts.getChildren().get(2).setLayoutX(ACTION_BOX_HGT);
txts.setSpacing(20);
sp1.getChildren().add(txts);
StackPane sp2 = new StackPane();
sp2.setPrefSize(130, ACTION_BOX_HGT);
sp2.getChildren().add(lbAdicionarEstante);
sp2.getStyleClass().add("sp");
sp2.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent paramT) {
togglePaneVisibility();
}
});
paneRegistarEstante.getChildren().addAll(GroupBuilder.create().children(sp1).build(), GroupBuilder.create().children(sp2).build());
root.getChildren().add(GroupBuilder.create().children(paneRegistarEstante).build());
}
use of com.jfoenix.controls.JFXTextField in project S4T1TM2 by CSUS-CSC-131-Spring2018.
the class JavaFXDemo method start.
/**
* Typically (or at least, by convention), Java applications that apply JavaFX Stages (Windows) extend the JavaFX Application class
* JEP 153 (http://openjdk.java.net/jeps/153) allows Java to launch JavaFX Applications without a declared main method (although, must be specified in the manifest)
*
* However, a main method with additional procedures may be defined. Implicitly, the default main method for a JavaFX application follows below:
*/
/*
public static void main(String[] args) {
Application.launch(JavaFXDemo.class);
}
*/
@Override
public void start(Stage primaryStage) throws Exception {
// primaryStage is the default stage JavaFX builds for you
// Exception is part of the Application#start(Stage) signature, but can be removed if no exceptions are thrown in your procedure
// define attributes for the primary stage
primaryStage.setTitle("Default Title");
// alternatively, you may set the scene dimensions in the constructor, and the Stage will inherit from those
primaryStage.setHeight(600);
primaryStage.setWidth(800);
// Pane is one of the simplest forms of containers, there exist others for different purposes (StackPane, ScrollPane, etc...)
// Since rootPane will be set as the root pane, it will automatically inherit width/height from the scene (which may inherit from the primary stage)
Pane rootPane = new Pane();
// Creates a text input field, using the JFoenix UI extension. The standard JavaFX one is TextField
JFXTextField field = new JFXTextField();
field.setPromptText("Placeholder value...");
// Most JavaFX elements extend from one of the parent types - javafx.scene.Node
// Nodes have observable and bindable values, and elements that will inherit and possibly add more properties
// Some properties are readonly, and some are read and writeable
// Properties have a datatype
// for example, we can bind the title of the window to the value of the text field, which will overwrite the currently defined title "Default Title" immediately
primaryStage.titleProperty().bind(field.textProperty());
// Mathematical calculations can be done with observable values, such as subtraction
// If any value updates that is being depended on, it will update
// Center the text field to the 3/4th the width, and 1/2 the height
// field.x = rootPane.width * 3/4 - field.width * 1/2
field.layoutXProperty().bind(rootPane.widthProperty().multiply(.75f).subtract(field.widthProperty().divide(2)));
// field.x = rootPane.width * 1/4 - field.width * 1/2
field.layoutYProperty().bind(rootPane.heightProperty().multiply(.5).subtract(field.heightProperty().divide(2)));
// part of JFoenix's material design
// when the textbox is focused
field.setFocusColor(Color.GREEN);
// when it is not focused
field.setUnFocusColor(Color.RED);
// define a background (very cumbersome in java, easier in css)
// field.setBackground(new Background(new BackgroundFill(Color.GRAY, null, null )));
// so why not just use inline CSS?
field.setStyle("-fx-background-color: gray;");
// we need to add field to the rootPane as a child, Nodes can be added to anything that is a `Parent`, which a Pane is
rootPane.getChildren().add(field);
// lets try a button
// text inside button
JFXButton button = new JFXButton("Random Text");
// or just define it later
button.setText("Defined");
// or bind it to a constant value?!
button.textProperty().bind(StringConstant.valueOf("A constant"));
// more JFoenix UI control, let's make the button more defined
button.setButtonType(JFXButton.ButtonType.RAISED);
button.setBackground(new Background(new BackgroundFill(Color.rgb(97, 118, 207), null, null)));
// There's pretty much a infinite amount of ways you can do anything in JavaFX
// lets create a event handler
button.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent event) {
// event gives you things you may be interested in
System.out.println("Clicked! Is shift down: " + event.isShiftDown());
}
});
// boilerplate is bothersome, lets try Java 8's concise lambdas
button.setOnMouseClicked(event -> System.out.println("Clicked! Is shift down: " + event.isShiftDown()));
// again, add it
// no layoutX or layoutY was specified, it will just be by default placed in the upper left corner (aka the origin)
rootPane.getChildren().add(button);
// all primary stages need a Scene for the window
Scene scene = new Scene(rootPane);
// additional content can be defined here for a scene, like background color
scene.setFill(Color.GRAY);
// set the scene
primaryStage.setScene(scene);
// Show the stage!
primaryStage.show();
// By default, closing all JavaFX Stages will implicitly exit the JavaFX platform, making it cumbersome to create a new stage
// For applications that get minimized to a tray icon, that is not desirable.
// That can be disabled by executing the following:
// Platform.setImplicitExit(false);
}
use of com.jfoenix.controls.JFXTextField in project S4T1TM2 by CSUS-CSC-131-Spring2018.
the class TreeViewDemo method start.
@Override
public void start(Stage stage) {
rootNode.setExpanded(true);
final JFXTreeView<String> treeView = new JFXTreeView<>(rootNode);
treeView.setEditable(true);
// creating node and adding to department
for (Employee employee : employees) {
FilterableTreeItem<String> empLeaf = new FilterableTreeItem<>(employee.getName());
FilterableTreeItem<String> test = new FilterableTreeItem<>("Test");
empLeaf.getInternalChildren().add(test);
boolean found = false;
for (TreeItem<String> depNode : rootNode.getChildren()) {
if (depNode.getValue().contentEquals(employee.getDepartment())) {
((FilterableTreeItem) depNode).getInternalChildren().add(empLeaf);
found = true;
break;
}
}
if (!found) {
FilterableTreeItem<String> depNode = new FilterableTreeItem<>(employee.getDepartment());
rootNode.getInternalChildren().add(depNode);
depNode.getInternalChildren().add(empLeaf);
}
}
// initialize stage
stage.setTitle("Tree View Sample");
stage.setTitle("Agile Manager");
stage.setWidth(800);
stage.setHeight(600);
treeView.setPrefHeight(600);
treeView.setPrefWidth(200);
// creating pane
VBox box = new VBox();
box.setPrefWidth(200);
box.setPrefHeight(600);
final Scene scene = new Scene(box);
scene.setFill(Color.LIGHTGRAY);
// treeView.setShowRoot(false);
// create search functionality
TextField filterField = new JFXTextField();
filterField.setPromptText("Search...");
// define search predicate
rootNode.predicateProperty().bind(Bindings.createObjectBinding(() -> {
// predicate is reevaluated when filterfield is modified
if (filterField.getText() == null || filterField.getText().isEmpty())
return null;
return TreeItemPredicate.create(actor -> actor.toString().contains(filterField.getText()));
}, filterField.textProperty()));
// add to pane
box.getChildren().addAll(new JFXTreeViewPath(treeView), treeView, filterField);
VBox.setVgrow(treeView, Priority.ALWAYS);
// stage shit
stage.setScene(scene);
stage.show();
}
use of com.jfoenix.controls.JFXTextField in project placar-eletronico by GeovaniNieswald.
the class UsuarioPropagandaController method trocarCorJFXTextField.
/**
* Método para trocar a cor dos campos TextField.
*
* @param corUnFocus String - Hexadecimal da cor quando o campo não está com
* foco.
* @param corFocus String - Hexadecimal da cor quando o campo está com foco.
* @param componentes JFXTextField - Varargs que contém os campos.
*/
private void trocarCorJFXTextField(String corUnFocus, String corFocus, JFXTextField... componentes) {
for (JFXTextField comp : componentes) {
comp.setUnFocusColor(Paint.valueOf(corUnFocus));
comp.setFocusColor(Paint.valueOf(corFocus));
}
}
use of com.jfoenix.controls.JFXTextField in project JFoenix by jfoenixadmin.
the class TreeViewDemo method start.
@Override
public void start(Stage stage) {
rootNode.setExpanded(true);
final JFXTreeView<String> treeView = new JFXTreeView<>(rootNode);
for (Employee employee : employees) {
FilterableTreeItem<String> empLeaf = new FilterableTreeItem<>(employee.getName());
boolean found = false;
for (TreeItem<String> depNode : rootNode.getChildren()) {
if (depNode.getValue().contentEquals(employee.getDepartment())) {
((FilterableTreeItem) depNode).getInternalChildren().add(empLeaf);
found = true;
break;
}
}
if (!found) {
FilterableTreeItem<String> depNode = new FilterableTreeItem<>(employee.getDepartment());
rootNode.getInternalChildren().add(depNode);
depNode.getInternalChildren().add(empLeaf);
}
}
stage.setTitle("Tree View Sample");
VBox box = new VBox();
final Scene scene = new Scene(box, 400, 300);
scene.setFill(Color.LIGHTGRAY);
treeView.setShowRoot(false);
TextField filterField = new JFXTextField();
rootNode.predicateProperty().bind(Bindings.createObjectBinding(() -> {
if (filterField.getText() == null || filterField.getText().isEmpty())
return null;
return TreeItemPredicate.create(actor -> actor.toString().contains(filterField.getText()));
}, filterField.textProperty()));
box.getChildren().addAll(new JFXTreeViewPath(treeView), treeView, filterField);
VBox.setVgrow(treeView, Priority.ALWAYS);
stage.setScene(scene);
stage.show();
}
Aggregations