java fx

java fx

compute the factorial of a number entered in one text field by pressing the compute button and output displayed in another text field in javafx
View Answers

August 11, 2010 at 4:31 PM

Hi Friend,

We have created an example in swing. Here is the code:

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

class FactorialExample extends JFrame{
JTextField t1,t2;
FactorialExample(){
JLabel l1=new JLabel("Enter Number: ");
JLabel l2=new JLabel("Factorial of Input Number: ");
t1=new JTextField(20);
t2=new JTextField(20);
JPanel p=new JPanel(new GridLayout(3,2));
JButton b=new JButton("Find");
b.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
String number=t1.getText();
int num=Integer.parseInt(number);
long fac=num;
for(int i=num;i>1;i--)
{
fac=fac*(i-1);
}
t2.setText(Long.toString(fac));

}
});
p.add(l1);
p.add(t1);
p.add(l2);
p.add(t2);
p.add(b);
add(p);
setVisible(true);
pack();
}
public static void main(String[] args) {
FactorialExample f=new FactorialExample();
}
}

Thanks









Related Tutorials/Questions & Answers:
What is Java FX?
What is Java FX? The JavaFX technology is yet another set of technologies... technology can be used to develop applications for mobile devices. Java FX?s promises Java FX technology can be used to create highly interactive
java fx - Java Interview Questions
java fx  compute the factorial of a number entered in one text field by pressing the compute button and output displayed in another text field in javafx  Hi Friend, We have created an example in swing. Here
Advertisements
converting java class to java fx class
converting java class to java fx class   i am working on a java project which would convert text to speech and speech to text. i have developed a java file that would work for text to speech. it is working fine as a .java file
Maven dependency for com.dua3.fx - fx-util version 0.17-BETA24 is released. Learn to use fx-util version 0.17-BETA24 in Maven based Java projects
this version ( com.dua3.fx - fx-util version 0.17-BETA24 ) in their Java project... and includes  com.dua3.fx - fx-util version 0.17-BETA24 java library in your...Maven dependency for  com.dua3.fx  - Version 0.17-BETA24 of fx-util
Maven dependency for com.dua3.fx - fx-icons version 0.17-BETA25 is released. Learn to use fx-icons version 0.17-BETA25 in Maven based Java projects
this version ( com.dua3.fx - fx-icons version 0.17-BETA25 ) in their Java project... and includes  com.dua3.fx - fx-icons version 0.17-BETA25 java library...Maven dependency for  com.dua3.fx  - Version 0.17-BETA25 of fx-icons
Maven dependency for com.dua3.fx - fx-util version 0.17-BETA26 is released. Learn to use fx-util version 0.17-BETA26 in Maven based Java projects
this version ( com.dua3.fx - fx-util version 0.17-BETA26 ) in their Java project... and includes  com.dua3.fx - fx-util version 0.17-BETA26 java library in your...Maven dependency for  com.dua3.fx  - Version 0.17-BETA26 of fx-util
Maven dependency for com.dua3.fx - fx-icons version 0.17-BETA17 is released. Learn to use fx-icons version 0.17-BETA17 in Maven based Java projects
this version ( com.dua3.fx - fx-icons version 0.17-BETA17 ) in their Java project... and includes  com.dua3.fx - fx-icons version 0.17-BETA17 java library...Maven dependency for  com.dua3.fx  - Version 0.17-BETA17 of fx-icons
Maven dependency for com.dua3.fx - fx-util version 0.17-BETA22 is released. Learn to use fx-util version 0.17-BETA22 in Maven based Java projects
this version ( com.dua3.fx - fx-util version 0.17-BETA22 ) in their Java project... and includes  com.dua3.fx - fx-util version 0.17-BETA22 java library in your...Maven dependency for  com.dua3.fx  - Version 0.17-BETA22 of fx-util
Maven dependency for com.dua3.fx - fx-icons version 0.17-BETA23.1 is released. Learn to use fx-icons version 0.17-BETA23.1 in Maven based Java projects
this version ( com.dua3.fx - fx-icons version 0.17-BETA23.1 ) in their Java...Maven dependency for  com.dua3.fx  - Version 0.17-BETA23.1 of fx-icons released The developers of   com.dua3.fx - fx-icons project have
Maven dependency for com.dua3.fx - fx-icons version 0.17-BETA21 is released. Learn to use fx-icons version 0.17-BETA21 in Maven based Java projects
this version ( com.dua3.fx - fx-icons version 0.17-BETA21 ) in their Java project... and includes  com.dua3.fx - fx-icons version 0.17-BETA21 java library...Maven dependency for  com.dua3.fx  - Version 0.17-BETA21 of fx-icons
Maven dependency for com.dua3.fx - fx-util version 0.17-BETA18 is released. Learn to use fx-util version 0.17-BETA18 in Maven based Java projects
this version ( com.dua3.fx - fx-util version 0.17-BETA18 ) in their Java project... and includes  com.dua3.fx - fx-util version 0.17-BETA18 java library in your...Maven dependency for  com.dua3.fx  - Version 0.17-BETA18 of fx-util
Maven dependency for com.dua3.fx - fx-util version 0.21.1 is released. Learn to use fx-util version 0.21.1 in Maven based Java projects
( com.dua3.fx - fx-util version 0.21.1 ) in their Java project if it is based...? Steps to use  com.dua3.fx - fx-util version 0.21.1 in Java projects...Maven dependency for  com.dua3.fx  - Version 0.21.1 of fx-util
Maven dependency for com.dua3.fx - fx-util version 0.17.0-RC8 is released. Learn to use fx-util version 0.17.0-RC8 in Maven based Java projects
this version ( com.dua3.fx - fx-util version 0.17.0-RC8 ) in their Java project... and includes  com.dua3.fx - fx-util version 0.17.0-RC8 java library in your project...Maven dependency for  com.dua3.fx  - Version 0.17.0-RC8 of fx-util
Maven dependency for com.dua3.fx - fx-util version 0.17-BETA11 is released. Learn to use fx-util version 0.17-BETA11 in Maven based Java projects
this version ( com.dua3.fx - fx-util version 0.17-BETA11 ) in their Java project... and includes  com.dua3.fx - fx-util version 0.17-BETA11 java library in your...Maven dependency for  com.dua3.fx  - Version 0.17-BETA11 of fx-util
Maven dependency for com.dua3.fx - fx-icons version 0.17-BETA11 is released. Learn to use fx-icons version 0.17-BETA11 in Maven based Java projects
this version ( com.dua3.fx - fx-icons version 0.17-BETA11 ) in their Java project... and includes  com.dua3.fx - fx-icons version 0.17-BETA11 java library...Maven dependency for  com.dua3.fx  - Version 0.17-BETA11 of fx-icons
Maven dependency for com.dua3.fx - fx-util version 0.18.1 is released. Learn to use fx-util version 0.18.1 in Maven based Java projects
( com.dua3.fx - fx-util version 0.18.1 ) in their Java project if it is based...? Steps to use  com.dua3.fx - fx-util version 0.18.1 in Java projects...Maven dependency for  com.dua3.fx  - Version 0.18.1 of fx-util
Maven dependency for com.dua3.fx - fx-icons version 0.18.0-RC1 is released. Learn to use fx-icons version 0.18.0-RC1 in Maven based Java projects
this version ( com.dua3.fx - fx-icons version 0.18.0-RC1 ) in their Java project... and includes  com.dua3.fx - fx-icons version 0.18.0-RC1 java library in your...Maven dependency for  com.dua3.fx  - Version 0.18.0-RC1 of fx-icons
Maven dependency for com.dua3.fx - fx-icons version 0.17-BETA10 is released. Learn to use fx-icons version 0.17-BETA10 in Maven based Java projects
this version ( com.dua3.fx - fx-icons version 0.17-BETA10 ) in their Java project... and includes  com.dua3.fx - fx-icons version 0.17-BETA10 java library...Maven dependency for  com.dua3.fx  - Version 0.17-BETA10 of fx-icons
Maven dependency for com.dua3.fx - fx-icons version 0.17-BETA9 is released. Learn to use fx-icons version 0.17-BETA9 in Maven based Java projects
this version ( com.dua3.fx - fx-icons version 0.17-BETA9 ) in their Java project... and includes  com.dua3.fx - fx-icons version 0.17-BETA9 java library in your...Maven dependency for  com.dua3.fx  - Version 0.17-BETA9 of fx-icons
Maven dependency for com.dua3.fx - fx-util version 0.17-BETA8 is released. Learn to use fx-util version 0.17-BETA8 in Maven based Java projects
this version ( com.dua3.fx - fx-util version 0.17-BETA8 ) in their Java project... and includes  com.dua3.fx - fx-util version 0.17-BETA8 java library in your project...Maven dependency for  com.dua3.fx  - Version 0.17-BETA8 of fx-util
Maven dependency for com.dua3.fx - fx-util version 0.17-BETA4 is released. Learn to use fx-util version 0.17-BETA4 in Maven based Java projects
this version ( com.dua3.fx - fx-util version 0.17-BETA4 ) in their Java project... and includes  com.dua3.fx - fx-util version 0.17-BETA4 java library in your project...Maven dependency for  com.dua3.fx  - Version 0.17-BETA4 of fx-util
Maven dependency for com.dua3.fx - fx-util version 0.17.0-RC5 is released. Learn to use fx-util version 0.17.0-RC5 in Maven based Java projects
this version ( com.dua3.fx - fx-util version 0.17.0-RC5 ) in their Java project... and includes  com.dua3.fx - fx-util version 0.17.0-RC5 java library in your project...Maven dependency for  com.dua3.fx  - Version 0.17.0-RC5 of fx-util
Maven dependency for com.dua3.fx - fx-icons version 0.17.0-RC2 is released. Learn to use fx-icons version 0.17.0-RC2 in Maven based Java projects
this version ( com.dua3.fx - fx-icons version 0.17.0-RC2 ) in their Java project... and includes  com.dua3.fx - fx-icons version 0.17.0-RC2 java library in your...Maven dependency for  com.dua3.fx  - Version 0.17.0-RC2 of fx-icons
Maven dependency for com.dua3.fx - fx-util version 0.17.0-RC6.1 is released. Learn to use fx-util version 0.17.0-RC6.1 in Maven based Java projects
this version ( com.dua3.fx - fx-util version 0.17.0-RC6.1 ) in their Java project... and includes  com.dua3.fx - fx-util version 0.17.0-RC6.1 java library...Maven dependency for  com.dua3.fx  - Version 0.17.0-RC6.1 of fx-util
Maven dependency for com.dua3.fx - fx-icons version 0.17-BETA1 is released. Learn to use fx-icons version 0.17-BETA1 in Maven based Java projects
this version ( com.dua3.fx - fx-icons version 0.17-BETA1 ) in their Java project... and includes  com.dua3.fx - fx-icons version 0.17-BETA1 java library in your...Maven dependency for  com.dua3.fx  - Version 0.17-BETA1 of fx-icons
Maven dependency for com.dua3.fx - fx-icons version 0.15 is released. Learn to use fx-icons version 0.15 in Maven based Java projects
( com.dua3.fx - fx-icons version 0.15 ) in their Java project if it is based on Maven...? Steps to use  com.dua3.fx - fx-icons version 0.15 in Java projects. Follow...Maven dependency for  com.dua3.fx  - Version 0.15 of fx-icons
Maven dependency for com.dua3.fx - fx-util version 0.15-beta13 is released. Learn to use fx-util version 0.15-beta13 in Maven based Java projects
this version ( com.dua3.fx - fx-util version 0.15-beta13 ) in their Java project... and includes  com.dua3.fx - fx-util version 0.15-beta13 java library in your...Maven dependency for  com.dua3.fx  - Version 0.15-beta13 of fx-util
Maven dependency for com.dua3.fx - fx-icons version 0.15-beta13 is released. Learn to use fx-icons version 0.15-beta13 in Maven based Java projects
this version ( com.dua3.fx - fx-icons version 0.15-beta13 ) in their Java project... and includes  com.dua3.fx - fx-icons version 0.15-beta13 java library...Maven dependency for  com.dua3.fx  - Version 0.15-beta13 of fx-icons
Maven dependency for com.dua3.fx - fx-util version 0.15-beta8 is released. Learn to use fx-util version 0.15-beta8 in Maven based Java projects
this version ( com.dua3.fx - fx-util version 0.15-beta8 ) in their Java project... and includes  com.dua3.fx - fx-util version 0.15-beta8 java library in your project...Maven dependency for  com.dua3.fx  - Version 0.15-beta8 of fx-util
Maven dependency for com.dua3.fx - fx-icons version 0.15-beta8 is released. Learn to use fx-icons version 0.15-beta8 in Maven based Java projects
this version ( com.dua3.fx - fx-icons version 0.15-beta8 ) in their Java project... and includes  com.dua3.fx - fx-icons version 0.15-beta8 java library in your...Maven dependency for  com.dua3.fx  - Version 0.15-beta8 of fx-icons
Maven dependency for com.dua3.fx - fx-icons version 0.17-BETA24 is released. Learn to use fx-icons version 0.17-BETA24 in Maven based Java projects
this version ( com.dua3.fx - fx-icons version 0.17-BETA24 ) in their Java project... and includes  com.dua3.fx - fx-icons version 0.17-BETA24 java library...Maven dependency for  com.dua3.fx  - Version 0.17-BETA24 of fx-icons
Maven dependency for com.dua3.fx - fx-icons version 0.17-BETA24.1 is released. Learn to use fx-icons version 0.17-BETA24.1 in Maven based Java projects
this version ( com.dua3.fx - fx-icons version 0.17-BETA24.1 ) in their Java...Maven dependency for  com.dua3.fx  - Version 0.17-BETA24.1 of fx-icons released The developers of   com.dua3.fx - fx-icons project have
Maven dependency for com.dua3.fx - fx-util version 0.17-BETA24.1 is released. Learn to use fx-util version 0.17-BETA24.1 in Maven based Java projects
this version ( com.dua3.fx - fx-util version 0.17-BETA24.1 ) in their Java project... that downloads and includes  com.dua3.fx - fx-util version 0.17-BETA24.1 java...Maven dependency for  com.dua3.fx  - Version 0.17-BETA24.1 of fx
Maven dependency for com.dua3.fx - fx-icons version 0.17-BETA26 is released. Learn to use fx-icons version 0.17-BETA26 in Maven based Java projects
this version ( com.dua3.fx - fx-icons version 0.17-BETA26 ) in their Java project... and includes  com.dua3.fx - fx-icons version 0.17-BETA26 java library...Maven dependency for  com.dua3.fx  - Version 0.17-BETA26 of fx-icons
Maven dependency for com.dua3.fx - fx-util version 0.17-BETA25 is released. Learn to use fx-util version 0.17-BETA25 in Maven based Java projects
this version ( com.dua3.fx - fx-util version 0.17-BETA25 ) in their Java project... and includes  com.dua3.fx - fx-util version 0.17-BETA25 java library in your...Maven dependency for  com.dua3.fx  - Version 0.17-BETA25 of fx-util
Maven dependency for com.dua3.fx - fx-icons version 0.17-BETA27 is released. Learn to use fx-icons version 0.17-BETA27 in Maven based Java projects
this version ( com.dua3.fx - fx-icons version 0.17-BETA27 ) in their Java project... and includes  com.dua3.fx - fx-icons version 0.17-BETA27 java library...Maven dependency for  com.dua3.fx  - Version 0.17-BETA27 of fx-icons
Maven dependency for com.dua3.fx - fx-util version 0.17-BETA27 is released. Learn to use fx-util version 0.17-BETA27 in Maven based Java projects
this version ( com.dua3.fx - fx-util version 0.17-BETA27 ) in their Java project... and includes  com.dua3.fx - fx-util version 0.17-BETA27 java library in your...Maven dependency for  com.dua3.fx  - Version 0.17-BETA27 of fx-util
Maven dependency for com.dua3.fx - fx-icons version 0.17-BETA23.2 is released. Learn to use fx-icons version 0.17-BETA23.2 in Maven based Java projects
this version ( com.dua3.fx - fx-icons version 0.17-BETA23.2 ) in their Java...Maven dependency for  com.dua3.fx  - Version 0.17-BETA23.2 of fx-icons released The developers of   com.dua3.fx - fx-icons project have
Maven dependency for com.dua3.fx - fx-util version 0.17-BETA23.2 is released. Learn to use fx-util version 0.17-BETA23.2 in Maven based Java projects
this version ( com.dua3.fx - fx-util version 0.17-BETA23.2 ) in their Java project... that downloads and includes  com.dua3.fx - fx-util version 0.17-BETA23.2 java...Maven dependency for  com.dua3.fx  - Version 0.17-BETA23.2 of fx
Maven dependency for com.dua3.fx - fx-util version 0.17-BETA17 is released. Learn to use fx-util version 0.17-BETA17 in Maven based Java projects
this version ( com.dua3.fx - fx-util version 0.17-BETA17 ) in their Java project... and includes  com.dua3.fx - fx-util version 0.17-BETA17 java library in your...Maven dependency for  com.dua3.fx  - Version 0.17-BETA17 of fx-util
Maven dependency for com.dua3.fx - fx-util version 0.17-BETA23.1 is released. Learn to use fx-util version 0.17-BETA23.1 in Maven based Java projects
this version ( com.dua3.fx - fx-util version 0.17-BETA23.1 ) in their Java project... that downloads and includes  com.dua3.fx - fx-util version 0.17-BETA23.1 java...Maven dependency for  com.dua3.fx  - Version 0.17-BETA23.1 of fx
Maven dependency for com.dua3.fx - fx-util version 0.17-BETA23 is released. Learn to use fx-util version 0.17-BETA23 in Maven based Java projects
this version ( com.dua3.fx - fx-util version 0.17-BETA23 ) in their Java project... and includes  com.dua3.fx - fx-util version 0.17-BETA23 java library in your...Maven dependency for  com.dua3.fx  - Version 0.17-BETA23 of fx-util
Maven dependency for com.dua3.fx - fx-util version 0.17-BETA21 is released. Learn to use fx-util version 0.17-BETA21 in Maven based Java projects
this version ( com.dua3.fx - fx-util version 0.17-BETA21 ) in their Java project... and includes  com.dua3.fx - fx-util version 0.17-BETA21 java library in your...Maven dependency for  com.dua3.fx  - Version 0.17-BETA21 of fx-util
Maven dependency for com.dua3.fx - fx-icons version 0.17-BETA23 is released. Learn to use fx-icons version 0.17-BETA23 in Maven based Java projects
this version ( com.dua3.fx - fx-icons version 0.17-BETA23 ) in their Java project... and includes  com.dua3.fx - fx-icons version 0.17-BETA23 java library...Maven dependency for  com.dua3.fx  - Version 0.17-BETA23 of fx-icons
Maven dependency for com.dua3.fx - fx-icons version 0.17-BETA22 is released. Learn to use fx-icons version 0.17-BETA22 in Maven based Java projects
this version ( com.dua3.fx - fx-icons version 0.17-BETA22 ) in their Java project... and includes  com.dua3.fx - fx-icons version 0.17-BETA22 java library...Maven dependency for  com.dua3.fx  - Version 0.17-BETA22 of fx-icons
Maven dependency for com.dua3.fx - fx-util version 0.17-BETA20 is released. Learn to use fx-util version 0.17-BETA20 in Maven based Java projects
this version ( com.dua3.fx - fx-util version 0.17-BETA20 ) in their Java project... and includes  com.dua3.fx - fx-util version 0.17-BETA20 java library in your...Maven dependency for  com.dua3.fx  - Version 0.17-BETA20 of fx-util
Maven dependency for com.dua3.fx - fx-icons version 0.17-BETA20 is released. Learn to use fx-icons version 0.17-BETA20 in Maven based Java projects
this version ( com.dua3.fx - fx-icons version 0.17-BETA20 ) in their Java project... and includes  com.dua3.fx - fx-icons version 0.17-BETA20 java library...Maven dependency for  com.dua3.fx  - Version 0.17-BETA20 of fx-icons
Maven dependency for com.dua3.fx - fx-util version 0.17-BETA19 is released. Learn to use fx-util version 0.17-BETA19 in Maven based Java projects
this version ( com.dua3.fx - fx-util version 0.17-BETA19 ) in their Java project... and includes  com.dua3.fx - fx-util version 0.17-BETA19 java library in your...Maven dependency for  com.dua3.fx  - Version 0.17-BETA19 of fx-util
Maven dependency for com.dua3.fx - fx-icons version 0.17-BETA19 is released. Learn to use fx-icons version 0.17-BETA19 in Maven based Java projects
this version ( com.dua3.fx - fx-icons version 0.17-BETA19 ) in their Java project... and includes  com.dua3.fx - fx-icons version 0.17-BETA19 java library...Maven dependency for  com.dua3.fx  - Version 0.17-BETA19 of fx-icons
Maven dependency for com.dua3.fx - fx-icons version 0.17-BETA18 is released. Learn to use fx-icons version 0.17-BETA18 in Maven based Java projects
this version ( com.dua3.fx - fx-icons version 0.17-BETA18 ) in their Java project... and includes  com.dua3.fx - fx-icons version 0.17-BETA18 java library...Maven dependency for  com.dua3.fx  - Version 0.17-BETA18 of fx-icons

Ads