Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- FadeTransition fade = new FadeTransition();
- fade.setNode(krug);
- fade.setAutoReverse(false);
- fade.setFromValue(0);
- fade.setToValue(1);
- fade.setCycleCount(1);
- fade.setDuration(Duration.seconds(5));
- fade.play();
- 2
- scena.setOnKeyPressed(e-> {
- if (e.getCode() == KeyCode.NUMPAD8) {
- } else if (e.getCode() == KeyCode.NUMPAD5) {
- } else if (e.getCode() == KeyCode.NUMPAD2) {
- }
- public static void main(String[] args) {
- launch(args);
- }
- public void animacija(Circle krug)
- {
- }
- /*
- * 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 fade;
- import javafx.animation.FadeTransition;
- import javafx.animation.Timeline;
- import javafx.application.Application;
- import javafx.event.ActionEvent;
- import javafx.event.EventHandler;
- import javafx.scene.Scene;
- import javafx.scene.control.Button;
- import javafx.scene.layout.Pane;
- import javafx.scene.layout.StackPane;
- import javafx.scene.paint.Color;
- import javafx.scene.shape.Circle;
- import javafx.stage.Stage;
- import javafx.util.Duration;
- /**
- *
- * @author profesor
- */
- public class Fade extends Application {
- @Override
- public void start(Stage primaryStage) {
- Circle krug=new Circle();
- krug.setRadius(50);
- krug.setFill(Color.RED);
- krug.setLayoutX(250);
- krug.setLayoutY(250);
- Pane p=new Pane();
- p.getChildren().add(krug);
- Button start=new Button("Start");
- Button pauza=new Button("Pauza");
- p.getChildren().addAll(start,pauza);
- start.setLayoutX(50);
- start.setLayoutY(50);
- pauza.setLayoutX(150);
- pauza.setLayoutY(50);
- FadeTransition fade=new FadeTransition();
- fade.setNode(krug);
- fade.setAutoReverse(true);
- fade.setFromValue(1);
- fade.setToValue(0);
- fade.setCycleCount(Timeline.INDEFINITE);
- fade.setDuration(Duration.seconds(1));
- primaryStage.setScene(new Scene(p,500,500));
- primaryStage.show();
- start.setOnAction(e->{
- fade.play();
- });
- pauza.setOnAction(e->{
- fade.pause();
- });
- }
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- launch(args);
- }
- }
- /*
- * 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 primer1;
- import java.io.File;
- import java.util.Scanner;
- import javafx.application.Application;
- import javafx.event.ActionEvent;
- import javafx.event.EventHandler;
- import javafx.scene.Scene;
- import javafx.scene.control.Button;
- import javafx.scene.layout.Pane;
- import javafx.scene.layout.StackPane;
- import javafx.stage.FileChooser;
- import javafx.stage.FileChooser.ExtensionFilter;
- import javafx.stage.Stage;
- /**
- *
- * @author profesor
- */
- public class Primer1 extends Application {
- @Override
- public void start(Stage primaryStage) {
- Pane p=new Pane();
- Button dugme=new Button("Otvori Fajl");
- p.getChildren().add(dugme);
- primaryStage.setScene(new Scene(p,500,500));
- primaryStage.show();
- dugme.setOnAction(e->{
- FileChooser fc=new FileChooser();
- fc.getExtensionFilters().addAll(new ExtensionFilter("Text","*.txt"));
- File izabranFajl=fc.showOpenDialog(null);
- if(izabranFajl!=null)
- {
- try
- {
- Scanner scanner=new Scanner(izabranFajl);
- while(scanner.hasNextLine())
- {
- System.out.println(scanner.nextLine());
- }
- scanner.close();
- }
- catch(Exception ex)
- {
- ex.printStackTrace();
- }
- }
- });
- }
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- launch(args);
- }
- }
- /*
- * 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.
- */
- MRK
- * 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 primer1;
- import javafx.application.Application;
- import javafx.event.ActionEvent;
- import javafx.event.EventHandler;
- import javafx.scene.Scene;
- import javafx.scene.control.Button;
- import javafx.scene.layout.Pane;
- import javafx.scene.layout.StackPane;
- import javafx.stage.Stage;
- /**
- *
- * @author student
- */
- public class Primer1 extends Application {
- @Override
- public void start(Stage primaryStage) {
- Pane p=new Pane();
- Button dugme=new Button("Otvori Fajl");
- p.getChildren().add(dugme);
- primaryStage.setScene(new Scene(p,500,500));
- primaryStage.show();
- dugme.setOnAction(e->{
- FileChosser fc=new FileChooser();
- fc.getExtensionFilters().addAll(new ExtensionFilter("Text","*.txt"));
- File izabranFajl=fc.showOpenDialog(null);
- if(izabranjFajl!=null)
- {
- try
- {
- Scanner scanner=new Scanner(izbranFajl);
- }
- catch(Exception ex)
- {
- }
- }
- })
- }
- ======================================================================
- package semafor;
- import javafx.animation.FadeTransition;
- import javafx.application.Application;
- import javafx.scene.Scene;
- import javafx.scene.input.KeyCode;
- import javafx.scene.layout.Pane;
- import javafx.scene.paint.Color;
- import javafx.scene.shape.Circle;
- import javafx.scene.shape.Rectangle;
- import javafx.stage.Stage;
- import javafx.util.Duration;
- public class Semafor extends Application {
- @Override
- public void start(Stage primaryStage) {
- Pane p = new Pane();
- Rectangle prav = new Rectangle();
- Rectangle pole = new Rectangle();
- Circle circ = new Circle();
- Circle circ1 = new Circle();
- Circle circ2 = new Circle();
- circ.setRadius(50);
- circ1.setRadius(50);
- circ2.setRadius(50);
- circ.setFill(Color.RED);
- circ1.setFill(Color.YELLOW);
- circ2.setFill(Color.GREEN);
- circ.setLayoutX(250);
- circ.setLayoutY(135);
- circ1.setLayoutX(250);
- circ1.setLayoutY(250);
- circ2.setLayoutX(250);
- circ2.setLayoutY(365);
- pole.setWidth(15);
- pole.setHeight(100);
- pole.setLayoutX(242);
- pole.setLayoutY(425);
- pole.setFill(Color.BLACK);
- prav.setWidth(150);
- prav.setHeight(350);
- prav.setLayoutX(175);
- prav.setLayoutY(75);
- prav.setStrokeWidth(5);
- prav.setStroke(Color.BLACK);
- prav.setFill(Color.TRANSPARENT);
- p.getChildren().addAll(prav,circ,circ1,circ2,pole);
- Scene scena = new Scene(p,500,500);
- primaryStage.setScene(scena);
- primaryStage.setResizable(false);
- primaryStage.show();
- scena.setOnKeyPressed(e-> {
- if (e.getCode() == KeyCode.NUMPAD8) {
- animacija(circ);
- } else if (e.getCode() == KeyCode.NUMPAD5) {
- animacija(circ1);
- } else if (e.getCode() == KeyCode.NUMPAD2) {
- animacija(circ2);
- }
- });
- }
- public static void main(String[] args) {
- launch(args);
- }
- public void animacija(Circle krug){
- FadeTransition fade = new FadeTransition();
- fade.setNode(krug);
- fade.setAutoReverse(false);
- fade.setFromValue(0);
- fade.setToValue(1);
- fade.setCycleCount(1);
- fade.setDuration(Duration.seconds(1));
- fade.play();
- }
- }
- //////////////////////////CEO SEMAFOR ! ! !
- package semafor;
- import javafx.animation.FadeTransition;
- import javafx.application.Application;
- import javafx.scene.Scene;
- import javafx.scene.input.KeyCode;
- import javafx.scene.layout.Pane;
- import javafx.scene.paint.Color;
- import javafx.scene.shape.Circle;
- import javafx.scene.shape.Rectangle;
- import javafx.stage.Stage;
- import javafx.util.Duration;
- public class Semafor extends Application {
- @Override
- public void start(Stage primaryStage) {
- Pane p = new Pane();
- Rectangle prav = new Rectangle();
- Rectangle pole = new Rectangle();
- Circle circ = new Circle();
- Circle circ1 = new Circle();
- Circle circ2 = new Circle();
- circ.setVisible(false);
- circ1.setVisible(false);
- circ2.setVisible(false);
- circ.setRadius(50);
- circ1.setRadius(50);
- circ2.setRadius(50);
- circ.setFill(Color.RED);
- circ1.setFill(Color.YELLOW);
- circ2.setFill(Color.GREEN);
- circ.setLayoutX(250);
- circ.setLayoutY(135);
- circ1.setLayoutX(250);
- circ1.setLayoutY(250);
- circ2.setLayoutX(250);
- circ2.setLayoutY(365);
- pole.setWidth(15);
- pole.setHeight(100);
- pole.setLayoutX(242);
- pole.setLayoutY(425);
- pole.setFill(Color.BLACK);
- prav.setWidth(150);
- prav.setHeight(350);
- prav.setLayoutX(175);
- prav.setLayoutY(75);
- prav.setStrokeWidth(5);
- prav.setStroke(Color.BLACK);
- prav.setFill(Color.TRANSPARENT);
- p.getChildren().addAll(prav,circ,circ1,circ2,pole);
- Scene scena = new Scene(p,500,500);
- primaryStage.setScene(scena);
- primaryStage.setResizable(false);
- primaryStage.show();
- scena.setOnKeyPressed(e-> {
- if (e.getCode() == KeyCode.NUMPAD8) {
- circ.setVisible(true);
- circ1.setVisible(false);
- circ2.setVisible(false);
- animacija(circ);
- } else if (e.getCode() == KeyCode.NUMPAD5) {
- circ.setVisible(false);
- circ1.setVisible(true);
- circ2.setVisible(false);
- animacija(circ1);
- } else if (e.getCode() == KeyCode.NUMPAD2) {
- circ.setVisible(false);
- circ1.setVisible(false);
- circ2.setVisible(true);
- animacija(circ2);
- }
- });
- }
- public static void main(String[] args) {
- launch(args);
- }
- public void animacija(Circle krug){
- FadeTransition fade = new FadeTransition();
- fade.setNode(krug);
- fade.setAutoReverse(false);
- fade.setFromValue(0);
- fade.setToValue(1);
- fade.setCycleCount(1);
- fade.setDuration(Duration.seconds(1));
- fade.play();
- }
- }
- Daddy Roadhog shoves his big meat into your tight anus
- //////////////////////////// MEDIA PLAYER
- package media;
- import javafx.application.Application;
- import javafx.stage.Stage;
- import javafx.geometry.Pos;
- import javafx.scene.Scene;
- import javafx.scene.control.Button;
- import javafx.scene.control.Label;
- import javafx.scene.control.Slider;
- import javafx.scene.layout.BorderPane;
- import javafx.scene.layout.HBox;
- import javafx.scene.layout.Region;
- import javafx.scene.media.Media;
- import javafx.scene.media.MediaPlayer;
- import javafx.scene.media.MediaView;
- import javafx.util.Duration;
- public class Mediaa extends Application {
- private static final String MEDIA_URL
- = "http://cs.armstrong.edu/liang/common/sample.mp4";
- @Override // Override the start method in the Application class
- public void start(Stage primaryStage) {
- Media media = new Media(MEDIA_URL);
- MediaPlayer mediaPlayer = new MediaPlayer(media);
- MediaView mediaView = new MediaView(mediaPlayer);
- Button playButton = new Button(">");
- playButton.setOnAction(e -> {
- if (playButton.getText().equals(">")) {
- mediaPlayer.play();
- playButton.setText("||");
- } else {
- mediaPlayer.pause();
- playButton.setText(">");
- }
- });
- Button rewindButton = new Button("<<");
- rewindButton.setOnAction(e -> mediaPlayer.seek(Duration.ZERO));
- Slider slVolume = new Slider();
- slVolume.setPrefWidth(150);
- slVolume.setMaxWidth(Region.USE_PREF_SIZE);
- slVolume.setMinWidth(30);
- slVolume.setValue(50);
- mediaPlayer.volumeProperty().bind(
- slVolume.valueProperty().divide(100));
- HBox hBox = new HBox(10);
- hBox.setAlignment(Pos.CENTER);
- hBox.getChildren().addAll(playButton, rewindButton,
- new Label("Volume"), slVolume);
- BorderPane pane = new BorderPane();
- pane.setCenter(mediaView);
- pane.setBottom(hBox);
- // Create a scene and place it in the stage
- Scene scene = new Scene(pane, 650, 500);
- primaryStage.setTitle("MediaDemo"); // Set the stage title
- primaryStage.setScene(scene); // Place the scene in the stage
- primaryStage.show(); // Display the stage
- }
- /**
- * The main method is only needed for the IDE with limited JavaFX support.
- * Not needed for running from the command line.
- */
- public static void main(String[] args) {
- launch(args);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement