Anyone got code for a celsius/fahrenheit converter or know why I can get it

Greetings,
I'm looking for a celsius/fahrenheit converter as a applet or application. I know there are billions out there so if someone has or (or feels like building it) I would be very greatful...
Thanks

// A very simple Celcius <--> Fahrenheit Converter
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
public class Converter extends JFrame {
    private BListener b = new BListener();
    private Container contentPane;
    private JTextField enterNumber;
    private JPanel mainPanel;
    private JButton FtoC, CtoF;
    private double celsius=0.0, fahrenheit=0.0;
    public static void main(String[] args) {
     Converter c =
         new Converter("Converter");
    public Converter(String title) {
     super(title);
     // set size of window
     setSize(600, 100);
     // Make window closable
     MakeClosable();
     mainPanel = new JPanel();
     mainPanel.setPreferredSize(new Dimension(600,100));
     enterNumber = new JTextField("0.0", 10);
     FtoC = new JButton("To Celsius");
     CtoF = new JButton("To Fahrenheit");
     FtoC.addActionListener(b);
     CtoF.addActionListener(b);
     contentPane = getContentPane();
     contentPane.add(mainPanel);
     mainPanel.add(enterNumber);
     mainPanel.add(FtoC);
     mainPanel.add(CtoF);
     setVisible( true );
    public void MakeClosable() {
     addWindowListener( new WindowAdapter () {
          public void windowClosing(WindowEvent e) {
              System.exit(0);
    class BListener implements ActionListener {
     public void actionPerformed(ActionEvent e) {
         // which button was pushed
         String which = e.getActionCommand();
         if(which.equals("To Celsius")){
          GetCelsius();
         if(which.equals("To Fahrenheit")){
          GetFahrenheit();
    public void GetCelsius() {
     String F = enterNumber.getText();
     if(!(F.equals(""))){
         try{
          fahrenheit = Double.parseDouble(F);
          celsius = (5.0/9.0)*(fahrenheit-32);
          enterNumber.setText(" " + celsius);
         catch(NumberFormatException e){
          JOptionPane.showMessageDialog(null,
                               "Please enter a number first",
                               "No number",
                               JOptionPane.ERROR_MESSAGE);
    public void GetFahrenheit() {
     String C = enterNumber.getText();
     if(!(C.equals(""))){
         try{
          celsius = Double.parseDouble(C);
          fahrenheit = ((9.0/5.0)*celsius)+32;
          enterNumber.setText(" " + fahrenheit);
         catch(NumberFormatException e){
          JOptionPane.showMessageDialog(null,
                               "Please enter a number first",
                               "No number",
                               JOptionPane.ERROR_MESSAGE);
} // end of Converter class

Similar Messages

  • My MacAir is great except for a problem i have. Keys F1, F2,F5,F6,F7,F8,F9,F10,F11,F12 and the power button are unresponsive. These are keys i frequently use and i have searched the whole apple help centre. Anyone got answers for me? Please helP!!!

    My MacAir is great except for a problem i have. Keys F1, F2,F5,F6,F7,F8,F9,F10,F11,F12 and the power button are unresponsive. These are keys i frequently use and i have searched the whole apple help centre. Anyone got answers for me? Please helP!!!

    Some keys don't work as expected
    From the Apple menu, choose System Preferences.
    From the View menu, choose Speech.
    Click the Text to Speech tab.
    If "Speak selected text when the key is pressed" is enabled, the key or key combination set to speak text cannot be used for other purposes or used to type text--click Set Key and change it to a less-commonly used key combination (try to use modifier keys such as Shift, Command, Option, and Control). Or, disable the "Speak selected text when the key is pressed" option.
    Click the Universal Access pane in System Preferences, click the Keyboard tab.
    Make sure that Slow Keys is turned off. With Slow Keys on, you need to press a key for a longer period of time for it to be recognized.
    In the Universal Access pane, click the Mouse tab, and make sure Mouse Keys is turned off. With Mouse Keys enabled, you cannot use the Numeric Keypad to enter numbers--instead the keypad moves the pointer (cursor). (There is an option to enable Mouse Keys with five presses of the Option key; you may want to turn that option off to avoid accidentally enabling it.) If Mouse Keys is enabled and you are using a keyboard with no numeric keypad or Num Lock function, see Unable to type while Mouse Keys is enabled in Mac OS X.
    If the function keys on the top row of the keyboard are not working as expected, see Mac OS X: How to change the behavior of function keys.
    If the issue persists, use Keyboard Viewer to help isolate the issue:
    Click the Language & Text pane (Mac OS X v10.6) or International pane (Mac OS X v10.5.8 or earlier) in System Preferences.
    Click the Input Sources tab (or Input Menu tab in Mac OS X 10.5.8 or earlier).
    Click the Keyboard & Character Viewer "On" checkbox to select it (click the Keyboard Viewer "On" checkbox in Mac OS X 10.5.8 or earlier).
    From the Input (flag) menu, choose Show Keyboard Viewer.
    If the keyboard is connected and detected by Mac OS X, the keys you type will highlight in the Keyboard Viewer window. Open TextEdit (or any text application), and try to type something using the keys that were previously not responding to see if they highlight in Keyboard Viewer.
    Start from the Mac OS X Install Disc, choose Terminal from the Utilities menu and test the keys which were previously not working.  If the keys work while started from the Install disc, then the keyboard itself is working correctly.  Use Mac OS X: How to troubleshoot a software issue to isolate the software issue that may be causing the keys to not respond.
    http://support.apple.com/kb/TS1381

  • My gift card code was unreadable.  Anyone know how I can get a new code/get my money back/call apple to complain about their crappy product now that i've wasted $25?

    I purchased a $25 gift card for iTunes several weeks ago.  Went to use it tonight, and when I scratched off the code it was completely unreadable.  I'm not impressed at having wasted $25.  Nor am I impressed with the lack of helpful information on the Apple/itunes website--there seems to be no way to directly contact them to either complain or ask for assistance. 
    Does anyone know if you can get them to refund the money or provide a new code or card or whatever?  I no longer have the receipt from the store where I purchased the card, so I can't take it to them and beg for a replacement.  Besides, the problem lies with a shoddy product, not the store that sold it. 
    I've gotta say, I'll be thinking really hard before buying an itunes gift card for myself or anyone else from now on. Losing your investment in the card is just not worth the effort.

    I tried this and was asked to provide not only photos of the front and back of the card but a sales receipt.  This is a gift card.  It was a gift!  I don't have a sales receipt.  Very disappointed.

  • I know my Game Center username and password, but I don't know the email (or maybe apple id) that is for my account. It is not my normal one. I can't log in with just my username, so does anyone know how I can get my email?

    I know my Game Center username and password, but I don't know the email (or maybe apple id) that is for my account. It is not my normal one. I can't log in with just my username, so does anyone know how I can get my email?
    Can you help me please

    Dear
    I have worked renovation of the device and have an account, but I forgot my email
    I do not know E-mail has been linked in game center
    I have a name defined in game center
    Do I have the possibility of knowing E-mail has been linked in game center

  • Anyone know how java can get html code

    I have this great idea for a program but I need to know how java can get some source code off a web page (HTML) so i can then get certain information from it.
    Then with that certain information on my side can I then like post data through a from like a cgi/php script through a post variable?
    Have any of you heard of something like this?

    you can read the html easy enough, look in the docs for, of all things, objects that have html in their name.
    if you are going to post back then you need an interface to post to--like a servlet--but in any case it has to be supported by the site you want to post back.

  • My MacBook has been "moving to trash" 4 items for a LONG time now.  I can't force quit this or stop it in any way. Does anyone know how I can get this to stop, I'm pretty sure its slowing my whole system down because it is constantly working on this.

    "Moving Items to Trash" has been up on my desktop for days now. I don't know who to get rid of this and believe its slowing my WHOLE system down.  Does anyone know how I can get rid of this, cancel it, forece quit, or anything? HELP!

    Try force quitting
    Press Command + Option + Esc

  • Hi. I have purchased Lego Indiana Jones for my Macbook Pro. On trying to install it, it is telling me it encountering an error. Does anyone know how I can get around this? Cheers

    Hi. I have purchased Lego Indiana Jones for my Macbook Pro. On trying to install it, it is telling me it encountering an error. Does anyone know how I can get around this? Cheers

    I have this problem too the error message for me is error 36
    (It works on my Macbook but not my Macbook pro)
    Any help you could give would be great

  • So I updated to OS X Maverick(s) and backuped my harddrive and got a new one installed, everything seems okay but some things are missing in my settings like the software update icon. Does anyone know how I can get it back?

    So I updated to OS X Maverick(s) and backuped my harddrive and got a new one installed, everything seems okay but some things are missing in my settings like the software update icon. Does anyone know how I can get it back?

    Okay so I asked someone from apple and they said that the software update icon is gone but its functions have been merged with the app store icon on the settings menu. Crisis averted haha!

  • Does anyone know where i can get cheep parts (ac adapter 150-watt for hp touchsmart pc)?

    Does anyone know where i can get cheep parts (ac adapter 150-watt for hp touchsmart pc)?

    Hello mdhart: Ebay.com has several posted log on Ebay select computers and type in HP Touchsmat. Computers will display go down the page you will see AC Adapters. Price range is from $27.99 to $43.99. Most of them are buy it now $28.99 Today they have 11 of them posted. You can contact Hp store on live chat and get their price. Hp did not list HP Touchsmarts AC adapters. Just laptops AC adapters are listed. So you have to contact the HP store to get information about Hp Touchsmart AC adapters.

  • Does anyone know where I can get Operating Instructions for the Sony BVW-75 Betacam SP?

    I have been trying without success to find Operating Instructions for the Sony BVW-75 Betacam SP I just bought. Does anyone know where I can get it?

    Thank you for trying to help. All of those links are for the product brochure, service/maintenance manual, or other products. I have spent several hours following Google search results and eBay searches with no luck. That's why I am reaching out to the technical community to see if someone has an instruction manual somewhere in the back room of their studio.

  • Anyone know where I can get Oracle 7.3 client for windows from ?

    As per title anyone know where I can get the Oracle 7.3 client libraries from ?
    My media cabinet only holds oracle versions back to 8.1.7
    TIA,
    Mike.

    sybrand_b wrote:
    You pay the Oracle lawsuit?For using Oracle Client when Oracle currently provides Instant Client for free and allows it to be distributed with 3rd party/ISV applications? Doubt that Oracle will do that, or have a valid case - nor will it be in their best interest seeing that this is part of a migration to a later Oracle version (which means revenue for Oracle).
    790095  wrote:
    We have a customer who has a 7.3 DB still that we need to get that data out of to migrate.Is exp not available on that server platform? In which case schema exports can be done and then imported into the new database.
    If I set up a secure FTP site would anyone be able to upload an ISO of the 7.3 client disk ?I will have a look to see for that Oracle Workgroup CD (it was a "free trial" distro at the time which I picked up at the local Oracle offices). The problem however is bandwidth cap. I'm still in a part of the world where broadband means around 32Kb/s thruput and being limited to the amount of b/w one can use (I'm capped to only using 5GB per month - which is not much).
    I suggest however to log a service request with support.oracle.com - you are likely to resolve the problem much faster that way.

  • Does anyone know where I can get a driver for a Kodak G610 easy share?

    does anyone know where I can get a driver for a Kodak G610 easy share? tried the Kodak site but the software doesnt appear to work

    There is no longer any support from Kodak for their EasyShare cameras on Mac OS X.
    If you connect your Camera via a USB cable, does iPhoto launch?
    If iPhoto doesn't launch automatically, try launching iPhoto first,then plug your camera in via connected USB cable that came with your camera.
    If iPhoto doesn't open, have you tried using OS X Image Capture App to download your photos from your camera?

  • Hi everyone!  I turned on my computer the other day and the icon for Safari was missing from my dock.  I looked in the applications folder and it is no longer there.  Does anyone know how I can get safari if I have no internet search engine?

    Hi everyone!  I turned on my computer the other day and the icon for Safari was missing from my dock.  I looked in the applications folder and it is no longer there.  Does anyone know how I can get safari if I have no internet search engine?  I

    Safari 5.0.6 for Leopard can be downloaded from here:
    http://support.apple.com/kb/DL1422
    Does anyone know how I can get safari if I have no internet search engine?
    How did you post here?

  • My ipad (3rd generation) charger suddenly stopped working? I live in Singapore so there isn't an official apple store. Does anyone know where I can get it(charger) fixed/replaced? By the way, I got my ipad from the online store. Please and thank you

    My ipad (3rd generation) charger suddenly stopped working? I live in Singapore so there isn't an official apple store. Does anyone know where I can get it(charger) fixed/replaced? By the way, I got my ipad from the online store. Please and thank you

    Currently there are 15 Apple Premiun Reseller in Singapore; you can find your nearest reseller here:
    http://www.apple.com/sg/reseller/searchtips.php?location=

  • Need Edwardian Script for CS5- anyone know where I can get it?

    I have a client that wants Edwardian Script for her wedding video. I don't have it on any of my Adobe CS5 products. I do not want to join the cloud. Anyone know how I can get the font and use it with CS5?

    I saved the font to my C drive, and then re- launched PP.
    Saving the font will not show up in PP. You need to "install" the font into your "Fonts" directory. Did you install it or just save it? If you did not install it you should just be able to right click on the font and select to install it from the contextual menu. Once the font has been "installed" in your Fonts directory all of the apps will read it. I have Edwardian Script installed on my machines and the Adobe apps read them fine.

Maybe you are looking for