Skip to content

Instantly share code, notes, and snippets.

@sebolio
Last active September 1, 2015 06:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sebolio/21c608076d03c11f5232 to your computer and use it in GitHub Desktop.
Save sebolio/21c608076d03c11f5232 to your computer and use it in GitHub Desktop.
el juego de la verda
package sample;
import javafx.scene.control.Button;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import java.util.Random;
public class Controller {
public Button nop;
public Button sipi;
public WebView popo;
public WebEngine web;
public void initialize() {
System.out.println("toy in");
web = popo.getEngine();
web.load("http://seb.cl");
}
public void dentro() {
nop.setLayoutX((new Random()).nextInt(480));
nop.setLayoutY((new Random()).nextInt(180));
}
}
package sample;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class Main extends Application {
@Override
public void start(Stage primaryStage) throws Exception{
Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
primaryStage.setTitle("El juego de la verdá");
primaryStage.setScene(new Scene(root));
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.*?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.text.*?>
<?import javafx.scene.web.*?>
<AnchorPane prefHeight="327.0" prefWidth="503.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/2.2" fx:controller="sample.Controller">
<children>
<Text layoutX="185.0" layoutY="49.0" scaleX="2.0266173748347347" scaleY="2.3157266965811343" strokeType="OUTSIDE" strokeWidth="0.0" text="Te gusta el pico?" />
<Button fx:id="sipi" layoutX="92.0" layoutY="108.0" mnemonicParsing="false" prefHeight="29.0" prefWidth="109.0" text="Sipo" />
<Button fx:id="nop" layoutX="313.0" layoutY="108.0" mnemonicParsing="false" onMouseEntered="#dentro" prefHeight="29.0" prefWidth="109.0" text="No poh weon" />
<WebView fx:id="popo" layoutX="64.0" layoutY="160.0" prefHeight="111.0" prefWidth="321.0" />
</children>
</AnchorPane>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment