Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training  
 

java fx

Ads

 
 

Share on Google+Share on Google+

navn
java fx
1 Answer(s)      7 years ago
Posted in : Java Interview Questions
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
Ads
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

Ads









Related Tutorials/Questions & Answers:
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
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
Advertisements
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 for windows
Java fx for windows         JavaFX, a family of products, is based on Java technology to create Rich Internet applications (RIAs) that simplifies and speed up the creation
Data Binding With fx:Model tag in Flex4
Data Binding with fx:Model tag  in Flex4: The <fx:Model> tag... and these node of objects have a scalar values. The tag is <fx:Model>. Syntax...;?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
Data Binding with XML Data Model in Flex4
Data Binding with XML DataModel in Flex4: The <fx:XML> tag contains a data in tree format. It is just like a <fx:Model> tag. The flex builder compiles the <fx:XML> tag into literal XML data. You can use this data
IT115 programming with java - Java Beginners
comment lines. 1. Using valid Java code from Chapter 1 to 4, create... sections in your principle class ( constructor fx, accessor fx, custom fx, private data members) ,along with the three custom fx use input(), calculation
Java Courses
Java FX Programming JSF Java project based training...Java Courses We are conduction various Java Courses online, onsite and classroom training. Our Java Courses content is well designed and supported with many
Local style sheets in Flex4
Local style sheets in Flex4: You can set the style of components in <fx... is following: <fx:Style> @namespace namespace_identifiernamespace_string; selector_name { style_property: value; [...] } </fx:Style>
java
java  diff bt core java and java
java
java  what is java
java
java   why iterator in java if we for loop
java
java  explain technologies are used in java now days and structure java
java
java  different between java & core java
Java
Java   Whether Java is pure object oriented Language
JAVA
JAVA  how the name came for java language as "JAVA
java
java  is java open source
java
java  what is java reflection
java
java   in java does not pointers concept but what is nullpointers in java?   nullpointer is a runtime Exception
java
what is the size of array in java ?  what is the size of array in java ? what is the mean of finalize in java
java
java   What is ?static? keyword
java
java  RARP implementation using java socket
java
java  sample code for RARP using java
Java
Java  how to do java in command prompt
java
java  give a simple example for inheritance in java
java
java  why to set classpath in java
java
java  why to set classpath in java
java
java  why to set classpath in java
java
java  Write a java code to print "ABABBABCABABBA
java
java  write a program in java to acess the email
java
java  send me java interview questions