七达网-安全的软件、游戏下载基地!

关于我们最近更新热门排行

首页 游戏库 软件 游戏 应用 文章 专题

新闻资讯软件应用软件教程编程开发 操作系统游戏攻略安卓应用安卓游戏
当前位置:首页 ›› 编程开发 ›› java温度转换代码

java温度转换代码

2014-12-11 11:56   作者:佚名   来源:本站整理   浏览:465   评论:0  

许多网友都在问Java程序中温度转换代码怎么写,对于初学者来说,这个程序确实有电脑度,下面七达网小编为大家搜集的有关Java温度转换的代码,仅供参考,这个代码感兴趣的朋友可以试一下,希望能够对大家有所帮助。

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

public class temp extends JFrame implements ActionListener,ItemListener{
JTextField jT1,jT2;
JLabel jL1,jL2;
JButton jB1, jB2;
JRadioButton[] jR=new JRadioButton[2];
ButtonGroup radioGroup;
JCheckBox[]jC=new JCheckBox[2];
double x;
String y;
public temp(){
super("温度转换");
public static void main(String args[]){
temp w1=new temp();
}
public void actionPerformed(ActionEvent e){
int x1=Integer.parseInt(jT1.getText());
int x2=Integer.parseInt(jT2.getText());
if(e.getSource()==jR[0]){
jL1.setText("摄氏度=");
jL1.setText("华氏度");

double x=(Integer.parseInt(jT1.getText()))*1.8+32;

jT2.setText(String.valueOf(x));

}

if(e.getSource()==jR[1]){

jL1.setText("华氏度=");

jL1.setText("摄氏度");

double x=(Integer.parseInt(jT1.getText()))*1.8+32;

jT2.setText(String.valueOf(x));

}

double x=(Integer.parseInt(jT1.getText())-32)/1.8;

jT2.setText(String.valueOf(x));
}

public void itemStateChanged(ItemEvent arg0) {

// TODO Auto-generated method stub

}

}import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

public class temp extends JFrame implements ActionListener,ItemListener{

JTextField jT1,jT2;
JLabel jL1,jL2;

JButton jB1, jB2;

JRadioButton[] jR=new JRadioButton[2];

ButtonGroup radioGroup;

JCheckBox[]jC=new JCheckBox[2];

double x;

String y;

public temp(){

super("温度转换");
    1. Node.jsNode.js

      本站为大家提供 node.js 安装node.js 教程node.js 下载node.js 视频教程node.js web开发node.js 开发工具node.js mysqlnode.js 爬虫node.js npmnode.js ide

    软件评论

    请自觉遵守互联网相关政策法规,评论内容只代表网友观点,与本站立场无关!

        登录   注册
    猜你喜欢