public RNADrawingView() { // set up gui drawingPane.setPrefWidth(400); drawingPane.setPrefHeight(400); warningLabel.setTextFill(Color.RED); animateCheckbox.setSelected(false); buttonBox.getChildren().addAll(foldButton, drawButton, animateCheckbox); inputBox.getChildren().addAll(sequenceField, bracketField, buttonBox); buttonInputBox.getChildren().addAll(inputBox, warningLabel, buttonBox); drawingPane.getChildren().add(drawing); root.setTop(buttonInputBox); root.setBottom(drawingPane); buttonBox.setAlignment(Pos.BOTTOM_LEFT); inputBox.setPadding(new Insets(10, 5, 10, 5)); HBox.setMargin(foldButton, new Insets(0, 2.5, 0, 2.5)); HBox.setMargin(drawButton, new Insets(0, 2.5, 0, 2.5)); HBox.setMargin(animateCheckbox, new Insets(0, 2.5, 0, 2.5)); VBox.setMargin(sequenceField, new Insets(0, 0, 5, 0)); this.scene = new Scene(root); scene.getStylesheets().add("resources/assignment6and7.css"); drawingPane.getStyleClass().add("drawingPane"); }
public void start(final Stage stage) { for (ConditionalFeature f : EnumSet.allOf(ConditionalFeature.class)) { System.err.println(f + ": " + Platform.isSupported(f)); } Rectangle2D screen = Screen.getPrimary().getVisualBounds(); final Random rand = new Random(); /* final Group starfield = new Group(); for(int i=0;i<66;i++) { int size = rand.nextInt(3)+1; if(size==3) { size = rand.nextInt(3)+1; } Circle circ = new Circle(rand.nextInt((int)screen.getWidth()), rand.nextInt(200+(int)screen.getHeight())-200, size); circ.setFill(Color.rgb(200,200,200+rand.nextInt(56))); circ.setTranslateZ(1+rand.nextInt(40)); starfield.getChildren().add(circ); } */ final List<Starfield> stars = new ArrayList<>(); for (int i = 0; i < 10; i++) { int sw = (int) screen.getWidth(), sh = (int) screen.getHeight(); Starfield sf = new Starfield(rand, -sw, -sh, 2 * sw, 2 * sh, rand.nextInt(30) + 10); sf.setTranslateZ(rand.nextInt(2000) + 50); stars.add(sf); } // final Starfield starfield2 = new Starfield(rand, -200, -200, (int)screen.getWidth(), // (int)screen.getHeight()+200, 40); final Ruleset1D rules = new Ruleset1D(new int[] {Colors.randomColor(rand), Colors.randomColor(rand)}); final Ruleset rules2 = new Rulespace1D(rules); // Rule rule = rules.random(rand).next(); Iterator<Rule> it = rules.iterator(); GridPane gridp = new GridPane(); int i = 0, j = 0; while (it.hasNext()) { Rule rule = it.next(); CA ca = new CA(rule, new RandomInitializer(), rand, 42, 100, 100); Plane plane = ca.createPlane(); ImageView imview = new ImageView(plane.toImage()); imview.setSmooth(true); imview.setFitWidth(30); imview.setPreserveRatio(true); gridp.add(imview, i, j); if (++i == 16) { i = 0; j++; } } // gridp.setScaleX(0.3); // gridp.setScaleY(0.3); // gridp.setPrefSize(100*3/3, 100*3/3); // gridp.setMaxSize(100*3/3, 100*3/3); final double XTRANS = screen.getWidth() / 2 - 30 * 16 / 2; final double YTRANS = screen.getHeight() / 2 - 30 * 16 / 2; // gridp.setTranslateX((screen.getWidth()/2+100*16/2)*0.3); // gridp.setTranslateX(0); gridp.setTranslateX(XTRANS); gridp.setTranslateY(YTRANS); // gridp.setAlignment(Pos.CENTER); Group grid = new Group(gridp); // grid.setTranslateX(0); // grid.setTranslateY(0); // gridp.relocate(-400, -400); // gridp.setTranslateX(-300); // gridp.setTranslateY(-150); /* final RotateTransition rt = new RotateTransition(Duration.millis(3000), gridp); rt.setByAngle(180); rt.setCycleCount(4); rt.setAutoReverse(true); */ // rt.setAutoReverse(false); /*` final BorderPane border = new BorderPane(); */ // Label title = new Label("EXPLORATIONS IN CELLULAR SPACES"); Label title = new Label("E X P L O R A T I O N S"); title.setFont(new Font("Helvetica Neue Condensed Bold", 36)); title.setTextFill(Color.WHITE); // Label title2 = new Label("IN CELLULAR SPACES"); Label title2 = new Label("EXPLORATIONS IN CELLULAR SPACES"); title2.setFont(new Font("Helvetica Neue Condensed Bold", 28)); title2.setTextFill(Color.WHITE); /*` title.setAlignment(Pos.CENTER); title.setContentDisplay(ContentDisplay.CENTER); title.setTextAlignment(TextAlignment.CENTER); */ final HBox toptitle = new HBox(); toptitle.setAlignment(Pos.CENTER); toptitle.getChildren().add(title); toptitle.setTranslateX(XTRANS); toptitle.setTranslateY(YTRANS - 36); final HBox btitle = new HBox(); btitle.setAlignment(Pos.CENTER); title2.setAlignment(Pos.CENTER); btitle.getChildren().add(title2); btitle.setTranslateX(XTRANS); // btitle.setTranslateX(screen.getWidth()/2-title2.getPrefWidth()/2); btitle.setTranslateY(YTRANS + 30 * 16); Group border = new Group(); // border.getChildren().add(toptitle); for (Starfield st : stars) { border.getChildren().add(st); } // border.getChildren().add(starfield2); border.getChildren().add(btitle); border.getChildren().add(grid); final List<TranslateTransition> tts = new ArrayList<>(); final TranslateTransition tt = new TranslateTransition(Duration.millis(6000), grid); tt.setByY(2000); tts.add(tt); for (Starfield sf : stars) { TranslateTransition st = new TranslateTransition(Duration.millis(6000), sf); st.setByY(200); st.setByZ(100 + rand.nextInt(100)); tts.add(st); } /* final TranslateTransition tt2 = new TranslateTransition(Duration.millis(6000), starfield1); tt2.setByY(200); tt2.setByZ(200); final TranslateTransition tt3 = new TranslateTransition(Duration.millis(6000), starfield2); tt3.setByY(300); tt3.setByZ(200); */ // final ParallelTransition infinite = new ParallelTransition(tt, tt2, tt3); final ParallelTransition infinite = new ParallelTransition(tts.toArray(new TranslateTransition[0])); final BorderPane ctrl = new BorderPane(); // ctrl.setPrefSize(200, 100); // ctrl.setMaxSize(200, 100); Label start = new Label("Start"); start.setTextFill(Color.WHITE); start.setFont(new Font("Helvetica", 28)); start.setAlignment(Pos.CENTER_LEFT); start.setContentDisplay(ContentDisplay.CENTER); start.setTranslateX(XTRANS + 30 * 16 + 100); start.setTranslateY(screen.getHeight() / 2); // start.setTranslateX(-400); Circle ico = new Circle(15); ico.setOnMouseClicked( new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent e) { FadeTransition ft = new FadeTransition(Duration.millis(500), ctrl); ft.setFromValue(1.0); ft.setToValue(0.0); FadeTransition tft = new FadeTransition(Duration.millis(500), btitle); tft.setFromValue(1.0); tft.setToValue(0.0); ParallelTransition pt = new ParallelTransition(ft, tft); // TranslateTransition fft = new TranslateTransition(Duration.millis(3000), border); // tt.setByY(2000); SequentialTransition st = new SequentialTransition(pt, infinite); st.setOnFinished( new EventHandler<ActionEvent>() { public void handle(ActionEvent e) { State state = State.state().rules(rules2).random(new Rand()).size(400); Iterator<Rule> it = state.rules().random(state.random().create()); CA ca = new CA( it.next(), new RandomInitializer(), state.random().create(), 0, state.size(), state.size()); state.ca(ca); // final Futures futures = new Futures(rules2, new Rand()); final Controls controls = new Controls(state); // controls.setTranslateX(screen.getWidth()/2 - // futures.getPossibilityWidth()/2); // controls.setTranslateY(screen.getHeight()/2 - // futures.getPossiblityHeight()/2-20); // controls.setTranslateX(screen.getWidth()/2 - (3*200+2*10)/2); // controls.setTranslateY(screen.getHeight()/2 - (3*200+2*10)/2-20); for (Starfield sf : stars) { state.addListener(sf); // futures.addFutureListener(sf); } // futures.addFutureListener(starfield1); // futures.addFutureListener(starfield2); border.getChildren().remove(grid); border.getChildren().remove(btitle); // border.getChildren().add(futures); border.getChildren().add(controls); // futures.setTranslateX(screen.getWidth()/2 - futures.getPossibilityWidth()/2); // futures.setTranslateY(screen.getHeight()/2 - // futures.getPossiblityHeight()/2); // border.setCenter(futures); // border.setAlignment(futures, Pos.CENTER); } }); st.play(); } }); // Sphere ico = new Sphere(15); // ico.setDrawMode(DrawMode.LINE); ico.setFill(Color.rgb(10, 10, 10)); ico.setStroke(Color.WHITE); ico.setStrokeWidth(3); ico.setTranslateX(XTRANS + 30 * 16 + 100); ico.setTranslateY(screen.getHeight() / 2); // ctrl.setTop(ico); ctrl.setCenter(ico); /* border.setRight(ctrl); border.setMaxSize(800,600); border.setPrefSize(800,600); */ border.getChildren().add(ctrl); Group root = new Group(); root.getChildren().add(border); // root.setAutoSizeChildren(false); // root.setLayoutX(-400); // root.setLayoutY(-400); // Scene scene = new Scene(root, 1200, 1000); Scene scene = new Scene(root, 1280, 1024, true, SceneAntialiasing.DISABLED); scene.setFill(Color.BLACK); scene.setCamera(new PerspectiveCamera()); // set Stage boundaries to visible bounds of the main screen stage.setX(screen.getMinX()); stage.setY(screen.getMinY()); stage.setWidth(screen.getWidth()); stage.setHeight(screen.getHeight()); stage.setTitle("Explorations in Cellular Spaces"); stage.setScene(scene); stage.setResizable(false); // root.autosize(); // stage.sizeToScene(); stage.show(); }
private void display() { // create labels and textfields Label lbl_klantNaam = new Label("Klant naam:"); lbl_klantNaam.setTextFill((Color.valueOf("#FFFC00"))); Label lbl_klantID = new Label("Klant email:"); lbl_klantID.setTextFill((Color.valueOf("#FFFC00"))); Label lbl_klantAdres = new Label("Klant adres:"); lbl_klantAdres.setTextFill((Color.valueOf("#FFFC00"))); Label lbl_factuurNummer = new Label("Factuur nummer:"); lbl_factuurNummer.setTextFill((Color.valueOf("#FFFC00"))); Label lbl_factuurDatum = new Label("Factuur datum:"); lbl_factuurDatum.setTextFill((Color.valueOf("#FFFC00"))); Label lbl_debiteurenNummer = new Label("Debiteuren nummer:"); lbl_debiteurenNummer.setTextFill((Color.valueOf("#FFFC00"))); String klantHeleNaam = klantVoornaam + " " + klantAchternaam; Label lbl_DklantNaam = new Label(klantHeleNaam); lbl_DklantNaam.setTextFill((Color.valueOf("#FFFC00"))); Label lbl_DklantID = new Label(order.getKlantEmail()); lbl_DklantID.setTextFill((Color.valueOf("#FFFC00"))); Label lbl_DklantAdres = new Label(order.getFactuurAdres()); lbl_DklantAdres.setTextFill((Color.valueOf("#FFFC00"))); Label lbl_DfactuurNummer = new Label(Integer.toString(order.getOrderID())); lbl_DfactuurNummer.setTextFill((Color.valueOf("#FFFC00"))); Label lbl_DfactuurDatum = new Label(order.getOrderDatum().toString()); lbl_DfactuurDatum.setTextFill((Color.valueOf("#FFFC00"))); Label lbl_DdebiteurenNummer = new Label(Integer.toString(debiteurenNummer)); lbl_DdebiteurenNummer.setTextFill((Color.valueOf("#FFFC00"))); TextField tf_wijnnaam = new TextField(); TextField tf_prijs = new TextField(); table.setEditable(true); TableColumn<OrderRegel, Integer> codeCol = new TableColumn<>("Nr"); codeCol.setCellValueFactory(new PropertyValueFactory<>("orderRegelID")); TableColumn<OrderRegel, Integer> aantalCol = new TableColumn("Aantal"); aantalCol.setCellValueFactory(new PropertyValueFactory<>("aantal")); TableColumn<OrderRegel, Integer> wijnCol = new TableColumn("Wijn serie nr"); wijnCol.setCellValueFactory(new PropertyValueFactory<>("wijnID")); TableColumn<OrderRegel, String> naamCol = new TableColumn("Naam"); naamCol.setCellValueFactory(new PropertyValueFactory<>("wijnNaam")); TableColumn<OrderRegel, Integer> jaartalCol = new TableColumn("Jaartal"); jaartalCol.setCellValueFactory(new PropertyValueFactory<>("wijnJaartal")); TableColumn<OrderRegel, Integer> perflesCol = new TableColumn("Per fles"); perflesCol.setCellValueFactory(new PropertyValueFactory<>("wijnPrijs")); TableColumn<OrderRegel, Double> bedragCol = new TableColumn("Bedrag"); bedragCol.setCellValueFactory(new PropertyValueFactory<>("totaalPrijs")); table = new TableView<>(); ObservableList<OrderRegel> orders = FXCollections.observableArrayList(orderController.getAlleOrderRegels(order.getOrderID())); table.setItems(orders); table.getColumns().addAll(wijnCol, naamCol, jaartalCol, aantalCol, perflesCol, bedragCol); // topbox items title = new Label("Lions-club Oegstgeest/Warmond"); title.setId("title"); title.setTextFill(Color.web("#FFCF03")); title.autosize(); icon = new ImageView(new Image("/images/icon.png")); icon.setPreserveRatio(true); icon.autosize(); // buttons cancel = new Button("Terug"); cancel.setOnAction( e -> new BestellingOverzichtView(new OrderController(), new KlantController())); Button exporteer = new Button("Exporteer naar PDF"); exporteer.setOnAction( e -> { factuurGenerator = new FactuurGenerator(klantController.getKlantByOrder(order), order, orders); factuurGenerator.factuur(); Alert alert = new Alert(AlertType.INFORMATION); alert.setHeaderText(null); alert.setTitle("Exporteer naar PDF"); alert.setContentText("De factuur is succesvol ge�xporteerd. "); alert.showAndWait(); }); // add elements to panes topBox.getChildren().addAll(icon, title); topBox.setAlignment(Pos.CENTER); centerBox.getChildren().add(form); centerBox.getChildren().add(table); form.addColumn( 0, lbl_klantNaam, lbl_klantID, lbl_klantAdres, lbl_factuurNummer, lbl_factuurDatum, lbl_debiteurenNummer); form.addColumn( 1, lbl_DklantNaam, lbl_DklantID, lbl_DklantAdres, lbl_DfactuurNummer, lbl_DfactuurDatum, lbl_DdebiteurenNummer); form.addColumn(2, exporteer); bottomBox.getChildren().add(cancel); bottomBox.getChildren().add(exporteer); mainPane.setTop(topBox); mainPane.setCenter(centerBox); mainPane.setBottom(bottomBox); stage.setScene(scene); }
@Override public void start(Stage primaryStage) { VBox loginPane = new VBox(); loginPane.setAlignment(Pos.CENTER); primaryStage.setTitle("Amoeba"); primaryStage.setScene(new Scene(loginPane, 800, 600)); primaryStage.show(); TextField username = new TextField(); username.setPromptText("Username"); username.setMaxSize(200, 50); Timeline renderTimer = new Timeline(); Timeline inputTimer = new Timeline(); ColorPicker colorPicker = new ColorPicker(); colorPicker.setEditable(true); colorPicker.setValue(Color.BLACK); lagLabel.setTranslateX(25); lagLabel.setTranslateY(10); lagLabel.setTextFill(Color.RED); TextField address = new TextField("localhost"); address.setPromptText("Server IP Address"); address.setMaxSize(200, 50); TextField port = new TextField("8080"); port.setPromptText("Port Number"); port.setMaxSize(200, 50); Button btn = new Button("Play"); btn.setDefaultButton(true); loginPane.getChildren().addAll(username, colorPicker, address, port, btn); primaryStage.setResizable(false); music.setCycleCount(MediaPlayer.INDEFINITE); renderPane.setBackground(new Background(backgroundImage)); renderPane.setPrefSize(800, 600); chatBox.setPrefSize(400, 100); chatBox.setTranslateX(0); chatBox.setTranslateY(468); chatBox.setWrapText(true); chatBox.setEditable(false); chatBox.setStyle("-fx-opacity: 0.5"); chatInput.setPrefSize(400, 10); chatInput.setTranslateX(0); chatInput.setTranslateY(570); chatInput.setStyle("-fx-opacity: 0.8"); highScores.setPrefSize(400, 210); highScores.setEditable(false); currentScores.setPrefSize(400, 250); currentScores.setEditable(false); currentScores.setLayoutY(210); scores.setTranslateX(-390); scores.setTranslateY(0); scores.setStyle("-fx-opacity: 0.8"); scores.setOnMouseEntered( (e) -> { scores.setTranslateX(0); }); scores.setOnMouseExited( (e) -> { if (e.getX() > 350) { scores.setTranslateX(-390); } }); btn.setOnAction( (e) -> { if (!networkController.isConnected()) { networkController.connect(address.getText(), Integer.parseInt(port.getText())); if (username.getText().isEmpty()) { username.setText("Anonymous"); } networkController.sendMessage(new LoginMessage(username.getText(), "")); ArrayList<KeyValuePair> properties = new ArrayList<>(); properties.add(new KeyValuePair("color", colorPicker.getValue().toString())); networkController.sendMessage(new SetBlobPropertiesMessage(properties)); primaryStage.setScene(new Scene(renderPane)); renderTimer.play(); inputTimer.play(); music.play(); } }); inputTimer.setCycleCount(Timeline.INDEFINITE); inputTimer .getKeyFrames() .add( new KeyFrame( Duration.seconds(0.05), (e) -> { if (sendCoordinates) { networkController.sendMessage(new MoveTowardCoordinatesMessage(x, y)); } })); renderTimer.setCycleCount(Timeline.INDEFINITE); renderTimer .getKeyFrames() .add( new KeyFrame( Duration.seconds(0.01), (e) -> { render(); })); renderPane.setOnMouseReleased( (e) -> { this.sendCoordinates = false; }); renderPane.setOnMouseDragged( (e) -> { this.sendCoordinates = true; this.x = e.getX(); this.y = e.getY(); }); renderPane.setOnMouseClicked( (e) -> { if (e.getButton() == MouseButton.SECONDARY) { networkController.sendMessage(new BoostMessage()); } else if (e.getClickCount() > 1 || e.getButton() == MouseButton.MIDDLE) { networkController.sendMessage(new SplitMessage()); } }); renderPane.setOnKeyPressed( (e) -> { if (e.getCode().equals(KeyCode.ENTER) && !chatInput.getText().isEmpty()) { networkController.sendMessage(new ChatMessage("", chatInput.getText())); chatInput.clear(); } }); primaryStage.setOnCloseRequest( (e) -> { networkController.sendMessage(new LogoutMessage()); try { Thread.sleep(100); } catch (InterruptedException ex) { Logger.getLogger(AmoebaClient.class.getName()).log(Level.WARNING, null, ex); } finally { System.exit(0); } }); }
@FXML private void archiveButtonClicked(ActionEvent event) { configureButtons(); archiveButton.setGraphic(archiveSelectedIMV); // clear old content contentPane.getChildren().clear(); // ask for archive date titleLabel.setText("Archiving"); // create text and textfield VBox mainBox = new VBox(); mainBox.setSpacing(20); mainBox.setAlignment(Pos.CENTER); HBox box = new HBox(); contentPane.getChildren().add(mainBox); box.setSpacing(5); box.setAlignment(Pos.CENTER); Label dateLabel = new Label("Cut Off Date:"); dateLabel.setFont(new Font("System", 24)); TextField dateTF = new TextField(); dateTF.setPromptText("YYYY-MM-DD"); Label errorLabel = new Label(); errorLabel.setTextFill(Paint.valueOf("#f5515f")); errorLabel.setFont(new Font("System", 14)); Button confirmButton = new Button("Confirm"); confirmButton.setStyle( "-fx-background-color: #e63347;" + "-fx-background-radius: 7;" + "-fx-text-fill: white"); confirmButton.setPrefSize(130, 40); confirmButton.setOnAction( e -> { if (dateTF.getText() != null) { String cutoffDate = dateTF.getText().trim(); if (cutoffDate.length() > 10) { errorLabel.setText("Too long"); return; } else if (!isDate(cutoffDate)) { errorLabel.setText("Wrong date format"); return; } boolean success = operation.archive(cutoffDate); if (success) { // set up content contentPane.getChildren().clear(); TableView table = new TableView(); TableColumn fnCol = new TableColumn("First Name"); fnCol.setCellValueFactory(new PropertyValueFactory<>("firstName")); TableColumn lnCol = new TableColumn("Last Name"); lnCol.setCellValueFactory(new PropertyValueFactory<>("lastName")); TableColumn emailCol = new TableColumn("Email"); emailCol.setCellValueFactory(new PropertyValueFactory<>("email")); TableColumn lvCol = new TableColumn("Updated At"); lvCol.setCellValueFactory(new PropertyValueFactory<>("updatedAt")); TableColumn discountCol = new TableColumn("Discount"); discountCol.setCellValueFactory(new PropertyValueFactory<>("discount")); table.getColumns().addAll(fnCol, lnCol, emailCol, lvCol, discountCol); ObservableList<Customer> data = FXCollections.observableArrayList(operation.getArchivedCustomers()); table.setItems(data); contentPane.getChildren().add(table); titleLabel.setText("Archived Customers"); } else { titleLabel.setText("Can't archive"); return; } } else { errorLabel.setText("Please enter a date"); return; } }); box.getChildren().addAll(dateLabel, dateTF, errorLabel); mainBox.getChildren().addAll(box, confirmButton); }