/*
* Bem10jfx.blogspot.com
*/
package cad_jfx;
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ListView;
import javafx.scene.control.TextField;
import javafx.scene.layout.HBox;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.text.Text;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
/**
*
* @author mabson rodrigues
*/
public class Cad_JFX extends Application {
//observableArrayList que receberar os dados atravez do JDBC
ObservableList<String> namesbd = FXCollections.observableArrayList("");
//ListView
ListView<String> lvResult = new ListView<String>(namesbd);
//Textfield\'s
TextField tfnome = new TextField();
TextField tffone = new TextField();
TextField tfmail = new TextField();
TextField tfsen = new TextField();
@Override//start Stage StageStyle.UTILITY stageprimay=null
public void start(Stage primaryStage) {
//stage
Stage stage = new Stage(StageStyle.UNIFIED);
Group gp = new Group();
//scene
Scene scene = new Scene(gp, 400, 400, Color.BLACK);
stage.setScene(scene);
HBox hbox = new HBox();
//binds para centralizar o hbox de acordo com o stage mesmo que a tela seja maximizada o hb sera redimencionado centralizando o layout x e Y ta tela
hbox.layoutXProperty().bind(scene.widthProperty().subtract(scene.widthProperty().divide(1.1)));
hbox.layoutYProperty().bind(scene.heightProperty().subtract(scene.heightProperty().divide(1.3)));
hbox.setStyle("-fx-background-color: #f90400;-fx-border-radius: 20; -fx-background-radius: 20; -fx-padding: 5;");
gp.getChildren().addAll(hbox);
VBox vb = new VBox();
vb.setStyle("-fx-background-color: #e8a72e; -fx-border-radius: 20; -fx-background-radius: 20; -fx-padding: 5;");
hbox.getChildren().addAll(vb);
Text txnome = new Text("nome");
Text txfone = new Text("fone");
Text txemail = new Text("email");
Text txsenha = new Text("senha");
txfone.setFill(Color.WHITE);
txnome.setFill(Color.WHITE);
txemail.setFill(Color.WHITE);
txsenha.setFill(Color.WHITE);
vb.getChildren().addAll(
txnome, tfnome, txfone,
tffone, txemail, tfmail,
txsenha, tfsen
);
VBox vbresults = new VBox();
hbox.getChildren().add(vbresults);
HBox hbutonsx = new HBox();
Button btxapagar = new Button("excluir");
Button btxedit = new Button("editar");
Button btbmb = new Button("bm");
hbutonsx.getChildren().addAll(btxapagar, btxedit, btbmb);
//lv prefsize
lvResult.setPrefSize(80, 150);
//css
lvResult.setStyle("-fx-background-color: #e8a72e; "
+ "-fx-border-radius: 20; "
+ "-fx-background-radius: 20; "
+ "-fx-padding: 5;");
vbresults.getChildren().addAll(hbutonsx, lvResult);
//css
HBox hboxbt = new HBox();
hboxbt.setStyle("-fx-background-color: #a8a72e; "
+ "-fx-border-radius: 20; "
+ "-fx-background-radius: 20; "
+ "-fx-padding: 5;");
vb.getChildren().addAll(hboxbt);
//buttons
Button btsave = new Button("salvar");
Button btconsult = new Button("consultar");
Button bterase = new Button("erase");
hboxbt.getChildren().addAll(btsave, btconsult, bterase);
stage.show();
}
/**
* @Bem10jfx.blogspot.com
*/
public static void main(String[] args) {
launch(args);
}
}