Help with JAI in java applet

I'm fairly inexperienced with java, but I'm hopeful someone here won't mind helping.
I am using netbeans and have a project to let a user upload files or scan them in with a usb scanner. I've imported icepdf to the libraries and referenced it in the jnlp file and it worked fine. I did the same with jai_windows-i586.jar and I get this error when trying to upload
Exception in thread "AWT-EventQueue-2" java.lang.NoClassDefFoundError: com/sun/media/jai/codec/SeekableStream
Caused by: java.lang.ClassNotFoundException: com.sun.media.jai.codec.SeekableStream
I expanded the jar file and found it contained an exe. jai-1_1_3-lib-windows.i586.jre.exe. I found that if I run that exe [(found here)|http://download.java.net/media/jai/builds/release/1_1_3/] on any pc locally, I will not get the errors on that pc.
Am I referencing it incorrectly?
<resources>
<j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se" max-heap-size="1024m" />
<jar href="ScanAreaUI.jar" main="true" />
<jar href="icepdf-core.jar"/>
<jar href="jai_windows-i586.jar"/>
<nativelib href="JTwain-Native.jar" />
</resources>
Do I need to make the applet install the exe located in the jar? I've tried to find information on how to do that without much luck so far.
Thanks for any advice/help.

If it's not finding your "exe" file, then you have an OS path problem. You can either change your path variable in Windows or you can move that "exe" to a location where you already have a path defined. You do realize that when you use features of JAI that are not incorporated in to the JDK, you'll have to have the JAI package loaded on every machine you ever want to run your project.

Similar Messages

  • Need help with bufferstrategy in a applet

    im getting the following errors that its not public in class component
    but in the api it says it's public heres the error.
    can anyone help ?
    heres the code and error
    import java.awt.*;
    import java.applet.*;
    import java.awt.event.*;
    import java.awt.image.*;
    //implements Runnable,KeyListener,MouseListener,MouseMotionListener
    public class memImgSrcApplet extends Applet
    MemoryImageSource producerobj;
    Image img;
    boolean done = false;
    int w,h,cx,cy;long nofloops =0;
    int [] pixels;
    DirectColorModel colorModel;
    MemoryImageSource source;
    BufferStrategy strategy;
      public void init(){
       System.out.println(" init " );
       GraphicsDevice device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
       //setUndecorated(true);// knock out bars and stuff
       setIgnoreRepaint(true);// ignore automatic repaint.
       show();//show fullscreen.
        w = getSize().width;h = getSize().height;
        pixels = new int[w * h];
        colorModel = new DirectColorModel(32, 0x00FF0000, 0x0000FF00, 0x000000FF,0);
        source = new MemoryImageSource(w, h, colorModel, pixels, 0, w);
        source.setAnimated(true);
        Image img = createImage(source);
        createBufferStrategy(2);
        strategy = this.getBufferStrategy();
      public void run(){
       System.out.println(" run " );
       int j =0;
       long t = System.currentTimeMillis();
       while(j < 1000){
       j++;
       for (int n=pixels.length; --n>=0;){ pixels[n] = n+j;}
       source.newPixels();
       Graphics g = strategy.getDrawGraphics();
       g.drawImage(img, 0, 0, null);
       strategy.show();
       System.out.println(" 1000 frames in  milliseconds elapsed "+(System.currentTimeMillis()-t)+" seconds "+(System.currentTimeMillis()-t)/1000f );
       System.out.println(" fps "+( 1000f/ ((System.currentTimeMillis()-t) /1000f )) );
      public void start(){
      System.out.println(" start " );
      public void stop(){
      System.out.println(" stop " );
         //public void paint(Graphics g){System.out.println(" paint " );}
    }     C:\myjava\documents downloaded\fullscreen\memImgSrcApplet.java:30: createBufferStrategy(int) is not public in java.awt.Component; cannot be accessed from outside package
    createBufferStrategy(2);
    ^
    C:\myjava\documents downloaded\fullscreen\memImgSrcApplet.java:31: getBufferStrategy() is not public in java.awt.Component; cannot be accessed from outside package
    strategy = this.getBufferStrategy();
    ^
    Note: C:\myjava\documents downloaded\fullscreen\memImgSrcApplet.java uses or overrides a deprecated API.
    Note: Recompile with -deprecation for details.
    2 errors
    Exit code: 1
    There were errors
    and i have no idea why im geting the depreciation note

    I think if you use BufferStrategy in an Applet, you have to do it on a Canvas and add the Canvas to the Applet. I'll have to check to make sure.

  • Desperately need some help with client-server java programming

    Hi all,
    I'm new to client server java programming. I would like to work on servlets and apache tomcat. I installed the apache tomcat v 5.5 into my machine and i have sun java 6 also. I created a java applet class to be as a client and embed it into an html index file, like this:
    <applet code="EchoApplet.class" width="300" height="300"></applet>However, when I try to run the html file on the localhost, it print this error: classNotFoundException, couldn't load "EchoApplet.class" class. On the other hand, when I open the index file on applet viewer or by right clicking, open with firefox version 3, it works.
    I thought that the problem is with firefox, but after running the applet through the directory not the server, i found that the problem is not any more with firefox.
    Can anyone help me to solve this problem. I'm working on it for 5 days now and nothing on the net helped me. I tried a lot of solutions.
    Any help?

    arun,
    If the browser is going to execute $myApplet, first it must get the $myApplet.class from the server, right?
    So it follows that:
    1. $myApplet.class must be acessible to server, and
    2. the server must know exactly where to find $myApplet.class
    So, the simplest solution is to is put the $myApplet.class in the same directory as the HTML file which uses it... then your applet tag is simple:
      <applet height="200" width="400" code="$myApplet.class" ></applet>* The height & width attributes are required
    * Note the +.class+ is required in the code attribute (a common mistake).
    * This works uniformly (AFAIK) accross all java-enabled browsers.
    * There are incompatibilities with the codebase attribute. Poo!
    Cheers. Keith.

  • Need help with long term Java problems

    I've been having problems with Java on my computer for about a year now, and I'm hoping that someone here can help me out.
    Java used to work fine on the computer when I first got it (a Dell laptop) and I hadn't installed anything myself. But then one day it stopped loading Java applets, and hasn't worked since. By this, I mean that I get the little colorful symbol in a box when I try to play Yahoo games, use the http://www.jigzone.com site, go to chat rooms, etc. Java menus on websites like http://www.hartattack.tv used to work still, but lately they've been giving me that symbol too.
    I've tried downloading a newer version of Java, but nothing I do seems to work, and I don't know of anything I did to trigger it not working. I'm hoping there's a simple solution to this, and I'm just dumb.
    Thanks.

    This might be way off, but it's something that's tripped me up in the past:
    If you are using Sun's Java plugin, the first time you go to a site that has a particular Java applet, you may be asked to approve/reject a security request.
    If you have clicked on any other windows while the request is first being loaded (which can take some time, because this is swing based), then the security dialog box does not pop to the top of the window stack, and doesn't add an entry into the task bar.
    It appears that Java just doesn't work, but it's actually waiting for you to click "Yes". You can check this by hitting alt-tab and seeing if the Java coffee cup icon is one of the options.
    - K

  • Help with Times Table GUI applet

    Hello,
    I need help with an applet which inputs an integer from the user and displays the appropiate times table up to times 10 eg; user input 5 - display shows
    5 time 1 is 5
    5 times 2 is 10
    5 times 10 is 50.
    I have only managedt o get the display to show one statement eg 5 times 1 - I have tried using a for loop to show the whole table - but unlike a print statement each time the loop goes round it overwrites the data in the display box with the new data - any help would be much appreciated.
    Note: it is for a programming course year 1 exercise - so I can only use basic constructs or loops to achieve this. Thanks in advance! Heres what I have so far:
    import java.applet.* ;
    import java.awt.* ;
    import java.awt.event.* ;
    public class TimesTableApplet extends Applet implements ActionListener
         // Declare the GUI components globally
         Label titleLabel, whichTableLabel ;
         TextField whichTableBox, resultBox ;
         Button showTableButton, clearButton ;
         // Declare integer variables for holdind the number input by the user,
         // the times number, and the result number
         int whichTable, times=1, result ;
         // Declare variables to hold string versions of the three integer variables
         // above, for placing in the TextFields
         String whichTableString, timesString, resultString ;
         public void init ()
              // Create the Labels
              titleLabel = new Label ( "Times Table" ) ;
              whichTableLabel = new Label ( "Which Table?" ) ;
              // Create the TextFields
              whichTableBox = new TextField ( 5 ) ;
              resultBox = new TextField ( 30 ) ;
              // Create the Buttons
              showTableButton = new Button ( "Show Table" ) ;
              clearButton = new Button ( "Clear" ) ;
              // Add the components to the applet window
              add ( titleLabel ) ;
              add ( whichTableLabel ) ;
              add ( whichTableBox ) ;
              whichTableBox.addActionListener ( this ) ;
              add ( resultBox ) ;
              resultBox.setEditable ( false ) ;
              add ( showTableButton ) ;
              showTableButton.addActionListener ( this ) ;
              add ( clearButton ) ;
              clearButton.addActionListener ( this ) ;
         } // End of init method
         public void actionPerformed ( ActionEvent event )
              // Find out which button generated the event
              String arg = event.getActionCommand () ;
              // If the user clicks the clear button, clear the whichTableBox and
              // resultBox
              if ( arg.equals ( "Clear" ) )
                   whichTableBox.setText ( "" ) ;
                   resultBox.setText ( "" ) ;
              else
                   try
                        // Try extracting a string from the whichTableBox ( the users input )
                        // and converting it to an integer
                        whichTableString = whichTableBox.getText () ;
                        whichTable = Integer.parseInt ( whichTableString ) ;
                        // Clear status box
                        showStatus ( "" ) ;
                        // If the user clicks the showTableButton, display the appropiate
                        // times table up to times 10
                        if ( arg.equals ( "Show Table" ) ) ;
                             result = whichTable * times ;
                             timesString = Integer.toString ( times ) ;
                             resultString = Integer.toString ( result ) ;
                             resultBox.setText ( whichTableString + " times " + timesString + " is " + resultString ) ;
                   } // End of try block
                   catch ( NumberFormatException entry )
                        // Display error message and clear whichTableBox
                        showStatus ( "Error: Invalid Input - not an integer!" ) ;
                        whichTableBox.setText ( "" ) ;
                   } // End of catch block
              } // End of else statement
         } // End of actionPerformed method
    } // End of class

    use this code, please arrange your User interface correctly.
    * TimesTableApplet.java
    * Created on March 12, 2007, 12:08 PM
    * @author cc.woon
    import java.applet.* ;
    import java.awt.* ;
    import java.awt.event.* ;
    public class TimesTableApplet extends Applet implements ActionListener
    // Declare the GUI components globally
    Label titleLabel, whichTableLabel ;
    TextField whichTableBox ;
    TextArea resultBox;
    Button showTableButton, clearButton ;
    // Declare integer variables for holdind the number input by the user,
    // the times number, and the result number
    int whichTable, times=1, result ;
    // Declare variables to hold string versions of the three integer variables
    // above, for placing in the TextFields
    String whichTableString, timesString, resultString ;
    public void init ()
    // Create the Labels
    titleLabel = new Label ( "Times Table" ) ;
    whichTableLabel = new Label ( "Which Table?" ) ;
    // Create the TextFields
    whichTableBox = new TextField ( 5 ) ;
    resultBox = new TextArea() ;
    // Create the Buttons
    showTableButton = new Button ( "Show Table" ) ;
    clearButton = new Button ( "Clear" ) ;
    // Add the components to the applet window
    add ( titleLabel ) ;
    add ( whichTableLabel ) ;
    add ( whichTableBox ) ;
    whichTableBox.addActionListener ( this ) ;
    add ( resultBox ) ;
    resultBox.setEditable ( false ) ;
    add ( showTableButton ) ;
    showTableButton.addActionListener ( this ) ;
    add ( clearButton ) ;
    clearButton.addActionListener ( this ) ;
    } // End of init method
    public void actionPerformed ( ActionEvent event )
    // Find out which button generated the event
    String arg = event.getActionCommand () ;
    // If the user clicks the clear button, clear the whichTableBox and
    // resultBox
    if ( arg.equals ( "Clear" ) )
    whichTableBox.setText ( "" ) ;
    resultBox.setText ( "" ) ;
    else
    try
    // Try extracting a string from the whichTableBox ( the users input )
    // and converting it to an integer
    whichTableString = whichTableBox.getText () ;
    whichTable = Integer.parseInt ( whichTableString ) ;
    // Clear status box
    showStatus ( "" ) ;
    // If the user clicks the showTableButton, display the appropiate
    // times table up to times 10
    if ( arg.equals ( "Show Table" ) ) ;
    result = whichTable * times ;
    timesString = Integer.toString ( times ) ;
    String output = "";
    for(int i =1;i<=10;i++){
    output += whichTable +" times "+i + ": "+(i*whichTable)+"\n";
    resultString = Integer.toString ( result ) ;
    //resultBox.setText ( whichTableString + " times " + timesString + " is " + resultString ) ;
    resultBox.setText ( output) ;
    } // End of try block
    catch ( NumberFormatException entry )
    // Display error message and clear whichTableBox
    showStatus ( "Error: Invalid Input - not an integer!" ) ;
    whichTableBox.setText ( "" ) ;
    } // End of catch block
    } // End of else statement
    } // End of actionPerformed method
    } // End of class

  • Looking for Help with Hyperion to JAVA

    I am looking for help with connecting Hyperion to Java. We are in Maryland but would be willing to work out something for remote consulting. If you have experience with connecting web services, hyperion, and Java and would be interested in about 80 hours of consulting please contact me at:[email protected] x4846

    Hi,
    From your description, you want to achieve the following goal:
    Configure Exchange to filter the attachments if the size is over 10 MB and store it in a public folder, and then forward the email to Salesforce.
    Based on my knowledge, I'm afraid that it can't be achieved. Exchange can filter messages with attachments, but it couldn't store these attachments on public folder automatically. Also, I don't see any transport rule can do it.
    Hope my clarification is helpful.
    Best regards,
    Amy Wang
    TechNet Community Support

  • Help with my basic java

    Hello i am in a high school programming class and i need help. I have to make an application that draws a basic face, and then i put in different scrollbars, drop menus and checkboxes to control how the face works. I have gotten most of what i need to do but i am stuck on, I need to have a so if i press it they will get closer together of farther apart, which is where im stuck. i can only make them move in the same direction. any ideas???
    heres the code.
    import java.awt.*;
    import java.awt.event.*;
    public class Unit9q extends java.applet.Applet implements AdjustmentListener,ItemListener {
         Graphics g;
         Checkbox mybox1,mybox2,mybox3,mybox4,mybox5;
         CheckboxGroup mygroup1,mygroup2;
         Choice mymenubar1,mymenubar2;
         String colorword,shapeword,menuitem1,menuitem2,eyefill,eyesstring;
         Color clr;
         int yaxis,inteyes,ineyes;
         Scrollbar yaxisscroll,eyes;     
         public void init() {
              yaxisscroll=new Scrollbar(0,50,1,120,140);
              yaxisscroll.addAdjustmentListener(this);
              yaxisscroll.setBounds(100,10,100,20);
              add(yaxisscroll);
              yaxis=120;
              eyes=new Scrollbar(0,50,1,120,140);
              eyes.addAdjustmentListener(this);
              eyes.setBounds(100,10,100,20);
              add(eyes);
              inteyes=110;
              mygroup1=new CheckboxGroup();
              mybox1=new Checkbox("Red",mygroup1,false);
              mybox2=new Checkbox("Blue",mygroup1,false);
              mybox3=new Checkbox("Green",mygroup1,false);          
              mybox4=new Checkbox("Filled",mygroup2,false);
              mybox5=new Checkbox("Outlined",mygroup2,false);
              add(mybox4);
              add(mybox5);
              mybox1.addItemListener(this);
              mybox2.addItemListener(this);
              mybox3.addItemListener(this);
              add(mybox1);
              add(mybox2);
              add(mybox3);
              clr=Color.white;
              mymenubar1=new Choice();
              mymenubar1.addItem("Square");
              mymenubar1.addItem("Circle");
              mymenubar1.addItem("Rectangle");
              mymenubar1.addItem("Oval");
              mymenubar1.addItemListener(this);
              mymenubar2=new Choice();
              mymenubar2.addItem("Square");
              mymenubar2.addItem("Oval");
              mymenubar2.addItemListener(this);
              add(mymenubar1);
         public void adjustmentValueChanged(AdjustmentEvent event){
              yaxis=yaxisscroll.getValue();
              inteyes=eyes.getValue();
              repaint();
         public void itemStateChanged(ItemEvent event) {
              menuitem1=mymenubar1.getSelectedItem();
              menuitem2=mymenubar2.getSelectedItem();
              if (mybox1.getState()==true) {clr=Color.red;}
              else if (mybox2.getState()==true) {clr=Color.blue;}
              else if (mybox3.getState()==true) {clr=Color.green;}
              repaint();
         public void paint(Graphics g) {
              g.setColor(Color.black);
              if (menuitem1.equals("Rectangle")){
                   g.drawRect(100,100,70,90);}
              else if (menuitem1.equals("Oval")){
                   g.drawOval(100,100,75,90);}
              else if (menuitem1.equals("Circle")){
                   g.drawOval(100,100,80,80);}
              else if (menuitem1.equals("Square")){
                   g.drawRect(100,100,80,80);}     
              if (menuitem2.equals("Circle")){
                   g.drawOval(80,100,10,10);}
              else if (menuitem2.equals("Square")){
                   g.drawRect(80,100,10,10);}     
                        g.setColor(clr);
              if (mybox4.getState()==true) {
                   g.fillRect(inteyes,120,10,10);
                   g.fillRect(ineyes,120,10,10);}
              else if (mybox5.getState()==true) {
                   g.drawOval(inteyes,120,10,10);
                   g.drawOval(ineyes,120,10,10);}     
              ineyes=inteyes+42;
              g.setColor(Color.black);     
              g.fillOval(128,yaxis,15,22);
              g.drawArc(111,160,50,20,0,180);     
         } //thank you if you can solve it

    Next time you post code, use the CODE button or [code] and [/code] tags so that it maintains the formatting from your editor.
    If two things are moving int the same direction, your adding N to both of their x-coordinates. If you want one to move in one direction and the other in the other direction, then you have to add N to one and -N to the other.

  • Beginner needs help with inserting images in applet.

    //  Name: Sachit Harish
    //  Name of Program: HorseRacing
    //  Date Started: May 15, 2003
    //  Date Finished: 2003
    //  Program Description:
    import java.awt.*;
    import java.applet.*;
    public class HorseRacing extends Applet
    //     Button startGameButton;
         InputField betAmountBox;
         Image redHorse; //<---------//
    //     Button[] drawings = new Button[4];      
    //    String[] labels =  {"Face", "Cheese", "Stick", "Mashed Potatoes"};
        //  Method Name: init()
        //  Parameters Passed: None
        //  Data Returned: None
        //  Method Purpose: Where we initialise the InputBoxes and colors.
        public void init()         
          //     startGameButton=new Button("Click to Start Game");
          //     add(startGameButton);
          /*  for(int i=0; i<drawings.length; i++)
                 drawings=new Button (labels[i]);     
         add(drawings[i]);
    inputBoxes();     
    setBackground(Color.gray); //background color
    setForeground(Color.black); //input field text color
    redHorse = getImage(getCodeBase(), "horse_red.GIF"); //<---------//
    // Method Name: paint()
    // Parameters Passed: Graphics variable screen
    // Data Returned: None
    // Method Purpose: Where the programs calls and collects all the methods.
    //                         If high and low are not integers, an error message
    //                         appears.
    public void paint(Graphics screen)
         //screen.drawString("HORSE RACES!!!!!", 40,60);
         //startGameButton.move(50,300);
         betAmountBox.setPosition(115,200);
         startGame();
         if(betAmountBox.isInt())
              int betAmount=getBetAmount();
         else
    screen.drawString("ERROR: You have not entered an Integer!", 10,110);
    screen.drawString(" Please correct your mistake.", 40,125);
         /*int xPos=10;
         int yPos=10;
         for(int i=0; i<drawings.length; i++)
              drawings[i].move(xPos,yPos);
              xPos+=60;
         screen.drawString("Click each button and get a surprise!", 10,50);*/
    // Method Name: inputBoxes()
    // Parameters Passed: None
    // Data Returned: None
    // Method Purpose: Where we initialise the inputboxes, set the size of
    // the InputField and adds it to the screen. Also
    // initialises the InputField to start with 1's
    void inputBoxes()
    betAmountBox = new InputField(5);
    add(betAmountBox);
    betAmountBox.initialise(50);
    // Method Name: getBetAmount()
    // Parameters Passed: Variable number
    // Data Returned: None
    // Method Purpose: Returns the variable number back to the paint()
    int getBetAmount()
    int betAmount=betAmountBox.toInt();
    return betAmount;
    // Method Name: action()
    // Parameters Passed: Event variable evt, Object varible obj
    // Data Returned: Variable true
    // Method Purpose: This block responds when the user takes an action
    // (such as hitting the return key). It causes the paint
    // block to be done again
    public boolean action(Event evt, Object arg)
    Graphics screen=getGraphics();
    if(evt.target instanceof Button)
         if(arg=="Click to Start Game")
              screen.clearRect(0,0,600,600);
              startGame();
    /*if(evt.target instanceOf Button)
                   if(arg=="Face")
                        screen.clearRect(5,55,400,400);
                        faceDrawing();
                   else if (arg=="Cheese")
                        screen.clearRect(5,55,400,400);
                        cheeseDrawing();
                   else if (arg=="Stick")
                        screen.clearRect(5,55,400,400);
                        stickDrawing();
                   else if (arg=="Mashed Potatoes")
                        screen.clearRect(5,55,400,400);
                        potatoeDrawing();
    return true;
    void startGame()
    Graphics screen=getGraphics();
              //Horse Racing Box
              screen.drawRect(10,10,505,120);
              screen.drawLine(60,10,60,130);
              screen.drawLine(10,40,515,40);
              screen.drawLine(10,70,515,70);
              screen.drawLine(10,100,515,100);               
              screen.setColor(Color.red);
              screen.fillRect(11,11,49,29);
              screen.setColor(Color.yellow);
              screen.fillRect(11,41,49,29);
              screen.setColor(Color.blue);
              screen.fillRect(11,71,49,29);
              screen.setColor(Color.orange);
              screen.fillRect(11,101,49,29);
              screen.setColor(Color.black);
              //Betting Box          
              screen.drawRect(10,150,280,100);     
              screen.drawLine(10,185,290,185);
              screen.drawLine(80,150,80,185);
              screen.drawLine(150,150,150,185);
              screen.drawLine(220,150,220,185);
              screen.setColor(Color.red);
              screen.fillRect(11,151,69,34);
              screen.setColor(Color.yellow);
              screen.fillRect(81,151,69,34);
              screen.setColor(Color.blue);
              screen.fillRect(151,151,69,34);
              screen.setColor(Color.orange);
              screen.fillRect(221,151,69,34);
              screen.setColor(Color.black);
              screen.drawString("BET = ", 40,230);
    screen.drawImage(redHorse, 200,200,300,300,this); //<---------//      
    The picture an't showing up... why? First time trying to insert images. (I made arrows where I did stuff with the image.)
    -sachit

    BTW, ignore the buttons and stuff. I just quickly grabbed this file from an earlier button program. :p
    -sachit

  • Help with a SIMPLE java thing

    I've only got ONE handful of hair left.
    I'm trying to build a series of dropdown boxes; a day dropdown (Mon, Tue, Wed...), a month dropdown (Jan, Feb, Mar...), a year dropdown, hour dropdown, minute dropdown, and an am/pm dropdown.
    I think I want to build my dropdowns using "for" loops something like this:
    for (i=0;i<12;i++) {
    myStringBuffer.append("<option>" + [someUnknownFunctionThatReturnsTheFirstThreeLettersOfTheMonth(i)] + "</option>")
    I've been trying to mix up various combinations of Date objects (most date functions seem to be depreciated), Calendar Objects, DateFormat Objects and SimpleDateFormat Objects but nothing seems to want to perform the function that I need.
    I've had iffy success creating a calendar object, setting the Month to "i", using the getTime function to return a Date object which I can then pass to the SimpleDateFormat object using the .format(Date) function, after setting the pattern to "EEE", but it seems like just an incredibly complicated way to do what ought to be a simple function...i.e. convert a number 0-11 (or 1-12, I'm not picky) into the name of a stinking Month! Arrgh.
    If anyone can help, I thank you.

    I've done that before, so i'll share it with you.
    import java.text.SimpleDateFormat;
    import java.text.DateFormatSymbols;
    import java.util.Calendar;
    import java.util.Date;
    public String createListOfMonth(String pName) {
    StringBuffer sbMonth = new StringBuffer();
    DateFormatSymbols fm = new DateFormatSymbols();
    String[] arrMonth = fm.getMonths();
    sbMonth.append("<select name=\"" + pName + "\">");
    sbMonth.append("     <option value=\"\">Month</option>\n");
    for (int i=0; i<arrMonth.length; i++) {
    if (!arrMonth.trim().equals("")) {
    String sValue = "0000" + (i + 1);
    sValue = sValue.substring(sValue.length() - 2);               
    sbMonth.append("     <option value=\"" + sValue + "\">" + arrMonth[i] + "</option>\n");
    sbMonth.append("</select>");
    return (sbMonth.toString());
    You can manipulate the symbol (either for months, days) using different locale. You can see the API for java.text.DateFormatSymbols in Java2 SE.
    Regards,
    Hariyanto

  • Im DROWNING! need help with a simple java assignment! plz someone help me!

    i need help with my java assignment, with validating a sin number. easy for must who know java. im drowning... please help!

    You will need to store each digit of the social insurance number in a field of its own. To validate the entry you will:
    1. Multiply the 2nd, 4th, 6th and 8th digit by 2.
    2. If the product of any of the four multiplications result in a value greater than 9, add the two resulting digits together to yield a single-digit response. For example 6 * 2 = 12, so you would add the 1 and the 2 to get a result of 3.
    3. Add these four calculated values together, along with the 1st, 3rd, 5th, and 7th digits of the original number.
    4. Subtract this sum from the next highest multiple of 10.
    5. The difference should be equal to the 9th digit, which is considered the check digit.
    Example of validating S.I.N. 765932546
    1st digit 7
    2nd digit (6*2 =12 1+2=) 3
    3rd digit 5
    4th digit (9*2 = 18 1+8 =) 9
    5th digit 3
    6th digit (2*2 = 4) 4
    7th digit 5
    8th digit (4*2 = 8) 8
    Total 44 next multiple of 10 is 50
    50-44 = 6 which is the 9th digit
    Therefore the S.I.N. 765932546 is Valid
    ********* SIN Validation *********
    Welcome - Please enter the first number: 120406780
    Second digit value multiplied by 2 4
    Fourth digit value multiplied by 2 8
    Sixth digit value multiplied by 2 12
    Eighth digit value multiplied by 2 16
    Value derived from 6th digit 3
    Value derived from 8th digit 7
    The total is 30
    Calculated digit is 10
    Check digit must be zero because calculated value is 10
    The SIN 120406780 is Valid
    this is my assignemtn this is what i have! i dont know where to start! please help me!
    /*     File:     sinnumber.java
         Author:     Ashley
         Date:     October 2006
         Purpose: Lab1
    import java.util.Scanner;
    public class Lab1
              public static void main(String[] args)
                   Scanner input = new Scanner(System.in);
                   int sin = 0;
                   int number0, number1, number2, number3, number4, number5, number6, number7, number8;
                   int count = 0;
                   int second, fourth, sixth, eighth;
                   System.out.print("\t\n**********************************");
                   System.out.print("\t\n**********SIN Validation**********");
                   System.out.print("\t\n**********************************");
                   System.out.println("\t\nPlease enter the First sin number: ");
                   sin = input.nextInt();
                   count = int.length(sin);     
                   if (count > 8 || count < 8)
                   System.out.print("Valid: ");
         }

  • Help with a Times Table Applet.

    Hey,
    I am a college student and I have been given the task of constructing a times table applet. Basically, I am stuck to the point of where I have no clue of what to do next. Even my college tutor is stuck as to what to do. I was wondering if you could give me any aid in helping me develop this applet fully, so that it is correct and functioning. Here it is:
    import java.io.*;
    import Input.*;
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    abstract class TimesTableApplet extends Applet implements ActionListener
         public void initialize();{}
         String message="";
         public void init()
         Button btnClick= new Button("Enter");
    add(btnClick);
              //String line = null;
              float table = 0, range = 0, attempts = 0;
              int count = 1, reply = 1, lines = 1;
    TextArea textone;
         while(reply==1)
                   String line = null;
                   table = 0;
                   range = 0;
                   ClrScr.ClrScr();
                   textone = new TextArea("",10,30+12*lines);
                   lines=1;
              while (( table < 1) || (table > 20) && attempts <3)
                   textone = new TextArea("Input table from 1-20:",10,10);
                   table = Input.readFloat();attempts++;
              attempts = 0;
                   while (( range < 1) || (range > 14) && attempts <3)
                        textone = new TextArea("Input range 1-14:,10,20");
                        range = Input.readFloat();attempts++;
              if (( table >= 1) && (table <= 20))
                   if (( range >= 1) && (range <= 14))
                   while (count<=range)
                        textone = new TextArea(count + "x" + table + "=" + count * table);
                        count++;
                        lines++;
                   count=1;
                   textone = new TextArea("Would you like another go? Type '1' for yes");
                   reply = Input.readInt();
         }//end while reply ==1
         }//end init
         public void paint(Graphics g)
         int count =1;
         while ( count <=80)
         System.out.println();
         count++;
    }

    Ok, why did you post this code? we will not be able to compile it because we are missing
    the Input package not did you mention wich jar to find this (nor did google).
    Syntax error in initialize
    Usage of the unknown object ClrScr (static method ClrScr)
    Usage of the unknown object Input (static method readFloat and readInt)
    If your tutor is stuck he or she should find a new job.
    import java.io.*;
    import Input.*;
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    abstract class TimesTableApplet extends Applet implements ActionListener {
         public void initialize(){
         String message = "";
         public void init() {
              Button btnClick = new Button("Enter");
              add(btnClick);
              //String line = null;
              float table = 0, range = 0, attempts = 0;
              int count = 1, reply = 1, lines = 1;
              TextArea textone;
              while (reply == 1) {
                   String line = null;
                   table = 0;
                   range = 0;
                   ClrScr.ClrScr();
                   textone = new TextArea("", 10, 30 + 12 * lines);
                   lines = 1;
                   while ((table < 1) || (table > 20) && attempts < 3)
                        textone = new TextArea("Input table from 1-20:", 10, 10);
                        table = Input.readFloat();
                        attempts++;
                   attempts = 0;
                   while ((range < 1) || (range > 14) && attempts < 3) {
                        textone = new TextArea("Input range 1-14:,10,20");
                        range = Input.readFloat();
                        attempts++;
                   if ((table >= 1) && (table <= 20))
                        if ((range >= 1) && (range <= 14)) {
                             while (count <= range) {
                                  textone = new TextArea(count + "x" + table + "="
                                            + count * table);
                                  count++;
                                  lines++;
                   count = 1;
                   textone = new TextArea(
                             "Would you like another go? Type '1' for yes");
                   reply = Input.readInt();
              }//end while reply ==1
         }//end init
         public void paint(Graphics g) {
              int count = 1;
              while (count <= 80) {
                   System.out.println();
                   count++;
    }

  • Please Help!!! Java Applet is not compiling

    Hi everbody,,,
    im using Eclipse Applet Viewer and it was running yesterday but today it is not???
    here is one exmaple:
    import java.applet.Applet;
    import java.awt.*;
    import java.net.*;
    public class ImageExample extends Applet {
    MediaTracker mt;
    Image img;
    URL base;
    public void init(){
         mt = new MediaTracker(this);
         try{
              base = getDocumentBase();
         catch(Exception e){}
         img = getImage(base,"1.gif");
         mt.addImage(img,1);
         try{
              mt.waitForAll();
         catch(InterruptedException e){}
    public void paint(Graphics g){
         g.drawImage(img, 20, 20, this);
    }it not working with any examples? and i dont why?
    here is the error
    ====================================================================
    load: class ImageExample.class not found.
    java.lang.ClassNotFoundException: ImageExample.class
         at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:183)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
         at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:127)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
         at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:626)
         at sun.applet.AppletPanel.createApplet(AppletPanel.java:779)
         at sun.applet.AppletPanel.runLoader(AppletPanel.java:708)
         at sun.applet.AppletPanel.run(AppletPanel.java:362)
         at java.lang.Thread.run(Thread.java:619)
    Caused by: java.io.FileNotFoundException: /usr2/httpd/jspapps/tomcat/ImageExample/class.class (No such file or directory)
         at java.io.FileInputStream.open(Native Method)
         at java.io.FileInputStream.<init>(FileInputStream.java:106)
         at java.io.FileInputStream.<init>(FileInputStream.java:66)
         at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:70)
         at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:161)
         at sun.applet.AppletClassLoader.getBytes(AppletClassLoader.java:295)
         at sun.applet.AppletClassLoader.access$100(AppletClassLoader.java:44)
         at sun.applet.AppletClassLoader$1.run(AppletClassLoader.java:173)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:170)
         ... 8 more
    ====================================================================
    im using this tutroial to run the Applet
    http://www.cs.utah.edu/classes/cs1021/notes/lecture03/eclipse_help.html
    Please Advice Me
    thanx in advance

    up,,, up

  • What is the use of "resolve" action with SocketPermission in java applet

    Hi,
    Could anyone please explain, how does java applet resolve HOSTNAME mentioned in SocketPermission.
    How does DNS pinning work for java applet? Does applet do something like reverse DNS lookup?
    I have lots of questions in queue.:) But all related to one solution.
    Thanks!!!

    Hi Alex,
    this field is used to store the action which is to be performed on DB.
    If it is U- Update
    I -Insert
    like this .
    Regards,
    Atish

  • I need some help with sound in Java

    hi, i`m new to java. i`m having a through problems with a program i`m writing. i`ve added a song to an applet but it does not play. The code for this is:
    private AudioClip music;
    music = getAudioClip(
    getDocumentBase(), "titantic.wav" );
    Can some 1 tell me is that the write code. please help.

    2 things.
    1. You must also send a command to play the music file.
    2. I'm not certain, but I think that you can only load .au files this way.

  • Need help with running a Java program on Linux

    I am trying to get a Java program to run on a Linux machine. The program is actually meant for a Mac computer. I want to see if someone with Java experience can help me determine what is causing the program to stall. I was successful in getting it installed on my Linux machine and to partially run.
    The program is an interface to a database. I get the login screen to appear, but then once I enter my information and hit enter the rest of the program never shows, however, it does appear to connect in the background.
    Here is the error when I launch the .jar file from the command screen:
    Exception in thread "main" java.lang.IllegalArgumentException: illegal component position
    at java.awt.Container.addImpl(Unknown Source)
    at java.awt.Container.add(Unknown Source)
    I am not a programmer and I am hoping this will make some sense to someone. Any help in resolving this is greatly appreciated!

    Well, without knowing a little bit about programming, and how to run your debugger, I don't think you're going to fix it. The IllegalArgumentException is saying that some call does not like what it's getting. So you'll have to go in an refactor at least that part of the code.

Maybe you are looking for

  • PR-vendor error

    Hi Team, i m getting a error while creating PR, Error "Vendor XYZ does not exist for plant 1234", this error i m getting only when i put the vendor in desired vendor field,if i put it in fixed vendor there is no error. please let me any configrtion n

  • Query Selection Critieria

    Hi experts, My users would like the query selection critieria to allow them to choose a particular selection or select all results For example: Where t0.slpname = [%0] will allow them to select a particular salesperson for the query results. Is there

  • How to setup headphone with in-build microphone in hp 15 r-022tx

    hey, i have hp 15 r-022TX laptop and in this laptop as you know there is only 1 3.5 mm jack slot for headphone. i want to use headphone with in-build microphone (philips SHM1900) and for that i purchased a 2 in 1 jack to connect to laptop jack detail

  • Help! No SWF publish option in publish settings in Adobe CC

    Recently installed Flash CC but big problem. I'm on a Windows machine. I'm unable to publish anything but a javascript .js and html file, OR a JPEG. I need to publish SWFs! Why the heck is it like this? I've never encountered this before. See screen

  • ORA-24330: internal OCI error on OCIStmtFetch2

    I get an internal OCI error when using: OCIStmtFetch2(stmt, errhp,(ub4)1, OCI_FETCH_LAST, 0, OCI_DEFAULT); And OCIAttrGet (stmt, OCI_HTYPE_STMT, (dvoid *) &numrows, (ub4 *) 0, (ub4) OCI_ATTR_CURRENT_POSITION, errhp); return 0 in numrows. What might b