How To Call HTML Page Through Java Swing Page  ???....

Hi All ;
Please Can You Tell Me How To Call HTML Page Through Java Swing Page ....
Regards ;

Hi,
you can use HTML fragments on a panel.
http://java.sun.com/docs/books/tutorial/uiswing/components/html.html
However, to integrate a browser you need 3rd party software like IceBrowser
If you Google for: HTML Swing
then you find many more hints
Frank

Similar Messages

  • How  to  save  content of a  whole  swing  page

    Hi everyone ..
    can any of u tell me ,how to save contents of a java swing page in a single file with all components viz . textfield,textarea,JTable,JPanel etc .. with their respective formatting ie.e Font,Color etc ..
    Plz let me know it soon .. its very urgent ..
    Can I save it as Screenshot or Jpeg Image .. or how to go about it .
    Mohit

    Sure: see below!
    WARNING: this code will not compile as is because it uses some other classes from my personal code library (FileUtil & StringUtil). The particular methods of those classes which are used below are trivial methods that anyone can write, which is is why I have not posted them as well. So, to get the code below to compile, you can
    a) write your own versions of these classes or
    b) simply add the necessary methods to this class or
    c) simply comment out their usage (in the case of StringUtil, which is just used for arg checking)
    But if you still want me to post them, then I can post the relevant fragments of those classes.
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.*;
    import java.io.*;
    import javax.imageio.*;
    import javax.swing.*;
    import bb.io.FileUtil;
    import bb.util.StringUtil;
    * Class which supports taking screen shots of the entire desktop, AWT Components, or Swing JComponents.
    * This functionality is implemented in a series of <code>take</code> methods, each of which returns a BufferedImage.
    * This class also offers convenience <code>write</code> methods for storing BufferedImages to files.
    * <p>
    * The images taken by this class should be the precise images seen on the screen.
    * <b>However, the images written to files may deviate from the originals.</b>
    * One obvious cause is limitations of the chosen file format (especially with lossy formats like jpeg).
    * A subtle issue can occur, however, even when using lossless formats like png:
    * if the file is subsequently opened by another application,
    * that application may rescale the image, which can often cause visible artifacts.
    * <blockquote>
    *     To see this last problem on Windows XP,
    *     call {@link #take()} which returns an image of the entire desktop and write it to a file,
    *     and then open the file with XP's default graphics file viewer ("Windows Picture And Fax Viewer").
    *     This program shrinks the desktop image in order to fit it inside the program's window,
    *     and rescaling artifacts are readily seen, especially if the desktop image has any kind of text in it.
    *     If "Windows Picture And Fax Viewer" instead cropped the image or had a scroll pane, then this should not happen.
    * </blockquote>
    * <p>
    * Acknowledgement: this class was inspired by the program
    * <a href="http://www.discoverteenergy.com/files/ScreenImage.java">ScreenImage</a>.
    * Differences from the above program:
    * <ol>
    *  <li>this class uses {@link BufferedImage#TYPE_INT_ARGB} instead of {@link BufferedImage#TYPE_INT_RGB} in order to preserve alpha</li>
    *  <li>this class's {@link #formatNameDefault default image file format} is PNG instead of JPEG</li>
    *  <li>this class's <code>take</code> methods simply take snapshots and never have the side effect of writing image files</li>
    *  <li>this class added a version of <code>take</code> which can get a snapshot of a region of a Component</li>
    *  <li>
    *          when taking a snapshot of a region of a Component or JComponent,
    *          the Rectangle that specifies the region always has coordinates relative to the origin of the item
    *  </li>
    * </ol>
    * See also:
    * <a href="http://forum.java.sun.com/thread.jspa?forumID=57&threadID=597936">forum discussion #1 on screen shots</a>
    * <a href="http://forum.java.sun.com/thread.jspa?forumID=256&threadID=529933">forum discussion #2 on screen shots</a>
    * <a href="http://forum.java.sun.com/thread.jspa?forumID=57&threadID=622393">forum discussion #3 on screen shots</a>.
    * <p>
    * It might appear that this class is multithread safe
    * because it is immutable (both its immediate state, as well as the deep state of its fields).
    * However, typical Java gui code is not multithread safe, in particular, once a component has been realized
    * it should only be accessed by the event dispatch thread
    * (see <a href="http://java.sun.com/developer/JDCTechTips/2003/tt1208.html#1">Multithreading In Swing</a>
    * and <a href="http://java.sun.com/developer/JDCTechTips/2004/tt0611.html#1">More Multithreading In Swing</a>).
    * So, in order to enforce that requirement, all methods of this class which deal with components
    * require the calling thread to be the event dispatch thread.
    * See the javadocs of each method for its thread requirements.
    * <p>
    * @author bbatman
    public class ScreenShot {
         // -------------------- constants --------------------
         * Defines the image type for the BufferedImages that will create when taking snapshots.
         * The current value is {@link BufferedImage#TYPE_INT_ARGB}, which was chosen because
         * <ol>
         *  <li>the 'A' in its name means that it preserves any alpha in the image (cannot use the "non-A" types)</li>
         *  <li>the "_INT" types are the fastest types (the "BYTE" types are slower)
         * </ol>
         * @see <a href="http://forum.java.sun.com/thread.jspa?threadID=709109&tstart=0">this forum posting</a>
         private static final int imageType = BufferedImage.TYPE_INT_ARGB;
         * Default value for the graphics file format that will be written by this class.
         * The current value is "png" because the PNG format is by far the best lossless format currently available.
         * Furthermore, java cannot write to GIF anyways (only read).
         * <p>
         * @see <a href="http://www.w3.org/TR/PNG/">Portable Network Graphics (PNG) Specification (Second Edition)</a>
         * @see <a href="http://www.w3.org/QA/Tips/png-gif">GIF or PNG</a>
         * @see <a href="http://www.libpng.org/pub/png/">PNG Home Site</a>
         public static final String formatNameDefault = "png";
         // -------------------- take --------------------
         // desktop versions:
         * Takes a screen shot of the entire desktop.
         * <p>
         * Any thread may call this method.
         * <p>
         * @return a BufferedImage representing the entire screen
         * @throws AWTException if the platform configuration does not allow low-level input control. This exception is always thrown when GraphicsEnvironment.isHeadless() returns true
         * @throws SecurityException if createRobot permission is not granted
         public static BufferedImage take() throws AWTException, SecurityException {
              Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
              Rectangle region = new Rectangle(0, 0, d.width, d.height);
              return take(region);
         * Takes a screen shot of the specified region of the desktop.
         * <p>
         * Any thread may call this method.
         * <p>
         * @param region the Rectangle within the screen that will be captured
         * @return a BufferedImage representing the specified region within the screen
         * @throws IllegalArgumentException if region == null; region's width and height are not greater than zero
         * @throws AWTException if the platform configuration does not allow low-level input control. This exception is always thrown when GraphicsEnvironment.isHeadless() returns true
         * @throws SecurityException if createRobot permission is not granted
         public static BufferedImage take(Rectangle region) throws IllegalArgumentException, AWTException, SecurityException {
              if (region == null) throw new IllegalArgumentException("region == null");
              return new Robot().createScreenCapture( region );     // altho not currently mentioned in its javadocs, if you look at its source code, the Robot class is synchronized so it must be multithread safe, which is why any thread should be able to call this method
         // AWT Component versions:
         * Takes a screen shot of that part of the desktop whose area is where component lies.
         * Any other gui elements in this area, including ones which may lie on top of component,
         * will be included, since the result always reflects the current desktop view.
         * <p>
         * Only {@link EventQueue}'s {@link EventQueue#isDispatchThread dispatch thread} may call this method.
         * <p>
         * @param component AWT Component to take a screen shot of
         * @return a BufferedImage representing component
         * @throws IllegalArgumentException if component == null; component's width and height are not greater than zero
         * @throws IllegalStateException if calling thread is not EventQueue's dispatch thread
         * @throws AWTException if the platform configuration does not allow low-level input control. This exception is always thrown when GraphicsEnvironment.isHeadless() returns true
         * @throws SecurityException if createRobot permission is not granted
         public static BufferedImage take(Component component) throws IllegalArgumentException, IllegalStateException, AWTException, SecurityException {
              if (component == null) throw new IllegalArgumentException("component == null");
              if (!EventQueue.isDispatchThread()) throw new IllegalStateException("calling thread (" + Thread.currentThread().toString() + ") is not EventQueue's dispatch thread");
              Rectangle region = component.getBounds();
              region.x = 0;     // CRITICAL: this and the next line are what make region relative to component
              region.y = 0;
              return take(component, region);
         * Takes a screen shot of that part of the desktop whose area is the region relative to where component lies.
         * Any other gui elements in this area, including ones which may lie on top of component,
         * will be included, since the result always reflects the current desktop view.
         * <p>
         * Only {@link EventQueue}'s {@link EventQueue#isDispatchThread dispatch thread} may call this method.
         * <p>
         * @param component AWT Component to take a screen shot of
         * @param region the Rectangle <i>relative to</i> component that will be captured
         * @return a BufferedImage representing component
         * @throws IllegalArgumentException if component == null; component's width and height are not greater than zero; region == null
         * @throws IllegalStateException if calling thread is not EventQueue's dispatch thread
         * @throws AWTException if the platform configuration does not allow low-level input control. This exception is always thrown when GraphicsEnvironment.isHeadless() returns true
         * @throws SecurityException if createRobot permission is not granted
         public static BufferedImage take(Component component, Rectangle region) throws IllegalArgumentException, IllegalStateException, AWTException, SecurityException {
              if (component == null) throw new IllegalArgumentException("component == null");
              if (region == null) throw new IllegalArgumentException("region == null");
              if (!EventQueue.isDispatchThread()) throw new IllegalStateException("calling thread (" + Thread.currentThread().toString() + ") is not EventQueue's dispatch thread");
              Point p = new Point(0, 0);
              SwingUtilities.convertPointToScreen(p, component);
              region.x += p.x;
              region.y += p.y;
              return take(region);
         // Swing JComponent versions:
         * Takes a screen shot of <i>just</i> jcomponent
         * (no other gui elements will be present in the result).
         * <p>
         * Only {@link EventQueue}'s {@link EventQueue#isDispatchThread dispatch thread} may call this method.
         * <p>
         * @param jcomponent Swing JComponent to take a screen shot of
         * @return a BufferedImage representing jcomponent
         * @throws IllegalArgumentException if jcomponent == null
         * @throws IllegalStateException if calling thread is not EventQueue's dispatch thread
         public static BufferedImage take(JComponent jcomponent) throws IllegalArgumentException, IllegalStateException {
              if (jcomponent == null) throw new IllegalArgumentException("jcomponent == null");
              if (!EventQueue.isDispatchThread()) throw new IllegalStateException("calling thread (" + Thread.currentThread().toString() + ") is not EventQueue's dispatch thread");
              Dimension d = jcomponent.getSize();
              Rectangle region = new Rectangle(0, 0, d.width, d.height);
              return take(jcomponent, region);
         * Takes a screen shot of <i>just</i> the specified region of jcomponent
         * (no other gui elements will be present in the result).
         * <p>
         * Only {@link EventQueue}'s {@link EventQueue#isDispatchThread dispatch thread} may call this method.
         * <p>
         * @param jcomponent Swing JComponent to take a screen shot of
         * @param region the Rectangle <i>relative to</i> jcomponent that will be captured
         * @return a BufferedImage representing the region within jcomponent
         * @throws IllegalArgumentException if jcomponent == null; region == null
         * @throws IllegalStateException if calling thread is not EventQueue's dispatch thread
         public static BufferedImage take(JComponent jcomponent, Rectangle region) throws IllegalArgumentException, IllegalStateException {
              if (jcomponent == null) throw new IllegalArgumentException("jcomponent == null");
              if (region == null) throw new IllegalArgumentException("region == null");
              if (!EventQueue.isDispatchThread()) throw new IllegalStateException("calling thread (" + Thread.currentThread().toString() + ") is not EventQueue's dispatch thread");
              boolean opaquenessOriginal = jcomponent.isOpaque();
              Graphics2D g2d = null;
              try {
                   jcomponent.setOpaque( true );
                   BufferedImage image = new BufferedImage(region.width, region.height, imageType);
                   g2d = image.createGraphics();
                   g2d.translate(-region.x, -region.y) ;     // CRITICAL: this and the next line are what make region relative to component
                   g2d.setClip( region );
                   jcomponent.paint( g2d );
                   return image;
              finally {
                   jcomponent.setOpaque( opaquenessOriginal );
                   if (g2d != null) g2d.dispose();
         // -------------------- write --------------------
         * Writes image to a newly created File named fileName.
         * The graphics format will either be the extension found in fileName
         * or else {@link #formatNameDefault} if no extension exists.
         * <p>
         * Any thread may call this method.
         * <p>
         * @param image the BufferedImage to be written
         * @param fileName name of the File that will write image to
         * @throws IllegalArgumentException if image == null; fileName is blank
         * @throws IOException if an I/O problem occurs
         public static void write(BufferedImage image, String fileName) throws IllegalArgumentException, IOException {
              if (image == null) throw new IllegalArgumentException("image == null");
              if (StringUtil.isBlank(fileName)) throw new IllegalArgumentException("fileName is blank");
              File file = new File(fileName);
              String formatName = FileUtil.getExtension(file);
              if (formatName.length() == 0) formatName = formatNameDefault;
              write(image, formatName, file);
         * Writes image to file in the format specified by formatName.
         * <p>
         * Any thread may call this method.
         * <p>
         * @param image the BufferedImage to be written
         * @param formatName the graphics file format (e.g. "pnj", "jpeg", etc);
         * must be in the same set of values supported by the formatName arg of {@link ImageIO#write(RenderedImage, String, File)}
         * @param file the File that will write image to
         * @throws IllegalArgumentException if image == null; type is blank; file == null
         * @throws IOException if an I/O problem occurs
         public static void write(BufferedImage image, String formatName, File file) throws IllegalArgumentException, IOException {
              if (image == null) throw new IllegalArgumentException("image == null");
              if (StringUtil.isBlank(formatName)) throw new IllegalArgumentException("formatName is blank");
              if (file == null) throw new IllegalArgumentException("file == null");
              ImageIO.write(image, formatName, file);
         // -------------------- Test (inner class) --------------------
         * An inner class that consists solely of test code for the parent class.
         * <p>
         * Putting all the test code in this inner class (rather than a <code>main</code> method of the parent class) has the following benefits:
         * <ol>
         *  <li>test code is cleanly separated from working code</li>
         *  <li>any <code>main</code> method in the parent class is now reserved for a true program entry point</li>
         *  <li>test code may be easily excluded from the shipping product by removing all the Test class files (e.g. on Windoze, delete all files that end with <code>$Test.class</code>)</li>
         * </ol>
         * Putting all the test code in this inner class (rather than a shadow external class) has the following benefits:
         * <ol>
         *  <li>non-public members may be accessed</li>
         *  <li>the test code lives very close to (so is easy to find) yet is distinct from the working code</li>
         *  <li>there is no need to set up a test package structure</li>
         * </ol>
         public static class Test {
              public static void main(String[] args) throws Exception {
                   Gui gui = new Gui();
                   EventQueue.invokeLater( gui.getBuilder() );
                   new Timer(1000, gui.getTimerActionListener()).start();
              private static class Gui {
                   private Frame frame;
                   private TextField textField;
                   private JFrame jframe;
                   private JLabel jlabel;
                   private JPanel jpanel;
                   private int count = 0;
                   private Runnable getBuilder() {
                        return new Runnable() {
                             public void run() {
                                  System.out.println("Creating a Frame with AWT widgets inside...");
                                  frame = new Frame("ScreenShot.Test.main Frame");
                                  textField = new TextField();
                                  textField.setText( "Waiting for the screen shot process to automatically start..." );
                                  frame.add(textField);                              
                                  frame.pack();
                                  frame.setLocationRelativeTo(null);     // null will center it in the middle of the screen
                                  frame.setVisible(true);
                                  System.out.println("Creating a JFrame with Swing widgets inside...");
                                  jframe = new JFrame("ScreenShot.Test.main JFrame");
                                  jlabel = new JLabel(
                                       "<html>" +
                                            "To be, or not to be: that is the question:" + "<br>" +
                                            "Whether 'tis nobler in the mind to suffer" + "<br>" +
                                            "The slings and arrows of outrageous fortune," + "<br>" +
                                            "Or to take arms against a sea of troubles," + "<br>" +
                                            "And by opposing end them?" + "<br>" +
                                            "To die: to sleep; No more;" + "<br>" +
                                            "and by a sleep to say we end" + "<br>" +
                                            "The heart-ache and the thousand natural shocks" + "<br>" +
                                            "That flesh is heir to," + "<br>" +
                                            "'tis a consummation Devoutly to be wish'd." + "<br>" +
                                       "</html>"
                                  jpanel = new JPanel();
                                  jpanel.setBorder( BorderFactory.createEmptyBorder(20, 20, 20, 20) );
                                  jpanel.add(jlabel);
                                  jframe.getContentPane().add(jpanel);
                                  jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                                  jframe.pack();
                                  Point p = frame.getLocation();
                                  p.translate(0, frame.getSize().height  + 10);
                                  jframe.setLocation(p);
                                  jframe.setVisible(true);
                   private ActionListener getTimerActionListener() {
                        return new ActionListener() {
                             public void actionPerformed(ActionEvent evt) {
                                  try {
                                       switch (count++) {
                                            case 0:
                                                 displayMessage("Taking a screen shot of the entire desktop...");
                                                 ScreenShot.write( ScreenShot.take(), "desktop.png" );
                                                 break;
                                            case 1:
                                                 displayMessage("Taking a screen shot of the central rectangle of the desktop...");
                                                 Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
                                                 Rectangle region = getCenteredRectangle(d);
                                                 ScreenShot.write( ScreenShot.take(region), "desktopCenteredRectangle.png" );
                                                 break;
                                            case 2:
                                                 displayMessage("Taking a screen shot of the TextField...");
                                                 ScreenShot.write( ScreenShot.take(textField), "textField.png" );
                                                 break;
                                            case 3:
                                                 displayMessage("Taking a screen shot of the central rectangle of the TextField...");
                                                 d = textField.getSize();
                                                 region = getCenteredRectangle(d);
                                                 ScreenShot.write( ScreenShot.take(textField, region), "textFieldCenteredRectangle.png" );
                                                 break;
                                            case 4:
                                                 displayMessage("Taking a screen shot of the JLabel...");
                                                 ScreenShot.write( ScreenShot.take(jlabel), "jlabel.png" );
                                                 break;
                                            case 5:
                                                 displayMessage("Taking a screen shot of the central rectangle of the JLabel...");
                                                 d = jpanel.getSize();
                                                 region = getCenteredRectangle(d);
                                                 ScreenShot.write( ScreenShot.take(jpanel, region), "jpanelCenteredRectangle.png" );
                                                 break;
                                            default:
                                                 System.exit(0);
                                                 break;
                                  catch (Throwable t) {
                                       t.printStackTrace(System.err);
                             private void displayMessage(String text) {
                                  System.out.println(text);
                                  textField.setText(text);
                                  frame.pack();
                                  frame.invalidate();
                             private Rectangle getCenteredRectangle(Dimension d) {
                                  int x = d.width / 4;
                                  int y = d.height / 4;
                                  int width = d.width / 2;
                                  int height = d.height / 2;
                                  return new Rectangle(x, y, width, height);
    }

  • How to call HTML page through JSP ?

    i want to know Hw to call Automaticly a HTML page through JSP.
    example :-
    have u seen yahoo login wen u put your ID & pass & Clock on login button it will chack ID & pass in the database & if it is correct then It will call A Mail Home Page.
    that's same i want to do.
    i have a jsp page which chacks the userID & Pass & call the first.html page
    but i dont know how to call html page automaticly.
    Any one can help me
    what i think is this
    tell me is it right or not
    suppose i have made a variable
    String add = "first.html"
    after chacking userID & pass
    if(idpass == true)
    add;
    if(idpass == false)
    erre;
    it will work or not pl tell me

    If you do the redirect with javascript, the user cannot resubmit his login when he presses the refresh button. When he does press refresh, he only refreshes the redirect, not the form post that was before it. When he presses back the redirect will also kick him back in stead of going back to the login page. A simple javascript redirect page would look like this:
    <html>
    <body onload="document.location.href='myhtmlpage.htm';">
    </body>
    </html>But that is only if you care about resubmits of course.

  • How to call html page with in the flash

    I am new to action script, can some one guide me how to call html page with in the flash. lets say i have movie clip having instance name as "news_feed", I need to disply the html page in this news_feed. kindly help me, thanks alot

    some one tell me, weather it is possible or not ??

  • How to call the Jsp through BPM Obejct

    Hi,
    I have gone through the some topic, how to call the Jsp through BPM Object.
    I have followed step below,
    1. I have create the sample jsp page
    2. Import into BPM studio under webroot\custom Jsp
    3. Created the screenflow and added the "Interactive Component call" object
    4. Right Click the Object and selected Maintask and Implementation type as "BPM Object Interactive Call"
    5. Selected the use JSP presentation object option and when i click ok its showing "BPM instance object must be selected"
    But when i select the Instance Variable tab, its not showing anything.
    Can any one help me how to call the Jsp in screenflow with step by step procedure, that would be very greate help for me.
    Regards,
    Anandh P

    Hi,
    You are running a jsp report through rwservlet. In this case paper layout will be displayed. You have to deploy your jsp as web report to get the web layout. Please refer to the doc below, which describes how to deploy the web report.
    http://download-uk.oracle.com/docs/html/B10314_01/pbr_run.htm#1011901
    To run the jsp report, URL may look like
    http://www.wwt.com/reports/<jsp name>?<parameter list>
    Hope this helps
    Vinayak

  • How to change system time through java program

    Hi
    I want to know, how to change system time through java program.
    give me a idia with example.
    Thanks

    There isn't any core Java API for this. Use JNI or call an external process with Runtime.exec().
    ~

  • How to call external files from java?

    How to call external files in java. For example how to call a *.pdf file to open in its default editor(say Acrobat), or a *.html file to open in the default browser or a *.txt file in a notepad etc..,
    In my program i have *.chm (Compiled Windows HTML Help) help file. how to open it in its default editor it?

    Jayarathina_Madharasan wrote:
    no one answered my questionHi what wrong did i do...basically insulted all the volunteers here who took the time to consider your question and try to offer you help. Other than that, you did nothing wrong.
    From JavaRanch :
    And even if an answer doesn't solve your problem, even if it should totally miss the point - the best thing to do to motivate others to continue trying to help you is showing respect and gratitude for the investment of time that was put into dealing with your issue.
    Edited by: Encephalopathic on Apr 14, 2008 10:01 AM

  • How to call gnuplot command from java

    Hi there,
    In our course, we are required to develop an GUI for gnuplot. In case you don't know about gnuplot, it's a plotting program and has lots of command. We want to use java and swing, but now we don't know how to call gnuplot command from java, or how to execute a shell command(script) from java.
    By the way, since we need read in files with several columns of data and allow user to select a column, we want to use JTable. Is that reasonable?
    Thanks a lot for any suggestions!
    Jack

    Hi, there:
    Will using JTable add much overhead? I may have to use several JTables and switch among them. I can add scroll bar to or edit JTables, right?
    BTW, do you have experience about gnuplot? Can I find the command tree of gnuplot somewhere? Or do you know a better place to post question about gnuplot? unix/linux group, maybe.
    Thanks,
    Jack
    P.S. Would you guys answer my question after I use up my duke dollars? :- )

  • How to Call HTML Layers from Flash?

    how to Call HTML Layers from Flash? i need a help on example
    or script.

    What do you mean html layers? You can call JavaScript on the
    page using the
    ExternalInterface class. There's examples in Help if you look
    up the EI
    class, and it's call method.
    Dave -
    Head Developer
    http://www.blurredistinction.com
    Adobe Community Expert
    http://www.adobe.com/communities/experts/

  • How to call an API through Forms

    Hi,
    I want to call 'inv_quantity_tree_pub.query_quantities' from a custom form developed using Template.fmb.
    It is displaying error that 'remote package can not be called '.
    can any one help me on this issue.

    Hi;
    What is your OS?
    Please check below which could be helpful for your issue
    Oracle E-Business Suite Java APIs for Forms Troubleshooting Guide, Release 12 [ID 966982.1]
    http://drupal.org/node/751826
    http://oracle.ittoolbox.com/groups/technical-functional/oracle-dev-l/how-to-call-windows-apis-through-oracle-forms-developer-6i-1082381
    Regard
    Helios

  • How to insert html table inside java code

    Hi,
    I want to send an email with data in table format(with rows and columns) .Please tell me how to achieve this in java code .I just want to know the code for making the table in java
    Please help me
    Thanks in advance

    NewUser7 wrote:
    Please tell me how to generate html tables in java. .. Do you know how to produce an HTML table in HTML?
    ..i dont have jspI did not mention JSP. Pure J2SE code can produce HTML, though if done in a web-app., it would generally be done using JSP or Servlets.
    Here is an example of producing HTML in J2SE.
    import javax.swing.*;
    class HtmlTable {
         public static void main(String[] args) {
              int[][] values = {
                   {1,3894,5387},
                   {2,4112,4459},
                   {3,4886,6076}
              String prefix = "<html><body><table>\n";
              final StringBuilder sb = new StringBuilder(prefix);
              sb.append("<tr>");
              sb.append("<th>");
              sb.append("Month");
              sb.append("</th>");
              sb.append("<th>");
              sb.append("Unit A<br>Sales");
              sb.append("</th>");
              sb.append("<th>");
              sb.append("Unit B<br>Sales");
              sb.append("</th>");
              sb.append("</tr>\n");
              for (int ii=0; ii<values.length; ii++) {
                   sb.append("<tr>");
                   for (int jj=0; jj<values[ii].length; jj++) {
                        sb.append("<td>");
                        sb.append("" + values[ii][jj]);
                        sb.append("</td>");
                   sb.append("</tr>\n");
              sb.append("</table>");
              sb.append("</body>");
              sb.append("</html>");
              Runnable r = new Runnable() {
                   public void run() {
                        JOptionPane.showMessageDialog(
                             null,
                             new JTextArea(sb.toString(),20,10) );
                        JOptionPane.showMessageDialog(
                             null,
                             new JLabel(sb.toString()) );
              SwingUtilities.invokeLater(r);
    As an aside, those terms are HTML (an abbreviation) Java (a proper name) & JSP (an abbreviation). Please try to use correct upper/lower case when using technical terms.

  • How to do a dropdownlist in java Swing much like a JMenuBar items

    Hi sir,
    Here i want to know how to do a dropdownlist in java swing much like a JMenuBar items falling from the top to bottom .Here i should not use JMenuBar in any way.
    So that i need to do the dropdownlist by using other feature only.Since i am new to this.I need ur help urgently.Pls do provide the code for this so that i will be so gratefull to u.It is very Urgent.Since i have involved in a project which involves this feature.Pls. do provide the answer as well as the code quickly as possible.
    Thanx
    m.ananthu

    use JComboBox
    http://java.sun.com/docs/books/tutorial/uiswing/components/combobox.html

  • How to call Jakarta Ant via JAVA?

    Hi.
    My application has a new menu. This menu creates a build.xml Ant file.
    Now, when this menu is invoked , its action should call
    Jakarta Ant, after creating the xml file, so that the build.xml will
    do what is necessary.
    How can I do it? That is, how to call the Ant via java?
    Is there any way to use an Ant object?
    Thanks?
    Rodrigo Pimenta Carvalho.

    There is a slight problem in that
    PorjectHelper.configureProject is deprecated, but
    that is what Main calls...maybe someone else will
    complete this thread with an alternative call.The javadoc recommends using the non static method parse() instead. This is available by implementing class ProjectHelperImpl. An alternative to the code above might look like this:
            Project ant = new Project();
            ProjectHelper helper = new ProjectHelperImpl();
            ant.init();
            helper.parse(ant, new File("build.xml"));
            ant.executeTarget("clean");you might also want to add a logger so you can see the output of events generated by ant. The DefaultLogger class would be used like this. Simply add the code before you call the ant.init().
            DefaultLogger log = new DefaultLogger();
            log.setErrorPrintStream(System.err);
            log.setOutputPrintStream(System.out);
            log.setMessageOutputLevel(Project.MSG_INFO);
            ant.addBuildListener(log);

  • How to call a TopLink Query on ADF Page Load (onload)

    Hi,
    I am new to ADF wants to find out how to call a TopLink Query whenever a page loads. I saw SRDemo Sample but all the queries are bound to some kind of an action method i.e. clicking on a button executes a query etc. But I need to call a toplink query on my page load. Any small sample will help.
    Thanks

    Try this approach:
    http://blogs.oracle.com/shay/2007/07/25

  • What is the best way to call SSH commands through Java technologies

    What is the best way to call SSH commands through Java technologies

    I don't think you can specify the password at the prompt using ssh. Plink has the -pw command option for passwords. What I did was except ssh to ask me and write the password programmatically through the outputStream I obtained from my Process object. I looked for "password: ", and then wrote the password with a trailing newline.
    Both plink and ssh will also ask if you trust the host if it is the first time you are connecting to it. So before just writing the password, check if the program wants verification from you: normally supplying "y" or "n". This should only have to happen the first time the client connects. It looks like thisPLINK:
    The server's host key is not cached in the registry. You
    have no guarantee that the server is the computer you
    think it is.
    The server's key fingerprint is:
    1024 f8:43:61:4c:a2:5b:77:be:5b:a7:bb:1f:f7:79:b3:b7
    If you trust this host, enter "y" to add the key to
    PuTTY's cache and carry on connecting.
    If you want to carry on connecting just once, without
    adding the key to the cache, enter "n".
    If you do not trust this host, press Return to abandon the
    connection.
    Store key in cache? (y/n)
    SSH:
    The authenticity of host '127.0.0.1 (127.0.0.1)' can't be established.
    RSA key fingerprint is e1:02:13:c8:52:c2:23:41:9b:5b:58:2c:18:e6:59:af.
    Are you sure you want to continue connecting (yes/no)?What I did was read character by character from the inputStream until I found things of interest ... like "password: ". You only need to search for this in your method which will launch the ssh or plink Process. Once you have verifyed yourself, you can just pass commands to the Process, which is an ssh connection.
    My suggestion is to read() each byte from the Process's inputStream and write it to stdout. Look and see what you need to be looking for so you can interactive with the program correctly. You can't use readLine here becuase when the ssh asks for the password it does not print a newline. I do know for sure, that ssh will simply print, "passowrd: ". Plink will print this as well if the -pw option is not supplied.

Maybe you are looking for

  • Balkin AC1000 DB fails to connect to the internet

    I have a 2009 MacBook Pro 15" and I recently moved to a new town living in student accomodation. Each room has an ethernet port which connects directly to an extended LAN network. When I connect my mac directly to the ethernet port the internet works

  • Help needed in EJB

    Hi friends , I need your help in EJB I have to perform these operations 1) Calling an Appl Service from a EJB module. 2) Calling an EJB module from an Appl Service. 3) Basics of JNDI. for the second part I am exposing the EJB module as an Web Service

  • Every time I charge my shuffle, my songs get deleted

    I have a first gen shuffle, every time I plug it into my comp's USB, the songs on my shuffle get deleted. It blinks orange, green, orange, green... So I have to rechoose all my songs onto my shuffle. How can I get it so that I don't have to do this e

  • Generating Excel Report from Outlook 2013 for the meetings attended/ accepted

    Hello Team, Could you please advise how do I Generate Excel Report from Outlook 2013 for the meetings I attended/ accepted. Also I do I check or figure out the time I spent attending meeting. Please help to answer me ASAP. Thank you Preet

  • Re: Precompiling JSP with admin/managed servers

    Thanks, but I'm not doing any copying.           The admin/managed-server communication copies things to the managed server,           which then always recompiles the pages when hit.           -Greg           Check out my WebLogic 6.1 Workbook for O