Fengbin: JavaFX Instance (10) "Controlcirclewithouteventhandling"

Source: Internet
Author: User

The example (10) and the instance (11) Describe how to add an event handle to the button, and the instance (10) is the effect before the handle is added, and the instance (11) is the effect after the handle is added.

This example code is as follows:

Import javafx.application.Application;

Import Javafx.geometry.Pos;

Import Javafx.scene.Scene;

Import Javafx.scene.control.Button;

Import Javafx.scene.layout.StackPane;

Import Javafx.scene.layout.HBox;

Import Javafx.scene.layout.BorderPane;

Import Javafx.scene.paint.Color;

Import javafx.scene.shape.Circle;

Import Javafx.stage.Stage;

public class Controlcirclewithouteventhandling extends application {

@Override//Override The Start method in the Application class

public void Start (Stage primarystage) {

Stackpane pane = new Stackpane ();

Circle circle = New Circle (50);

Circle.setstroke (Color.Black);

Circle.setfill (Color.White);

Pane.getchildren (). Add (circle);

HBox HBox = new HBox ();

Hbox.setspacing (10);

Hbox.setalignment (Pos.center);

Button Btenlarge = New button ("enlarge");

Button Btshrink = New button ("Shrink");

Hbox.getchildren (). Add (Btenlarge);

Hbox.getchildren (). Add (Btshrink);

Borderpane Borderpane = new Borderpane ();

Borderpane.setcenter (pane);

Borderpane.setbottom (HBox);

Borderpane.setalignment (HBox, Pos.center);

Scene scene = new Scene (borderpane,200,150);

Primarystage.settitle ("controlcircle");

Primarystage.setscene (Scene);

Primarystage.show ();

}

}

The results of the operation are as follows:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/4E/37/wKiom1RgUZmydNjIAACN4sF5bxg340.jpg "title=" Picture 1.png "alt=" Wkiom1rguzmydnjiaacn4sf5bxg340.jpg "/>

This article is from the "Fengbin Technology blog" blog, make sure to keep this source http://fengbin8606.blog.51cto.com/8840305/1574982

Fengbin: JavaFX Instance (10) "Controlcirclewithouteventhandling"

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.