Windows typing game--Feature selection

Source: Internet
Author: User

Mainface class is mainly implemented after the login game function selection interface.

Import javafx.application.Application;

Import Javafx.event.EventHandler;

Import Javafx.scene.Cursor;

Import Javafx.scene.Scene;

Import Javafx.scene.image.Image;

Import Javafx.scene.image.ImageView;

Import javafx.scene.input.MouseEvent;

Import Javafx.scene.layout.Pane;

Import Javafx.stage.Stage;

Import javafx.stage.WindowEvent;

public class Mainface extends application{

Private Image Background=new image ("background.jpg");

Private image Bong2=new Image ("Bong2.png");

Private image Bong3=new Image ("Bong3.png");

Private image Char_bg=new Image ("Char_bg.png");

Private image Head=new Image ("Head.png");

Private image S_head=new Image ("Smallhead.png");

Private image Choice1=new Image ("Choice1.png");

Private image Choice2=new Image ("Choice2.png");

Private image Choice3=new Image ("Choice3.png");

public void Start (Stage primarystage) {

ImageView img_bg=new ImageView (background);

ImageView img_ch1_bg=new ImageView (bong2);

ImageView img_ch2_bg=new ImageView (bong2);

ImageView img_ch3_bg=new ImageView (bong2);

ImageView img_head1=new ImageView (BONG3);

ImageView img_head2=new ImageView (BONG3);

ImageView img_head3=new ImageView (BONG3);

ImageView img_head4=new ImageView (BONG3);

ImageView img_head=new ImageView (head);

ImageView img_s_head=new ImageView (s_head);

ImageView img_choice1=new ImageView (Choice1);

ImageView img_choice2=new ImageView (CHOICE2);

ImageView img_choice3=new ImageView (CHOICE3);

Img_bg.setfitwidth (600);

Img_bg.setfitheight (400);

Img_choice1.setx (270);

Img_choice1.sety (205);

Img_choice2.setx (270);

Img_choice2.sety (265);

Img_choice3.setx (270);

Img_choice3.sety (325);

Img_head.setx (150);

Img_head.sety (98);

Img_s_head.setx (215);

Img_s_head.sety (38);

IMG_HEAD1.SETX (140);

Img_head1.sety (88);

Img_head2.setx (222);

Img_head2.sety (88);

Img_head3.setx (304);

Img_head3.sety (88);

IMG_HEAD4.SETX (386);

Img_head4.sety (88);

IMG_CH1_BG.SETX (260);

Img_ch1_bg.sety (180);

IMG_CH2_BG.SETX (260);

Img_ch2_bg.sety (240);

IMG_CH3_BG.SETX (260);

Img_ch3_bg.sety (300);

Img_choice1.setcursor (Cursor.hand);

img_choice1.setonmouseclicked (New eventhandler<mouseevent> () {

public void handle (MouseEvent e) {

Gameface.run ();

}

});

Img_choice2.setcursor (Cursor.hand);

img_choice2.setonmouseclicked (New eventhandler<mouseevent> () {

public void handle (MouseEvent e) {

Listface.run ();

}

});

Img_choice3.setcursor (Cursor.hand);

img_choice3.setonmouseclicked (New eventhandler<mouseevent> () {

public void handle (MouseEvent e) {

New Loginface (). Start (New Stage ());

Primarystage.close ();

}

});

Img_ch1_bg.setcursor (Cursor.hand);

img_ch1_bg.setonmouseclicked (New eventhandler<mouseevent> () {

public void handle (MouseEvent e) {

Gameface.run ();

}

});

Img_ch2_bg.setcursor (Cursor.hand);

img_ch2_bg.setonmouseclicked (New eventhandler<mouseevent> () {

public void handle (MouseEvent e) {

Listface.run ();

}

});

Img_ch3_bg.setcursor (Cursor.hand);

img_ch3_bg.setonmouseclicked (New eventhandler<mouseevent> () {

public void handle (MouseEvent e) {

New Loginface (). Start (New Stage ());

Primarystage.close ();

}

});

    Pane pane=new Pane ();

Pane.getchildren (). AddAll (Img_bg,img_head1,img_head2,img_head3,img_head4,img_ch1_bg,img_ch2_bg,img_ch3_bg,img_ HEAD,IMG_S_HEAD,IMG_CHOICE1,IMG_CHOICE2,IMG_CHOICE3);

Scene scene=new scene (pane,600,400);

    Primarystage.settitle ("Sniper tank (case-insensitive version)");

Primarystage.setwidth (600);

Primarystage.setheight (400);

Primarystage.setresizable (FALSE);

Primarystage.geticons (). Add (CHAR_BG);

Primarystage.setscene (Scene);

Primarystage.setoncloserequest (New eventhandler<windowevent> () {

public void handle (WindowEvent e) {

System.exit (0);

}

});

Primarystage.show ();

}

}

Windows typing game--Feature selection

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.