Tenho o seguinte código:
//ReadServerFile.java
//Esse programa utiliza um JEditorPane para exibir o conteúdo
//de um arqiuvo em servidor
import java.awt.;//classes relacionadas a interface com usuario
import java.awt.event.;
import java.net.;//classes relacionadas a comunicação de dados
import javax.swing.;//classes relacionadas a interface com usuario
import java.io.;//classes relacionadas a entrada/saida
import javax.swing.event.;
public class ReadServerFile extends JFrame{
private JTextField enter;
private JEditorPane contents;
public ReadServerFile(){
super ("Meu Browser");
Container c = getContentPane();
enter = new JTextField ("Entre com a URL aqui");
enter.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent e)
{
getThePage(e.getActionCommand());
}
}
);
c.add(enter, BorderLayout.NORTH);
contents = new JEditorPane();
contents.setEditable(false);
contents.addHyperlinkListener(
new HyperlinkListener(){
public void hyperlinkUpdate(HyperlinkEvent e)
{
if (e.getEventType() ==
HyperlinkEvent.EventType.ACTIVATED)
getThePage(e.getURL().toString());
}
}
);
c.add(new JScrollPane(contents),
BorderLayout.CENTER);
setSize(400,300);
show();
}
private void getThePage(String location){
setCursor(Cursor.getPredefinedCursor(
Cursor.WAIT_CURSOR));
try{
contents.setPage(location);
enter.setText(location);
}
catch(IOException io) {
JOptionPane.showMessageDialog(this,
"Error retrienvin specified URL",
"Bad URL", JOptionPane.ERROR_MESSAGE );
}
setCursor(Cursor.getPredefinedCursor(
Cursor.DEFAULT_CURSOR));
}
public static void main(String args[])
{
ReadServerFile app = new ReadServerFile();
app.addWindowListener(
new WindowAdapter(){
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
}
);
}
}
Apartir dele gostaria que se possivel alguem me explicasse as linhas de comando mais importante desse código, ou seja, qual o efeito de cada uma dessas linhas.
Grato.