Help!!!! JEditorPane and javascript

i am using JEditorPane in my project to display web pages. But JEditorPane does not support javascript, Applet, Shockwave animations.
Is there any way to Support all these things in JEditorPane by extra coding or Using open source code like Mozila's
Rhino ( javascript interpreter ).
Thanks in advance

i am using JEditorPane in my project to display web
pages. But JEditorPane does not support javascript,
Applet, Shockwave animations.
Is there any way to Support all these things in
JEditorPane by extra coding Sure, but it won't be a trivial task, just like creating your own web browser.
or Using open source code like Mozila's
Rhino ( javascript interpreter ).
Thanks in advanceJava 1.6 has Mozila's JavaScript engine built-in:
http://java.sun.com/javase/6/docs/technotes/guides/scripting/programmer_guide/index.html
You may also want to read these:
http://forum.java.sun.com/thread.jspa?threadID=593120&messageID=3108523
http://www.jguru.com/faq/view.jsp?EID=25662

Similar Messages

  • HELP PLASE ! JavaBean and Javascript in frames :)

    Hello,
    First please excuse me for my bad english I'm French think you in advance for your patience and your help ! :)
    To resum the problem :
    I have 2 frames, a menu frame and a main frame
    I use a javabean wich is saved in application variable.
    When the pages of main frame use the javabean there is no probleme.
    BUT when menu frame calls pages of main frame it don't restore the javabean, it looks like je page called by menu frame, which operates on the javabean, wasn't called, and the changes I do in this page aren't saved
    Menu frame uses javascript to calls main frame pages so I think the problem is conjonction of frame and javascript.
    But I have no choice because it's volonty of my boss, so please help me ! :)
    More precisly :
    the javabean : NavigationBean
    page frame menu : menu_page.jsp
    main pages which use javabean : pageA.jsp, pageB.jsp, pageC.jsp
    pageA.jsp has reference on pageB.jsp which has reference on pageC.jsp
    Traitement of the javabean NavigationBean in pageA.jsp, pageB.jsp and pageC.jsp :
    <jsp:useBean      id="gestionNavigation"
              class= "NavigationBean"          
              scope="application">                         
    </jsp:useBean>
    <jsp:setProperty      name="gestionNavigation"
                   property="request"
                   value="<%=request%>" />     
    (it needs response and request to run)
    <jsp:setProperty      name="gestionNavigation"
                   property="response"
                   value="<%=response%>" />
    <jsp:setProperty      name="gestionNavigation"
                   property="pageActuelle"
                   value="<%=urlActuelle%>" />
    (it saves in NavigationBean object the url where user is)
    In pageA I clean all NavigationBean so all pages saved are deleted
    if user go DIRECTLY on pageA.jsp, all is ok :
    user go on
         pageA -> pageB -> pageC
    and NavigationBean save
         pageA -> pageB -> pageC
    That's good ! :)
    BUT if after user go on menu frame it's wrong !
    user go on
         pageA -> pageB -> pageC -> menu_page.jsp -> pageA -> pageB
    BUT NavigationBean save
         pageA -> pageB -> pageC -> pageB
    instead of
         pageA -> pageB
    To resume, for NavigationBean when user go directly on main pages there is no problem, but when it uses menu frame it doesn't save that user go on pageA
    I clean NavigationBean on pageA, but instead of this problem it doesn't clean and retrieve old datas
    It looks like that when user uses menu FRAME it uses an old NavigationBean object, but when it go directly on pages of main frame it runs !
    And I use scope application so don't understand, I have tried session scope but no change :(
    I have tried using "response.encondeURL" but no change
    Think you in advance for your help, and good luck from Paris for all New York people ! :)
    David

    It sounds like what might be happening is when the user goes 'back' to the menu, they're not requesting the page from the server. So, they're either getting the old page cached by the browser. Maybe. If you reload the menu page manually, does it work?

  • Accidently installed NoScript, can't get rid of it and JavaScript has been disabled even though it says it's enabled - help!

    I accidently installed NoScript when trying to remove adverts/pop-ups. Now it's causing problems on various sites I regularly use and I can't get rid of it. It doesn't show up on Tools/Add- ons so I can disable and JavaScript has been disabled, even though it shows as 'Enabled'.
    Help would be appreciated.

    The usual method for uninstalling extensions and themes is by using the Add-ons manager for your Mozilla application, as follows.
    # Click "Tools -> Add-ons
    # Click on the Extensions or Themes button on the top.
    # Click on the extension or theme you want to uninstall.
    # Click Uninstall.
    # Restart your Mozilla application.

  • About XML/XSL and Javascript : Plz Help Urgent

    Hai , I am developing one module which invloves XML database ,XSL and Javascript.
    In this I want to transform XML data to XHTML form using XSLT .,
    I have done this ,(using xsl templates ,In my form two radio buttons one dropdown box and two text boxes are there .).
    All the information which ever is displayed coming from XML .,
    But I want to validate this elements (which are in xslt ,ie checking text box is empty or not ..)
    Where I have to add script in XSL .,
    Plz give simple example on this ,
    I am sending this code ,plz have a look at this ,,
    XML -----+ ---XSLT---------------> XHTML(HTML) (where validation is required)*
    Hotels.xml
    ==============>
    <Services>
         <Service>
              <Hotels type="radio" title="Hotel" groupname="service" default="true"/>
              <HotelsFlights type="radio" title="Flight+Hotel" groupname="service"/>
         </Service>
         <Hotels>
              <Destination title_d="Destination :">          
                   <DestinationPlace type="OPTION" id="" title_d="Select Destination" value_d="Select Destination" defalut="true"/>
                   <DestinationPlace type="OPTION" id="" title_d="Aruba" value_d="Aruba" />
              </Destination>
              <HotelChoice title_hc="Hotels :">
                   <choice type="OPTION" id=" " title_h="AmsterDam Manor Beach" value_h="AmsterDam Manor Beach"/>
                   <choice type="OPTION" id=" " title_h="Wyndham Aruba Beach" value_h="Wyndham Aruba Beach"/>
              </HotelChoice>
              <Dates>
                   <CheckIn type="INPUT" title_dt="Check In :" id="chkin" name="chkin" size_dt="10" maxlength="10">mm/dd/yyyy</CheckIn>
                   <CheckOut type="INPUT" title_dt="Check Out :" name="chkout" size_dt="10" maxlength="10">mm/dd/yyyy</CheckOut>
              </Dates>
              <RoomNos title="No.of Rooms :">
                   <room type="OPTION" id="" titl="1" valu="1"/>
                   <room type="OPTION" id="" titl="1" valu="2"/>
                   <room type="OPTION" id="" titl="1" valu="3"/>
              </RoomNos>
              <Submit tile="Search :" type="submit" id="search" value="Search"/>
         </Hotels>
    </Services>
    Hotels.xsl-
    ------------->
    <?xml version="1.0"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="html"/>
    <xsl:template match="/">
         <html>
         <head>
         <script language="javascript">
         function RadioFunc()
              var result;
              alert(" Radio ");
              result +=document.write("<TABLE >");
              result +=document.write("<TR><TD>"+'Praveen'+"</TD></TR>");
              result +=document.write("</TABLE>");
              alert("Result "+result);
         function validateForm()
              alert("Before validating");
              var chkindate= document.getElementById(chkin).value;
              alert(chkindate);
         </script>
         </head>
         </html>
         <xsl:apply-templates/>
    <xsl:if test="@value_d='Select Destination'">
                        alert("Please Enter Destination");
              </xsl:if>
    </xsl:template>
    <xsl:template match="Services" >
         <form name="myform" action="two.jsp" method="get" >
              <table bgcolor="lightgreen" width="350" height="200" border="1" >
              <tr><td><xsl:apply-templates/></td></tr>
              </table>
         </form>
    </xsl:template>
    <xsl:template match="Service">
         <table border="0" align="center" valign="top"><tr>
         <xsl:for-each select="*">
              <td align="left"><xsl:value-of select="@title"/></td>
              <td align="center">
              <input type="{@type}" onClick="RadioFunc()">
                   <xsl:attribute name="Name">
                        <xsl:value-of select="@groupname"/>
                   </xsl:attribute>
                   <xsl:attribute name="value">
                        <xsl:value-of select="@value"/>
                   </xsl:attribute>
                   <xsl:if test="@default='true'">
                        <xsl:attribute name="checked"/>
                   </xsl:if>
              </input>
              </td>
         </xsl:for-each>
         </tr></table>
    </xsl:template>
    <xsl:template match="Hotels/Destination">
    <xsl:value-of select="@title_d"/>
         <SELECT id="dest" name="dest">
         <xsl:for-each select="*">
              <xsl:element name="{@type}">
                   <xsl:value-of select="@value_d"/>
              </xsl:element>
         </xsl:for-each>     
         </SELECT>
    </xsl:template>
    <xsl:template match="Hotels/HotelChoice">
    <xsl:value-of select="@title_hc"/>
    <SELECT id="hcid" name="hcid">
         <xsl:for-each select="*">
              <xsl:element name="{@type}">
                   <xsl:value-of select="@value_h"/>
              </xsl:element>
         </xsl:for-each>
    </SELECT>
    </xsl:template>
    <xsl:template match="Hotels/Dates">
    <table><tr>
    <xsl:for-each select="*">
              <td>
                   <xsl:value-of select="@title_dt"/>
              </td>
              <td>
              <xsl:element name="{@type}" >
                   <xsl:attribute name="size">
                        <xsl:value-of select="@size_dt"/>
                   </xsl:attribute>
                   <xsl:attribute name="maxlength">
                        <xsl:value-of select="@maxlength"/>
                   </xsl:attribute>
                   <xsl:attribute name="value">
                        <xsl:value-of select="text()"/>
                   </xsl:attribute>
              </xsl:element>
              </td>
    </xsl:for-each>
    </tr></table>
    </xsl:template>
    <xsl:template match="Hotels/RoomNos">
    <table align="center"><th>Travellers</th>
    <tr><td><xsl:value-of select="@title"/></td>
    <td><SELECT id="rooms" name="rooms">
              <xsl:for-each select="*">
                   <xsl:element name="{@type}">
                        <xsl:value-of select="@valu"/>
                   </xsl:element>
              </xsl:for-each>     
    </SELECT>
    </td></tr>
         </table>
    </xsl:template>
    <xsl:template match="Hotels/Submit">
         <table align="center" border="0" >
         <tr>
         <td align="center">
              <input type="{@type}" onclick="validateForm();">
                   <xsl:attribute name="value">
                        <xsl:value-of select="@value"/>
                   </xsl:attribute>
              </input>
         </td>
         </tr>
         </table>
    </xsl:template>
    </xsl:stylesheet>
    ======================================================

    Hi
    This is not the forum for this type of question ...sorry. Try the XMLDB forum, XML DB
    Tim

  • Does JEditorPane support JavaScript, CSS, XHTML, HTML?

    Can anyone confirm what JEditorPane actually can support? I can't find anything specific in the J6SE release notes and most of the stuff of Google is pretty dated, I have also searched the forums but nothing much on there that is recent. According to one post it supports some CSS and HTML but no JavaScript.
    Can anyone confirm this?
    What I plan to do is make a lightweight split pane editor for the above but I also want to be able to preview the code in another pane instead of launching a browser. If there still is no support then can anyone suggest an alternative way to get the same results?
    Failing that I will just have to try and then fall back to the browser but it would be nice to know before hand. The online docs I read don't cover a lot on compatibility.
    Cheers

    the answer is no. the html support in JEditorPane is
    very simple to be able to do things like simple help
    manuals and such. But you may be able to integrate
    the mozilla gecko engine into your application if you
    really want this.
    http://jrex.mozdev.org/
    Hi Gimbal,
    Thanks for the info. The jrex thing certainly looks more like what I am after.
    Cheers

  • Error using java and javascript

    I have a jsp page that links to a bean and is working fine (getting data from the database).
    On a html form I have a button with a picture that fires off javascript when clicked:
    <BUTTON TYPE=reset onclick=showinfo('<%=index%>')>
    <IMG SRC="http://localhost:8080/Portal/Images/q2.bmp" ALT="Info">
    </BUTTON>
    The javascript function just opens a new window and displays the text sent in:
    <Script Language=JavaScript>
    function showinfo(arrayindex)
    InfoWin=window.open("","InfoWin","width=345,height=220");
    InfoWin.document.write(arrayindex);
    return false;
    </Script>
    Well in the above example index is a number (pulled from the database using a java bean and javascript converts it into a string then the function displays it correctly. If I replace <%=index%> with regular text it works fine as well(because java isn't used to pull data)! The problem occurs when I retrieve text data from the database and send it to the function. The web page gives errors about a nonterminating string. But I can move the code to somewhere else on the form(as long as I don't send it to java script) and it will print the text to the screen. I can also view the source of the web page and the html shows the text from the data base as if I hard coded the text into the javascript!!!!!!!!!!!!!!!!!
    This must be a bug between java and javascript!
    -can pass numbers(from a database) between the two
    -can't pass text (from a database)between the two
    Any info would help!

    Found the problem myself!
    I am using an odbc connection to msaccess and the spaces in the text was messing things up!
    After taking out the spaces it worked again.

  • Use of HTML and Javascript within EP

    I have a newbie question:
    I have several HTMl documents with javascript embedded like e.g. various calculators we use on the current website.
    If I want to migrate these html sources to EP content, what can I best do than?
    I assume that all existing html and javascript renders as normal without too many development involved?
    Is there a good example how-To source which I can use to demonstrate this?
    many thanks for your help

    Hi,
    Well there are two options:
    <b>1) If you are interested to make the portal component and then use in Portal.
    2) If you want to use your earlier HTML document as it is inside the portal.</b>
    In case 1 you need to make the Portal objects and then make a portal project. You can use javascript in that as well.
    In case 2 you can directly make the URL iView of the HTML document and then view it from the portal. Well this is not a good way of using your javascript. Personally I suggest you to go for Portal Project.
    I hope this help you!!
    Regards
    Pravesh
    PS: Please consider reewarding points.

  • Apply formatting in a JEditorPane and export the content in HTML.

    Hi,
    I'm writing, a program to allow the user to enter a formated text and even add images in a JEditorPane.
    Here is a simple sample of the code:
    import javax.swing.*;
    import javax.swing.text.*;
    import java.awt.*;              //for layout managers and more
    import java.awt.event.*;        //for action events
    import java.net.URL;
    import java.io.IOException;
    public class EditorPane extends JPanel{
        private String newline = "\n";
        private JPanel buttonPanel;
        private JPanel textPanePanel;
        private JEditorPane myEditorPane;
        private JButton boldButton;
        private JButton colorButton;
        private JButton imgButton;
        private JButton saveButton;
         public EditorPane() {
            createGUI();
        private void createGUI() {
            buttonPanel = new JPanel();
            boldButton = new JButton("Bold");
            boldButton.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    boldButtonActionPerformed(evt);
            colorButton = new JButton("Color");
            colorButton.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    colorButtonActionPerformed(evt);
            imgButton = new JButton("Image");
            imgButton.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    imgButtonActionPerformed(evt);
            saveButton = new JButton("Save");
            saveButton.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    saveButtonActionPerformed(evt);
            buttonPanel.setLayout(new GridLayout(1, 4));
            buttonPanel.add(boldButton);
            buttonPanel.add(colorButton);
            buttonPanel.add(imgButton);
            buttonPanel.add(saveButton);
            textPanePanel = new JPanel();
            textPanePanel.setLayout(new BorderLayout());       
            myEditorPane = this.createEditorPane();
            JScrollPane paneScrollPane = new JScrollPane(myEditorPane);
            textPanePanel.add(paneScrollPane, BorderLayout.CENTER);
            this.setLayout(new BorderLayout());
            this.add(buttonPanel, BorderLayout.NORTH);
            this.add(textPanePanel, BorderLayout.CENTER);
        public static void main(String[] args) {
            javax.swing.SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                     JFrame frame = new JFrame("TextSamplerDemo");
                    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                   EditorPane newContentPane = new EditorPane();
                    //newContentPane.setOpaque(true); //content panes must be opaque
                    frame.setContentPane(newContentPane);
                    frame.pack();
                    frame.setSize(300,300);
                    frame.setVisible(true);
    private JEditorPane createEditorPane() {
            JEditorPane editorPane = new JEditorPane();
            editorPane.setEditable(true);
            java.net.URL helpURL = TextSamplerDemo.class.getResource(
                                            "simpleHTMLPage.html");
            if (helpURL != null) {
                try {
                    editorPane.setPage(helpURL);
                } catch (IOException e) {
                    System.err.println("Attempted to read a bad URL: " + helpURL);
            } else {
                System.err.println("Couldn't find file: simpleHTMLPage.html");
            return editorPane;
        private void boldButtonActionPerformed(java.awt.event.ActionEvent evt) {
        System.out.println("boldButtonNextActionPerformed");
        //myEditorPane
            // TODO add your handling code here:
        private void colorButtonActionPerformed(java.awt.event.ActionEvent evt) {
        System.out.println("colorButtonActionPerformed");
            // TODO add your handling code here:
        private void imgButtonActionPerformed(java.awt.event.ActionEvent evt) {
        System.out.println("imgButtonActionPerformed");
            // TODO add your handling code here:
        private void saveButtonActionPerformed(java.awt.event.ActionEvent evt) {
        System.out.println("saveButtonActionPerformed");
        String newStr = new String("this is the new String");
        //newStr.setFont(new java.awt.Font("Tahoma", 0, 14));
        this.myEditorPane.replaceSelection("sdfsdfsd");
            // TODO add your handling code here:
    }and the HTML Code of simpleHTMLPage.html is
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body>
    <p>Simple text</p>
    <p><strong>Bold text</strong></p>
    <p><em>Italic text</em></p>
    <p align="center">Center text</p>
    <p><font color="#000099"><strong>Color text</strong></font></p>
    <p>image here : <img src="images/Pig.gif" width="121" height="129"></p>
    <p> </p>
    </body>
    </html>By pressing the Save button I can change the selected text.
    I don�t know the way to get and apply the format (size, color �) to only the selected text and display the selected image in real time in the EditorPane. Like if you press the Bold button, the selected text font will be change to bold.
    I would like to get or save the HTML code of the content of the EditorPane by pressing the Save button, How to make it?
    I can apply the formatting on the selected text in a JTextPane, but I don't know the way to save or export the content in HTML. By doing that it could fix my problem too.
    So any help to do that will be much appreciated.
    Thanks.

    Hi,
    Tks for your answer. That one I can do it. I would like to display the selected text in bold instead of adding the tag in the JEditorPane. If I get you right, you get the hole content of the JEditorPane and save it. How did you get it ? And before saving that in the database, did you fing the keysWord to convert the HTML tag in the corresponding entities ?
    Bellow you have a sample of code to make the formatting in the JTextPane.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.text.*;
    import javax.swing.text.Highlighter;
    import javax.swing.event.*;
    import java.util.*;
    import javax.swing.text.*;
    import javax.swing.text.BadLocationException;
    public class MonJTextPane extends JFrame implements CaretListener, ActionListener
              *     Attributs :
         private JTextPane monTextPane;
         private JLabel monLabel;
         private JButton monBouton;
         private StyleAide style; // class qui defini les effets de style de l'editeur
              *     Constructeur :
         public MonJTextPane ()
         {     super ("Aide");
              // construction du composant Texte
              this.style = new StyleAide (new StyleContext ());
              this.monTextPane = new JTextPane ();
              this.monTextPane.setDocument (style);
              this.monTextPane.addCaretListener (this);
              // construction de la fenetre :
              this.getContentPane ().setLayout (new BorderLayout ());
              this.setBounds (150,150,600,550);
              this.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
              this.monLabel = new JLabel ("Auncune ligne saisie...");
              this.monBouton = new JButton ("change de style");
              this.monBouton.addActionListener (this);
              JPanel panel = new JPanel ();
              panel.setLayout (new GridLayout (1,2));
              panel.add (monLabel);
              panel.add (monBouton);
              this.getContentPane ().add (panel, BorderLayout.SOUTH);
              this.getContentPane ().add (this.monTextPane, BorderLayout.CENTER);
              this.setVisible (true);
              *     Methodes :
         private int getCurrentLigne ()
         {     return ( this.style.getNumLigne (monTextPane.getCaretPosition ())+1 );
         public int getCurrentColonne ()
         {     return ( this.style.getNumColonne (monTextPane.getCaretPosition ())+1 );
              *     Methodes CaretListener:
         // ecoute les deplacements du curseur d'insertion
         public void caretUpdate(CaretEvent e)
         {     int debut = java.lang.Math.min (e.getDot (), e.getMark ());
              int fin   = java.lang.Math.max (e.getDot (), e.getMark ());
              this.monLabel.setText ("Ligne numero : "+ this.getCurrentLigne ()+" Colonne : "+this.getCurrentColonne ()+" (debut : "+debut+", fin : "+fin+")");
              *     Methodes ActionListener:
         public void actionPerformed (ActionEvent e)
         {     int start     = monTextPane.getSelectionStart();
              int end          = monTextPane.getSelectionEnd();
              int debut     = java.lang.Math.min (start, end);
              int fin          = java.lang.Math.max (start, end);
              int longueur= fin - debut;
              this.style.changeStyleSurligne (debut, longueur);
         // lance le tout ....
         public static void main (String argv [])
         {     new MonJTextPane ();
    // la Classe DefaultStyledDocument correspond a la classe utilise comme Model pour les
    // composant Texte evolue comme : JTextPane ou JEditorPane
    // en derivant de cette derniere nous pouvons donc redefinir les methodes d'insertion afin de personnalise
    // le style d'ecriture en fonction du texte et creer une methode permettant de modifier le style utilise pour
    // une partie de texte deja ecrite.
    class StyleAide extends DefaultStyledDocument
              *     Constructeur :
         public StyleAide (StyleContext styles)
         {     super (styles);
              initStyle (styles);
              *     Methodes :
         // redefini pour choisir l'effet de style a utiliser
         public void insertString(int offs, String str, AttributeSet a) throws BadLocationException
         {     try
              {     // si le texte insere est egale a HELP le texte s'ecrit avec le style "styleOp"
                   if ( str.equals ("HELP") )
                   {     super.insertString (offs, str, getStyle ("styleOp"));
                   else // sinon le texte est ecrit avec le style "styleNormal"
                   {     super.insertString (offs, str, getStyle ("styleNormal"));
              catch (BadLocationException e)
              {     System.out.println ("Tuuuttt erreur Insere");
         // modifie le style d'ecriture d'un texte deja ecrit compris
         public void changeStyleSurligne (int positionDepart, int longueur)
         {     setCharacterAttributes (positionDepart, longueur, getStyle ("styleKeyWord"), true);
         // le Model d'un composant texte est enregistre sous form d'un arbre
         // cette methode permet de recuperer le noeud root de l'arbre
         private Element getRootElement ()
         {     return this.getDefaultRootElement ();
         // methode permettant d'obtenir la ligne correspondant a un offset donnee
         public int getNumLigne (int offset)
         {     Element eltR = getRootElement ();
              int numLigne = eltR.getElementIndex (offset);
              Element elt  = eltR.getElement (numLigne);
              if ( offset != elt.getEndOffset () )
              {     return numLigne;
              else
              {     if ( numLigne != 0 )
                   {     return numLigne+1;
              return 0;
         public int getNumColonne (int offset)
         {     Element eltR = getRootElement ();
              Element elt = eltR.getElement (eltR.getElementIndex (offset));
              int numColonne = offset-elt.getStartOffset ();
              return numColonne;
         // Defini les differents styles
         private static void initStyle (StyleContext styles)
         {     // definition du style pour le texte normal (brute)
              javax.swing.text.Style defaut = styles.getStyle (StyleContext.DEFAULT_STYLE);
              javax.swing.text.Style styleNormal = styles.addStyle("styleNormal", defaut);
              StyleConstants.setFontFamily (styleNormal, "Courier");
              StyleConstants.setFontSize (styleNormal, 11);
              StyleConstants.setForeground(styleNormal, Color.black);
              javax.swing.text.Style tmp = styles.addStyle("styleKeyWord", styleNormal);
              // Ajout de la couleur blue et du style gras pour les mots cle
              StyleConstants.setForeground(tmp, Color.blue);
              StyleConstants.setBold(tmp, true);
              tmp = styles.addStyle("styleOp", styleNormal);
              // Ajout de la couleur rouge pour le style des operateurs
              StyleConstants.setForeground(tmp, Color.red);
    }But it hard for me to convert it in the corresponding HTML document.
    Did you have and idea
    Tkks

  • Link in new tab opens blank and "javascript:subValue(1)" is seen in the address bar.

    On a specific website, when I left click a link it opens but when trying to open the link in a new tab, the new tab opens blank and "javascript:subValue(1)" is seen in the address bar. This website hosts many, many images which I hope to download using a bulk image save addon but those images must first be in separate tabs. Opening these links in new tabs is vital to the process.

    Certain Firefox problems can be solved by performing a ''Clean reinstall''. This means you remove Firefox program files and then reinstall Firefox. Please follow these steps:
    '''Note:''' You might want to print these steps or view them in another browser.
    #Download the latest Desktop version of Firefox from http://www.mozilla.org and save the setup file to your computer.
    #After the download finishes, close all Firefox windows (click Exit from the Firefox or File menu).
    #Delete the Firefox installation folder, which is located in one of these locations, by default:
    #*'''Windows:'''
    #**C:\Program Files\Mozilla Firefox
    #**C:\Program Files (x86)\Mozilla Firefox
    #*'''Mac:''' Delete Firefox from the Applications folder.
    #*'''Linux:''' If you installed Firefox with the distro-based package manager, you should use the same way to uninstall it - see [[Installing Firefox on Linux]]. If you downloaded and installed the binary package from the [http://www.mozilla.org/firefox#desktop Firefox download page], simply remove the folder ''firefox'' in your home directory.
    #Now, go ahead and reinstall Firefox:
    ##Double-click the downloaded installation file and go through the steps of the installation wizard.
    ##Once the wizard is finished, choose to directly open Firefox after clicking the Finish button.
    Please report back to see if this helped you!

  • Filting html tags, css, and javascript with regex

    hi everyone,
    im writing a small application where a user types in a url, and the text of the webpage is displayed in a text area.
    ive got it to work, however it takes some time, and also alot of content i dont want is displayed - tags, scripts and sometimes css.
    initally i filtered out the html tags with a regular expression, but i still get alot of unwanted content.
    im not a confident java programmer, and the idea of parsing html, css and javascript is the scariest idea ever to me, so my next idea is to keep only everything between the <body> tags - everything above and below it is deleted - hopefully that should leave me only with the visible content on the site.
    ive messed around with regular expressions but i cant get it to work, can anyone help out?
    thanks alot,
    Torre

    Darryl.Burke wrote:
    I tried out the regexes I posted on the source of a forum page, which is not valid html (contains two each opening and closing body tags). With a bit of trial and error I was able to remove everything upto the first, and not the second, opening tag by using a reluctant qualifier, ^.*?, but couldn't for the life of me achieve removal of only the last closing tag, leaving the other, invalid one intact. How would you do that?Regexes always try to match the first occurrence of whatever they're looking for (the sentinel), and there's no way to change that behavior (but it would be handy if you could). What you have to do instead is make sure the rest of the regex can't match the sentinel. For that you need lookahead, and the simplest way to use it is to scan the rest of the text looking for the sentinel and, if it doesn't find one, go ahead and gobble up the remaining text: "(?is)</body>(?!.*</body).*$" However, if there are many occurrences of the sentinel, you could take a serious performance hit. Here's a much more efficient way: "(?is)</body>(?:[^<]++|<(?!/body>))*+$" After matching the sentinel, this regex gobbles up anything that's not the first character of the sentinel, or the first character as long as it isn't followed by the remaining characters of the sentinel. The advantages of this regex are that it never has to backtrack, and the lookahead is only applied when it's necessary, where the first regex applies it every time.

  • Netui tags and javascript

              Hello Gang, not sure if anyone has run into this issue, but here it goes.
              I got a netui:form with netui:checkboxes that I need to have a specific type of
              functionality.
              The first netui:checkbox when checked calls a javascript function that enables
              the remaining netui:checkboxes so that the user can check them.
              Except the first netui:checkbox, all other netui:checkboxes need to be disabled
              at run time and then enabled once the first check box is checked, below is the
              code I got thus far, can't get the diable/enable part to work for the netui tags.
              (Keep in mind that this works well with regular html checkbox tag and javascript)
              The following code wont generate javascript errors.
              It's not doing anything in terms of enabling/disabling the netui:checkboxes.
              <script language="javascript">
              function checkBoxDisable()
              document[getNetuiTagName("updateForm")][getNetuiTagName("tue")].disabled=true;
              document[getNetuiTagName("updateForm")][getNetuiTagName("wed")].disabled=true;
              document[getNetuiTagName("updateForm")][getNetuiTagName("thu")].disabled=true;
              document[getNetuiTagName("updateForm")][getNetuiTagName("fri")].disabled=true;
              function checkboxEnable()
              if (document[getNetuiTagName("updateForm")][getNetuiTagName("mon")].checked)
              document[getNetuiTagName("updateForm")][getNetuiTagName("tue")].disabled=false;
              document[getNetuiTagName("updateForm")][getNetuiTagName("wed")].disabled=false;
              document[getNetuiTagName("updateForm")][getNetuiTagName("thu")].disabled=false;
              document[getNetuiTagName("updateForm")][getNetuiTagName("fri")].disabled=false;
              else
              document[getNetuiTagName("updateForm")][getNetuiTagName("tue")].disabled="true";
              document[getNetuiTagName("updateForm")][getNetuiTagName("wed")].disabled="true";
              document[getNetuiTagName("updateForm")][getNetuiTagName("thu")].disabled="true";
              document[getNetuiTagName("updateForm")][getNetuiTagName("fri")].disabled="true";
              </script>
              <netui:form action="updateContact" tagId="updateForm">
              <netui:checkBox dataSource="{actionForm.accessDays}" defaultValue="{pageFlow.days[0]}"
              tagId="mon" onClick="checkboxEnable()"/>Monday
              <netui:checkBox dataSource="{actionForm.accessDays}" defaultValue="{pageFlow.days[1]}"
              tagId="tue"/>Tuesday
              <netui:checkBox dataSource="{actionForm.accessDays}" defaultValue="{pageFlow.days[2]}"
              tagId="wed"/>Wednesday
              <netui:checkBox dataSource="{actionForm.accessDays}" defaultValue="{pageFlow.days[3]}"
              tagId="thu"/>Thursday
              <netui:checkBox dataSource="{actionForm.accessDays}" defaultValue="{pageFlow.days[4]}"
              tagId="fri"/>Friday
              </netui:form>
              Any help on this will be appreciated ..
              

              Hello Gang, not sure if anyone has run into this issue, but here it goes.
              I got a netui:form with netui:checkboxes that I need to have a specific type of
              functionality.
              The first netui:checkbox when checked calls a javascript function that enables
              the remaining netui:checkboxes so that the user can check them.
              Except the first netui:checkbox, all other netui:checkboxes need to be disabled
              at run time and then enabled once the first check box is checked, below is the
              code I got thus far, can't get the diable/enable part to work for the netui tags.
              (Keep in mind that this works well with regular html checkbox tag and javascript)
              The following code wont generate javascript errors.
              It's not doing anything in terms of enabling/disabling the netui:checkboxes.
              <script language="javascript">
              function checkBoxDisable()
              document[getNetuiTagName("updateForm")][getNetuiTagName("tue")].disabled=true;
              document[getNetuiTagName("updateForm")][getNetuiTagName("wed")].disabled=true;
              document[getNetuiTagName("updateForm")][getNetuiTagName("thu")].disabled=true;
              document[getNetuiTagName("updateForm")][getNetuiTagName("fri")].disabled=true;
              function checkboxEnable()
              if (document[getNetuiTagName("updateForm")][getNetuiTagName("mon")].checked)
              document[getNetuiTagName("updateForm")][getNetuiTagName("tue")].disabled=false;
              document[getNetuiTagName("updateForm")][getNetuiTagName("wed")].disabled=false;
              document[getNetuiTagName("updateForm")][getNetuiTagName("thu")].disabled=false;
              document[getNetuiTagName("updateForm")][getNetuiTagName("fri")].disabled=false;
              else
              document[getNetuiTagName("updateForm")][getNetuiTagName("tue")].disabled="true";
              document[getNetuiTagName("updateForm")][getNetuiTagName("wed")].disabled="true";
              document[getNetuiTagName("updateForm")][getNetuiTagName("thu")].disabled="true";
              document[getNetuiTagName("updateForm")][getNetuiTagName("fri")].disabled="true";
              </script>
              <netui:form action="updateContact" tagId="updateForm">
              <netui:checkBox dataSource="{actionForm.accessDays}" defaultValue="{pageFlow.days[0]}"
              tagId="mon" onClick="checkboxEnable()"/>Monday
              <netui:checkBox dataSource="{actionForm.accessDays}" defaultValue="{pageFlow.days[1]}"
              tagId="tue"/>Tuesday
              <netui:checkBox dataSource="{actionForm.accessDays}" defaultValue="{pageFlow.days[2]}"
              tagId="wed"/>Wednesday
              <netui:checkBox dataSource="{actionForm.accessDays}" defaultValue="{pageFlow.days[3]}"
              tagId="thu"/>Thursday
              <netui:checkBox dataSource="{actionForm.accessDays}" defaultValue="{pageFlow.days[4]}"
              tagId="fri"/>Friday
              </netui:form>
              Any help on this will be appreciated ..
              

  • Problem of Java - javascript and javascript - java communicate of same obje

    Hi all,
    I have met a great problem in program an applet! I have tried to communicate between java and javascript and javascript and java in the same page by using jsobject. However, problem occur. It is not a problem to call javascript from java by using jsobject. However, javascript call java by using document.object.function has problem. It cannot find out the object in IE. I have followed the webpage show in java, but the browser still prompt me the object called client not find. Please help!! My html code is shown as follow:
    <HTML>
    <HEAD>
    <TITLE>Alva Final Year Project Demo</TITLE>
    </HEAD>
    <Script language="javaScript">
    function show(html){
    layer.innerHTML = html;
    function getResponse(response){
    alert("response: " + response);
    document.client.getJSCommunicate();
    </Script>
    <BODY>
    <DIV id="layer" style="position:absolute">
    <H2>Secure Server</H2>
    <HR>
    <!--"CONVERTED_APPLET"-->
    <!-- CONVERTER VERSION 1.0 -->
    <OBJECT id="client" classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
    WIDTH = "800" HEIGHT = "400" codebase="http://java.sun.com/products/plugin/1.1.1/jinstall-111-win32.cab#Version=1,1,1,0">
    <PARAM NAME = CODE VALUE = "ClientPart.class" >
    <PARAM NAME="SCRIPTABLE" VALUE="true">
    <PARAM NAME="MAYSCRIPT" VALUE="true">
    <PARAM NAME="type" VALUE="application/x-java-applet;version=1.1">
    <COMMENT>
    <EMBED type="application/x-java-applet;version=1.1" java_CODE = "ClientPart.class" NAME = "client" WIDTH = "800" HEIGHT = "400" pluginspage="http://java.sun.com/products/plugin/1.1.1/plugin-install.html"><NOEMBED></COMMENT>
    </NOEMBED></EMBED>
    </OBJECT>
    <!--
    <APPLET CODE = "ClientPart.class" WIDTH = "800" HEIGHT = "400" NAME = "clientPart" >
    </APPLET>
    -->
    <!--"END_CONVERTED_APPLET"-->
    </DIV>
    </BODY>
    </HTML>
    Thanks your kindly help.
    Alva

    Everthing looks fine to me from here, you should be able to just call the java function direct such as
    document.myAppletObj.doMethod();
    I think your problem could be that your object is called "client". IE can get funny about names, it didn't like me calling a method delete()!!
    Try adding something else to the name such as "my_client", and see if this works any better.
    Chris

  • HTMLEditorKit : How you handle FRAMES, IFRAMES and JAVASCRIPT

    Hi all,
    Currently im using the HTMLEditorKit to parse through the HTML page. Obviously its easier when the elements are on the body of the page. But what if the page has frames,iframes or javascript and i want to extract links that these elements reference to. How do i do it? I know some of you would recommend my class to extend the parsercallback class. But is there a way for example i can use 3 or even 4 different iterators each pointing to the different elements ?
    and lets say if i reference to a SCRIPT tag of the HTML, how do i extract the possible URLs in it. Same goes for iFrames and JavaScripts. Can anyone please help me with this ?

    Tim,
    The form action needs to be the page URL. The INPUT fields/objects of your form will be sent as parameters when the form is submitted. These parameters can be read by your portlet by using the parameter passing PDK services. It is recommended to use qualified parameters in case the portlet that reads the parameters is the same as the one that has submitted them.
    As far as I remember the parameter passing sample portlet contains similar code to what you're looking for.

  • Help Library Requires Javascript

    Whenever I try to use the Logic Pro 9 online Help from the menu bar Help item, I get the message
    The Help Library requires JavaScript.
    If JavaScript is not enabled, you will not be able to view all the content.
    So how do I enable JavaScript?

    A bunch of us have had this problem, too. The solution I found in another of the notes dealing with this was to open a Terminal window, and enter the line:
    defaults write com.apple.helpviewer WebKitJavaScriptEnabled 1

  • Help: JEditorPane displays all HTML content centered

    I'm using a JEditorPane to display the contents of a simple help file written in HTML.
    The problem is that the help file is displayed with all elements centered! That is, every element is displayed as if it had the <CENTER></CENTER> tags around it. The page is not written this way, and displays normally in regular web browsers.
    It's a really simple help page, and was written by hand. I have checked, and all of the tags used in the page conform to HTML 3.2. Does anyone know what might be causing this problem?
       private JEditorPane createEditorPane()
          JEditorPane editorPane = new JEditorPane();
          editorPane.setEditable(false);
          editorPane.addHyperlinkListener(new Hyperactive());
          if (theHelpFile != null)
             try
                editorPane.setPage(theHelpFile); //This is a string, the URL to the file
             } //end try
             catch (Exception e)
                System.out.println(e.getMessage());
                System.err.println("Bad URL: " + theHelpFile);
             } //end catch
          } //end if
          else
             System.err.println("Couldn't find file: "+theHelpFile);
          } //end else
          return editorPane;
       } //end createEditorPane

    If you are using the standard HTMLEditorKit that comes along with JEditorPane, you should note that it only supports HTML 3.2. This may be the problem. Check page source if div's and similar are used or if the page has "HTML 3.2"-old elements like table's or similar to control layout/display.

Maybe you are looking for

  • Unable to find this Oracle document ID 1277924.1

    Hi All, Unable to find the below document provided by Oracle Support WebCenter Page Hangs with Web Page Layout Components Referring to JSF Pages (Doc ID 1277924.1) Any help will be appreciated. Thanks, Somnath

  • Superdrive not able to read DVDs or CDs

    I'm having an iMac G5, running MacOs 10.4.3 with an Matshita DVD-R UJ-846. Since quite some time now I'm not able to read inserted DVDs or CDs. Either a dialogue box appears telling me I've inserted a blank disk or nothing appears and I have to find

  • How do I get iTunes to remove a charge for something I did not want to auto renew?

    How do I get iTunes to remove a charge from my chacking account for an auto renew item that I do not want?

  • Workitems getting stuck at expired users

    Hi, We have a case where workitems get stuck because the assigned users have expired validity. At the time of assignment, one user is set as agent. Then that user gets set to expired, however the Workitem still is assigned to that one user. This will

  • Spry menu hover fundtions

    I am trying to create a horizontal drop down menu with some items that have submenus and some that don't. I have set the "ul.MenuBarHorizontal a:hover, ul.MenuBarHorizontal a:focus" to show the background colour #33C but when I point the mouse over t