How to create an applet in a jDesktopPane

hello i would like to create an applet (JApplet) in a desktop (JDesktopPane).
i have to put the applet in a JInternalFrame so i can move and resize the window around.
indeed i can have several applets in the JDesktopPane.
it would be more powerfull than viewing it in a web navigator.
more i want to load an applet from its web site from its jar file.
i know that from a html page, you have to tell the navigator where is the jar file with the "archive" tag; the "CODE" tag is the name of the class file not the path to the package like my.package.myclass !
can i put my.package.myclass instead of myclass.class in the "CODE" tag?
here's some snaphot of my softwar kevin_shell to give you some ideas:
http://go.to/kevin-net/SNAP
desktop_panel: the JDesktopPane where i have opened a simple applet.
explorer_panel
it is an open source project.
hope someone answer me, i will give to you my source code.

duplicate post

Similar Messages

  • How to create an applet that shows a pdf as non-editable.

    Hi friends,
    Does any one know how to create an applet that shows a pdf document (should make that pdf a non-editable one) while clicking a link.Its urgent for me as I have to complete this one tomorrow itself...please help me...
    I am able to view the pdf document but that cannot be make a non-editable one.
    Can anyone gave me the code for that one....please I am not very much good in Java.

    PDF is a proprietary format and Java doesn't support it by default. Are you using a 3rd party tool to create the PDF? If so, you need to review the developer docs to see how to make the document non-editable. Frankly, I don't see why you're using an Applet to view a PDF in the first place. What exactly are you trying to do. I'm confused.

  • How to create an applet in a JDestopPane?

    hello i would like to create an applet (JApplet) in a desktop (JDesktopPane).
    i have to put the applet in a JInternalFrame so i can move and resize the window around.
    indeed i can have several applets in the JDesktopPane.
    it would be more powerfull than viewing it in a web navigator.
    more i want to load an applet from its web site from its jar file.
    i know that from a html page, you have to tell the navigator where is the jar file with the "archive" tag; the "CODE" tag is the name of the class file not the path to the package like my.package.myclass !
    can i put my.package.myclass instead of myclass.class in the "CODE" tag?

    duplicate post

  • How to create an applet, with many squares inside?

    Hey,
    I'm having problems creating an applet. Heres the image I need to recreate. The drawing should scale, so that it reaches the full width and
    height of the applet.
    http://img503.imageshack.us/my.php?image=graphicsafx5.jpg
    I created a similar one (the code is below), but don't know how to modify it to create the image in the above link. Do I need a for loop? like for ( int i = 0; i < 10; ++i )
    import java.applet.Applet;
    import java.awt.*;
    public class AprilTest1 extends Applet
       public void paint(Graphics g)
            Graphics2D g2 = (Graphics2D)g;
            int width = getWidth();
            int height = getHeight();
            g2.setColor( Color.black );
            g2.fillRect( 0, 0, width, height);
            int pen_width = width/90 + 1;
            g2.setStroke(new BasicStroke(pen_width));
            g2.setColor( Color.white );
            g2.drawRect( width/4, height/4, width/2, height/2);
    }

    As CeciNEstPasUnProgrammeur said you do need a loop. You can probably make good use of the % operator inside your loop also.
    for(int i=0; i<NUMBER_OF_RECTANGLES; i++){
         if(i % 2 == 0) {
             //draw black rectangle
         } else {
             //draw white rectangle
    }Just think about what you need to do:
    -Start 1 rectangle at (0,0) and have its width and height as getWidth() and getHeight().
    -Pick an increment [this will be the 'width' of each rectangle]
    -Now for each rectangle you want to move your x and y points right and down by your increment. Moreover, you want to make your width and height smaller by your increment*2
    Essentially what I did is initialize 3 variables to 0 [say x, y, and z]. In your for loop use the % operator in an if-else block. If the loop is on an even number make a white rectangle, if the loop is on an odd number make a black rectangle. Set the x and y position to x+z and y+z respectivley. Set the height and width to getHeight()-(z*2) and getWidth()-(z*2) and then increment z by...lets say 10.
    This means on the first loop:
    x = 0
    y = 0
    width = getWidth()
    height = getHeight()
    Second loop:
    x = 10
    y = 10
    width = getWidth()-20 [10 to compensate for the shift, and 10 for the width]
    height = getHeight()-20
    Here is what I came up with - hope it helps.
    import java.applet.Applet;
    import java.awt.*;
    public class AprilTest1 extends Applet {
         private int x, y, z = 0;
         public void paint(Graphics g) {
              for(int i=0; i<10; i++){
                   if(i%2==1){
                      g.setColor( Color.white );
                      g.fillRect(x+z, y+z, getWidth()-(z*2), getHeight()-(z*2)); 
                   } else {
                      g.setColor( Color.black );
                      g.fillRect(x+z, y+z, getWidth()-(z*2), getHeight()-(z*2));
                   z += 10;
    }Any questions, feel free to ask :)

  • How to create signed applet and make it work with browser

    i hav an applet that needs to write a file to onto local system resource. i came to know that the applet needs to be signed. so i searched some guides to create a signed applet but most of them specify how to use it with applet viewer and not on a browser. plz help me with how to sign an applet and and allow it to write a file from within a browser.

    On linux, something like this:
    keytool -genkey -alias signSocket -keystore socketstore -keypass abc123 -dname "cn=your name" -storepass abc123
    jar cvf Socket.jar *.class
    jarsigner -keystore socketstore -storepass abc123 -keypass abc123 -signedjar SSocket.jar Socket.jar signSocket
    And in html:
    CODE = "YourClass.class"
    ARCHIVE = "SSocket.jar"
    ...

  • What is lightweight and heavyweight ? how to create my applet lightweight?

    Sir ,
    t have created an applet and in that i have not use any component
    for drawing now i want to use component for applet but cant grtting how to do this , by reference of sun java i have found this code for application to create lightweight::
    import java.awt.*;
    import java.awt.event.*;
    * Silly Sample program which demonstrates the basic paint
    * callback mechanism in the AWT.
    public class test1{
    public static void main(String[] args) {
    Frame f = new Frame("Have a nice day!");
    f.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    System.exit(0);
    f.add(new SmileyCanvas(Color.yellow), BorderLayout.CENTER);
    f.pack();
    f.show();
    * A canvas which renders a smiley-face to the screen
    * Note: Canvas is a heavyweight superclass, which makes
    * SmileyCanvas also heavyweight. To convert this class to
    * a lightweight, change "extends Canvas" to "extends Component".
    class SmileyCanvas extends Canvas {
    public SmileyCanvas(Color faceColor) {
    setForeground(faceColor);
    public Dimension getPreferredSize() {
    return new Dimension(300,300);
    * Paint when the AWT tells us to...
    public void paint(Graphics g) {
    // Dynamically calculate size information
    // (the canvas may have been resized externally...)
    Dimension size = getSize();
    int d = Math.min(size.width, size.height); // diameter
    int ed = d/20; // eye diameter
    int x = (size.width - d)/2;
    int y = (size.height - d)/2;
    // draw head (color already set to foreground)
    g.fillOval(x, y, d, d);
    g.setColor(Color.black);
    g.drawOval(x, y, d, d);
    // draw eyes
    g.fillOval(x+d/3-(ed/2), y+d/3-(ed/2), ed, ed);
    g.fillOval(x+(2*(d/3))-(ed/2), y+d/3-(ed/2), ed, ed);
    //draw mouth
    g.drawArc(x+d/4, y+2*(d/5), d/2, d/3, 0, -180);
    this code is not for applet so how to make this code for applet ?

    I use the Snippets folder to store re-usable code. Scroll to
    the file or
    folder desired, double click and voila! Code is inserted into
    the page.
    As for the other bells & whistles, you are probably
    thinking about DW
    Extensions (.mxp) files. There are many 3rd party makers of
    extensions.
    Some are free, some cost a nominal fee. Check around to see
    if what you
    want isn't already available. If not, read this article.
    Creating an Extension:
    http://help.adobe.com/en_US/Dreamweaver/10.0_Extending/WS5b3ccc516d4fbf351e63e3d117f508c8d e-7fde.html
    Nancy O.
    Alt-Web Design & Publishing
    www.alt-web.com

  • How to create an applet within an application?

    Hi. Im trying to make an applet work within a main application but I cant get it to work because then I have 2 of these and it gives me an error:
    public class java_tester extends JFrame implements MouseListener //MAIN APPLICATION
    public class MusicPlay extends JApplet //APPLET
    I cant have both if them because it is like two different programs.
    Can anyone help me with this?
    Thanks

    ProGenius wrote:
    But when I put public class MusicPlay extends JApplet it underlines it because the name of the main program is different and when I give it the same name it still underlines it. I know it probably is easy to do it but I really dont know how to make it work.
    Thanks a lot for your helpWhat is "it", what is "it" underlining, and why is this a problem? There's no such concept as "main program". If you're confused by the presence of two whole classes, don't be. Anything beyond the laughably trivial will consist of several classes.

  • How to create a frame in a applet?

    Dear All,
    How to create a frame in a applet?
    Thanks in advance
    Kityy

    You can't add a Frame/JFrame to an Applet/JApplet.
    An Applet/JApplet has its origins in the class Panel/JPanel.
    So, if you make your Applet to an application you
    can easily do that by putting your Applet "above" a Frame.
    Maybe you can archieve your goals with some Panels?!

  • How to create a transport background for an applet ?

    HI can any one tell me the solution for this ...
    How to create a transport background for an applet ?
    please help
    -seenu_ch

    what does it mean to have a transparent background to an applet? transparent means you can "look through" it.
    What do you want to "look thorough" an applet.
    Sorry, I am still not understanding :(
    Please let me know what this means.
    regards,
    Sangeetha

  • Anyone has ideas how to create Google Calendar as an embedded web applet

    Hello...
    Anyone has ideas how to create Google Calendar as an embedded web applet in CRM On Demand? I would like to create an embedded web applet to show up the user's Google Calendar. I may have users Google credentials saved in its user record of CRMOD.

    This can be enabled with InBound SSO implementation where your CRMOD Credentials and Google Apps Credentials are mapped.
    if it would help consider reading something on OpenSSO on SAML for this requirement
    Regards.
    Deepak H Andeli

  • How to create a digital signature formy Applet?

    who can tell me how to create a digital signature for my applet? i want details of the process, because i know nothing about it. Thank you very much!!!

    http://java.sun.com/docs/books/tutorial/security1.2/apisign/gensig.html

  • HOW TO: Create a GUI "Hello World"

     </p>
    This document describes how to create and run a very simple &quot;Hello World&quot;
    Java GUI app using JDeveloper. The application will have one button and one
    text field. Clicking the button will populate the text field with the message,
    &quot;Hello World!&quot;</p>
    Creating The New Application
    In this section, we will create an application with an empty frame.</p>
    <ol>
    [*]Choose File | New Workspace.
    </li>
    [*]Choose File | Save Workspace.
    </li>
    [*]Enter <TT>HelloGui.jws</tt> as the name for the workspace.
    This creates a Workspace called HelloGui. A workspace organizes all the projects
    you need to work on at one time.
    </li>
    [*]Choose File | New Project.
    The Project Wizard opens. This wizard will help you create a new project called
    HelloGui. A project contains all the files that go together in one &quot;tier&quot;--for
    example, all the files belonging to a single Java Application client, or all
    the files belonging to an Enterprise Java Bean. Because we are working on
    a simple, one-tier application, we will only need one project in our workspace.
    </li>
    [*]If the Welcome page appears, click Next.
    </li>
    [*]On the Project Type page, in the What is the Project's Filename?
    field, change the filename to <TT>HelloGui.jpr</tt>. Leave the rest of the
    path the same.
    </li>
    [*]Select A Project containing a new... and choose Application
    from the dropdown list.
    </li>
    [*]Click Next.
    </li>
    [*]On the Project Options page, in the What is the name of the project's
    default package field, enter <TT>helloGui</tt>.
    </li>
    [*]Click Next.
    </li>
    [*]On the Project Information page, you can enter any information about your
    project that you wish.
    </li>
    [*]Click Finish.
    The Application Wizard opens.
    </li>
    [*]In the Class field, enter <TT>HelloApp</tt>.
    </li>
    [*]Select the New Empty Frame radio button.
    </li>
    [*]Click OK.
    The Frame Wizard opens.
    </li>
    [*]In the Class field, enter <TT>HelloFrame</tt>.
    </li>
    [*]Click OK.
    JDeveloper creates an application, <TT>HelloApp</tt>, containing an empty
    frame, <TT>HelloFrame</tt>. The source code for these classes appears in the
    Navigator, which is the upper left-hand pane in the JDeveloper IDE.
    </li>
    [*]Choose File | Save All.</li>
    </ol>
    Adding a Panel to the Frame
    In this section, we will now add a panel to the frame. In the next section,
    we will add all the other components to this panel.</p>
    <ol>
    [*]In the Navigator, double-click <TT>HelloFrame.java</tt>.
    A viewer opens. This viewer has four tabs at the bottom:
    <ul>
    [*]Source, the currently active tab, which displays the source code
    of the selected class</li>
    [*]Design, which invokes a visual layout designer</li>
    [*]Class, which invokes an editor for the class' attributes, and
    can help you stay JavaBean complient</li>
    [*]Doc, which displays the class' JavaDoc
    </li>
    </ul>
    </li>
    [*]Click the Design tab.
    The viewer now displays a grey square, a graphical mock-up of your frame.
    Also, on the right-hand side of your screen, the Property Inspector opens.
    This allows you to quickly set attributes and define events for components.
    </li>
    [*]In the component palette (the tabbed toolbar near the top of your screen),
    select the Swing Containers tab.
    </li>
    [*]Click the blue square (described in rollover text as <TT>JPanel</tt>) and
    click on your frame to add the panel.
    The Property Inspector now displays attributes of the JPanel.
    </li>
    [*]In the Property Inspector, click twice inside the box beside the name
    field.
    </li>
    [*]Change the name to mainPanel.
    </li>
    [*]Click the box beside the layout field.
    </li>
    [*]Choose XYLayout.
    XYLayout is an easy-to-use Layout for prototyping. Later, we will change the
    layout to a more portable one.</li>
    </ol>
    Adding Components to the Panel
    In this section, we finish laying out a prototype UI. We will add polish and
    portability to the UI later.</p>
    <ol>
    [*]In the Component Palette, select the Swing tab.
    </li>
    [*]Select the <TT>JTextField</tt> component, which looks like a text field
    with a cursor.
    </li>
    [*]In your panel, click and drag the cursor to outline the text field.
    Don't worry if the text field doesn't have exactly the right size or position.
    We will adjust these later.
    The Property Inspector now displays attributes of the JTextField.
    </li>
    [*]In the Property Inspector, change the name (just as you did for the
    JPanel) to <TT>displayField</tt>.
    </li>
    [*]Change the text to nothing (erase the value that is already there).
    </li>
    [*]In the Component Palette, select the <TT>JButton</tt> component, which looks
    like a button being clicked.
    </li>
    [*]In your panel, click and drag the cursor to outline the button.
    The Property Inspector now displays attributes of the JButton.
    </li>
    [*]In the Property Inspector, change the name and action command
    to helloButton.
    </li>
    [*]Change the text to <TT>Say Hello!</tt>.
    </li>
    [*]Choose File | Save All.</li>
    </ol>
    Wiring Up the UI
    In this section, we wire the UI so that clicking the button causes &quot;Hello
    World!&quot; to display in the text field.</p>
    <ol>
    [*]In the Property Inspector, select the Events tab.
    </li>
    [*]Click the box next to the Action Performed field and press the Enter
    key.
    This creates a method, <TT>helloButton_actionPerformed()</tt>, which will
    be invoked when the button is clicked, and displays the source code for the
    method stub in the viewer.
    </li>
    [*]In the viewer, add the following command to the body of the method:
    <TT>displayField.setText(&quot;Hello World!&quot;);</tt>
    </li>
    [*]Choose File | Save All.</li>
    </ol>
    Testing the Prototype Application
    <ol>
    [*]Choose Run | Run &quot;HelloApp&quot;.
    Your application appears, with a blank text field and a button labeled &quot;Say
    Hello!&quot;
    </li>
    [*]Click the button.
    The text &quot;Hello World!&quot; appears in the text field.
    </li>
    [*]Close your application.</li>
    </ol>
    Refining the UI
    In this section, we polish the UI so that the components have the right size
    and alignment, the text in the text field shows up red, and the panel uses the
    portable GridBag layout instead of the JDeveloper-specific XYLayout.</p>
    <ol>
    [*]In the viewer, select the Design tab.
    </li>
    [*]Select your text field.
    </li>
    [*]Drag the edges of your text field until it is the size you want.
    </li>
    [*]Drag the center of the text field until it is the vertical position you
    want.
    </li>
    [*]Right-click the text field and choose Align Center.
    This centers your text field horizontally in the frame.
    </li>
    [*]In the property inspector, click the box next to the foreground field.
    </li>
    [*]Click the ellipses (...).
    A color editor appears.
    </li>
    [*]Select Red from the dropdown list.
    </li>
    [*]Click OK.
    </li>
    [*]On your frame, select your button.
    </li>
    [*]Drag the right edge of your button until it is the horizontal size you want.
    </li>
    [*]Select your text field, and multi-select your button by control-clicking
    it.
    </li>
    [*]Right-click your button or text field.
    </li>
    [*]Choose Same Size Vertical.
    This sets the height of all selected components to that of the first selected
    component (the text field).
    </li>
    [*]Right-click your button or text field.
    </li>
    [*]Choose Align Center.
    This aligns the center of all selected components to that of the first selected
    component (the text field).
    </li>
    [*]Select your panel by clicking anywhere on the grey background in the visual
    designer.
    </li>
    [*]In the Property Inspector, click the box beside the layout field.
    </li>
    [*]Select GridBagLayout from the dropdown list.
    </li>
    [*]Choose File | Save All.</li>
    </ol>
    Running the Finished Application From Within JDeveloper
    <ol>
    [*]Choose Run | Run &quot;HelloApp&quot;.
    Your application appears, with a blank text field and a button labeled &quot;Say
    Hello!&quot;
    </li>
    [*]Click the button.
    The text &quot;Hello World!&quot; appears in the text field, in red.
    </li>
    [*]Close your application.</li>
    </ol>
    Deploying the Application to Your File System
    <ol>
    [*] In the Navigator, right-click <tt>HelloGui.jpr</tt> and choose New Deployment
    Profile.
    The Deployment Profile Wizard opens.
    </li>
    [*]If the Welcome page appears, click Next.
    </li>
    [*]On the Delivery page, select Web Application or Command-Line Application
    from the dropdown list, and click Next.
    </li>
    [*]On the Staging Area page, in the Deployment Destination field, enter
    <tt><JDeveloper>/HelloGui</tt>, where <tt><JDeveloper></tt>
    is your JDeveloper root directory. Click Next.
    </li>
    [*]On the Project page, select all the <tt>.java</tt> files and click Next.
    </li>
    [*]Skip the Archive page and Applet Tags page by clicking Next on each.
    </li>
    [*]On the Libraries page, shuttle all libraries from the Project Libraries
    list to the Deployed Libraries list, and click Next.
    </li>
    [*]On the Finish page, name the profile <tt>HelloGui.prf</tt>, and click Finish.
    </li>
    [*]When JDeveloper asks you if you want to deploy now, click Yes.</li>
    </ol>
    JDeveloper will archive your application files and copy this archive and all
    other required libraries to <tt><JDeveloper>/HelloGui</tt>.</p>
    Running the Application from the Command Line
    <ol>
    [*]Open a command-line prompt.
    </li>
    [*]Enter the following script.
    Note: You may want to create a batch file containing this script. Be
    sure to replace JDeveloper_Home with your JDeveloper home directory.
    <pre>set __CLASSPATH_ROOT_DIR__=JDeveloper_Home\HelloGui
    set CLASSPATH=&quot;%__CLASSPATH_ROOT_DIR__%\HelloGui.jar&quot;
    set CLASSPATH=%CLASSPATH%;&quot;%__CLASSPATH_ROOT_DIR__%\xmlparserv2.jar&quot;
    set CLASSPATH=%CLASSPATH%;&quot;%__CLASSPATH_ROOT_DIR__%\classes12.zip&quot;
    set CLASSPATH=%CLASSPATH%;&quot;%__CLASSPATH_ROOT_DIR__%\jdev-rt.zip&quot;
    set CLASSPATH=%CLASSPATH%;&quot;%__CLASSPATH_ROOT_DIR__%\swingall.jar&quot;
    cd JDeveloper_Home\HelloGui
    jre -cp %CLASSPATH% helloGui.HelloApp</pre>
    </li>
    [*]Your application appears, with a blank text field and a button labeled &quot;Say
    Hello!&quot;
    </li>
    [*]Click the button.
    The text &quot;Hello World!&quot; appears in the text field, in red.
    </li>
    [*]Close your application.</li>
    </ol>
    </p>
     </p>
    null

    Hello,
    I followed your instruction step by step to make this "Hello World", but when I run it, I got message "cannot find the runable node". What do I miss here? Thanks.
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Avrom Faderman ([email protected]):
    </p>
    This document describes how to create and run a very simple "Hello World"
    Java GUI app using JDeveloper. The application will have one button and one
    text field. Clicking the button will populate the text field with the message,
    "Hello World!"</p>
    [b]Creating The New Application
    In this section, we will create an application with an empty frame.</p>
    <ol>
    [*]Choose File | New Workspace.
    </li>
    [*]Choose File | Save Workspace.
    </li>
    [*]Enter <TT>HelloGui.jws</tt> as the name for the workspace.
    This creates a Workspace called HelloGui. A workspace organizes all the projects
    you need to work on at one time.
    </li>
    [*]Choose File | New Project.
    The Project Wizard opens. This wizard will help you create a new project called
    HelloGui. A project contains all the files that go together in one "tier"--for
    example, all the files belonging to a single Java Application client, or all
    the files belonging to an Enterprise Java Bean. Because we are working on
    a simple, one-tier application, we will only need one project in our workspace.
    </li>
    [*]If the Welcome page appears, click Next.
    </li>
    [*]On the Project Type page, in the What is the Project's Filename?
    field, change the filename to <TT>HelloGui.jpr</tt>. Leave the rest of the
    path the same.
    </li>
    [*]Select A Project containing a new... and choose Application
    from the dropdown list.
    </li>
    [*]Click Next.
    </li>
    [*]On the Project Options page, in the What is the name of the project's
    default package field, enter <TT>helloGui</tt>.
    </li>
    [*]Click Next.
    </li>
    [*]On the Project Information page, you can enter any information about your
    project that you wish.
    </li>
    [*]Click Finish.
    The Application Wizard opens.
    </li>
    [*]In the Class field, enter <TT>HelloApp</tt>.
    </li>
    [*]Select the New Empty Frame radio button.
    </li>
    [*]Click OK.
    The Frame Wizard opens.
    </li>
    [*]In the Class field, enter <TT>HelloFrame</tt>.
    </li>
    [*]Click OK.
    JDeveloper creates an application, <TT>HelloApp</tt>, containing an empty
    frame, <TT>HelloFrame</tt>. The source code for these classes appears in the
    Navigator, which is the upper left-hand pane in the JDeveloper IDE.
    </li>
    [*]Choose File | Save All.</li>
    </ol>
    Adding a Panel to the Frame
    In this section, we will now add a panel to the frame. In the next section,
    we will add all the other components to this panel.</p>
    <ol>
    [*]In the Navigator, double-click <TT>HelloFrame.java</tt>.
    A viewer opens. This viewer has four tabs at the bottom:
    <ul>
    [*]Source, the currently active tab, which displays the source code
    of the selected class</li>
    [*]Design, which invokes a visual layout designer</li>
    [*]Class, which invokes an editor for the class' attributes, and
    can help you stay JavaBean complient</li>
    [*]Doc, which displays the class' JavaDoc
    </li>
    </ul>
    </li>
    [*]Click the Design tab.
    The viewer now displays a grey square, a graphical mock-up of your frame.
    Also, on the right-hand side of your screen, the Property Inspector opens.
    This allows you to quickly set attributes and define events for components.
    </li>
    [*]In the component palette (the tabbed toolbar near the top of your screen),
    select the Swing Containers tab.
    </li>
    [*]Click the blue square (described in rollover text as <TT>JPanel</tt>) and
    click on your frame to add the panel.
    The Property Inspector now displays attributes of the JPanel.
    </li>
    [*]In the Property Inspector, click twice inside the box beside the name
    field.
    </li>
    [*]Change the name to mainPanel.
    </li>
    [*]Click the box beside the layout field.
    </li>
    [*]Choose XYLayout.
    XYLayout is an easy-to-use Layout for prototyping. Later, we will change the
    layout to a more portable one.</li>
    </ol>
    Adding Components to the Panel
    In this section, we finish laying out a prototype UI. We will add polish and
    portability to the UI later.</p>
    <ol>
    [*]In the Component Palette, select the Swing tab.
    </li>
    [*]Select the <TT>JTextField</tt> component, which looks like a text field
    with a cursor.
    </li>
    [*]In your panel, click and drag the cursor to outline the text field.
    Don't worry if the text field doesn't have exactly the right size or position.
    We will adjust these later.
    The Property Inspector now displays attributes of the JTextField.
    </li>
    [*]In the Property Inspector, change the name (just as you did for the
    JPanel) to <TT>displayField</tt>.
    </li>
    [*]Change the text to nothing (erase the value that is already there).
    </li>
    [*]In the Component Palette, select the <TT>JButton</tt> component, which looks
    like a button being clicked.
    </li>
    [*]In your panel, click and drag the cursor to outline the button.
    The Property Inspector now displays attributes of the JButton.
    </li>
    [*]In the Property Inspector, change the name and action command
    to helloButton.
    </li>
    [*]Change the text to <TT>Say Hello!</tt>.
    </li>
    [*]Choose File | Save All.</li>
    </ol>
    Wiring Up the UI
    In this section, we wire the UI so that clicking the button causes "Hello
    World!" to display in the text field.</p>
    <ol>
    [*]In the Property Inspector, select the Events tab.
    </li>
    [*]Click the box next to the Action Performed field and press the Enter
    key.
    This creates a method, <TT>helloButton_actionPerformed()</tt>, which will
    be invoked when the button is clicked, and displays the source code for the
    method stub in the viewer.
    </li>
    [*]In the viewer, add the following command to the body of the method:
    <TT>displayField.setText("Hello World!");</tt>
    </li>
    [*]Choose File | Save All.</li>
    </ol>
    Testing the Prototype Application
    <ol>
    [*]Choose Run | Run "HelloApp".
    Your application appears, with a blank text field and a button labeled "Say
    Hello!"
    </li>
    [*]Click the button.
    The text "Hello World!" appears in the text field.
    </li>
    [*]Close your application.</li>
    </ol>
    Refining the UI
    In this section, we polish the UI so that the components have the right size
    and alignment, the text in the text field shows up red, and the panel uses the
    portable GridBag layout instead of the JDeveloper-specific XYLayout.</p>
    <ol>
    [*]In the viewer, select the Design tab.
    </li>
    [*]Select your text field.
    </li>
    [*]Drag the edges of your text field until it is the size you want.
    </li>
    [*]Drag the center of the text field until it is the vertical position you
    want.
    </li>
    [*]Right-click the text field and choose Align Center.
    This centers your text field horizontally in the frame.
    </li>
    [*]In the property inspector, click the box next to the foreground field.
    </li>
    [*]Click the ellipses (...).
    A color editor appears.
    </li>
    [*]Select Red from the dropdown list.
    </li>
    [*]Click OK.
    </li>
    [*]On your frame, select your button.
    </li>
    [*]Drag the right edge of your button until it is the horizontal size you want.
    </li>
    [*]Select your text field, and multi-select your button by control-clicking
    it.
    </li>
    [*]Right-click your button or text field.
    </li>
    [*]Choose Same Size Vertical.
    This sets the height of all selected components to that of the first selected
    component (the text field).
    </li>
    [*]Right-click your button or text field.
    </li>
    [*]Choose Align Center.
    This aligns the center of all selected components to that of the first selected
    component (the text field).
    </li>
    [*]Select your panel by clicking anywhere on the grey background in the visual
    designer.
    </li>
    [*]In the Property Inspector, click the box beside the layout field.
    </li>
    [*]Select GridBagLayout from the dropdown list.
    </li>
    [*]Choose File | Save All.</li>
    </ol>
    Running the Finished Application From Within JDeveloper
    <ol>
    [*]Choose Run | Run "HelloApp".
    Your application appears, with a blank text field and a button labeled "Say
    Hello!"
    </li>
    [*]Click the button.
    The text "Hello World!" appears in the text field, in red.
    </li>
    [*]Close your application.</li>
    </ol>
    Deploying the Application to Your File System
    <ol>
    [*] In the Navigator, right-click <tt>HelloGui.jpr</tt> and choose New Deployment
    Profile.
    The Deployment Profile Wizard opens.
    </li>
    [*]If the Welcome page appears, click Next.
    </li>
    [*]On the Delivery page, select Web Application or Command-Line Application
    from the dropdown list, and click Next.
    </li>
    [*]On the Staging Area page, in the Deployment Destination field, enter
    <tt><JDeveloper>/HelloGui</tt>, where <tt><JDeveloper></tt>
    is your JDeveloper root directory. Click Next.
    </li>
    [*]On the Project page, select all the <tt>.java</tt> files and click Next.
    </li>
    [*]Skip the Archive page and Applet Tags page by clicking Next on each.
    </li>
    [*]On the Libraries page, shuttle all libraries from the Project Libraries
    list to the Deployed Libraries list, and click Next.
    </li>
    [*]On the Finish page, name the profile <tt>HelloGui.prf</tt>, and click Finish.
    </li>
    [*]When JDeveloper asks you if you want to deploy now, click Yes.</li>
    </ol>
    JDeveloper will archive your application files and copy this archive and all
    other required libraries to <tt><JDeveloper>/HelloGui</tt>.</p>
    Running the Application from the Command Line
    <ol>
    [*]Open a command-line prompt.
    </li>
    [*]Enter the following script.
    Note: You may want to create a batch file containing this script. Be
    sure to replace JDeveloper_Home with your JDeveloper home directory.
    <pre>set __CLASSPATH_ROOT_DIR__=JDeveloper_Home\HelloGui
    set CLASSPATH="%__CLASSPATH_ROOT_DIR__%\HelloGui.jar"
    set CLASSPATH=%CLASSPATH%;"%__CLASSPATH_ROOT_DIR__%\xmlparserv2.jar"
    set CLASSPATH=%CLASSPATH%;"%__CLASSPATH_ROOT_DIR__%\classes12.zip"
    set CLASSPATH=%CLASSPATH%;"%__CLASSPATH_ROOT_DIR__%\jdev-rt.zip"
    set CLASSPATH=%CLASSPATH%;"%__CLASSPATH_ROOT_DIR__%\swingall.jar"
    cd JDeveloper_Home\HelloGui
    jre -cp %CLASSPATH% helloGui.HelloApp</pre>
    </li>
    [*]Your application appears, with a blank text field and a button labeled "Say
    Hello!"
    </li>
    [*]Click the button.
    The text "Hello World!" appears in the text field, in red.
    </li>
    [*]Close your application.</li>
    </ol>
    </p>
    </p><HR></BLOCKQUOTE>
    null

  • HELP!!! How to create a modal JPanel

    Hi
    I've been creating an applet that uses transparent JPanels to draw boxes that look like windows.
    I'm in need, now, to create one that asks for user input (ie "click the OK button") and that blocks the current thread and other panels until the user has answered.
    It's totally similar to a windows message box.
    How do i do it????
    I've been taking examples from this tech tip (http://java.sun.com/developer/JDCTechTips/2001/tt1220.html) that explains almost everything (but uses JInternalFrame), and also 2 ways of doing the thread-blocking work:
    One way uses a worker thread to compose the UI and wait() while the java dispatcher thread does the app events (action, paint) and notifyAll() when the user presses "OK".
    In the other way, the author copied the code from EventQueue's dispatchEvent() and created a dispatcher thread into the modal JFrame, so that events could be processed without having to use another thread.
    I think this last method is a hack because of portabilityu issues, for example code in my dispatchEvent() (JRE1.6.0) contains more checks and cases than the code he postet in that page.
    I think I would have problem running similar code on a previous or future version of the JRE.
    Anyway I haven't succeeded yet to wake up the waiting thread when the user has clicked OK. The notifyAll method executes, no exception is thrown, but the other thread remains asleep.
    Here's my code (note the "synchronized" keywords)
    synchronized public int show(String title, String message, int buttons, boolean isError) {
            if (isError)
                jptBox = new TLPanel(title, new Color(104,10,11), new Color(234,30,34), new Color(241,79,83));
            else
                jptBox = new TLPanel(title, new Color(6,29,108), new Color(80,103,184), new Color(120,138,200));
            jptBox.setBounds(TLStartup.centerSize(400, 100));
            btn1 = new JButton("OK");
            btn1.setBounds(180, 75, 40, 20);
            btn1.addActionListener(new ActionListener() {
                public synchronized void actionPerformed(ActionEvent e) {
                    this.notify();
            jptBox.add(btn1);
            cnt.add(jptBox);
            cnt.setComponentZOrder(jptBox, 0);
            try {
                this.wait();
            } catch (Exception ex) {
                System.out.println(ex.toString());
            return MB_ANSWER_YES;
        }

    I put a boolean variable test=true into my class, and modified the code to check it into the waiting cycle:
            try {
                while (test)
                    this.wait(1000);
            } catch (Exception ex) {
                System.out.println(ex.toString());
            }and to reset it into the actionPerformed:
            btn1.addActionListener(new ActionListener() {
                public synchronized void actionPerformed(ActionEvent e) {
                    test = false;
                    this.notifyAll();
            });And HOW COME it does work now ??? (with some delay)

  • Error is in example  "How to Create Online and Offline Forms in Web Dynpro"

    Hi,
    I am developing " How to Create Online and Offline Forms in Web Dynpro " in nwds 7.0. This is standard example which is available at sdn. but when i run it gives me error like "
    Failed to process request. Please contact your system administrator.
    [Hide]
    Error Summary
    While processing the current request, an exception occured which could not be handled by the application or the framework.
    If the information contained on this page doesn't help you to find and correct the cause of the problem, please contact your system administrator. To facilitate analysis of the problem, keep a copy of this error page. Hint: Most browsers allow to select all content, copy it and then paste it into an empty document (e.g. email or simple text file).
    Root Cause
    The initial exception that caused the request to fail, was:
       java.lang.NullPointerException
        at com.travelrequestapp.TravelRequestComView.wdDoInit(TravelRequestComView.java:97)
        at com.travelrequestapp.wdp.InternalTravelRequestComView.wdDoInit(InternalTravelRequestComView.java:133)
        at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.doInit(DelegatingView.java:61)
        at com.sap.tc.webdynpro.progmodel.controller.Controller.initController(Controller.java:215)
        at com.sap.tc.webdynpro.progmodel.view.View.initController(View.java:445)
        ... 34 more
    See full exception chain for details.
    System Environment
    Client
    Web Dynpro Client Type HTML Client
    User agent Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)
    Version null
    DOM version null
    Client Type msie6
    Client Type Profile ie6
    ActiveX enabled
    Cookies enabled
    Frames enabled
    Java Applets enabled
    JavaScript enabled
    Tables enabled
    VB Script enabled
    Server
    Web Dynpro Runtime Vendor: SAP, build ID: 7.0009.20060804145649.0000 (release=645_VAL_REL, buildtime=2006-08-26:14:41:58[UTC], changelist=413534, host=pwdfm101), build date: Thu Feb 15 10:23:57 IST 2007
    J2EE Engine 7.00 patchlevel
    Java VM Java HotSpot(TM) Server VM, version:1.4.2_13-b06, vendor: Sun Microsystems Inc.
    Operating system Windows 2003, version: 5.2, architecture: x86
    Session & Other
    Session Locale en_US
    Time of Failure Mon Oct 29 12:13:24 IST 2007 (Java Time: 1193640204484)
    Web Dynpro Code Generation Infos
    local/TravelRequest
    SapDictionaryGenerationCore 7.0006.20051128142640.0000 (release=645_VAL_REL, buildtime=2006-01-14:14:59:42[UTC], changelist=378068, host=PWDFM101.wdf.sap.corp)
    SapDictionaryGenerationTemplates (unknown)
    SapGenerationFrameworkCore 7.0006.20050713144242.0000 (release=645_VAL_REL, buildtime=2006-01-14:14:48:59[UTC], changelist=357697, host=PWDFM101.wdf.sap.corp)
    SapIdeWebDynproCheckLayer 7.0006.20051128151834.0000 (release=645_VAL_REL, buildtime=2006-01-14:15:05:10[UTC], changelist=378108, host=PWDFM101.wdf.sap.corp)
    SapMetamodelCommon 7.0006.20050929162929.0000 (release=645_VAL_REL, buildtime=2006-01-14:14:49:45[UTC], changelist=369752, host=PWDFM101.wdf.sap.corp)
    SapMetamodelCore 7.0006.20050929162929.0000 (release=645_VAL_REL, buildtime=2006-01-14:14:49:38[UTC], changelist=369752, host=PWDFM101.wdf.sap.corp)
    SapMetamodelDictionary 7.0006.20051128142655.0000 (release=645_VAL_REL, buildtime=2006-01-14:14:57:39[UTC], changelist=378069, host=PWDFM101.wdf.sap.corp)
    SapMetamodelWebDynpro 7.0006.20051128151854.0000 (release=645_VAL_REL, buildtime=2006-01-14:15:02:09[UTC], changelist=378109, host=PWDFM101.wdf.sap.corp)
    SapWebDynproGenerationCTemplates 7.0006.20060111154644.0000 (release=645_VAL_REL, buildtime=2006-01-14:15:18:33[UTC], changelist=384368, host=pwdfm101)
    SapWebDynproGenerationCore 7.0006.20051128151834.0000 (release=645_VAL_REL, buildtime=2006-01-14:15:05:21[UTC], changelist=378108, host=PWDFM101.wdf.sap.corp)
    SapWebDynproGenerationTemplates 7.0006.20060111154644.0000 (release=645_VAL_REL, buildtime=2006-01-14:15:18:33[UTC], changelist=384368, host=pwdfm101)
    sap.com/tcwddispwda
    No information available null
    sap.com/tcwdcorecomp
    No information available null
    Detailed Error Information
    Detailed Exception Chain
    java.lang.NullPointerException
         at com.travelrequestapp.TravelRequestComView.wdDoInit(TravelRequestComView.java:97)
         at com.travelrequestapp.wdp.InternalTravelRequestComView.wdDoInit(InternalTravelRequestComView.java:133)
         at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.doInit(DelegatingView.java:61)
         at com.sap.tc.webdynpro.progmodel.controller.Controller.initController(Controller.java:215)
         at com.sap.tc.webdynpro.progmodel.view.View.initController(View.java:445)
         at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:200)
         at com.sap.tc.webdynpro.progmodel.view.ViewManager.getView(ViewManager.java:709)
         at com.sap.tc.webdynpro.progmodel.view.ViewManager.bindRoot(ViewManager.java:579)
         at com.sap.tc.webdynpro.progmodel.view.ViewManager.makeVisible(ViewManager.java:793)
         at com.sap.tc.webdynpro.progmodel.view.ViewManager.performNavigation(ViewManager.java:296)
         at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.navigate(ClientApplication.java:767)
         at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.navigate(ClientComponent.java:873)
         at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.doNavigation(WindowPhaseModel.java:498)
         at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processRequest(WindowPhaseModel.java:144)
         at com.sap.tc.webdynpro.clientserver.window.WebDynproWindow.processRequest(WebDynproWindow.java:335)
         at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:143)
         at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:299)
         at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessingStandalone(ClientSession.java:711)
         at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:665)
         at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:232)
         at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:152)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:62)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doPost(DispatcherServlet.java:53)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
         at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
    So please help me to correct this error .....
    Help will be rewarded.
    Regards,
    Gurprit Bhatia

    Hi Gurprit,
    A null value is being passed at runtime. Make sure that you enter values when filling in the form.
    Also check for the cardinality of the nodes being used. You can also initiliaze your value attributes as follows:
    In wdDoInit() method:
    wdContext.currentNodeAElement.setValueA("");
    Context is as follows:
    RootNode
      |____NodeA
            |_____ValueA
    Hope it helps.

  • How to create a pie diagram and display it in html code

    hii frds,
    happy 2 meet u all.
    I want to know how to create a pie diagram that should not be devleloped by using applet, and use it in the html code to display a pie diagram in browser.
    ex code:
    package temp;
    import java.awt.*;
    import java.awt.image.BufferedImage;
    import java.io.*;
    import javax.imageio.ImageIO;
    import javax.swing.JFrame;
    public class Dummy1 extends Panel {
    BufferedImage image;
         int a1,a2,l,t,w,h;
    public Dummy1()
              try
    a1=90;
              a2=210;
              l=10;
              t=10;
              w=200;
              h=200;
    } catch (Exception ie) { System.out.println("Error:"+ie.getMessage());  }
    public void paint(Graphics g) {
    // g.drawImage( image, 0, 0, null);
    g.setColor(Color.green);
              g.fillArc(l,t,w,h,0,a1);
    g.setColor(Color.red);
              g.fillArc(l,t,w,h,a1,(a2-a1));
         g.setColor(Color.blue);
              g.fillArc(l,t,w,h,a2,(360-a2));
              System.out.println("in paint");
              image=(Image)g.getGraphics();
    public JFrame getMyFrame()
    JFrame frame=null;
              try
    frame = new JFrame("Display image");
    Panel panel = new Dummy1();
    frame.getContentPane().add(panel);
    frame.setSize(500, 500);
    // frame.setVisible(true);
    // frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              }catch(Exception e) { e.printStackTrace(); }
              return frame;
    static public void main(String args[]) throws
    Exception {
    JFrame frame = new JFrame("Display image");
    Panel panel = new Dummy1();
    frame.getContentPane().add(panel);
    frame.setSize(500, 500);
    frame.setVisible(true);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    - > with out using <applet> in html can't we display the awt grahics in browser.
    plz clarify my doubts.
    thank you.
    regards
    moons..

    If you are using MSSQL SERVER then try creating a stored procedure like this
    create proc Name
    select * from Table
    by executing this in sql query analyzer will create a stored procedure that returns all the data from Table
    here is the syntax to create SP
    Syntax
    CREATE PROC [ EDURE ] procedure_name [ ; number ]
        [ { @parameter data_type }
            [ VARYING ] [ = default ] [ OUTPUT ]
        ] [ ,...n ]
    [ WITH
        { RECOMPILE | ENCRYPTION | RECOMPILE , ENCRYPTION } ]
    [ FOR REPLICATION ]
    AS sql_statement [ ...n ]
    Now Create new report and create new connection to your database and select stored procedure and add it to the report that shows all the columns and you can place the required fields in the report and refresh the report.
    Regards,
    Raghavendra
    Edited by: Raghavendra Gadhamsetty on Jun 11, 2009 1:45 AM

Maybe you are looking for

  • Newbie Please Help!

    Is there a way in which I can run the following program from within an HTML web site. The code is from /* From http://java.sun.com/docs/books/tutorial/index.html */ However I have changed some of it and wish to run it from within a web-site I am buil

  • Error When trying to Launch Site

    I have created a site from Site Studio Designer and when I am trying to open that site from my local UCM server (from the Web Sites menu), it is giving error as Content Server Request Failed Must be in Contribution mode to access node '4' on site 'vi

  • HTTP POST within an application

    hi, i am very new to java and just reached my next problem ;) what i want to do is post some data to a webserver from within my application and get the answer of the server back to a string (or something like that). what do i have to do for this?

  • Spanish speech analysis not appearing in the language list

    I downloaded and installled the spanish speech analysis module for CS 6 and CC. I have both CS 6 and CC installed on my machine. I installed the spanish module. Then in prelude, the spanish option doesn't appear in the language list. I only have engl

  • Error in interpretation of keyframes

    Hi there, today I want to report something, that look like an error in the way, FCPX interprets keyframes, which I set for moving a clip on the screen. This happens with FCPX version 10.1.4 and at least 10.1.3 (for earlier versions I am not sure, if