Sunday, January 31, 2010

How Many Computers Can You Put Fsx On

Check


The exercise of the audit was to do the conversion from degrees Celsius to degrees Fahrenheit and the plot

import javax.swing .*;

import java.awt.*;

public class Grafico extends JPanel {
    private int x2=100;
    private int p1;
    private int p2;
    double cast =x2*1.8+32;
    private int y2=(int)cast;
    private int x1=0;
    private int y1=32;
    public void paintComponent(Graphics g){
        int h=this.getHeight();
        g.setColor(Color.RED);
        g.drawLine(x1, h-y1, x2, h-y2);
    }

}

 

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

public class Verifica {     JLabel conv=new JLabel();

    JLabel farin=new JLabel("Temperatura in °F");

    JLabel celsius=new JLabel("temperatura in °C");

    JButton b=new JButton("Converti");
Graph g = new Graph ();
public Test () {# &
160; b.addActionListener (new Button ());
& # 160; f1.setLayout (new GridLayout (3,4));
f1 . add (t1);
f1.add(celsius);
        f1.add(conv);
        f1.add(farin);
        f1.add(g);
        f1.add(BorderLayout.SOUTH,b);
        f1.setSize(500,500);
        f1.setVisible(true);
        f1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }

    class Bottone implements ActionListener{

        public void actionPerformed(ActionEvent e){

            T1.getText String value = ();

double value1 = Double.parseDouble (value);
; Double farinheit = value1 * 1.8 +32;
; String conversion = Double.ToString (farinheit);
            int v=(int)valore1;
            conv.setText(conversione);
            f1.repaint();
        }

    }
    public static void main(String Args[]){
        Verifica v=new Verifica();
    }

}








0 comments:

Post a Comment