import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.io.*;
/**
*
* @author root
*/
public class Browser extends JFrame implements HyperlinkListener{
public static void main(String[] args) {
new Browser("http://www.guj.com.br");
}
private JEditorPane htmlPane;
private String initialURL;
public Browser(String initialURL) {
super("Web");
this.initialURL = initialURL;
addWindowListener(new ExitListener());
WindowUtilities.setNativeLookAndFeel();
JPanel topPanel = new JPanel();
topPanel.setBackground(Color.lightGray);
JLabel urlLabel = new JLabel("Web");
topPanel.add(urlLabel);
getContentPane().add(topPanel, BorderLayout.NORTH);
try {
htmlPane = new JEditorPane(initialURL);
htmlPane.setEditable(false);
htmlPane.addHyperlinkListener(this);
JScrollPane scrollPane = new JScrollPane(htmlPane);
getContentPane().add(scrollPane, BorderLayout.CENTER);
} catch(IOException ioe) {
warnUser("Serviço temporariamente indisponível!");
}
int width = 220;
int height = 400;
setBounds(width/8, height/8, width, height);
setVisible(true);
}
private void warnUser(String message) {
JOptionPane.showMessageDialog(this, message, "Erro de Conexão",
JOptionPane.ERROR_MESSAGE);
}
public void hyperlinkUpdate(HyperlinkEvent e) {
throw new UnsupportedOperationException("Não implementado");
}
}
e gostaria de poder acessa-lo por traz de um proxy, gostaria de poder fazer essa configuração toda vez que acessar ele.
Pois em um curso tenho um proxy, e no outro tenho um proxy com autenticação, então gostaria de fazer que toda vez ele peça uma configuração de proxy ou se as configurações forem em branco ele conectar diretamente, sem proxy.
Alguem saberia me ajudar?
Obrigado a todos