Launching Browser From Swing Application - Help Needed

Hi,
I am opening a HTML file in Internet Explorer from my swing application.
I am using the code given below
private final static String WIN_FLAG = "url.dll,FileProtocolHandler";
private final static String WIN_PATH = "rundll32";
String cmd = WIN_PATH + " " + WIN_FLAG + " " + url;
// url is HTML file Path
Process p = Runtime.getRuntime().exec( cmd );
The HTML file is opening up,but it always opens behind the swing application,that makes me every time to maximize the HTML file after it being opened up.
I want to open it in front of the Swing Application.
Any Help Please ?
- Manikandan

Browser Utility - Class to launch a URL in a web browser in
a platform independent manner. Includes an optional swing
GUI allowing user customization. [Open Source - GPL]
http://ostermiller.org/utils/Browser.html
BrowserLauncher - Open the system web browser with
particular attention paid to various Macintosh systems.
(Freeware)
http://browserlauncher.sourceforge.net/
Java World - With a little platform-specific Java code, you
can easily use your system's default browser to display any
URL in Windows or Unix.
http://www.javaworld.com/javaworld/javatips/jw-javatip66.html
JConfig - Class Libraries that allow a URL to be launched in
a browser on Windows, Unix, or Macintosh. [Commercial]
http://www.tolstoy.com/samizdat/jconfig.html
Apple - MRJFileUtils.openURL() not implemented in Mac OS X.
http://developer.apple.com/techpubs/macosx/ReleaseNotes/JavaGMWebReleaseNotes.html#MRJToolkit
Apple - How one would open a URL in a web browser on a
Macintosh.
http://developer.apple.com/qa/java/java12.html

Similar Messages

  • Launching Browser from Swing Applicaton....

    Hi,
    i am launching browser from my swing application.While opening HTML file, always the HTML file goes behind the application.Everytime i have to maximize the html file window.
    i want the HTML file to come up in front of the swing application.
    any help please ??? itz very urgent.....
    Thanks in advance.
    Manikandan

    Browser Utility - Class to launch a URL in a web browser in
    a platform independent manner. Includes an optional swing
    GUI allowing user customization. [Open Source - GPL]
    http://ostermiller.org/utils/Browser.html
    BrowserLauncher - Open the system web browser with
    particular attention paid to various Macintosh systems.
    (Freeware)
    http://browserlauncher.sourceforge.net/
    Java World - With a little platform-specific Java code, you
    can easily use your system's default browser to display any
    URL in Windows or Unix.
    http://www.javaworld.com/javaworld/javatips/jw-javatip66.html
    JConfig - Class Libraries that allow a URL to be launched in
    a browser on Windows, Unix, or Macintosh. [Commercial]
    http://www.tolstoy.com/samizdat/jconfig.html
    Apple - MRJFileUtils.openURL() not implemented in Mac OS X.
    http://developer.apple.com/techpubs/macosx/ReleaseNotes/JavaGMWebReleaseNotes.html#MRJToolkit
    Apple - How one would open a URL in a web browser on a
    Macintosh.
    http://developer.apple.com/qa/java/java12.html

  • How to Call Crystal Reports from Swing Application

    Hi All,
    I have a requirement for calling Crystal Report from Swing Application. Please let me know how can I do that, and also provide the Source code for calling the crystal report.
    Thanks in advance.
    Chandra

    hi
    this is the code that i am using in my application which is similar to urs. but i am working with CR XI so make all the neccessary changes.
        import java.awt.*;
        import javax.swing.*;
        import com.crystaldecisions.ReportViewer.*;
        import com.crystaldecisions.reports.sdk.*;
        import com.crystaldecisions.sdk.occa.report.reportsource.*;
       public class HelloSwing
            public static void createAndShowGUI()
                try
                    //Make sure we have nice window decorations.
                    JFrame.setDefaultLookAndFeelDecorated(true);
                    //Create and set up the window.
                    JFrame frame = new JFrame("HelloWorldSwing");
                    frame.setTitle( "Testing Reports");
                    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                   ReportViewerBean viewer = new ReportViewerBean();
                    viewer.init( new String[0], null, null, null);
                  ReportClientDocument rpt = new ReportClientDocument();
                    rpt.open( "report path", 1 );
                    IReportSource rptSource = rpt.getReportSource();
                    viewer.setReportSource( rptSource );
                    frame.getContentPane().add( viewer, BorderLayout.CENTER );
                    frame.setSize( 700, 500 );
                    frame.setVisible(true);
                    viewer.start();
                catch ( Exception exception )
                    System.out.println( exception.toString() );
            public static void main(String[] args)
                javax.swing.SwingUtilities.invokeLater(new Runnable()
                    public void run()
                        createAndShowGUI();
       there are 23 jar files that u need to import into ur package. but remember that ReportViewerBean should be the first jar file in the list & it should be followed by jrcerom.jar
    specify the key in the CRConfig.xml file (which also has to be imported in the package)
    u can find these jar files in the common objects folder in your program files.
    hope it helps. best of luck

  • HT204266 I deleted safari browser from my iPad 2, need to download again?

    I deleted safari browser from my iPad 2, need to download again?

    Try reset home screen layout:
    Settings>General>Reset>Reset Home Screen Layout.

  • Hello Mac heads.! I just downloaded Onyx for tiger.  All went well.  But I try to launch onyx from my applications and it doesn't offer checking the S.M.A.R.T. status so I can check my disk.  Everything else appears.  Uninstall only, forums, website etc.

    Hello Mac heads.! I just downloaded Onyx for tiger.  All went well.  But I try to launch onyx from my applications and it doesn't offer checking the S.M.A.R.T. status so I can check my disk.  Everything else appears.  Uninstall only, forums, website etc.

    I think you should get Applejack...
    http://www.macupdate.com/info.php/id/15667/applejack
    After installing, reboot holding down CMD+s, (+s), then when the DOS like prompt shows, type in...
    applejack AUTO
    Then let it do all 6 of it's things.
    At least it'll eliminate some questions if it doesn't fix it.
    The 6 things it does are...
    Correct any Disk problems.
    Repair Permissions.
    Clear out Cache Files.
    Repair/check several plist files.
    Dump the VM files for a fresh start.
    Trash old Log files.
    First reboot will be slower, sometimes 2 or 3 restarts will be required for full benefit... my guess is files relying upon other files relying upon other files! :-)
    Disconnect the USB cable from any Uninterruptible Power Supply so the system doesn't shut down in the middle of the process.

  • To exit from swing application(reply soon )

    hi guys,
    what to do to exit from swing application using button or menuitem.
    i have extendd frame.
    i wrote]
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);but it didn't worked.
    thanx.

    hi guys,
    what to do to exit from swing application using
    button or menuitem.
    i have extendd frame.
    i wrote]
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);[
    code]What does that code do? Check the API for JFrame.
    but it didn't worked.No it would not. How do you add a action to a menuitem? (Check the tutorials).
    How do exit the JVM (check the tutorials, and/or the API for System)

  • Help Needed in opening a HTML File from swing application

    Hi,
    I am opening a HTML file in Internet Explorer from my swing application.
    I am using the code given below
    private final static String WIN_FLAG = "url.dll,FileProtocolHandler";
    private final static String WIN_PATH = "rundll32";
    String cmd = WIN_PATH + " " + WIN_FLAG + " " + url;
    // url is HTML file Path
    Process p = Runtime.getRuntime().exec( cmd );
    The HTML file is opening up,but it always opens behind the swing application,that makes me every time to maximize the HTML file after it being opened up.
    I want to open it in front of the Swing Application.
    Any Help Please ?
    - Manikandan

    Check your Application's JFrame properties (may be ur Frame is set to be in top position ,always),and also check running your application in some other OS.

  • Launching Browser from Java when Browser URL is very  long

    Hi,
    I am trying to launch a browser from Java.
    I am doing the following.
    String command = "cmd" + "/c" + "start" + " browserURL";
    Process p = Runtime.getRuntime()exec(command);
    Note: My browserURL is very long.
    Now the browser is invoked. But the URL shown is incomplete and hence
    browser is unable to open the required application.
    Can someone help me in this.
    One way is to increase the buffer size on the command prompt?
    Is there any java command for this?
    Is there any other way to solve this issue.
    Thanks,
    AR

    this is my second time posting this, take note of it. I can't remember where i got it from, but credits go to the person that wrote it. It has helped me out thousands of times!!!
    to use, compile, then call from your program:
    org.newio.utils.BrowserLauncher.openURL("your url here")dfwtc
    package org.newio.utils;
    import java.io.File;
    import java.io.IOException;
    import java.lang.reflect.*;
    public class BrowserLauncher
        private static int jvm;
        private static Object browser;
        private static boolean loadedWithoutErrors;
        private static Class mrjFileUtilsClass;
        private static Class mrjOSTypeClass;
        private static Class macOSErrorClass;
        private static Class aeDescClass;
        private static Constructor aeTargetConstructor;
        private static Constructor appleEventConstructor;
        private static Constructor aeDescConstructor;
        private static Method findFolder;
        private static Method getFileType;
        private static Method makeOSType;
        private static Method putParameter;
        private static Method sendNoReply;
        private static Object kSystemFolderType;
        private static Integer keyDirectObject;
        private static Integer kAutoGenerateReturnID;
        private static Integer kAnyTransactionID;
        private static final int MRJ_2_0 = 0;
        private static final int MRJ_2_1 = 1;
        private static final int WINDOWS_NT = 2;
        private static final int WINDOWS_9x = 3;
        private static final int OTHER = -1;
        private static final String FINDER_TYPE = "FNDR";
        private static final String FINDER_CREATOR = "MACS";
        private static final String GURL_EVENT = "GURL";
        private static final String FIRST_WINDOWS_PARAMETER = "/c";
        private static final String SECOND_WINDOWS_PARAMETER = "start";
        private static final String NETSCAPE_OPEN_PARAMETER_START = " -remote 'openURL(";
        private static final String NETSCAPE_OPEN_PARAMETER_END = ")'";
        private static String errorMessage;
        private BrowserLauncher()
        private static boolean loadClasses()
            switch(jvm)
            default:
                break;
            case 0: // '\0'
                try
                    Class aeTargetClass = Class.forName("com.apple.MacOS.AETarget");
                    macOSErrorClass = Class.forName("com.apple.MacOS.MacOSError");
                    Class osUtilsClass = Class.forName("com.apple.MacOS.OSUtils");
                    Class appleEventClass = Class.forName("com.apple.MacOS.AppleEvent");
                    Class aeClass = Class.forName("com.apple.MacOS.ae");
                    aeDescClass = Class.forName("com.apple.MacOS.AEDesc");
                    aeTargetConstructor = aeTargetClass.getDeclaredConstructor(new Class[] {
                        Integer.TYPE
                    appleEventConstructor = appleEventClass.getDeclaredConstructor(new Class[] {
                        Integer.TYPE, Integer.TYPE, aeTargetClass, Integer.TYPE, Integer.TYPE
                    aeDescConstructor = aeDescClass.getDeclaredConstructor(new Class[] {
                        java.lang.String.class
                    makeOSType = osUtilsClass.getDeclaredMethod("makeOSType", new Class[] {
                        java.lang.String.class
                    putParameter = appleEventClass.getDeclaredMethod("putParameter", new Class[] {
                        Integer.TYPE, aeDescClass
                    sendNoReply = appleEventClass.getDeclaredMethod("sendNoReply", new Class[0]);
                    Field keyDirectObjectField = aeClass.getDeclaredField("keyDirectObject");
                    keyDirectObject = (Integer)keyDirectObjectField.get(null);
                    Field autoGenerateReturnIDField = appleEventClass.getDeclaredField("kAutoGenerateReturnID");
                    kAutoGenerateReturnID = (Integer)autoGenerateReturnIDField.get(null);
                    Field anyTransactionIDField = appleEventClass.getDeclaredField("kAnyTransactionID");
                    kAnyTransactionID = (Integer)anyTransactionIDField.get(null);
                    break;
                catch(ClassNotFoundException cnfe)
                    errorMessage = cnfe.getMessage();
                    return false;
                catch(NoSuchMethodException nsme)
                    errorMessage = nsme.getMessage();
                    return false;
                catch(NoSuchFieldException nsfe)
                    errorMessage = nsfe.getMessage();
                    return false;
                catch(IllegalAccessException iae)
                    errorMessage = iae.getMessage();
                return false;
            case 1: // '\001'
                try
                    mrjFileUtilsClass = Class.forName("com.apple.mrj.MRJFileUtils");
                    mrjOSTypeClass = Class.forName("com.apple.mrj.MRJOSType");
                    Field systemFolderField = mrjFileUtilsClass.getDeclaredField("kSystemFolderType");
                    kSystemFolderType = systemFolderField.get(null);
                    findFolder = mrjFileUtilsClass.getDeclaredMethod("findFolder", new Class[] {
                        mrjOSTypeClass
                    getFileType = mrjFileUtilsClass.getDeclaredMethod("getFileType", new Class[] {
                        java.io.File.class
                    break;
                catch(ClassNotFoundException cnfe)
                    errorMessage = cnfe.getMessage();
                    return false;
                catch(NoSuchFieldException nsfe)
                    errorMessage = nsfe.getMessage();
                    return false;
                catch(NoSuchMethodException nsme)
                    errorMessage = nsme.getMessage();
                    return false;
                catch(SecurityException se)
                    errorMessage = se.getMessage();
                    return false;
                catch(IllegalAccessException iae)
                    errorMessage = iae.getMessage();
                return false;
            return true;
        private static Object locateBrowser()
            if(browser != null)
                return browser;
            switch(jvm)
            case 0: // '\0'
                try
                    Integer finderCreatorCode = (Integer)makeOSType.invoke(null, new Object[] {
                        "MACS"
                    Object aeTarget = aeTargetConstructor.newInstance(new Object[] {
                        finderCreatorCode
                    Integer gurlType = (Integer)makeOSType.invoke(null, new Object[] {
                        "GURL"
                    Object appleEvent = appleEventConstructor.newInstance(new Object[] {
                        gurlType, gurlType, aeTarget, kAutoGenerateReturnID, kAnyTransactionID
                    return appleEvent;
                catch(IllegalAccessException iae)
                    browser = null;
                    errorMessage = iae.getMessage();
                    return browser;
                catch(InstantiationException ie)
                    browser = null;
                    errorMessage = ie.getMessage();
                    return browser;
                catch(InvocationTargetException ite)
                    browser = null;
                    errorMessage = ite.getMessage();
                    return browser;
            case 1: // '\001'
                File systemFolder;
                try
                    systemFolder = (File)findFolder.invoke(null, new Object[] {
                        kSystemFolderType
                catch(IllegalArgumentException iare)
                    browser = null;
                    errorMessage = iare.getMessage();
                    return browser;
                catch(IllegalAccessException iae)
                    browser = null;
                    errorMessage = iae.getMessage();
                    return browser;
                catch(InvocationTargetException ite)
                    browser = null;
                    errorMessage = ite.getTargetException().getClass() + ": " + ite.getTargetException().getMessage();
                    return browser;
                String systemFolderFiles[] = systemFolder.list();
                for(int i = 0; i < systemFolderFiles.length; i++)
                    try
                        File file = new File(systemFolder, systemFolderFiles);
    if(file.isFile())
    Object fileType = getFileType.invoke(null, new Object[] {
    file
    if("FNDR".equals(fileType.toString()))
    browser = file.toString();
    return browser;
    catch(IllegalArgumentException iare)
    browser = browser;
    errorMessage = iare.getMessage();
    return null;
    catch(IllegalAccessException iae)
    browser = null;
    errorMessage = iae.getMessage();
    return browser;
    catch(InvocationTargetException ite)
    browser = null;
    errorMessage = ite.getTargetException().getClass() + ": " + ite.getTargetException().getMessage();
    return browser;
    browser = null;
    break;
    case 2: // '\002'
    browser = "cmd.exe";
    break;
    case 3: // '\003'
    browser = "command.com";
    break;
    case -1:
    default:
    browser = "netscape";
    break;
    return browser;
    public static void openURL(String url)
    throws IOException
    if(!loadedWithoutErrors)
    throw new IOException("Exception in finding browser: " + errorMessage);
    Object browser = locateBrowser();
    if(browser == null)
    throw new IOException("Unable to locate browser: " + errorMessage);
    switch(jvm)
    case 0: // '\0'
    Object aeDesc = null;
    try
    try
    aeDesc = aeDescConstructor.newInstance(new Object[] {
    url
    putParameter.invoke(browser, new Object[] {
    keyDirectObject, aeDesc
    sendNoReply.invoke(browser, new Object[0]);
    catch(InvocationTargetException ite)
    throw new IOException("InvocationTargetException while creating AEDesc: " + ite.getMessage());
    catch(IllegalAccessException iae)
    throw new IOException("IllegalAccessException while building AppleEvent: " + iae.getMessage());
    catch(InstantiationException ie)
    throw new IOException("InstantiationException while creating AEDesc: " + ie.getMessage());
    break;
    finally
    aeDesc = null;
    browser = null;
    case 1: // '\001'
    Runtime.getRuntime().exec(new String[] {
    (String)browser, url
    break;
    case 2: // '\002'
    case 3: // '\003'
    Runtime.getRuntime().exec(new String[] {
    (String)browser, "/c", "start", url
    break;
    case -1:
    Process process = Runtime.getRuntime().exec((String)browser + " -remote 'openURL(" + url + ")'");
    try
    int exitCode = process.waitFor();
    if(exitCode != 0)
    Runtime.getRuntime().exec(new String[] {
    (String)browser, url
    catch(InterruptedException ie)
    throw new IOException("InterruptedException while launching browser: " + ie.getMessage());
    break;
    default:
    Runtime.getRuntime().exec(new String[] {
    (String)browser, url
    break;
    static
    loadedWithoutErrors = true;
    String osName = System.getProperty("os.name");
    if("Mac OS".equals(osName))
    String mrjVersion = System.getProperty("mrj.version");
    String majorMRJVersion = mrjVersion.substring(0, 3);
    try
    double version = Double.valueOf(majorMRJVersion).doubleValue();
    if(version == 2D)
    jvm = 0;
    } else
    if(version >= 2.1000000000000001D)
    jvm = 1;
    } else
    loadedWithoutErrors = false;
    errorMessage = "Unsupported MRJ version: " + version;
    catch(NumberFormatException numberformatexception)
    loadedWithoutErrors = false;
    errorMessage = "Invalid MRJ version: " + mrjVersion;
    } else
    if(osName.startsWith("Windows"))
    if(osName.indexOf("9") != -1)
    jvm = 3;
    } else
    jvm = 2;
    } else
    jvm = -1;
    if(loadedWithoutErrors)
    loadedWithoutErrors = loadClasses();
    suck my balls

  • How do you launch browser from a servlet

    I have an interesting issue here. I send data to a servlet and the servlet recieves and processes the data (confirmed through breakpoints) but I want to display the data in a JSP or directly thru the servlet using html tags.
    However I can forward or redirect the data from the servlet to my jsp code but this still doesn't launch a browser.
    A little more detail... I am not sending information from a JSP to the servlet. The servlet is listening on a port for input, so the servlet is being invoked directly when the data comes in. In the current state my servlet sends the results in a session object to a JSP which gets the results but can't display them since it doesn't launch browser.
    Does anybody know how to display my calculated results from the servlet in a browser?

    Ok let me try to be more specific. I have an application that sends data to the servlet over a socket connection. The servlet gets this data and multiplies it by a factor.
    When I put break points in, I see that the servlet gets this data.
    Now I am trying to display the data in a browser.
    Upon entry to doGet the servlet checks if the String variable that gets the parameter is not null. If it is not null then it forwards to a JSP.
    But I tried a scenario where I have a browser open that has the localhost address of the servlet and then I run the program which is outside the war file that contains the servlet to send data to the servlet, but when the servlet gets the data, it does the forward to the JSP but the page is not displayed. However I see the process move to the JSP thru the break points I put in.
    I know its kind of a weird scenario but I suspect that since the program calls the servlet and it gets the data, it must need to launch a new browser in order to be able to display the JSP it forwarded to.
    I could be wrong but so far I have exhausted all possible ideas in my head for now so if you understand what I am saying perhaps you can tell me if you know a better way to do this...
    Thanks

  • Problem to launch browser from URL

    Hi All,
    I need to launch a web browser from a URL (to send the user from ESS to a benefits provider web site). I created the resource and the service for the URL  in the IMG on R/3 and set it to open the URL on a separate page. I created the links to the URL and they show fine on the iview, but when I click on them, nothing happens.  Does anybody know what I am missing? Do I need to create a URL iview for this? Or how do I do it?
    I will appreciate any help on this.

    Nagaraju,
    thanks for the help. The thred you sent me linked me to another thred which is the one that actually gave me the answer to my problem, but either way you helped me solve the issue. I tried to give you full points but I get an error message that the item is locked for rewarding points, sorry. Either way, this item has been solved.
    Thank you.

  • Data coming from Three Applications and needs to post into SAP

    Hi all,
    i have scenario like
    XI needs to take data from 3 Applications and do some validations like data comparision of comman records and post the comman data among the three to SAP.
    Application1 will send text file and Application2 will send CSV file and Application3 will send xml file
    Ex:
    Application1:
    Emp No
    Emp Name
    Sal
    Location
    Application2:
    Emp No
    Emp Name
    Desgination
    Application3:
    Emp No
    Emp name
    Designation
    Location
    Now the Target data should be
    Emp No
    Emp Name
    Designation
    This is only the comman record which is there from 3 Applications.
    Regards

    Hi vamsi,
      As the experts mentioned above BPM is the way to achieve your business requirement.When you use BPM there is a step to wait till the 3 messages to come into XI to process furthur.Refer to the following links choose the one that is useful to you.
    Check this link for more information...
    http://help.sap.com/saphelp_nw04/helpdata/en/0e/56373f7853494fe10000000a114084/content.htm
    take a look at this blog..
    /people/alexander.bundschuh/blog/2006/01/04/scheduling-messages-in-sap-xi
    For your case yes its not mandatory to create communication channels for each step if the inputfiles are same and from same system..Else you obviously need to create different communication channels for each different file more over you mentioned that files are coming from 3 different application and should be merged.So 3 communication channels are required.
    Refer the following link too to get better understanding on message merge
    Re: BPM - Message merge
    All the best,
    Ram.
    Edited by: Ramakrishna kopparaju on Apr 24, 2009 7:55 PM

  • Compiling Application Help Needed

    Ok, I try compiling with TextPad my first application from the application tutorial (http://developer.java.sun.com/developer/onlineTraining/new2java/divelog/part1) and i get this error:
    C:\Documents and Settings\Nancy Schott\My Documents\Matt's Stuff\Programming\Divelog\DiveLog.java:50: cannot resolve symbol
    symbol : class Welcome
    location: class divelog.DiveLog
    tabbedPane.addTab("Welcome", null, new Welcome(), "Welcome to Dive Log");
    (the error is at the new Welcome() spot)
    1 error
    but it is with all of the tabbedPane.addTab stuff. Could someone help me, because I can not figure it out and the troubleshooting thing at the end of it didn't help.
    I compile useing the default TextPad command. It is something like
    javac $FileDir $File
    which means that for this it is saying
    javac C:\My Documents\Matt's Stuff\Programming\Divelog DiveLog.java
    Please Help!! Thanks

    here is my code for divelog:
    package divelog;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class DiveLog
         private JFrame dlframe; //not assigned yet
         private JTabbedPane tabbedPane; //not assigned yet
         public DiveLog()
              // Create a frame object to add the application GUI components to.
              dlframe = new JFrame("A Java Technology Dive Log");
              // Closes from title bar
              //and from menu
              dlframe.addWindowListener(new WindowAdapter()
                   public void windowClosing(WindowEvent e)
                        System.exit(0);
         // Tabbed pane with panels for Jcomponents
         // Instantiate JTabbedPane with keyword new
         tabbedPane =new JTabbedPane(SwingConstants.LEFT);
         // Calls method to set color
         tabbedPane.setBackground(Color.blue);
         tabbedPane.setForeground(Color.white);
         populateTabbedPane();
         dlframe.getContentPane().add(tabbedPane);
         dlframe.pack();
         dlframe.setSize(765, 690);
         dlframe.setBackground(Color.white);
         dlframe.setVisible(true);
         }// Ends constructor
         // Method header
         private void populateTabbedPane()
              //creates tabs with titles
              tabbedPane.addTab("Welcome", null, new Welcome(), "Welcome to Dive Log");
              //tabbedPane.addTab("Diver Data", null, new Diver(), "Click here to enter diver data");
              //tabbedPane.addTab( "Log Dives", null, new Dives(), "Click here to enter dives");
              //tabbedPane.addTab("Statistics", null, new Statistics(), "Click here to calculate" + " dive statistics");
              //tabbedPane.addTab("Favorite Web Site", null, new WebSite(), "Click here to see a web site");
              //tabbedPane.addTab("Resources", null, new Resources(), "Click here to see a list " + "of resources");
         }//Ends populateTabbedPane method
         private void buildMenu()
              // Opens buildMenu method
              JMenuBar mb = new JMenuBar();
              JMenu menu = new JMenu("File");
              JMenuItem item = new JMenuItem("Exit");
              //Closes the application from the Exit menu item.
              item.addActionListener(new ActionListener()
                   // Opens addActionListener method
                   public void actionPerformed(ActionEvent e)
                        // Opens actionPerformed method
                        System.exit(0);
                   } // Closes actionPerformed method
              }); // Closes addActionListener method
              menu.add(item);
              mb.add(menu);
              dlframe.setJMenuBar(mb);
         } //Ends the buildMenu method
         public static void main(String[] args)
              DiveLog dl = new DiveLog();
    }//Ends Class
    And here is my welcome class
    package divelog;
    import javax.swing.*;
    import java.awt.*;
    public class Welcome extends JPanel
    { // Opens class
    } // Closes class

  • How to send byte array and String values to servlet from Swing application

    Hi all,
    I am new to swing, servlet, and socket connection.
    I have swing application to draw images and some input data. I dont know to send to server.
    byte[] buf = baos.toByteArray();
    URL servletURL = new URL("http://10.70.70.1:8080/servlet/SaveImage)
    URLConnection conn = servletURL.openConnection();
    conn.setDoOutput(true);
    BufferedWriter out = new BufferedWriter( new OutputStreamWriter( conn.getOutputStream() ) );
    out.write(buf&a=aaaa&b=bbbbb);
    out.flush();
    out.close();
    can I do like this. Strings are received in server side perfect. but i cant get byte array data. Please help me.
    Thanks in advance.

    <img src="myservlet">
    In your myservlet:
    response.setContentType("image/jpeg");
    then write your image date via ImageIO that uses response output stream.

  • Open a browser from swing panel

    How can we open a browser from a swing panel? I want to open a browser from my panel, when i hit on a button or a link?
    Second question how can i create a link in a panel?
    Thanks

    odd, someone just asked that:
    http://forum.java.sun.com/thread.jsp?forum=57&thread=555001&tstart=0&trange=15

  • Browser in swing application without JEditorPane

    Hi,
    We are developing a free software for the school
    children.
    In our application, we want to display HTML file into
    swing frame. So we are using class JEditorPane.
    JEditorPane displays the output like a browser but it
    distrubs the alignment of text and image. Even in java
    docs they have accepted it.
    Do you know how to get proper browser in swing to
    display the HTML contents ? I mean how to render HTML
    in swing?
    The matter is bit urgent for us.
    Waiting for the early reply.
    regards,
    Anand Kulkarni

    Take a look at the JDIC project:
    https://jdic.dev.java.net/
    Then take a look at the Browser demo near the bottom of the page.
    JDIC is a project by Sun to get closer ties to the native system. The Browser portion of the project lets you embed IE in a Swing app.

Maybe you are looking for