这是什么意思?
完整代码就不写了,相信知道 的一下就看出来。但是我不理解。
textFieldURL.addActionListener(new java.awt.event.ActionListener(){
public void actionPerformed(ActionEvent e){
textFieldURL_actionPerformed(e);
}
});
jEditorPane.setEditable(false);//设置不可编辑
jEditorPane.addHyperlinkListener(new javax.swing.event.HyperlinkListener(){
public void hyperlinkUpdate(HyperlinkEvent e){
//jEditorPane_hyperlinkUpdate(e);
}
});
。。。。
。。。、
void textFieldURL_actionPerformed(ActionEvent e){
try{
jEditorPane.setPage(textFieldURL.getText());
}catch(IOException ex){
JOptionPane msg = new JOptionPane();
JOptionPane.showMessageDialog(this,"URL地址不正确: " + textFieldURL.getText(),"输入不正确!" ,0);
}
}
void jEditorpane_hyperlinkUpdate(HyperlinkEvent e){
try{
URL url = e.getURL();
jEditorPane.setPage(url); //显示页面内容
textFieldURL.setText(url.toString());
}catch(IOException io){
JOptionPane msg = new JOptionPane();
JOptionPane.showMessageDialog(this,"打开该链接失败!","输入不正确!",0);
}
}
。。。。
。。。。