下面的程序每一句都啥意思?public void actionPerformed(ActionEvent e){if(e.getSource()==itemCopy)text1.copy();else if(e.getSource()==itemCut)text1.cut();else if(e.getSource()==itemPaste)text2.paste();

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/13 08:17:10
下面的程序每一句都啥意思?public void actionPerformed(ActionEvent e){if(e.getSource()==itemCopy)text1.copy();else if(e.getSource()==itemCut)text1.cut();else if(e.getSource()==itemPaste)text2.paste();

下面的程序每一句都啥意思?public void actionPerformed(ActionEvent e){if(e.getSource()==itemCopy)text1.copy();else if(e.getSource()==itemCut)text1.cut();else if(e.getSource()==itemPaste)text2.paste();
下面的程序每一句都啥意思?
public void actionPerformed(ActionEvent e){
if(e.getSource()==itemCopy)
text1.copy();
else if(e.getSource()==itemCut)
text1.cut();
else if(e.getSource()==itemPaste)
text2.paste();

下面的程序每一句都啥意思?public void actionPerformed(ActionEvent e){if(e.getSource()==itemCopy)text1.copy();else if(e.getSource()==itemCut)text1.cut();else if(e.getSource()==itemPaste)text2.paste();
希望一下解释,
public void actionPerformed(ActionEvent e){ //添加事件监听 if(e.getSource()==itemCopy) //判断如果响应的事件源是复制项 text1.copy(); //对text1中的文本进行复制操作 else if(e.getSource()==itemCut)//判断如果响应的事件源是剪切项
text1.cut();//对text1中的文本进行复制操作
else if(e.getSource()==itemPaste)//判断如果响应的事件源是粘贴项
text2.paste();//对text1中的文本进行粘贴操作