Displaying HTML in a java application

Is there any other way to display HTML in a java application besides JEditorPane and JLabel (which are fairly restrictive). Its tableing I'm really after.

Eureka!
http://home.earthlink.net/~hheister/

Similar Messages

  • To show a html page from java application

    hi everyone,
    I am trying to show a html page through java application. What i tried is Runtime.getRuntime().exec("start url"); this shows it opens default browser. It works fine for win Nt but does not work on win98 or linux.
    Is there any other way of achieving the same?
    can anyone help me in this regard. I am in urgent need of it. any reply will appreciate.

    I hope this works.
    String urlName = "http://forum.java.sun.com";
    String browser = "iexplore "; //EXE file name --> for iexplore.exe
    Runtime.getRuntime().exec(browser+urlName);

  • Displaying Picture in a Java APPLICATION please help!!

    I have been trying to write a method that Displays a .jpg file when called. However I have not gotten far, every book I have tell you how to display pictures in an applet but not an application. I did find some code that is supposed to be for an application, but It does not compile right. Any help would be apprecidated!
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class PictureIt{
    public void makeImage() {
    //***Image Output Stream
    String imgFile
    = "d:\\temp\\TestImage.jpeg";
    out = new FileOutputStream(imgFile);
    BufferedImage image = null;
    image = (BufferedImage)createImage
    (panelJpeg.size.width, panelJpeg.size.height);
    Graphics g = image.getGraphics();
    panelJpeg.paintAll(g);
    }

    Displaying Picture in a Java APPLICATION please help!!
    Hope this helps.There is going to be two classes compile seperatly first class is what does the drawing
    here it is
    import javax.swing.*;
    import java.awt.*;
    public class draww extends JPanel {
    Image ball;
    int width1 = 100;
    int height1 = 100;
    public draww() {
    super();
    Toolkit kit = Toolkit.getDefaultToolkit();
    ball = kit.getImage("pic1.gif");
    public void paintComponent(Graphics comp) {
    Graphics2D comp2D = (Graphics2D) comp;
    comp2D.drawImage(ball, 20, 20, width1, height1, this);
    sound class is the container JFrame here it is
    import javax.swing.*;
    import java.awt.*;
    public class drawing extends JFrame {
    public drawing() {
    super("draw");
    setSize(400,400);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Container pane = getContentPane();
    draww d = new draww();
    pane.add(d);
    setContentPane(pane);
    setVisible(true);
    public static void main(String[] args) {
    drawing drawing1 = new drawing();
    PS Hope this helps and see you around

  • Get parameters from html page from java application standalone ...

    Hi all,
    I work in one solution that i have values in Html Page and i want get the parameters values from html and cath they in java application standalone.
    The Html page is in same host than de java application.
    I want know if this is possible. I wnat know if without HttpServlet i can get the parameters from Html Page pure.
    Thanks in Advance for the ideas,
    Antonio.

    Hi Abdul,
    The problem is my client want one solution where i have one page simple page Html and one application java standalone. This application runs in one machine, but we don't have web server. So the question is: Is possible without web server i can get the parameters values that is inside the html page from java application. I remember you that the application java is one .jar that run's with one command line from crontab "java -jar teste.jar".

  • Displaying HTML page in an application

    Hello all,
    I want to display an html page in my application. I looked into HotJova HTML Component but Sun doesnt offer this component anymore. Does anyone have any idea of how can I complete this task.
    Any help will be appreciated.
    Thank you

    JTextPane

  • Write HTML Files from java application

    Hello,
    i have to write HTML files from a java application.
    I am asking if anybody can give me a hint about a good simple solution (library) which can do some of the job for me.
    i know FOP for example is good to create pdf or html from xml, but i dont want to go via xml.
    the sites i need are really very simple presents emails.
    body and maybe a link for next and pervious.
    however, thank you in advance.
    a little hint will also help :)
    Sako.

    That, too, is my question.
    Be the "server" local or remote, wouldn't JSPs still
    be the easier solution? No. it will not. because you need a server. Server for a stand alone application is not esier. according to who said JSPs are easy?
    Its very very difficult.
    >
    When answering, please clarify. I'm a bit of a newbie
    here. :)To get sence about how hard is JSP, check Struts. this is very good open source Framework to simplify the JSPs. but it still complecated enough.
    or Tapestry my lovely open srouce Framework.
    its easier than Struts. but sill complecated because of the documentation.
    All in all, using JSP is the purpose of Java in the internet. but not for me. My application will not be available in the internet, i.e. no server, i.e. no need for JSP.
    i hope that helps a little.

  • HTML in a JAVA application

    Hello all
    I have a JAVA program and i have to display an HTML document (with tags and e.t.c.) in the way Internet explorer displays it (with the colors and all that stuff) Can i convert the plain text:
    <HTML>sdfsdf
    <h1>sdfsdf
    to a colored one?
    Thanks in advance!!

    You can try something like this...import java.awt.Component;
    import java.awt.Dimension;
    import java.awt.Toolkit;
    import java.io.File;
    import java.io.IOException;
    import java.net.MalformedURLException;
    import java.net.URL;
    import javax.swing.JEditorPane;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    public class Test extends JFrame
      private JEditorPane htmlPane = new JEditorPane();
      Test(URL url)
        super();
        try
          htmlPane.setPage(url);
        catch (IOException _ex)
          _ex.printStackTrace();
        init();
      private void init()
        JScrollPane s = new JScrollPane(htmlPane);
        JPanel p = new JPanel();
        JFrame frame = new JFrame();
        getContentPane().add(s);
        validate();
        setSize(700, 700);
        centerComponent(this);
        setVisible(true);
      public static void main(String[] args)
        if ( args.length != 1 )
          System.out.println("usage: java Test2 <fileName>");
          return;
        File file = new File(args[0]);
        if ( !file.exists())
          System.out.println("File not found: "+file.getAbsolutePath());
          return;
        try
          URL url = file.toURL();
          JFrame frame = new Test(url);
          frame.setVisible(true);
        catch (MalformedURLException _ex)
          _ex.printStackTrace();
      public static void centerComponent(Component target)
        target.validate();
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        Dimension frameSize = target.getSize();
        frameSize.width  = Math.min(frameSize.width, screenSize.width);
        frameSize.height = Math.min(frameSize.height, screenSize.height);
        target.setLocation(
          (screenSize.width - frameSize.width) / 2,
            (screenSize.height - frameSize.height) / 2);
    }Cheers, HJK

  • How connect an HTML page to a running Java Application?

    Hi,
    Exists a way to connect an HTML page to a running Java Application?
    the idea is, If we use SWT, the Browser widget have an instance of IE/Firefox attached to it, and we load local HTML pages inside, then i wish to have a way to bridge Java Application from HTML page. Then with that we can do follow JScript:
    var javaApp = document.getJavaApplication(); //here is the trick
    //below is like we do today with applets
    var person = container.create("myapp.Person");
    person.setName("Test");
    container.save(person);its great if we can Have an attribute for object tag or anything to conect HTML page to Java Application.

    I think that the better idea is to create a new mime type for that, maybe "application/x-java-connect-to-local-jvm", and use embed tag, to connect via plugin to a running JavaApp
    example:
    <embed type="application/x-java-connect-to-local-jvm" width="20" height="20" mainClass="mypackage.AppName"><br>
    <script>
    var javaApp = document.embeds[0];
    function createPerson()
      var person = javaApp.getNew("mypackage.Person");
      person.setName("test");
      javaApp.save(person);
    }The width and height, isnt necessary, but the view can be used to show red if connection failed and green for sucessfull connections, or maybe embed tag can have src to images for sucessfull and unsucessfull states.
    That's the idea, there is a way to extend Java Plugin to achieve that?
    any tip or idea or to achieve that, are welcome.
    Thanks

  • How to develop JMS Java Application.

    Now,I develop Java Application(J2SE stand alone) to send JMS for JMS Adapter(sender) verification.
    But fatal exception is displayed when I execute Java application.
    Error is rellated to following code.
    InitialContext context = new InitialContext(properties); //&#8592;(SendJMS.java:41)
    Are there wrong points in this code or other necessary settings(for example on Visual administrator) ?
    I think that Java Appli can send Java Message to JMS provider in J2EE(XIserver) by using JNDI.
    Is my thougt wrong?
    Sorry poor English.
    Best regards.
    (Java code)
    Created on 2007/09/06
    To change the template for this generated file go to
    Window>Preferences>Java>Code Generation>Code and Comments
    package jmsPackageS;
    import java.util.Properties;
    import javax.naming.*;
    import javax.jms.*;
    @author sakurai.youkou
    To change the template for this generated type comment go to
    Window>Preferences>Java>Code Generation>Code and Comments
    public class SendJMS {
         public static void main(String[] args) {
              try {
                   //1.JNDI server connection
                   //JNDI server connection property settings
                   java.util.Properties properties = new Properties();
                   properties.put(
                        Context.INITIAL_CONTEXT_FACTORY,
                        "com.sap.engine.services.jndi.InitialContextFactoryImpl");
                   //JNDI server URL
                   properties.put(Context.PROVIDER_URL, "xidevelp:50004");
                   //JNDI login data
                   //properties.put(Context.SECURITY_PRINCIPAL, "J2EE_ADMIN");
                   //properties.put(Context.SECURITY_CREDENTIALS, "mypassword");
                   //start initial context with the properties specified
                   InitialContext context = new InitialContext(properties); //(SendJMS.java:41)
                   //2.Register the connection factory
                   QueueConnectionFactory queueConnectionFactory =
                        (QueueConnectionFactory) context.lookup(
                             "jmsfactory/default/QueueConnectionFactory");
                   //3.Specify the connection type                //JMS provider connection
                   QueueConnection queueConnection =
                        queueConnectionFactory.createQueueConnection();
                   //4.Start the connection
                   //start the connection of Queue type
                   queueConnection.start();
                   //5.Create session
                   //create session of Topic type
                   QueueSession queueSession =
                        queueConnection.createQueueSession(
                             false,
                             Session.AUTO_ACKNOWLEDGE);
                   //6.Create or look up a destination
                   //create destination of Queue type
                   //Queue queue = queueSession.createQueue("Example_destination_name");
                   //look up a destination of Queue type
                   Queue queue =
                        (Queue) context.lookup("jmsqueues/default/sapDemoQueue");
                   //7.sender
                   // create subscriber to a queue
                   QueueSender queueSender = queueSession.createSender(queue);
                   //8.Send message contents
                   TextMessage textMessage = queueSession.createTextMessage();
                   textMessage.setText("Test");
                   //send message
                   queueSender.send(textMessage);
                   //sending message
                   String messageText = textMessage.getText();
                   System.out.println("Send Message text: " + messageText);
                   //Final.close
                   //closes the jms queue session
                   queueSession.close();
                   //Close the queue connection
                   queueConnection.close();
              } catch (NamingException ne) {
                   System.out.println("NamingException: " + ne);
              } catch (JMSException jmse) {
                   System.out.println("JMSException: " + jmse);
              } catch (Exception e) {
                   System.out.println("Error");
    (error message)
    java.lang.NoClassDefFoundError: com/sap/exception/IBaseException
         at java.lang.ClassLoader.defineClass0(Native Method)
         at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
         at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
         at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
         at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
         at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Class.java:219)
         at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:42)
         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:649)
         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
         at javax.naming.InitialContext.init(InitialContext.java:219)
         at javax.naming.InitialContext.<init>(InitialContext.java:195)
         at jmsPackageS.SendJMS.main(SendJMS.java:41)

    Hi Yoko
    have look at  this troubleshooting Pdf's
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/1706a7e3-0601-0010-b4b6-c5641cccc920
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3a83c242-0801-0010-dc95-d496cf6dba9d
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/bd5950ff-0701-0010-a5bc-86d45fd52283
    Thanks !!!

  • Displaying HTML Code

    Hi,
    is it possible to display HTML in a webdynpro application (without using iframe), e.g. I read HTML from database
    <b>bold text</b>
    then
    bold text should displayed in my WD4A.
    Best Regards,
    Marcel

    Hi Marcel,
    I think iFrame UI element should not be used anymore, but nevertheless, since iFrame seems to be the alternative for you at the moment, here is what you can do.
    First of all, are you creating the iFrame dynamically? Or are you creating it in the layout itself? iFrame has a property - 'source'. You need to create a context node with an attribute of type STRING. You can bind this attribute to the 'source' property of the iFrame. If you are creating it in the layout as an UI element, directly bind it to the 'source' property of the iFrame UI element. If you are dynamically creating it, then use the BIND_SOURCE method of class CL_WD_IFRAME to define the binding.
    You could also refer to the [WDP documentation|http://help.sap.com/saphelp_nw70/helpdata/EN/15/c07941601b1d09e10000000a155106/frameset.htm].
    I hope I understood your problem correctly, and was able to provide some insight on the solution.
    Regards,
    Wenonah

  • Executing an HTML file within java program

    I want my java code to be able to open/execute an HTML file that I have. How do you do this?
    Thanks.

    You can display html in a java app, but it is not so simple to run a browser. What you want to look up is the WebBrowser class. Here is an excerpt from some code of mine that displays a url in the browser app in a panel, but there's some chaff in my code you would not be interested in (I'm using a card layout). You're better off loocing up org.jdesktop.jdic.browser which contains the WebBrowser class    /**
         * Reveal the container with the browser display. The browser display is
         * currently hidded using a CardLayout, so it is a simple matter to swap
         * displays; however, we put off actually loading the web page until the
         * first time the display is revealed.
         * @return true if the URL could be resolved and the given web page
         * displayed.
        public boolean showBrowser(
            java.net.URL pURL )
            // See if the web page component has not initialized.
            if ( pWebBrowser == null )
                pWebBrowser = new WebBrowser();
                pBrowserPane.setViewportView( pWebBrowser );
            if ( aLastURLVisited == null || ! aLastURLVisited.equals( pURL ) )
                pWebBrowser.refresh();
                pWebBrowser.setURL( pURL );
                aLastURLVisited = pURL;
            pDualLayout.show( pDualPanel, BROWSER_PANEL );
            return true;
        }

  • Display webPage in java application?

    How do you display HTML format(like contents displayed in a browser) in an Java application?Which swing component do you use and can anyone tell me how to go about with it?? Thanks

    This will answer your question:
    http://java.sun.com/docs/books/tutorial/uiswing/components/label.html

  • Displaying a Message from PL/SQL block to Java Application

    Hi
    How can One display or populate a message in Java Application, that is generated from a PL/SQL block?

    Well, the easiest option would be to have a "message" parameter that gets passed back from the PL/SQL block to the calling Java application.
    I'm guessing, though, that you wouldn't be asking the question if the easy solution was a viable option... If that's the case, you're going to have to describe the problem in a bit more detail...
    Justin

  • Display HTML in Web DynPro Java View

    Hi,
    I have a data in HTML code. It is a full HTML code with the body, head, html.... Now in my Web DynPro i have a section whereby it displayed the message that store in the database table. In that column store all the HTML code. So now in my Web DynPro im using a TextEdit to display the message. It will showed all the HTML code in the TextEdit.
    For example
    <html>
    <head>
    </head>
    <body>
    <p>Testing</p>
    </body>
    </html>
    Is it possible in Web DynPro to display the HTML just like a webpage? As it will convert the HTML code to a readable format.
    Thanks.

    Hi Adrian,
    In case you have formatted text that you wish to be rendered on a Web Dynpro view (but not shown as is) then you should use the FormattedTextView UI element.
    Follow these steps:
    1. Insert a FormattedTextView element in your view.
    2. To define the content of the FormattedTextView, select the text property of your FormattedTextView element and bind the text property to the context attribute which has your HTML content
    When the application is run,  the HTML will be shown as a web page.
    Event onAction is triggered when the user clicks on a link (<a> tag) inside the FormattedTextView. The parameter contains the href attribute of the triggered link.
    The TextEdit UI element will not serve your pupose. Hope this helps.
    Best Regards,
    Supriya

  • Display HTML in Java Applet

    Is it possible to display HTML text in some control in Applet. I do not want to use the swing class for that. please guide me. I am currently using the TextArea to display text which displays text only in a single color. But I want to display text in multicolor. How to do it. If possible please show me with an example.

    You will have to write your own component. Look at java.awt.FontMetrics to get the size of a string. Use
    g.setColor(Color.blue);
    Graphics.drawString(myString,x,y);
    to draw a blue string.

Maybe you are looking for

  • HT201342 how can i change my email address on icloud account, it is already changed on my apple id

    How can I change my email address on icloud, I have already changed it on my apple id, but it still is asking for lmy old email and password and I can not back up or anything?

  • Step-down voltage converter or traval adapters?

    Hi, I am studying in Ireland with my iBook that I bought in the US - as well as a few other US electrical appliances. I have been using step-down voltage converters, but having problems. I just discovered today that I was using too many watts for the

  • How to restore 10.3 files after clean install of 10.4

    I had Mac OS 10.3 and did a clean install to Tiger (10.4) earlier this year. I thought I backed up my Apple Mail, iPhoto and iTunes libraries but I did not do it properly. I lost my attachments, all my photos and tunes. Is there anything that can be

  • Trouble with Satellite P205D-S7454

    I am having trouble installing a OS or the recovery discs on Satellite P205D-S7454.  When I am installing the OS it hangs 10 or 15 mins into the installation of any OS (Windows 7, Vista, Ubuntu Linux). I have removed the battery and tried installing

  • Can't get past Log-In window--Safe Boot

    I'll try and keep this easy/short: My iMac g-5(first Gen i-sight), when upon startup, the wheel would just spin and then the fans would blow turbo while stuck on the spinning wheel. Was running on Tiger but was able to salvage the h/d and all on it,