• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 162
  • Last Modified:

setPage java rss browser question

for browser is a jeditorpane, browserscrollpane is a jscrollpane, and bottompanel is a jpanel,
currently i have this to show a url.      

// Add the Content Panel ("browser")
      browser.setPage("http://www.google.com");
      browserScrollPane.setViewportView(browser);
      bottomPanel.add(browserScrollPane);
      
This doesn't allow me to actually access the site content; it just displays that particular page.  Also, it seems that any css/or mulit-frames pages (www.yahoo.com) won't work as a URL.  how much harder is it to do either of the two things.

Thanks
0
bcsmess
Asked:
bcsmess
1 Solution
 
objectsCommented:
the html support offered by JEditorPane does not support the latest html version.
also you need to implement yourself any navigation etc
0
 
rama_krishna580Commented:
Hi,

Look @ here it may help you..

import java.io.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;

public class TinyBrowser implements ActionListener,HyperlinkListener {
    static Frame frame = new Frame("Hello, world!");
    static JEditorPane browser = new JEditorPane();
    static TextField url = new TextField("http://www.yahoo.com/", 60);
    static Button go = new Button("Go!");

    static public void main(String args[]) {

      JScrollPane editorScrollPane = new JScrollPane(browser);
      editorScrollPane.setVerticalScrollBarPolicy(
                                        JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
      editorScrollPane.setPreferredSize(new Dimension(600,600));


      frame.setLayout(new FlowLayout());
      frame.add(url);
      frame.add(go);
             frame.add(editorScrollPane);

      TinyBrowser me = new TinyBrowser();

      browser.setEditable(false);
      browser.addHyperlinkListener(me);
      go.addActionListener(me);
      go.setActionCommand("go");

      frame.setSize(600,600);
      frame.show();

    }

    public void hyperlinkUpdate(HyperlinkEvent e) {
      if(e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
          try {
            browser.setPage(e.getURL());
            url.setText(e.getURL());
          }
          catch(IOException ioe) {
            System.out.println(e.toString());
          }
      }
    }

    public void actionPerformed(ActionEvent e) {
      if(e.getActionCommand().equals("go")) {
          try {
            browser.setPage(url.getText());
          }
          catch(IOException ioe) {
            System.out.println(ioe.toString());
          }
          frame.repaint();
      }
    }
}

R.K
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now