Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2015
    Posts
    2
    Rep Power
    0

    Default A few basic JavaFX questions - any help would be really appreciated!

    Hi all, i'm a beginner programmer and I had a few basic questions about some JavaFX code i'm writing (trying but hit a wall)

    Javaprogrammer1996's Pastebin - Pastebin.com

    - The program is a formula, where the user inputs the doubles and the code calculates the output
    - I started by writing a program which runs in Eclipse, this is MainController.java
    - I then followed some cave of programming tutorials on JavaFX to create Interface.java (structure of the GUI) and then Main.fxml to design the program on Scenebuilder
    - I am at the point now where I am trying to get the user input from the text boxes on my GUI, for use in the formula

    Any help/guidance on how I can do this would be really appreciated, thankyou

    I have attached a screenshot of my GUI
    Attached Thumbnails Attached Thumbnails A few basic JavaFX questions - any help would be really appreciated!-gui.png  

  2. #2
    Join Date
    Sep 2015
    Posts
    2
    Rep Power
    0

    Default Re: A few basic JavaFX questions - any help would be really appreciated!

    Just realized that its not very clear, the programme is aimed to give one output value for the numbers entered, so a box will pop up or something after doing the calculation with the numbers entered by the user.

    The user will enter all the values on the left of the image, and then a box will appear showing the output

    any help would be really really appreciated, thanks :)

  3. #3
    benji2505 is offline Senior Member
    Join Date
    Sep 2014
    Location
    MA, USA
    Posts
    398
    Rep Power
    5

    Default Re: A few basic JavaFX questions - any help would be really appreciated!

    You have to add an event listener to your button that triggers a readout of the values of the textfields and then calls a method that calculates. The syntax in the javafx API follows the javabeans system, so it should look similar to:

    Button yourButton = new Button();
    yourButton.setOnAction(e -> {
    // readout all fields
    // do the calculation
    // spid out the result
    })

    The readout should work with the .getText() method (+ conversion to double), for the popup window you will have to instantiate a new stage.
    Last edited by benji2505; 09-09-2015 at 02:10 AM.

Similar Threads

  1. Basic Questions
    By jmohandos304 in forum New To Java
    Replies: 13
    Last Post: 04-30-2014, 03:14 PM
  2. Basic GUI questions
    By sunde887 in forum New To Java
    Replies: 6
    Last Post: 02-11-2011, 06:11 PM
  3. VERY basic Java questions
    By hayden06f4i in forum New To Java
    Replies: 6
    Last Post: 11-10-2010, 08:09 PM
  4. Replies: 6
    Last Post: 09-26-2010, 02:25 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •