Total members 11890 |It is currently Fri Apr 19, 2024 10:53 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka






* Project Name:   Celsius to Fahrenheit Converstion applet
* Programmer:   msi_333
* Type:   Math
* Technology:  Java applets
* IDE:   NetBeans
* Description:   This is a simple applet which convert from Celsius to Fahrenheit Converstion degrees
This is live applet :grin:
java code
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import javax.swing.JApplet;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JSlider;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

/**
*
* @author SAMI
*/
public class mApplet extends JApplet implements ChangeListener{

/** Creates a new instance of Main */
private JSlider slider=new JSlider(JSlider.HORIZONTAL,0,100,30);
private JLabel CLable=new JLabel("Celsius :");
private JLabel FLable=new JLabel("Fahrenheit :");
private JLabel CLableValue=new JLabel("");
private JLabel FLableValue=new JLabel("");
private Container cp;
private float CDegree;
private float FrDegree;

public mApplet() {


cp=getContentPane();
slider.addChangeListener(this);
CDegree=slider.getValue();
getFahrenheit();
updateTexts();
cp.setLayout(new GridLayout(3,3));
cp.add(CLable);
cp.add(CLableValue);
cp.add(FLable);
cp.add(FLableValue);
cp.add(slider);

}

public void init() {

}
public void start() {

}
public void stop() {

}
public void destroy() {

}

public void stateChanged(ChangeEvent e) {
CDegree=slider.getValue();
getFahrenheit();
updateTexts();
}

public void getFahrenheit() {
FrDegree=(float)(CDegree*(float)9/5) + 32;
}
public void updateTexts()
{
CLableValue.setText(Float.toString(CDegree));
FLableValue.setText(Float.toString(FrDegree));
}
}



Attachment:
File comment: NetBeans Project
Sample.rar [24.38 KiB]
Downloaded 1164 times




_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time

updated.


_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 2 posts ] 

  Related Posts  to : Browser Celsius to Fahrenheit Converstion applet
 convert from celsius to fahrenheit or vice versa     -  
 $.browser Check if your browser is IE or FireFox or Chrome     -  
 Browser     -  
 Browser Support     -  
 how can we get browser information in jsp?     -  
 AJAX - Browser support     -  
 Whats your favourite browser?     -  
 Video Archive Browser in java     -  
 Java Web Browser (Mini Project)     -  
 Get the client navigator browser type or operating system     -  



Topic Tags

Java Applet
cron






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com