File tree Expand file tree Collapse file tree
Laboratorio/JavaFX/ConvertitoreValuta Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+
3+ <?import javafx .geometry.Insets?>
4+ <?import javafx .scene.control.Button?>
5+ <?import javafx .scene.control.Label?>
6+ <?import javafx .scene.control.TextField?>
7+ <?import javafx .scene.layout.HBox?>
8+ <?import javafx .scene.layout.VBox?>
9+
10+ <VBox alignment =" TOP_CENTER" prefHeight =" 320.0" prefWidth =" 550.0" spacing =" 20.0" style =" -fx-background-color: #0d0d0d;" xmlns =" http://javafx.com/javafx/25" xmlns : fx =" http://javafx.com/fxml/1" fx : controller =" ConvertitoreController" >
11+ <padding >
12+ <Insets bottom =" 25.0" left =" 25.0" right =" 25.0" top =" 25.0" />
13+ </padding >
14+ <children >
15+ <HBox alignment =" TOP_RIGHT" >
16+ <children >
17+ <Button fx : id =" btnExit1337" mnemonicParsing =" false" onAction =" #executeShutdown" text =" [X]" style =" -fx-background-color: #ff0000; -fx-text-fill: white;" />
18+ </children >
19+ </HBox >
20+ <HBox alignment =" CENTER" spacing =" 15.0" >
21+ <children >
22+ <Label minWidth =" 90.0" text =" EUR_INPUT:" style =" -fx-text-fill: #00ff00; -fx-font-family: 'Courier New';" />
23+ <TextField fx : id =" bufferEurozone" prefWidth =" 250.0" style =" -fx-background-color: #1a1a1a; -fx-text-fill: #00ff00; -fx-border-color: #00ff00;" />
24+ <Button fx : id =" hackEuroToDollar" mnemonicParsing =" false" onAction =" #pwn3dEuro" text =" >> USD" style =" -fx-background-color: #00ff00; -fx-text-fill: black;" />
25+ </children >
26+ </HBox >
27+ <HBox alignment =" CENTER" spacing =" 15.0" >
28+ <children >
29+ <Label minWidth =" 90.0" text =" USD_INPUT:" style =" -fx-text-fill: #00ff00; -fx-font-family: 'Courier New';" />
30+ <TextField fx : id =" bufferAmerica" prefWidth =" 250.0" style =" -fx-background-color: #1a1a1a; -fx-text-fill: #00ff00; -fx-border-color: #00ff00;" />
31+ <Button fx : id =" hackDollarToEuro" mnemonicParsing =" false" onAction =" #pwn3dDollar" text =" >> EUR" style =" -fx-background-color: #00ff00; -fx-text-fill: black;" />
32+ </children >
33+ </HBox >
34+ </children >
35+ </VBox >
Original file line number Diff line number Diff line change 1+ import javafx .event .ActionEvent ;
2+ import javafx .fxml .FXML ;
3+ import javafx .scene .control .Button ;
4+ import javafx .scene .control .TextField ;
5+
6+ public class ConvertitoreController {
7+
8+ @ FXML
9+ private Button btnExit1337 ;
10+
11+ @ FXML
12+ private Button hackDollarToEuro ;
13+
14+ @ FXML
15+ private Button hackEuroToDollar ;
16+
17+ @ FXML
18+ private TextField bufferAmerica ;
19+
20+ @ FXML
21+ private TextField bufferEurozone ;
22+
23+ private static final double EXPLOIT_RATE = 1.1 ;
24+
25+ @ FXML
26+ void executeShutdown (ActionEvent event ) {
27+ System .exit (0 );
28+ }
29+
30+ @ FXML
31+ void pwn3dDollar (ActionEvent event ) {
32+ String payloadInput = bufferAmerica .getText ();
33+ double rawData = Double .parseDouble (payloadInput );
34+ double crackedValue = rawData * EXPLOIT_RATE ;
35+ bufferEurozone .setText (String .format ("%.2f" , crackedValue ));
36+ }
37+
38+ @ FXML
39+ void pwn3dEuro (ActionEvent event ) {
40+ String payloadInput = bufferEurozone .getText ();
41+ double rawData = Double .parseDouble (payloadInput );
42+ double crackedValue = rawData / EXPLOIT_RATE ;
43+ bufferAmerica .setText (String .format ("%.2f" , crackedValue ));
44+ }
45+
46+ }
Original file line number Diff line number Diff line change 1+ import javafx .application .Application ;
2+ import javafx .fxml .FXMLLoader ;
3+ import javafx .scene .Parent ;
4+ import javafx .scene .Scene ;
5+ import javafx .stage .Stage ;
6+
7+ public class convertitoreFXML extends Application {
8+
9+ @ Override
10+ public void start (Stage terminal ) throws Exception {
11+ Parent rootAccess = FXMLLoader .load (getClass ().getResource ("Convertitore.fxml" ));
12+ terminal .setTitle ("CryptoConverter v1.337" );
13+ terminal .setScene (new Scene (rootAccess , 550 , 320 ));
14+ terminal .show ();
15+ }
16+
17+ public static void main (String [] args ) {
18+ Application .launch (convertitoreFXML .class , args );
19+ }
20+ }
You can’t perform that action at this time.
0 commit comments