FileDocCategorySizeDatePackage
WebBrowserFrame.javaAPI DocExample2815Thu Nov 08 00:23:26 GMT 2001com.ora.rmibook.chapter2

WebBrowserFrame

public class WebBrowserFrame extends ExitingFrame

Fields Summary
private JTextArea
_displayArea
private JTextField
_url
private JButton
_fetchButton
Constructors Summary
Methods Summary
private voidaskForPage(java.net.Socket webServer)

        BufferedWriter request;

        request = new BufferedWriter(new OutputStreamWriter(webServer.getOutputStream()));
        request.write("GET / HTTP/1.0\n\n");
        request.flush();
    
private javax.swing.JComponentbuildButtonBar()

        JPanel topPanel = new JPanel(new GridLayout(1, 2));

        _url = new JTextField(40);
        _fetchButton = new ActionButton(new FetchURL());
        topPanel.add(_url);
        topPanel.add(_fetchButton);
        return topPanel;
    
protected voidbuildGUI()

        JPanel newContentPane = new JPanel(new BorderLayout());

        newContentPane.add(buildButtonBar(), BorderLayout.SOUTH);
        newContentPane.add(buildMainPanel(), BorderLayout.CENTER);
        setContentPane(newContentPane);
        setSize(250, 300);
    
private javax.swing.JComponentbuildMainPanel()

        _displayArea = new JTextArea();
        _displayArea.setLineWrap(true);
        JScrollPane scrollPane = new JScrollPane(_displayArea);

        scrollPane.setBorder(new EtchedBorder());
        return scrollPane;
    
private voidreceivePage(java.net.Socket webServer)

        BufferedReader webPage = null;

        webPage = new BufferedReader(new InputStreamReader(webServer.getInputStream()));
        String nextLine;

        while (null != (nextLine = webPage.readLine())) {
            _displayArea.append(nextLine + "\n");
        }
        return;