Results 1 to 8 of 8
Thread: WebPage problem
- 06-01-2012, 06:56 PM #1
Member
- Join Date
- Apr 2012
- Posts
- 68
- Rep Power
- 0
WebPage problem
I am trying to view this webpage in a pane but it gives me errors every time i try each time the errors are different
Java Code:import javax.swing.*; import java.io.*; public class test { public static void main(String[] args) { JEditorPane jep = new JEditorPane(); jep.setEditable(false); try { jep.setPage("http://www.google.com"); } catch (IOException e) {e.printStackTrace();} JScrollPane scrollPane = new JScrollPane(jep); JFrame f = new JFrame("webpage"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(scrollPane); f.setSize(512, 342); f.show(); } }
- 06-01-2012, 06:58 PM #2
Re: WebPage problem
Can you post the text of some of the errors?it gives me errorsIf you don't understand my response, don't ignore it, ask a question.
- 06-01-2012, 07:07 PM #3
Moderator
- Join Date
- Jul 2010
- Location
- California
- Posts
- 1,609
- Rep Power
- 5
Re: WebPage problem
Post the error....and read the API for JEditorPane. If you are using less the JDK7, there is no setPage(String) method (compile time error). If you are using JDK7, you need to pass a valid URL (runtime error). Are you trying to set the text, or read a URL and set the content of the JEditorPane to the content of that URL?
- 06-01-2012, 09:08 PM #4
Member
- Join Date
- Apr 2012
- Posts
- 68
- Rep Power
- 0
Re: WebPage problem
here is the error
java.net.SocketException: Address family not supported by protocol family: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Du alStackPlainSocketImpl.java:69)
at java.net.AbstractPlainSocketImpl.doConnect(Abstrac tPlainSocketImpl.java:337)
at java.net.AbstractPlainSocketImpl.connectToAddress( AbstractPlainSocketImpl.java:198)
at java.net.AbstractPlainSocketImpl.connect(AbstractP lainSocketImpl.java:180)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.j ava:157)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.j ava:391)
at java.net.Socket.connect(Socket.java:579)
at java.net.Socket.connect(Socket.java:528)
at sun.net.NetworkClient.doConnect(NetworkClient.java :180)
at sun.net.http://www.http.HttpClient.openServe...ient.java:388)
at sun.net.http://www.http.HttpClient.openServe...ient.java:483)
at sun.net.www.http.HttpClient.<init>(HttpClient.java :213)
at sun.net.www.http.HttpClient.New(HttpClient.java:300)
at sun.net.www.http.HttpClient.New(HttpClient.java:316)
at sun.net.http://www.protocol.http.HttpURLConn...tion.java:992)
at sun.net.http://www.protocol.http.HttpURLConn...tion.java:928)
at sun.net.http://www.protocol.http.HttpURLConn...tion.java:846)
at sun.net.http://www.protocol.http.HttpURLConn...ion.java:1296)
at java.net.HttpURLConnection.getResponseCode(HttpURL Connection.java:468)
at javax.swing.JEditorPane.getStream(JEditorPane.java :736)
at javax.swing.JEditorPane.setPage(JEditorPane.java:4 35)
at javax.swing.JEditorPane.setPage(JEditorPane.java:8 83)
at test.main(test.java:12)
- 06-01-2012, 09:20 PM #5
Re: WebPage problem
The code works for me using:
D:\Java\jdk1.6.0_29\bin\javac.exe
D:\Java\jdk1.6.0_29\bin\java.exeIf you don't understand my response, don't ignore it, ask a question.
- 06-01-2012, 10:25 PM #6
Moderator
- Join Date
- Jul 2010
- Location
- California
- Posts
- 1,609
- Rep Power
- 5
Re: WebPage problem
is not a valid URL (or a valid string to compile). Pass an appropriate URL, and perhaps describe what exactly your goals are. Your call is the same as calling:Java Code:"<a class="linkification-ext" href="http://www.google.com" title="Linkification: h...."
URL url = new URL("<a class="linkification-ext" href="http://www.google.com" title="Linkification: h...");
URLConnection conn = url.openConnection();
which a) won't compile and b) will throw an exception (however I'd expect it to be a MalformedURLException).
- 06-13-2012, 10:21 PM #7
Member
- Join Date
- Apr 2012
- Posts
- 68
- Rep Power
- 0
Re: WebPage problem
it worked one time and then stopped working
- 07-16-2012, 09:03 PM #8
Re: WebPage problem
My API:Java Code:cat > a.out || cat > main.class
Similar Threads
-
loading webpage
By juhiswt in forum New To JavaReplies: 0Last Post: 03-17-2011, 06:37 PM -
Serving up a Webpage
By kammce in forum NetworkingReplies: 7Last Post: 01-01-2011, 02:57 AM -
Add a Swing UI in a WebPage
By ivvgangadhar in forum AWT / SwingReplies: 9Last Post: 06-30-2009, 08:16 AM -
save a webpage.....?
By 05bit044 in forum NetworkingReplies: 1Last Post: 08-04-2008, 04:49 PM -
problem in playing mp3 on webpage which was recorded as wav and converted into mp3
By sandeepk84@gmail.com in forum Advanced JavaReplies: 3Last Post: 10-31-2007, 11:47 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks