下面的程序每一句都啥意思?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/07/19 07:53:00
![下面的程序每一句都啥意思?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();](/uploads/image/z/8471290-58-0.jpg?t=%E4%B8%8B%E9%9D%A2%E7%9A%84%E7%A8%8B%E5%BA%8F%E6%AF%8F%E4%B8%80%E5%8F%A5%E9%83%BD%E5%95%A5%E6%84%8F%E6%80%9D%3Fpublic+void+actionPerformed%28ActionEvent+e%29%7Bif%28e.getSource%28%29%3D%3DitemCopy%29text1.copy%28%29%3Belse+if%28e.getSource%28%29%3D%3DitemCut%29text1.cut%28%29%3Belse+if%28e.getSource%28%29%3D%3DitemPaste%29text2.paste%28%29%3B)
下面的程序每一句都啥意思?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中的文本进行粘贴操作