Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package sample;
- import javafx.application.Application;
- import javafx.application.Platform;
- import javafx.beans.value.ChangeListener;
- import javafx.beans.value.ObservableValue;
- import javafx.scene.Scene;
- import javafx.scene.control.*;
- import javafx.scene.effect.DropShadow;
- import javafx.scene.image.Image;
- import javafx.scene.image.ImageView;
- import javafx.scene.input.MouseEvent;
- import javafx.scene.layout.*;
- import javafx.scene.paint.Color;
- import javafx.scene.paint.ImagePattern;
- import javafx.scene.text.Font;
- import javafx.scene.text.Text;
- import javafx.stage.Stage;
- import javafx.stage.WindowEvent;
- import java.time.LocalDate;
- public class Main extends Application {
- public static DropShadow borderGlow = new DropShadow();
- public static Stage stage;
- public static int padd=100;
- @Override
- public void start(Stage primaryStage) throws Exception{
- stage = primaryStage;
- borderGlow.setOffsetY(0f);
- borderGlow.setOffsetX(0f);
- borderGlow.setColor(Color.CORNFLOWERBLUE);
- borderGlow.setWidth(40);
- borderGlow.setHeight(40);
- AnchorPane mainPane = new AnchorPane();
- mainPane.setPrefHeight(795);
- mainPane.setPrefWidth(1089);
- mainPane.setStyle("-fx-background-color: #ccfbff;");
- //titlepane
- AnchorPane titlePane = new AnchorPane();
- titlePane.setPrefHeight(136);
- titlePane.setPrefWidth(1089);
- titlePane.setLayoutX(299);
- titlePane.setLayoutY(26);
- titlePane.setStyle("-fx-background-color: #ffffff;");
- AnchorPane.setTopAnchor(titlePane, 0.0);
- AnchorPane.setBottomAnchor(titlePane, 659.0);
- AnchorPane.setLeftAnchor(titlePane, 0.0);
- AnchorPane.setRightAnchor(titlePane, 0.0);
- //title text
- Text title = new Text();
- title.setText("TRIP\n");
- title.setLayoutX(200);
- title.setLayoutY(42);
- Font f = new Font("System Bold", 26);
- title.setFont(f);
- //image
- Image img = new Image("logo.png");
- ImageView imgv = new ImageView(img);
- imgv.setFitHeight(90);
- imgv.setFitWidth(90);
- imgv.setLayoutX(50);
- imgv.setLayoutY(20);
- titlePane.getChildren().addAll(title, imgv);
- //login
- TextField userName = new TextField();
- userName.setLayoutX(890);
- userName.setLayoutY(70);
- userName.setPrefHeight(35);
- userName.setPrefWidth(200);
- userName.setEffect(borderGlow);
- userName.setPromptText("Username");
- userName.setText("username");
- PasswordField passWord = new PasswordField();
- passWord.setLayoutX(1100);
- passWord.setLayoutY(70);
- passWord.setPrefHeight(35);
- passWord.setPrefWidth(200);
- passWord.setEffect(borderGlow);
- passWord.setPromptText("Password");
- passWord.setText("");
- Button login = new Button("Login");
- login.setLayoutX(1305);
- login.setLayoutY(68);
- // search
- AnchorPane searchBg=new AnchorPane();
- searchBg.setLayoutX(13);
- searchBg.setLayoutY(212);
- searchBg.setPrefHeight(470);
- searchBg.setPrefWidth(1089);
- searchBg.setStyle(" -fx-background-image: url('bg.png');-fx-background-size: 1400 470;");
- searchBg.getStylesheets().add(Main.class.getResource("table.css").toExternalForm());
- //searchBg.setStyle("-fx-background-color: yellow;");
- AnchorPane.setLeftAnchor(searchBg, 0.0);
- AnchorPane.setRightAnchor(searchBg, 0.0);
- TabPane tp = new TabPane();
- tp.setLayoutX(padd+83);
- tp.setLayoutY(82);
- tp.setPrefHeight(283);
- tp.setPrefWidth(950);
- // tp.setStyle("-fx-background-color: red;");
- //tp.setTabClosingPolicy();
- Tab hotelTab = new Tab();
- hotelTab.setText("Hotels");
- AnchorPane hotelPane = new AnchorPane();
- hotelPane.setPrefHeight(244);
- hotelPane.setPrefWidth(950);
- hotelPane.setStyle("-fx-background-color: #ccfbff;");
- TextField htf1 = new TextField();
- htf1.setLayoutX(padd+25);
- htf1.setLayoutY(81);
- htf1.setEffect(borderGlow);
- Text ht1=new Text("Destination or hotel name:");
- ht1.setLayoutX(padd+25);
- ht1.setLayoutY(65);
- ht1.setEffect(borderGlow);
- DatePicker hdp1=new DatePicker();
- hdp1.setLayoutX(padd+237);
- hdp1.setLayoutY(81);
- hdp1.setPrefHeight(31);
- hdp1.setPrefWidth(178);
- hdp1.setEffect(borderGlow);
- hdp1.setValue(LocalDate.now());
- DatePicker hdp2=new DatePicker();
- hdp2.setLayoutX(padd+431);
- hdp2.setLayoutY(81);
- hdp2.setPrefHeight(31);
- hdp2.setPrefWidth(175);
- hdp2.setEffect(borderGlow);
- hdp2.setValue(LocalDate.now().plusDays(2));
- Slider adult=new Slider(1,5,1);
- adult.setLayoutX(padd+645);
- adult.setLayoutY(54);
- adult.setEffect(borderGlow);
- adult.setShowTickLabels(true);
- adult.setShowTickMarks(true);
- adult.setBlockIncrement(1);
- adult.setMajorTickUnit(1);
- adult.setMinorTickCount(0);
- Slider child=new Slider(1,5,1);
- child.setLayoutX(padd+645);
- child.setLayoutY(105);
- child.setEffect(borderGlow);
- child.setBlockIncrement(1);
- child.setMajorTickUnit(1);
- child.setMinorTickCount(0);
- child.setShowTickLabels(true);
- child.setShowTickMarks(true);
- child.setBlockIncrement(1);
- Text ht2=new Text("Check in");
- ht2.setLayoutX(padd+237);
- ht2.setLayoutY(66);
- ht2.setEffect(borderGlow);
- Text ht3=new Text("Check out");
- ht3.setLayoutX(padd+431);
- ht3.setLayoutY(66);
- ht3.setEffect(borderGlow);
- Text ht4=new Text("Adults");
- ht4.setLayoutX(padd+645);
- ht4.setLayoutY(44);
- ht4.setEffect(borderGlow);
- adult.valueProperty().addListener(new ChangeListener<Number>() {
- @Override
- public void changed(ObservableValue<? extends Number> observable, //
- Number oldValue, Number newValue) {
- ht4.setText("Adults : "+(int)Math.floor(newValue.doubleValue()));
- }
- });
- Text ht5=new Text("Children");
- ht5.setLayoutX(padd+645);
- ht5.setLayoutY(97);
- ht5.setEffect(borderGlow);
- child.valueProperty().addListener(new ChangeListener<Number>() {
- @Override
- public void changed(ObservableValue<? extends Number> observable, //
- Number oldValue, Number newValue) {
- ht5.setText("Childs : "+(int)Math.floor(newValue.doubleValue()));
- }
- });
- Button hbutton = new Button("Search");
- hbutton.setLayoutX(padd+645);
- hbutton.setLayoutY(163);
- hbutton.setPrefHeight(41);
- hbutton.setPrefWidth(135);
- hotelPane.getChildren().addAll(htf1,ht1,hdp1,hdp2,adult,child,ht2,ht3,ht4,ht5,hbutton);
- hotelTab.setContent(hotelPane);
- //hotel
- Tab flightTab = new Tab();
- flightTab.setText("" +
- "" +
- "Flight");
- AnchorPane flightPane = new AnchorPane();
- flightPane.setPrefHeight(244);
- flightPane.setPrefWidth(950);
- flightPane.setStyle("-fx-background-color: #ccfbff;");
- TextField ftf1 = new TextField();
- ftf1.setLayoutX(padd+25);
- ftf1.setLayoutY(81);
- ftf1.setPrefHeight(31);
- ftf1.setPrefWidth(140);
- ftf1.setEffect(borderGlow);
- Text ft1=new Text("From");
- ft1.setLayoutX(padd+25);
- ft1.setLayoutY(65);
- ft1.setEffect(borderGlow);
- DatePicker fdp1=new DatePicker();
- fdp1.setLayoutX(padd+493);
- fdp1.setLayoutY(81);
- fdp1.setPrefHeight(31);
- fdp1.setPrefWidth(141);
- fdp1.setEffect(borderGlow);
- fdp1.setValue(LocalDate.now());
- Slider fchild=new Slider();
- fchild.setLayoutX(padd+700);
- fchild.setLayoutY(143);
- fchild.setPrefHeight(18);
- fchild.setPrefWidth(116);
- fchild.setEffect(borderGlow);
- Text ft2=new Text("To");
- ft2.setLayoutX(padd+184);
- ft2.setLayoutY(66);
- ft2.setEffect(borderGlow);
- Text ft3=new Text("Return");
- ft3.setLayoutX(padd+493);
- ft3.setLayoutY(66);
- ft3.setEffect(borderGlow);
- Text ft4=new Text("Children");
- ft4.setLayoutX(padd+700);
- ft4.setLayoutY(135);
- ft4.setEffect(borderGlow);
- TextField ftf2 = new TextField();
- ftf2.setLayoutX(padd+182);
- ftf2.setLayoutY(81);
- ftf2.setPrefHeight(31);
- ftf2.setPrefWidth(146);
- ftf2.setEffect(borderGlow);
- Text ft5=new Text("Depart");
- ft5.setLayoutX(padd+344);
- ft5.setLayoutY(66);
- ft5.setEffect(borderGlow);
- DatePicker fdp2=new DatePicker();
- fdp2.setLayoutX(padd+344);
- fdp2.setLayoutY(82);
- fdp2.setPrefHeight(31);
- fdp2.setPrefWidth(132);
- fdp2.setEffect(borderGlow);
- fdp2.setValue(LocalDate.now().plusDays(2));
- Text ft6=new Text("Adults");
- ft6.setLayoutX(padd+553);
- ft6.setLayoutY(137);
- ft6.setEffect(borderGlow);
- Slider fadult=new Slider();
- fadult.setLayoutX(padd+553);
- fadult.setLayoutY(147);
- fadult.setPrefHeight(18);
- fadult.setPrefWidth(113);
- fadult.setEffect(borderGlow);
- ComboBox fcb = new ComboBox();
- fcb.setLayoutX(padd+662);
- fcb.setLayoutY(81);
- fcb.setPrefWidth(150);
- fcb.getItems().add("Economy");
- fcb.getItems().add("Business");
- fcb.getItems().add("First");
- fcb.getSelectionModel().select("Economy");
- fcb.setEffect(borderGlow);
- Text ft7=new Text("Class");
- ft7.setLayoutX(padd+662);
- ft7.setLayoutY(64);
- ft7.setEffect(borderGlow);
- Button fbutton = new Button("Search");
- fbutton.setLayoutX(padd+675);
- fbutton.setLayoutY(183);
- fbutton.setPrefHeight(41);
- fbutton.setPrefWidth(135);
- flightPane.getChildren().addAll(ftf1,ftf2,ft1,fdp1,fchild,fadult,ft2,ft3,ft4,ft5,ft6,ft7,fdp2,fcb,fbutton);
- flightTab.setContent(flightPane);
- tp.getTabs().addAll(hotelTab,flightTab);
- searchBg.getChildren().addAll(tp);
- mainPane.getChildren().addAll(titlePane, userName, passWord, login,searchBg);
- mainPane.getStylesheets().add(Main.class.getResource("button.css").toExternalForm());
- Scene scene = new Scene(mainPane);
- stage.setScene(scene);
- stage.setTitle("Football Club Management");
- stage.show();
- // stage.getIcons().add(new Image("icon.png"));
- stage.setOnCloseRequest((WindowEvent t) -> {
- Platform.exit();
- System.exit(0);
- });
- }
- public static void main(String[] args) {
- launch(args);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement