Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package paraugs;
- import javafx.application.Application;
- import javafx.scene.Scene;
- import javafx.scene.control.Button;
- import javafx.scene.control.Label;
- import javafx.scene.control.TextField;
- import javafx.stage.Stage;
- import java.util.Arrays;
- import javafx.geometry.Insets;
- import javafx.scene.control.Alert;
- import javafx.scene.control.PasswordField;
- import javafx.scene.control.ScrollPane;
- import javafx.scene.control.TextArea;
- import javafx.scene.layout.GridPane;
- import javafx.scene.paint.Color;
- /**
- *
- * @author anrij
- */
- public class Paraugs extends Application {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- launch(args);
- }
- @Override
- public void start(Stage primaryStage) {
- Label lbl = new Label();
- TextField TX = new TextField();
- Alert alert = new Alert(Alert.AlertType.ERROR);
- PasswordField pw = new PasswordField();
- Button btn = new Button();
- alert.getDialogPane().setExpandableContent(new ScrollPane(new TextArea("kaka")));
- btn.setText("Login");
- TX.setPrefWidth(200);
- GridPane box = new GridPane();
- box.setPadding(new Insets(10, 10, 10, 10));
- box.setVgap(5);
- box.setHgap(5);
- GridPane.setConstraints(TX, 0, 1);
- GridPane.setConstraints(lbl, 0, 4);
- GridPane.setConstraints(btn, 0, 3);
- GridPane.setConstraints(pw, 0, 2);
- box.getChildren().addAll(Arrays.asList(lbl, btn, TX, pw));
- btn.setOnAction(e -> {
- if(TX.getText().equals("misters_x") && pw.getText().equals("parole")) {
- alert.showAndWait();
- } else {
- lbl.setText("Lietotājvārds vai parole nav pareiza!");
- lbl.setTextFill(Color.rgb(210, 39, 30));
- }
- });
- primaryStage.setTitle("Paraugs");
- primaryStage.setScene(new Scene(box, 210, 140));
- primaryStage.show();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement