Java Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingJava Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old March 19th, 2018, 11:35 AM
bebexx bebexx is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2018
Posts: 1 bebexx User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 40 sec
Reputation Power: 0
Exclamation Redraw Circle in JavaFX

Hello all,

I need to have a circle automatically re-draw itself when a user enters in a radius value.

The code compiles(No Syntax errors) but shows nothing:

Code:
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import javafx.scene.control.TextField;
import javafx.geometry.Pos;
import javafx.scene.text.Font;
import javafx.scene.shape.*;
import javafx.scene.Group;
import javafx.scene.control.Label;
import javafx.scene.layout.GridPane;
import javafx.geometry.HPos;
import java.util.Scanner;

public class PP4o15 extends Application {
    private Label result;
    private TextField input;
  
    public void start(Stage primaryStage) {
        int r;
        double pi= 3.14, area;
        Circle circle= new Circle(100,65,20);
        circle.setFill(null);
       
        
        Scanner q = new Scanner(System.in);
        r=q.nextInt();
        //Pi Method
        area=pi*r*r;
       
   
        Font font= new Font(18);
        input= new TextField();
        //Changed Font below
        input.setFont(new Font("Arial",30));
        input.setPrefWidth(50);
        input.setAlignment(Pos.CENTER);
        
        //Stacking input TextField ontop of circle
        //StackPane pane= new StackPane(circle);
        //pane.getChildren().addAll(circle,input);
        
        Group root= new Group(circle);
        Scene scene= new Scene(root,400,200);
        
        result = new Label("");
        result.setFont(font);
        GridPane.setHalignment(result,HPos.CENTER);
        
        primaryStage.setTitle("Enter in Radius");
        primaryStage.setScene(scene);
        primaryStage.show();
    }
    //Create method that has return
    public void processReturn(ActionEvent event)
    {
       //Method to process return
        input.setOnAction(this::processReturn); 
    }
}

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJava Development > Redraw Circle in JavaFX


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap