Parsing HTML using Swing's HTMLEditorKit

Hi all,
I posted this question on the "Java programming", but I think I posted on the wrong forum. So, please let me know if I have posted on the wrong forum, again.
Anyway, I have read an article on parsing HTML using the Swing HTML Parser (http://java.sun.com/products/jfc/tsc/articles/bookmarks/index.html). However, I find that the HTMLEditorKit is unable to understand the <Meta> tag under the <Head> tag? Is this true? I am getting an error message:
javax.swing.text.ChangedCharSetException
at javax.swing.text.html.parser.DocumentParser.handleEmptyTag(DocumentParser.java:172)
at javax.swing.text.html.parser.Parser.startTag(Parser.java:327)
at javax.swing.text.html.parser.Parser.parseTag(Parser.java:1786)
at javax.swing.text.html.parser.Parser.parseContent(Parser.java:1821)
at javax.swing.text.html.parser.Parser.parse(Parser.java:1980)
at javax.swing.text.html.parser.DocumentParser.parse(DocumentParser.java:109)
at javax.swing.text.html.parser.ParserDelegator.parse(ParserDelegator.java:74)
at URLReader.main(URLReader.java:58)
Below is a simple code to write out the html file it reads in:
public static void main(String[] args) throws Exception {
HTMLEditorKit.ParserCallback callback = new HTMLEditorKit.ParserCallback () {
public void handleText(char[] data, int pos) {
try {
System.out.println(data);
} catch (Exception e) {
System.out.println("IOE: " + e);
Reader reader = new FileReader("myFile.html");
new ParserDelegator().parse(reader, callback, false);
The html file that is having a problem reading in is:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>NWS WSR-88D Radar System Transmit/Receive Status</title>
</head>
<p>A <foo>xx</foo>link</html>
If I take away <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">, there is no problem.
Any suggestions? Thanks in advance.

Hi,
Setting the third argument really works!!! Yee..... haa....!!!
WORKING SOLUTION: new ParserDelegator().parse(reader, callback, TRUE);
MANY... MANY THANKS for looking at the problem!!!
Send third argument in parse method as true.

Similar Messages

  • Parsing HTML into DOM using HTMLEditorKit

    I am trying to parse an HTML file using javax.swing.text.html.HTMLEditorKit. My limitations are that I cannot install new libraries like jtidy and I must use a .jsp file, not a servlet. I'm able to get the url and parse it using ParserCallBack, but the new handleText method will not write to the page. Further more I cannot pass anything out of this method to use later because it is void. I want to get some data back from this method or at least do something useful within it. Is that possible?
         java.net.URL url = new java.net.URL("http://" + request.getServerName() + "/" + urls.get(i));
         java.io.InputStream is = url.openStream();
         java.io.InputStreamReader isr = new java.io.InputStreamReader(is);
         java.io.BufferedReader br = new java.io.BufferedReader(isr);
       javax.swing.text.html.HTMLEditorKit.ParserCallback callback =
          new javax.swing.text.html.HTMLEditorKit.ParserCallback () {
            public void handleText(char[] data, int pos) {
                out.println(data);
        new javax.swing.text.html.parser.ParserDelegator().parse(br, callback, false);Attempting to print from within this method gives this error:
    Attempt to use a non-final variable out from a different method. From enclosing blocks, only final local variables are available.
    Maybe I need to try and write the output xml file all from inside the parserCallback?

    Those are rather stupid requirements. Okay, I can see the one about not using external libraries because nobody knows how to deal with the licences. But making you use a JSP instead of a servlet just gets in the way of writing the Java code which you could probably do perfectly well if you didn't have to cram it into a JSP scriptlet. Stupid.
    But anyway: the error message says you need a final local variable. So don't just sit there, give it a final local variable. I forget just what type "out" is supposed to be, but something like "final JSPWriter fakeOut = out", followed by using "fakeOut" rather than "out" should work.

  • How to generate dynamic HTML pages using Swing Application?

    Hello,
    I am writing a Java application to connect to a local light-weight java database. I would like to generate and present a HTML on the fly after selecting records from a database. At server side, I could easily use JSP/Servlet to do this. How can I do this on a desktop client machine using Java application? I do not want to install Apache web server on the desktop machine. Any help will be greatly appreciated. Thanks in advance.
    Dominic

    The way u need to generate your html pages depened on what u want to generate,
    anyway what i can help with, is how to display a generated page.
    u have to use JEditorPane with HTMLEditorKit and HTMLDocument to display any HTML.
    also u can use the methods provided with the above objects to generate your html format.
    I hope I helped.

  • JEditorPane parsing HTML

    Hi all,
    I am using JEditorPane and it's ability to parse HTML, which although is relatively old and crusty is certainly all I need for the job.
    Now, I understand there is a chain of classes involved in taking my .html file and turning popping into a something we can see in a JEditorPane. For example, an img tag, is picked up by HTMLEditorKit and turned into an ImageView for display purposes.
    I want to do the following: I have subclassed HTMLEditorKit, and have overridden the HTMLFactory (although at the moment it just defers everything to super). I want to be able to pick out all of the html comment tags as they go through the HTMLEditorKit :
    <!-- hey hey this is a comment -->... and get to the comment text, "hey hey this is a comment", as a Java string. However I've been digging around with Element for hours now and although my HTMLFactory correctly digs out the comments from the rest of the elements:
    else if (kind == HTML.Tag.COMMENT)
                        {System.out.println("I found a comment but don't know what it said!!");... as you can see, I don't know how to get to the comment text itself.
    The reason why I want access to the comment text is that I want to supplement the HTML code a little bit and add something in the comment that will affect the way it is rendered when I read it depending on the comment - so there's the reason if curious.
    Any help, and I do mean anything at all, would be much appreciated, as this is the last obstacle in my path to getting this thing working :)
    Thanks for your time!
    - Peter

    Here is some old code I have lying around that attempts to iterate through all the elements. If I remember correctly the comment text is found in the AttributeSet of the element:
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.text.*;
    import javax.swing.text.html.*;
    class GetHTML
        public static void main(String[] args)
            EditorKit kit = new HTMLEditorKit();
            Document doc = kit.createDefaultDocument();
            // The Document class does not yet handle charset's properly.
            doc.putProperty("IgnoreCharsetDirective", Boolean.TRUE);
            try
                // Create a reader on the HTML content.
                Reader rd = getReader(args[0]);
                // Parse the HTML.
                kit.read(rd, doc, 0);
                System.out.println( doc.getText(0, doc.getLength()) );
                System.out.println("----");
                // Iterate through the elements of the HTML document.
                ElementIterator it = new ElementIterator(doc);
                Element elem = null;
                while ( (elem = it.next()) != null )
                    AttributeSet as = elem.getAttributes();
                    System.out.println( "\n" + elem.getName() + " : " + as.getAttributeCount() );
                    if ( elem.getName().equals( HTML.Tag.IMG.toString() ) )
                        Object o = elem.getAttributes().getAttribute( HTML.Attribute.SRC );
                        System.out.println( o );
                    Enumeration enum = as.getAttributeNames();
                    while( enum.hasMoreElements() )
                        Object name = enum.nextElement();
                        Object value = as.getAttribute( name );
                        System.out.println( "\t" + name + " : " + value );
                        if (value instanceof DefaultComboBoxModel)
                            DefaultComboBoxModel model = (DefaultComboBoxModel)value;
                            for (int j = 0; j < model.getSize(); j++)
                                Object o = model.getElementAt(j);
                                Object selected = model.getSelectedItem();
                                if ( o.equals( selected ) )
                                    System.out.println( o + " : selected" );
                                else
                                    System.out.println( o );
                    if ( elem.getName().equals( HTML.Tag.SELECT.toString() ) )
                        Object o = as.getAttribute( HTML.Attribute.ID );
                        System.out.println( o );
                    //  Wierd, the text for each tag is stored in a 'content' element
                    if (elem.getElementCount() == 0)
                        int start = elem.getStartOffset();
                        int end = elem.getEndOffset();
                        System.out.println( "\t" + doc.getText(start, end - start) );
            catch (Exception e)
                e.printStackTrace();
            System.exit(1);
        // Returns a reader on the HTML data. If 'uri' begins
        // with "http:", it's treated as a URL; otherwise,
        // it's assumed to be a local filename.
        static Reader getReader(String uri)
            throws IOException
            // Retrieve from Internet.
            if (uri.startsWith("http:"))
                URLConnection conn = new URL(uri).openConnection();
                return new InputStreamReader(conn.getInputStream());
            // Retrieve from file.
            else
                return new FileReader(uri);
    }To test it just use:
    java GetHTML somefile.html

  • Parse HTML document embedded in IFRAME

    Dear fellows:
    How can I access contents of an HTML document embedded in an IFRAME tag, by using java class HTMLEditorKit.Parser?
    It is well known that the contents of such embedded HTML document can be accessed by javascript at front end. However, I am more interested on processing it at backend, using HTMLEditorKit.Parser, or any java swing API.
    Thanks for help.

    The javax.swing.text.html framework barely supports HTML 3.2.

  • DocumentParser parsing HTML ...

    i am parsing HTML of website through this
    HTMLEditorKit.Parser parser = new javax.swing.text.html.parser.ParserDelegator();
    i was able to parse www.yahoo.com
    its html code (first few lines)
    <html><head>
    <script language=javascript>
    var now=new Date,t1=0,t2=0,t3=0,t4=0,t5=0,t6=0,cc='',ylp='';t1=now.getTime();
    </script>
    <title>Yahoo!</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l r (cz 1 lz 1 nz 1 oz 1 vz 1) gen true for "http://www.yahoo.com" r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l r (n 0 s 0 v 0 l 0) gen true for "http://www.yahoo.com" r (n 0 s 0 v 0 l 0))'>
    <base href="http://www.yahoo.com/_ylh=X3oDMTEwZGh2NmNjBF9TAzI3MTYxNDkEdGVzdAMwBHRtcGwDaW5kZXgtdGJs/" target=_top>
    <script language=javascript>------------
    and my corresponding log goes like this ....
    0 DEBUG  [main]  - Start :html
    15 DEBUG  [main]  - Start :head
    15 DEBUG  [main]  - Start :script
    15 DEBUG  [main]  - End :script
    15 DEBUG  [main]  - Start :title
    15 DEBUG  [main]  - End :title
    15 DEBUG  [main]  - meta -- http-equiv=Content-Type content=text/html; charset=UTF-8
    31 DEBUG  [main]  - meta -- http-equiv=PICS-Label content=(PICS-1.1 "http://www.icra.org/ratingsv02.html" l r (cz 1 lz 1 nz 1 oz 1 vz 1) gen true for "http://www.yahoo.com" r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l r (n 0 s 0 v 0 l 0) gen true for "http://www.yahoo.com" r (n 0 s 0 v 0 l 0))
    31 INFO  [main]  - base http://www.yahoo.com/_ylh=X3oDMTEwZGh2NmNjBF9TAzI3MTYxNDkEdGVzdAMwBHRtcGwDaW5kZXgtdGJs/
    31 DEBUG  [main]  - Start :script
    31 DEBUG  [main]  - End :script
    31 DEBUG  [main]  - Start :script
    62 DEBUG  [main]  - End :script
    62 DEBUG  [main]  - Start :style
    62 DEBUG  [main]  - End :style
    62 DEBUG  [main]  - Start :script
    next I parsed www.java.sun.com/index.html
    its html code (first few lines ) goes like this ...
    <html>
    <head>
    <title>Java Technology</title>
    <meta name="keywords" content="Java, platform" />
    <meta name="description" content="Java technology is a portfolio of products that are based on the power of networks and the idea that the same software should run on many different kinds of systems and devices." />
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
    <meta name="date" content="2003-11-23" />
    <link rel="stylesheet" href="/css/default_developer.css" />
    <script type="text/javascript" language="JavaScript" src="/js/popUp.js"></script>
    <script type="text/javascript" language="JavaScript" src="/js/support_incident.js"></script>
    <link href="http://developers.sun.com/rss/java.xml" rel="alternate" type="application/rss+xml" title="rss" />
    </head>
    <!--stopindex-->
    <body leftmargin="0"....-----
    and my corresponding log goes like this ...
    0 DEBUG  [main]  - Start :html
    16 DEBUG  [main]  - Start :head
    16 DEBUG  [main]  - Start :title
    16 DEBUG  [main]  - End :title
    16 INFO  [main]  - meta --- name=keywords content=Java, platform
    16 DEBUG  [main]  - End :head
    16 DEBUG  [main]  - Start :body
    16 DEBUG  [main]  - Simple Tag :linkNow as u can see from the logs that the META TAG of yahoo was read in twice by the Parser while the META TAG of java.sun.com/index.html was read only once.
    One visible difference between the html of these two tags is that the META tag of yahoo page doesnt has a closing tag (isnt well formed) whereas the META tag of java.sun.com is well formed.
    why is the meta tag (of java.sun.com) being ignored by the parser ?
    Is it because of this...
    javax.swing.text.html.parser.Parser.java , method boolean ignoreElement(Element elem) : line 429
    returns true for ignoring meta tag in html file...
    is my problem due to this?
    how can i possibly overcome this :-(
    Code for my Callback class looks like this ...
         HTMLEditorKit.ParserCallback  parserCallback = new HTMLEditorKit.ParserCallback()
              public void handleStartTag(HTML.Tag t, MutableAttributeSet a , int pos)
                   try {
                   if (t==HTML.Tag.A)
                        String hrefValue = (String)a.getAttribute(HTML.Attribute.HREF);
                        logger.log(Level.INFO,t + " " + hrefValue);
                   else
                        logger.log(Level.DEBUG,"Start :"+t  );
                   catch(Exception e){ e.printStackTrace();     }
              public void handleEndTag(HTML.Tag t, int pos)
                   try {
                   logger.log(Level.DEBUG, "End :"+t);
                   catch(Exception e){ e.printStackTrace();     }
              public void handleSimpleTag(HTML.Tag t , MutableAttributeSet a,int pos)
                   try
                   if (t== HTML.Tag.BASE )
                        String hrefValue = (String)a.getAttribute(HTML.Attribute.HREF);
                        logger.log(Level.INFO,t + " " + hrefValue);
                   else if (t == HTML.Tag.FRAME)
                        String srcValue= (String)a.getAttribute(HTML.Attribute.SRC);
                        logger.log(Level.INFO, t +" "+ srcValue);                     
                   else if (t == HTML.Tag.META)
                        String nm = (String)a.getAttribute(HTML.Attribute.NAME);
                        String content = (String)a.getAttribute(HTML.Attribute.CONTENT);
                        if ("keywords".equalsIgnoreCase(nm) || "description".equalsIgnoreCase(nm))
    // i found it
                             logger.log(Level.INFO, t + " --- " + a);
                        else
                             logger.log(Level.DEBUG,t + " -- " + a);
                   else
                        logger.log(Level.DEBUG,"Simple Tag :" + t);
                   catch(Exception e){ e.printStackTrace();     }
         };I want to read the values in meta tag attributes "name" , "content" where <meta name="keywords" content="asdfasdfasdf" > or <meta name="description" content="asdfasdfasdf">
    ?

    ok ...
    then if there is some other way to be able to read in html tags such as meta , a (anchor) , base , frame ( only these tags matter to me ) without being concerned abt the way their html has been coded .............. then plz tell me ...
    searching internet showed that their are html parser that use stringtokenizer kind of ways to read in html ...
    has anyone over here use anything like this ever......

  • HTML with swing

    Hi,
    Is there a swing component to display html?
    How can I display an HTML file within a JFrame ?
    Thanks!

    Here's some sample code for printing a html file inside a JEditorPane.
    private void displayHTMLFile() {     
    /* HTMLEditorKit is used for displaying html files in JEditorPane */
    HTMLEditorKit htmlKit = new HTMLEditorKit();
    JEditorPane editPane = new JEditorPane();
    editPane.setEditorKit( htmlKit );
    editPane.setEditable( false );
    try {
    /* read the html file using an input stream reader */
    InputStreamReader in = new InputStreamReader(
    new FileInputStream( "try.html" ), "iso-8859-1" );
    /* give the input stream reader to the htmlkit to read */
    htmlKit.read( in, editPane.getDocument(), 0 );
    } catch ( Exception e ) {
    System.out.println(e.toString());
    /* display the editor pane inside a scroll pane */
    JScrollPane scroll     = new JScrollPane( editPane );
    getContentPane().add( scroll, "Center" );                    
    }     

  • Parsing HTML files

    Hello,
    I have a question about parsing HTML files. Usually when I get an HTML file and I need to find all the text in it I do this. This stuff just collects all of the hyperlinks and ignores all the html tags just keeping the actual text. It's fine for smaller files but occasionally I'll hit a large online text file and it will work but its way to slow for large files. I don't need to do all of this HTML tag stripping however for text files. Is there a way to still grab all the text without doing any tag searching to make it faster?
    thanks,
    private void find() throws IOException
            //Really slow for large text files.  Need a way to just use a regular scanner on an internet text file
            new ParserDelegator().parse(new InputStreamReader(myBase.openStream()),
                    new ParserListener(),
                    true); 
         * Inner class for processing all "<a href.."> tags when reading a base URL.
        private class ParserListener extends HTMLEditorKit.ParserCallback
            final String IGNORED_LINKS = "^(http|mailto|\\W).*";
            public void handleStartTag (HTML.Tag t, MutableAttributeSet a, int pos)
                if (t == HTML.Tag.A)
                    String href = (String)(a.getAttribute(HTML.Attribute.HREF));
                    //System.out.println(href);
                    //System.out.println(href.matches(IGNORED_LINKS) + "\t" + href);
                    if (! (href == null || href.matches(IGNORED_LINKS)) && !myURLs.contains(href))
                        myURLs.add(href);
                //TODO fix
                if (t == HTML.Tag.TITLE)
                    String title = (String) (a.getAttribute(HTML.Attribute.TITLE));
                    if (!(title == null))
                        myTitle = title;
                    else myTitle = "No title was found";
            public void handleText (char[] data, int pos)
                myText.append(" ");
                myText.append(data);
        }

    JFactor2004 wrote:
    My question is. If I know an html file is actually just a txt fileThis isn't a question. HTML files are text by definition.
    is it possible to look through it (maybe use something similar to a regular scanner) without doing anything with html.That depends on what you mean by "doing something with HTML". You can certainly read it one line at a time.

  • Please see my small code ( parsing html)

    The following code extracts URLs from a webpage. It is working fine for most of the URLs. But not for some, like
    http://www.sun.com/java
    http://www.kraftfoods.com/
    http://www.kitchen-bath.com/
    Actually , I observed for these URLs, they are getting redirected. How can I over come this?
    Thanks.
    Note : there is some redundant code in the program.
    import java.io.*;
    import java.util.regex.*;
    import java.net.*;
    import java.util.*;
    import java.lang.reflect.*;
    import javax.swing.text.html.*;
    import javax.swing.text.*;
    class Out
         public static String[] getLinks(String uriStr) {
    List result = new ArrayList();
         try {
    URL locator = new URL(uriStr);
                   URLConnection connection = locator.openConnection();
                   connection.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Q312461)");
                   connection.connect();
    //               BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
    Reader rd = new InputStreamReader(connection.getInputStream());
    // Parse the HTML
    EditorKit kit = new HTMLEditorKit();
    HTMLDocument doc = (HTMLDocument)kit.createDefaultDocument();
                   doc.putProperty("IgnoreCharsetDirective", Boolean.TRUE);
    kit.read(rd, doc, 0);
    // Find all the A elements in the HTML document
    HTMLDocument.Iterator it = doc.getIterator(HTML.Tag.A);
    while (it.isValid()) {
    SimpleAttributeSet s = (SimpleAttributeSet)it.getAttributes();
    String link = (String)s.getAttribute(HTML.Attribute.HREF);
    if (link != null) {
    // Add the link to the result list
    result.add(link);
    it.next();
    } catch (MalformedURLException e) {
                                  System.out.println("In Out.java");
                             System.out.println(e);
                             e.printStackTrace();
    } catch (BadLocationException e) {                    
                                  System.out.println("In Out.java");
                             System.out.println(e);
                             e.printStackTrace();
    } catch (IOException e) {               
                                  System.out.println("In Out.java");
                             System.out.println(e);
                             e.printStackTrace();
    // Return all found links
    return (String[])result.toArray(new String[result.size()]);
         public static void main(String[] args)
              String links[] = getLinks(args[0]);     
              System.out.println(links.length);
              for(int i = 0 ; i < links.length ; i++)
                   System.out.println(links);

    I made the following changes.Still it is not working.
    URL locator = new URL(uriStr);
    HttpURLConnection connection = (HttpURLConnection)locator.openConnection();
                   connection.setInstanceFollowRedirects(true);
    Can anyone help me??
    Thanks.

  • How can i connect multiple forms using swings or applets(AWT) & with D-Base

    Hello Friends,
    I am Sreedhar from Hyderabad. working as a java developer in a small organization. I got a challenge to work on java stand alone (desktop) application. Basically our company is based on SCM(Supply Chain Management), I never work before using swings and AWT. now my present challenge is to develope an application on swings and AWT using Net Beans IDE. but i am unble find the code to connect one form to another form, i want to develop similar application like a web application , suppose if i click on OK button it has to connect next form. in the next for it has to take user name and password should allow me to access main form. please help me about this topic, if anybody interested i can send u the screen shots and i can post to ur mail. please help me as soon as possible,

    sreedharkommuru wrote:
    Hello Friends,
    I am Sreedhar from Hyderabad. working as a java developer in a small organization. I got a challenge to work on java stand alone (desktop) application. Basically our company is based on SCM(Supply Chain Management), I never work before using swings and AWT. now my present challenge is to develope an application on swings and AWT using Net Beans IDE. but i am unble find the code to connect one form to another form, i want to develop similar application like a web application , suppose if i click on OK button it has to connect next form. in the next for it has to take user name and password should allow me to access main form. please help me about this topic, if anybody interested i can send u the screen shots and i can post to ur mail. please help me as soon as possible,There is no magic, you need to spend a good amount of time in tutorials, here is a good one to start off with:
    [The Really Big Index|http://java.sun.com/docs/books/tutorial/reallybigindex.html]
    Here are a few tips:
    1 - Do not mix AWT and SWING: it'll just cause you headaches in the long run that you cannot fix without refactoring to properly not mix the 2 together.
    2 - You use JDBC to access the database
    3 - You make accessors/constructors to pass parameters that you need from one form to another.
    Have fun.

  • How to use Swing in a Web applicatrion

    Can you suggest me some good PDF or some good site for reading about using SWING in a Web Application.
    In our web application we plan to use JSP/Struts for the presentation layer. However there are a few screens that require some advanced UI like color coded assets and a graphical version of Outstanding Vs Available limit. We are wondering whether we should use SWING for these screens. Do you think this is a good idea or is there a better apprach to deal with this
    What are the disadvantages of using SWING VS JSP/Servlet in a Web environment. Is there a site or pdf where i can get information about this.

    Applet/HTML page combinations are used often when a portion of a page requires Swing/AWT capabilities, e.g. administration consoles for Weblogic and JBoss are designed this way. The page is typically divided with frames that contain either applet or HTML code.
    A

  • Build a xml editor using swing

    I would like to know a simple way to build a xml editor using swing. The editor should present the xml in a tree structure, THe user should be able to modify the xml in the editor and save it.

    Try reading this from [The XML Tutorial|http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JAXPDOM4.html#wp64247] for discovering how to display the XML tree first, this is the first point to build a XMLNotepad like solution.

  • Parsing HTML characters (e.g. &nbsp)

    Hi
    Apologies if I'm missing something obvious, I haven't been able to find an answer searching the API or Forums...
    I'm parsing HTML documents (currently as Strings) to extract certain information. Is there an easy way to replace all special HTML characters such as   < etc. to a space or < respectively without having to do a string replace on every possible HTML character?
    I know there's an HTML parser in swing but that seems to be geared towards creating an HTML editor.
    Any help would be appreciated!

    There are also a number of open source or shareware programs, such as TidyHTML, that clean-up and parse existing HTML. Check out Sourceforge or www.downloads.com.
    - Saish

  • Using swing in Full screen sxclusive mode

    Hi!
    I have created a game which uses swing components.... I have decieded (because it is much cool, and looks nicer) to convert the game to Full screen mode....
    Mycurrent GUI consists of two JPanel s. One of which I use the paintComponent method to draw the game board to the JPanel. The other JPanel is split into several other parts which contain the details about each player.
    Now, what I want to do is to be able to update the graphics using a BufferStrategy. My question is how would I do this? I tried to create a eperate BufferStrategy for the "Board" JPanel, but I can't as JPanel doesn't support getBufferStrategy(). Then I tried to convert the whole "Board" into Canvas. This I could implemnt but as I rendered the image it was drawn over the second JPanel which is to the right of the "Board"
    I was thinking that maybe I could create a FlipBufferStrategy but it's protected and cannot be instantiated in a JPanel.
    So what I'm basically asking is how do you use swing components in Full Screen Exclusive mode and using active rendering?
    For dukes go to http://forum.java.sun.com/thread.jsp?forum=57&thread=394856&tstart=15&trange=15

    Hi,
    in case you don't already know it, here's Suns very own tutorial on that topic:
    http://java.sun.com/docs/books/tutorial/extra/fullscreen/index.html
    JPanel does not support getBufferStrategy() but JFrame (or any other subclass of Window) does. So you could put your JPanel into a JFrame and gain access to the BufferStrategy that way.
    Keep in mind that there is still a serious bug in createBufferStrategy() that can result in a deadlock. Browse the Bug Database for a workaround, I can't find it now, but I know that it is there.
    Last but not least you could post in the Swing Forum, which would be a more suitable place for a Swing question than the Java3D Forum :)
    Regards
    Fleischer

  • Can I Use Swing Components in a JSP Page

    Hi,
    Can I use Swing Componnents in a JSP Page.If so,Can anybody provide with a sample code.
    Thanks.

    hi,
    I wanted to use the JTabbedPane for tab buttons in my
    Jsp Page.Is that possible?I am afraid that you can't.
    As for GUI (graphics) in the HTML page you can use only the html form elements (but you should simulate other behaviours by dynamically reloading the page).-
    Ionel.

Maybe you are looking for