LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-07-2009, 12:44 PM   #1
manolakis
Member
 
Registered: Nov 2006
Distribution: xubuntu
Posts: 464

Rep: Reputation: 37
a JTappedPane with a web page tab.


Hi there,

Does anybody know how to add to a JTappedPane a tab with a web page in Java. How know how to get the content of a web page with the URL class but I dont actually know how to make a new JPanel with the web page.
Would be really glad for your help.

Thank you.
 
Old 09-08-2009, 09:10 AM   #2
kellinwood
Member
 
Registered: Jan 2006
Location: Culver City, California
Distribution: Fedora
Posts: 64

Rep: Reputation: 21
Add a JEditorPane to your JTabbedPlane. The JEditorPane supports HTML 3.2 and you can call setEditable(false) if you want it to be read only. More information is here: http://java.sun.com/j2se/1.5.0/docs/...ditorPane.html. Be sure to follow the link on that page to the Java Tutorial (lots of good stuff in the tutorial).

Ken
 
Old 09-08-2009, 10:16 AM   #3
indienick
Senior Member
 
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Rep: Reputation: 65
You wouldn't use a JPanel. Most Java classes that can display text also interpret HTML, and allow the text to be marked-up.

I pieced this together, for you:
Code:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.net.*;

public class ScrollableHTMLPane extends JScrollPane {

  private JTextPane textPane;
  private URL htmlPage;

  public ScrollableHTMLPane(String urlToDisplay) {

    try {

      this.textPane = new JTextPane();
      this.htmlPage = new URL(urlToDisplay);

      textPane.setPage(htmlPage);

    } catch (Exception e) {

      e.printStackTrace();

    }

  }

}
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
executing linux commands from web page and outputing it back to the web page ashes_sheldon Programming 9 02-28-2015 12:07 AM
Firefox 3.0.11 hanging when loading page into new tab catkin Linux - Software 11 08-22-2009 06:44 AM
LXer: New Tab Page: Proposed design principles and prototype LXer Syndicated Linux News 0 03-06-2009 01:20 AM
Hyperlinks open a new Firefox tab, but do not render page hairysocks Linux - Software 1 07-04-2008 02:32 PM
web page database access per page or per session? b0uncer Programming 6 01-13-2007 12:09 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:12 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration