java编程高手进帮我翻译一下答案(1)
大哥大姐我是初学的,希望你门能帮我解答一下~(每一句,都给点注视)importjava.awt.*;importjava.awt.event.*;importjava.u...
大哥大姐我是初学的,希望你门能帮我解答一下~(每一句,都给点注视)
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;
import javax.swing.event.*;
public class L2 extends JFrame implements ItemListener,ComponentListener,ActionListener,Runnable{
private JTextField Year;
private JLabel lab1;
private JButton up,down;
JLabel days[]=new JLabel[49];
Object month[]={"一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"};
JComboBox Month=new JComboBox(month);
JLabel lmonth=new JLabel("MONTH");
JLabel lyear=new JLabel("YEAR");
JPanel p1,p2;
int selYear,selMonth,day;
int totdays;
Thread 时针=null,分针=null,秒针=null;
int hour_a,hour_b,munite_a,munite_b,second_a,second_b;
int hour=0,munite=0,second=0;
Graphics g_second=null,g_munite=null,g_hour=null;
double point_x[]=new double[61],point_y[]=new double[61];
double scaled_x[]=new double[61],scaled_y[]=new double[61];
public L2(){
super("设置日期和时间属性 Version 1.0");
setSize(800,400);
setLocation(100,100);
setDefaultCloseOperation(EXIT_ON_CLOSE);
addComponentListener(this);
p1=new JPanel(null);
p1.setBounds(new Rectangle(0,0,400,32));
p2=new JPanel(null);
p2.setBounds(new Rectangle(0,30,400,370));
p1.setBackground(Color.pink);
p2.setBackground(Color.pink );
add(p1);
add(p2);
p1.add(lmonth);
lmonth.setBounds(new Rectangle(30,5,50,25));
p1.add(Month);
Month.setBounds(new Rectangle(90,5,60,25));
Month.addItemListener(this);
p1.add(lyear);
lyear.setBounds(new Rectangle(210,5,50,25));
Year=new JTextField("2007");
谢谢你么呢了 展开
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;
import javax.swing.event.*;
public class L2 extends JFrame implements ItemListener,ComponentListener,ActionListener,Runnable{
private JTextField Year;
private JLabel lab1;
private JButton up,down;
JLabel days[]=new JLabel[49];
Object month[]={"一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"};
JComboBox Month=new JComboBox(month);
JLabel lmonth=new JLabel("MONTH");
JLabel lyear=new JLabel("YEAR");
JPanel p1,p2;
int selYear,selMonth,day;
int totdays;
Thread 时针=null,分针=null,秒针=null;
int hour_a,hour_b,munite_a,munite_b,second_a,second_b;
int hour=0,munite=0,second=0;
Graphics g_second=null,g_munite=null,g_hour=null;
double point_x[]=new double[61],point_y[]=new double[61];
double scaled_x[]=new double[61],scaled_y[]=new double[61];
public L2(){
super("设置日期和时间属性 Version 1.0");
setSize(800,400);
setLocation(100,100);
setDefaultCloseOperation(EXIT_ON_CLOSE);
addComponentListener(this);
p1=new JPanel(null);
p1.setBounds(new Rectangle(0,0,400,32));
p2=new JPanel(null);
p2.setBounds(new Rectangle(0,30,400,370));
p1.setBackground(Color.pink);
p2.setBackground(Color.pink );
add(p1);
add(p2);
p1.add(lmonth);
lmonth.setBounds(new Rectangle(30,5,50,25));
p1.add(Month);
Month.setBounds(new Rectangle(90,5,60,25));
Month.addItemListener(this);
p1.add(lyear);
lyear.setBounds(new Rectangle(210,5,50,25));
Year=new JTextField("2007");
谢谢你么呢了 展开
1个回答
展开全部
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;
import javax.swing.event.*;
//上面是导入JAVA包
public class L2 extends JFrame implements ItemListener,ComponentListener,ActionListener,Runnable{
//定义类L2,继承自JFrame,并且实现 ItemListener,ComponentListener,ActionListener,Runnable接口
private JTextField Year;
private JLabel lab1;
private JButton up,down; //定义私有成员变量
JLabel days[]=new JLabel[49]; //定义数组,大小49
Object month[]={"一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"};
//定义数组month,存放月份
JComboBox Month=new JComboBox(month); //将月份增加到下拉列表框中
JLabel lmonth=new JLabel("MONTH"); //定义标签MONTH
JLabel lyear=new JLabel("YEAR"); //定义标签YEAR
JPanel p1,p2; //定义2个面板
int selYear,selMonth,day;
int totdays; //定义整型变量
Thread 时针=null,分针=null,秒针=null; //定义线程类变量
int hour_a,hour_b,munite_a,munite_b,second_a,second_b;
int hour=0,munite=0,second=0; //定义整型
Graphics g_second=null,g_munite=null,g_hour=null; //定义图像类变量
double point_x[]=new double[61],point_y[]=new double[61]; //定义double型数组
double scaled_x[]=new double[61],scaled_y[]=new double[61];
public L2(){ //类L2的构造方法
super("设置日期和时间属性 Version 1.0"); //调用L2父类的构造方法,设置标题
setSize(800,400); //设置窗体大小800 400
setLocation(100,100); //设置窗体的位置
setDefaultCloseOperation(EXIT_ON_CLOSE); //使得单击窗体右上角的关闭按钮,可以退出程序
addComponentListener(this); //添加组件监听
p1=new JPanel(null); //生成新面板
p1.setBounds(new Rectangle(0,0,400,32)); //移动,并调整大小
p2=new JPanel(null); //生成新面板
p2.setBounds(new Rectangle(0,30,400,370)); //同上
p1.setBackground(Color.pink); //设置面板的背景色
p2.setBackground(Color.pink );
add(p1); //增加到窗体中
add(p2);
p1.add(lmonth); //将Month标签加到P1面板中
lmonth.setBounds(new Rectangle(30,5,50,25)); //设置Month标签位置及大小
p1.add(Month); //将月份的下拉列表框加到P1面板中
Month.setBounds(new Rectangle(90,5,60,25)); //设置位置,及大小
Month.addItemListener(this); //增加事件,当改变月份的时候,将会触发事件
p1.add(lyear); //将YEAR标签加到P1面板中.
lyear.setBounds(new Rectangle(210,5,50,25)); //设置位置及大小
Year=new JTextField("2007");
import java.awt.event.*;
import java.util.*;
import javax.swing.*;
import javax.swing.event.*;
//上面是导入JAVA包
public class L2 extends JFrame implements ItemListener,ComponentListener,ActionListener,Runnable{
//定义类L2,继承自JFrame,并且实现 ItemListener,ComponentListener,ActionListener,Runnable接口
private JTextField Year;
private JLabel lab1;
private JButton up,down; //定义私有成员变量
JLabel days[]=new JLabel[49]; //定义数组,大小49
Object month[]={"一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"};
//定义数组month,存放月份
JComboBox Month=new JComboBox(month); //将月份增加到下拉列表框中
JLabel lmonth=new JLabel("MONTH"); //定义标签MONTH
JLabel lyear=new JLabel("YEAR"); //定义标签YEAR
JPanel p1,p2; //定义2个面板
int selYear,selMonth,day;
int totdays; //定义整型变量
Thread 时针=null,分针=null,秒针=null; //定义线程类变量
int hour_a,hour_b,munite_a,munite_b,second_a,second_b;
int hour=0,munite=0,second=0; //定义整型
Graphics g_second=null,g_munite=null,g_hour=null; //定义图像类变量
double point_x[]=new double[61],point_y[]=new double[61]; //定义double型数组
double scaled_x[]=new double[61],scaled_y[]=new double[61];
public L2(){ //类L2的构造方法
super("设置日期和时间属性 Version 1.0"); //调用L2父类的构造方法,设置标题
setSize(800,400); //设置窗体大小800 400
setLocation(100,100); //设置窗体的位置
setDefaultCloseOperation(EXIT_ON_CLOSE); //使得单击窗体右上角的关闭按钮,可以退出程序
addComponentListener(this); //添加组件监听
p1=new JPanel(null); //生成新面板
p1.setBounds(new Rectangle(0,0,400,32)); //移动,并调整大小
p2=new JPanel(null); //生成新面板
p2.setBounds(new Rectangle(0,30,400,370)); //同上
p1.setBackground(Color.pink); //设置面板的背景色
p2.setBackground(Color.pink );
add(p1); //增加到窗体中
add(p2);
p1.add(lmonth); //将Month标签加到P1面板中
lmonth.setBounds(new Rectangle(30,5,50,25)); //设置Month标签位置及大小
p1.add(Month); //将月份的下拉列表框加到P1面板中
Month.setBounds(new Rectangle(90,5,60,25)); //设置位置,及大小
Month.addItemListener(this); //增加事件,当改变月份的时候,将会触发事件
p1.add(lyear); //将YEAR标签加到P1面板中.
lyear.setBounds(new Rectangle(210,5,50,25)); //设置位置及大小
Year=new JTextField("2007");
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询