NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

import com.almasb.fxgl.app.scene.FXGLMenu;
import com.almasb.fxgl.app.scene.MenuType;
import com.almasb.fxgl.dsl.FXGL;
import com.almasb.fxgl.texture.Texture;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.image.Image;
import javafx.scene.layout.*;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.stage.Stage;

import java.awt.*;
import java.util.Locale;
import java.util.Stack;

public class MyMenu extends FXGLMenu {
public MyMenu(MenuType type) {
super(type);

int screenWidth = 1280;
int screenHeight = 720;

Texture background = FXGL.texture("background/wallpaper.jpg");
background.setFitHeight(getAppHeight());
background.setFitWidth(getAppWidth());

var sign = createActionTexture("mainMenu/wood_sign", 900, 350, 400, 350, "sign");
var textSign = createTextView("Super Mario", 1030, 430, 25, Color.web("#79470f"));
var textGroep = createTextView("Groep Nr 6", 1050, 540, 20, Color.web("#79470f"));
var startButton = createActionTexture("mainMenu/button", 65, 300, 300, 80, "start");
var startText = createTextView("Start", 150, 315, 30, Color.web("#79470f"));
var exitButton = createActionTexture("mainMenu/button", 65, 400, 300, 80, "exit");
var exitText = createTextView("Exit", 140, 415, 30, Color.web("#79470f"));
// var uitlogButton = createActionTexture("mainMenu/button", 65, 500, 300, 80, "uitloggen");
var uitlogText = createTextView("Loguit", 150, 515, 30, Color.web("#79470f"));

var usernameText = createTextView("Gebruikersnaam:", 390, 175, 30, Color.web("#af5e24"));
var usernameEditText = createEditText(385,240,500,80,26);
var passwordText = createTextView("Wachtwoord:", 390, 340, 30, Color.web("#af5e24"));
var passwordEditText = createEditText(385,405,500,80,26);
// var loginButton = createActionTexture("mainMenu/loginButton",485,550,350,80, "login");

Texture texture = FXGL.texture("mainMenu/loginButton.png");
Texture uitloggen = FXGL.texture("mainMenu/button.png");
uitloggen.setId("uitloggen");
uitloggen.setTranslateX(65);
uitloggen.setTranslateY(500);
uitloggen.setFitWidth(300);
uitloggen.setFitHeight(80);
uitloggen.setOnMouseClicked(e -> {
getContentRoot().getChildren().removeAll(background, sign, textSign, textGroep, startButton, startText, uitloggen, uitlogText, exitButton, exitText);
getContentRoot().getChildren().addAll(background, usernameText,usernameEditText,passwordText,passwordEditText, texture);
usernameEditText.setText("");
passwordEditText.setText("");

});
uitloggen.setOnMouseEntered(e -> buttonHoverTrue(uitloggen, 65, 500, 300, 80, "mainMenu/button_effected.png"));
uitloggen.setOnMouseExited(e -> buttonHoverFalse(uitloggen, 65, 500, 300, 80, "mainMenu/button.png"));



texture.setId("login");
texture.setTranslateX(485);
texture.setTranslateY(550);
texture.setFitWidth(350);
texture.setFitHeight(80);
texture.setOnMouseClicked(e -> {
if (usernameEditText.getText().toLowerCase(Locale.ROOT).equals("ipose") && passwordEditText.getText().toLowerCase(Locale.ROOT).equals("groep6")){

getContentRoot().getChildren().removeAll(background, usernameText,usernameEditText,passwordText,passwordEditText, texture);
getContentRoot().getChildren().addAll(background, sign, textSign, textGroep, startButton, startText, uitloggen, uitlogText, exitButton, exitText);

}else {
getContentRoot().getChildren().addAll(createTextView("Login Failed use (username:ipose), (password:groep6)",250,100,25,Color.RED));
}
});
texture.setOnMouseEntered(e -> buttonHoverTrue(texture, 485, 550, 350, 80, "mainMenu/loginButton_effected.png"));
texture.setOnMouseExited(e -> buttonHoverFalse(texture, 485, 550, 350, 80, "mainMenu/loginButton.png"));


// loginButton = createActionTexture("mainMenu/loginButton",485,550,350,80, "login", usernameEditText.getText(),passwordEditText.getText(), loginButton);
getContentRoot().getChildren().addAll(background, usernameText,usernameEditText,passwordText,passwordEditText, texture);
// getContentRoot().getChildren().addAll(background, sign, textSign, textGroep, startButton, startText, optionButton, optionText, exitButton, exitText);




}

protected final Texture createActionTexture(String url, int x, int y, int w, int h, String id) {
Texture texture = FXGL.texture(url+".png");
texture.setId(id);
texture.setTranslateX(x);
texture.setTranslateY(y);
texture.setFitWidth(w);
texture.setFitHeight(h);
texture.setOnMouseClicked(e -> buttonClicked(texture));
texture.setOnMouseEntered(e -> buttonHoverTrue(texture, x, y, w, h, url+"_effected.png"));
texture.setOnMouseExited(e -> buttonHoverFalse(texture, x, y, w, h, url+".png"));
return texture;
}


public void buttonClicked(Texture texture){
if (texture.getId().equals("start")){
fireNewGame();
}else if (texture.getId().equals("option")){

}else if (texture.getId().equals("exit")){
fireExit();
}
}


public void buttonClicked(Texture texture, String username, String password, VBox login, VBox menu){
if (texture.getId().equals("start")){
fireNewGame();
}else if (texture.getId().equals("option")){

}else if (texture.getId().equals("exit")){
fireExit();
}
}


public void buttonHoverTrue(Texture texture, int x, int y, int w, int h, String url) {
texture.set(FXGL.texture(url));
texture.setTranslateX(x);
texture.setTranslateY(y);
texture.setFitWidth(w + 2);
texture.setFitHeight(h + 2);
}


public void buttonHoverFalse(Texture texture, int x, int y, int w, int h, String url) {
texture.set(FXGL.texture(url));
texture.setTranslateX(x);
texture.setTranslateY(y);
texture.setFitWidth(w);
texture.setFitHeight(h);
}

protected final Label createTextView(String txt, int x, int y, int fontSize, Color color) {
Label myText = new Label(txt);
myText.setTranslateX(x);
myText.setTranslateY(y);
myText.setTextFill(color);
myText.setFont(Font.loadFont(getClass().getResourceAsStream("RubikWetPaint-Regular.ttf"), fontSize));
myText.setOnMouseEntered(e -> textHoverTrue(myText));
myText.setOnMouseExited(e -> textHoverFalse(myText));
myText.setId("text");
return myText;
}

public void textHoverTrue(Label mytext) {
mytext.setTextFill(Color.web("#ffda45"));
}

public void textHoverFalse(Label mytext) {
mytext.setTextFill(Color.web("#af5e24"));
}


protected final TextField createEditText(int x, int y, int w, int h, int fontSize) {
TextField textField = new TextField();
textField.setTranslateX(x);
textField.setTranslateY(y);
textField.setMinWidth(w);
textField.setMinHeight(h);
textField.setMaxWidth(w);
textField.setMaxHeight(h);
textField.setFont(Font.loadFont(getClass().getResourceAsStream("RubikWetPaint-Regular.ttf"), fontSize));
textField.setAlignment(Pos.CENTER);
return textField;
}
}

     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.