HTML JAVA NEED HELP

I am very new to Java and need some help.
I am trying to manipulate values about on a web page and seem to have got stuck.
The following are variables that are entered
PRICE (typed in)
BID (typed in)
New or Second Hand (radio Buttons)
Then calculate is clicked.
I can get outputs to work but I can't seem to use the PRICE, BID, or BID % to show in the output Box.
and
I can't seem to use what radio button is selected elsewhere other than the output box.
What I want is to use all variables at any time to calculate and manupulate them.
Here is the code, this should clarify what I'm talking about:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head>
<body>
<SCRIPT LANGUAGE="JavaScript">
<!--
var myPrice;
var myBid;
function Calculate(form)
var bper;
bper = (myBid / myPrice) * 100;
form.Fbper.value = bper;
function SetmyPrice(PV)
{myPrice = PV.value;}
function SetmyBid(dis)
{myBid = dis.value;}
function output(obj) {
var i = 0
while (!obj.type.checked)
{i = i + 1}
obj.response.value =
          "You are bidding for a " +
obj.type[i].value + ",\n"+
"item."
function ClearForm(form){
myPrice=0;
myBid=0;
bper=0;
form.myPrice.value = "";
form.myBid.value = "";
form.Fbper.value = "";
// -->
</SCRIPT>
<center>
<FORM METHOD="POST">
</center>
<p><font size="5">Price �<INPUT TYPE=text NAME=myPrice SIZE="14" ONCHANGE="SetmyPrice(this)"></font></p>
<p><font size="5">Bid �<INPUT TYPE=text NAME=myBid SIZE="14" ONCHANGE="SetmyBid(this)"></font></p>
<p style="margin-top: 0; margin-bottom: 0" align="left">
<input type="radio" checked value="New" name="type">New </p><p style="margin-top: 0; margin-bottom: 0" align="left">
<input type="radio" value="Second Hand" name="type">Second Hand </p><p style="margin-top: 0; margin-bottom: 0" align="left">
<INPUT TYPE=BUTTON ONCLICK="Calculate(this.form), output(this.form)" VALUE="Calculate"><INPUT TYPE=BUTTON VALUE=" Reset " onClick="ClearForm(this.form)"></p><p style="margin-top: 0; margin-bottom: 0" align="left">
 </p><p style="margin-top: 0; margin-bottom: 0" align="left">
OUTPUT</p><p style="margin-top: 0; margin-bottom: 0" align="left">
 </p><p style="margin-top: 0; margin-bottom: 0" align="left">
 </p><p style="margin-top: 0; margin-bottom: 0" align="left">
<font size="5">Bid </font><font size="4"><INPUT readonly TYPE=text NAME="Fbper" VALUE="" SIZE="4">%</font></p>
<p><textarea name="response" rows="3" cols="70"></textarea></p>
<center>
</FORM>
</center>
</body>
</html>

That's not java, that's javascript.
Thanks again to those boneheads at Netscape who decided to confuse everybody with that name. For that matter why does Sun have to have two sets of version numbers for every product.
Anyway you may get a better response on a javascript forum.

Similar Messages

  • Hi, i'm new to java. need help setting the path in win XP

    hi all,
    i'm new to java technology. i've just downloaded the JDK and ran my first java program (hello world). i love it. java's gr8. i need help. i run win XP and how can i setup the path sothat i can execute my programs from the root dir??? any help in this direction will be greatly appreciated. please email me @ [email protected]
    Best regards
    Mrinal

    Go to Start menu and select Control Panel. In the Control Panel, double click on System. In the System dialogue, choose the Advanced tab. Then click on Environmental Variables. Select Path and Edit. Put ;c:\j2sdk1.4.0\bin at the end of the Path (or c:\j2sdk1.4.0\bin;) at the start of the Path. That's it.

  • HTML Glitch Need Help Quick!

    +*I Need Help Now on this!+*
    I tried to open an HTML file in iWeb, and of course, it couldn't open it (I Should have known)
    But now, every time I open iWeb, it says (File).html cannot be opened (and I only tried to open it
    the first time!) and then it closes!
    what can I do!!?

    Go to
    ~/Library/Application Support/iWeb/
    and open the domain file.
    Next time iWeb will remember this.
    Where ~ is your Home Directory (Cmd-Shift-H)

  • New to java(need help on access specifier)

    hi! i am new to java.plzzzzz help me i have to make a project on access specifier's i know all theroy.but
    i am unable to understand how i can define all specifiers practicly.i mean in a program.
    thanks.plzzzzzzzz help me

    the most common project i can think of is a payroll system..
    you can have real implementation of all the access specifiers
    good luck

  • How to (make best) use external js library from html object (need help from dev)

    Ok, on another discussion about rotating full screen backgrounds slideshows, i was orientated to try a small lib named "backstrech"
    I throw myself in, and i really like what we can do with it.
    To use it simply, just make an html object and paste this in :
    <script src="http://musecdn2.businesscatalyst.com/scripts/4.0/jquery-1.8.3.min.js" type="text/javascript"></script>
    <script src="assets/jquery.backstretch.min.js" type="text/javascript"></script>
    <script>
      $.backstretch([
          "http://dl.dropbox.com/u/515046/www/outside.jpg"
        , "http://dl.dropbox.com/u/515046/www/garfield-interior.jpg"
        , "http://dl.dropbox.com/u/515046/www/cheers.jpg"
      ], {duration: 3000, fade: 750});
    </script>
    then add the jquery.backstretch.min.js to your "downloaded files" (file menu > files to download)
    And you’re done.
    Now, i need some help from better developers.
    As you can see, my first line is a call to jquery, the same that we find later in Muse exported code.
    Reason 1 : without this line, jquery is not defined and the plugin won’t work.
    This raises 2 issues :
    - We load twice the same ressource which is useless (100k)
    - loading js is all about having the page hangs while it loads, hence, they are put at the end of the body.
    Does anybody know a way to load this particular html script AFTER we are sure the muse scripts (esp. jquery) have been loaded ?
    (in the Edge Animate world, i’d go for the yepnope, and put it at the right place in the code, though, here i have no access to page load structure except head)
    PS : in addition to that, i made an exported page/excluded from navigation where i put all the images i wanted for the background, i could then simply change the images lines :
    , "http://dl.dropbox.com/u/515046/www/garfield-interior.jpg"
    to
    , "images/my_image_name_as_in_ressources.jpg"

    Got it, there was a bug in my code. Here is what you do:
    1. Download the js file https://raw.github.com/srobbin/jquery-backstretch/master/jquery.backstretch.min.js
    2. In Muse: Go to File -> Add Files for Upload and add the script file
    3. Open Page Properties -> Metadata -> HTML for <Head>
    Paste this code in:
    <script>
    window.onload = function() {
    var loaded = function() {
      $.backstretch([
          "http://dl.dropbox.com/u/515046/www/outside.jpg"
        , "http://dl.dropbox.com/u/515046/www/garfield-interior.jpg"
        , "http://dl.dropbox.com/u/515046/www/cheers.jpg"
      ], {duration: 3000, fade: 750});
    //Load the plugin:
    var head= document.getElementsByTagName('head')[0];
    var script= document.createElement('script');
    script.type= 'text/javascript';
    script.onreadystatechange = loaded;
    script.onload = loaded;
    script.src= 'assets/jquery.backstretch.min.js';
    head.appendChild(script);
    }; //Window OnLoad
    </script>
    4. Preview or Publish = Done!
    Example: http://musebackstretch.businesscatalyst.com/index.html

  • �� I have a java applet program (yanhua.java) need help!!!

    �� I have a java applet program (yanhua.java) that use mouse click a area show a fireworks, the applet program that a java fan mail me. Now i find some bug in the program, can you help me? thank in advance!
    The backdrop of the question: The yanhua.java applet program works well. But one day, i install j2re 1.4.1 plugin for my microsfot Internet Explorer, i run the yanhua.java applet program again, it show difficult(i move my mouse in the area, slowness), the fireworks is not fluent. Then i try my best to find the cause , i get some information, the following: yanhua.java run in j2re 1.4.1 plugin,it will deplete 100% cpu; else yanhua.java does not run in j2re 1.4.1 plugin, it will deplete 90%--95% cpu too; but my computer c3 1G cpu and 256MB memory, without running other program at that time. So i can have the assurance to say that the yanhua.java have some bug or error. can you help me to find all bug in yanhua.java? thank you very much!!!
    i want to solve the question: finding all bug in yanhua.java
    NOTE:
    1��fireworks show specially good effect(a yanhua.java applet) you can look at:
    http://www.3ren.net/down/java/yanhua.html
    2��all program you can get from http://www.3ren.net/down/java/yanhua.rar
    /*************************yanhua.java******************************
    import java.applet.Applet;
    import java.applet.AudioClip;
    import java.awt.*;
    import java.awt.image.MemoryImageSource;
    import java.util.Random;
    public class yanhua extends Applet
    implements Runnable
    private int m_nAppX;
    private int m_nAppY;
    private int m_centerX;
    private int m_centerY;
    private int m_mouseX;
    private int m_mouseY;
    private int m_sleepTime;
    private boolean isError;
    private boolean m_isPaintFinished;
    boolean isRunning;
    boolean isInitialized;
    Thread runner;
    int pix0[];
    MemoryImageSource offImage;
    Image dbImg;
    int pixls;
    int pixls2;
    Random rand;
    int bits;
    double bit_px[];
    double bit_py[];
    double bit_vx[];
    double bit_vy[];
    int bit_sx[];
    int bit_sy[];
    int bit_l[];
    int bit_f[];
    int bit_p[];
    int bit_c[];
    int bit_max;
    int bit_sound;
    int ru;
    int rv;
    AudioClip sound1;
    AudioClip sound2;
    public yanhua()
    m_mouseX = 0;
    m_mouseY = 0;
    m_sleepTime = 5;
    isError = false;
    isInitialized = false;
    rand = new Random();
    bits = 10000;
    bit_px = new double[bits];
    bit_py = new double[bits];
    bit_vx = new double[bits];
    bit_vy = new double[bits];
    bit_sx = new int[bits];
    bit_sy = new int[bits];
    bit_l = new int[bits];
    bit_f = new int[bits];
    bit_p = new int[bits];
    bit_c = new int[bits];
    ru = 50;
    rv = 50;
    public void init()
    String s = getParameter("para_bits");
    if(s != null)
    bits = Integer.parseInt(s);
    s = getParameter("para_max");
    if(s != null)
    bit_max = Integer.parseInt(s);
    s = getParameter("para_blendx");
    if(s != null)
    ru = Integer.parseInt(s);
    s = getParameter("para_blendy");
    if(s != null)
    rv = Integer.parseInt(s);
    s = getParameter("para_sound");
    if(s != null)
    bit_sound = Integer.parseInt(s);
    m_nAppX = this.getSize().width;
    m_nAppY = this.getSize().height;
    m_centerX = m_nAppX / 2;
    m_centerY = m_nAppY / 2;
    m_mouseX = m_centerX;
    m_mouseY = m_centerY;
    resize(m_nAppX, m_nAppY);
    pixls = m_nAppX * m_nAppY;
    pixls2 = pixls - m_nAppX * 2;
    pix0 = new int[pixls];
    offImage = new MemoryImageSource(m_nAppX, m_nAppY, pix0, 0, m_nAppX);
    offImage.setAnimated(true);
    dbImg = createImage(offImage);
    for(int i = 0; i < pixls; i++)
    pix0[i] = 0xff000000;
    sound1 = getAudioClip(getDocumentBase(), "firework.au");
    sound2 = getAudioClip(getDocumentBase(), "syu.au");
    for(int j = 0; j < bits; j++)
    bit_f[j] = 0;
    isInitialized = true;
    start();
    public void run()
    while(!isInitialized)
    try
    Thread.sleep(200L);
    catch(InterruptedException interruptedexception) { }
    do
    for(int j = 0; j < pixls2; j++)
    int k = pix0[j];
    int l = pix0[j + 1];
    int i1 = pix0[j + m_nAppX];
    int j1 = pix0[j + m_nAppX + 1];
    int i = (k & 0xff0000) >> 16;
    int k1 = ((((l & 0xff0000) >> 16) - i) * ru >> 8) + i;
    i = (k & 0xff00) >> 8;
    int l1 = ((((l & 0xff00) >> 8) - i) * ru >> 8) + i;
    i = k & 0xff;
    int i2 = (((l & 0xff) - i) * ru >> 8) + i;
    i = (i1 & 0xff0000) >> 16;
    int j2 = ((((j1 & 0xff0000) >> 16) - i) * ru >> 8) + i;
    i = (i1 & 0xff00) >> 8;
    int k2 = ((((j1 & 0xff00) >> 8) - i) * ru >> 8) + i;
    i = i1 & 0xff;
    int l2 = (((j1 & 0xff) - i) * ru >> 8) + i;
    int i3 = ((j2 - k1) * rv >> 8) + k1;
    int j3 = ((k2 - l1) * rv >> 8) + l1;
    int k3 = ((l2 - i2) * rv >> 8) + i2;
    pix0[j] = i3 << 16 | j3 << 8 | k3 | 0xff000000;
    rend();
    offImage.newPixels(0, 0, m_nAppX, m_nAppY);
    try
    Thread.sleep(m_sleepTime);
    catch(InterruptedException interruptedexception1) { }
    } while(true);
    public void update(Graphics g)
    paint(g);
    public void paint(Graphics g)
    g.drawImage(dbImg, 0, 0, this);
    public void start()
    if(isError)
    return;
    isRunning = true;
    if(runner == null)
    runner = new Thread(this);
    runner.start();
    public void stop()
    if(runner != null)
    runner.stop();
    runner = null;
    public boolean mouseMove(Event event, int i, int j)
    m_mouseX = i;
    m_mouseY = j;
    return true;
    public boolean mouseDown(Event event, int i, int j)
    m_mouseX = i;
    m_mouseY = j;
    int k = (int)(rand.nextDouble() * 256D);
    int l = (int)(rand.nextDouble() * 256D);
    int i1 = (int)(rand.nextDouble() * 256D);
    int j1 = k << 16 | l << 8 | i1 | 0xff000000;
    int k1 = 0;
    for(int l1 = 0; l1 < bits; l1++)
    if(bit_f[l1] != 0)
    continue;
    bit_px[l1] = m_mouseX;
    bit_py[l1] = m_mouseY;
    double d = rand.nextDouble() * 6.2800000000000002D;
    double d1 = rand.nextDouble();
    bit_vx[l1] = Math.sin(d) * d1;
    bit_vy[l1] = Math.cos(d) * d1;
    bit_l[l1] = (int)(rand.nextDouble() * 100D) + 100;
    bit_p[l1] = (int)(rand.nextDouble() * 3D);
    bit_c[l1] = j1;
    bit_sx[l1] = m_mouseX;
    bit_sy[l1] = m_nAppY - 5;
    bit_f[l1] = 2;
    if(++k1 == bit_max)
    break;
    if(bit_sound > 1)
    sound2.play();
    return true;
    public boolean mouseExit(Event event, int i, int j)
    m_mouseX = i;
    m_mouseY = j;
    return true;
    void rend()
    boolean flag = false;
    boolean flag1 = false;
    boolean flag2 = false;
    for(int k = 0; k < bits; k++)
    switch(bit_f[k])
    default:
    break;
    case 1: // '\001'
    bit_vy[k] += rand.nextDouble() / 50D;
    bit_px[k] += bit_vx[k];
    bit_py[k] += bit_vy[k];
    bit_l[k]--;
    if(bit_l[k] == 0 || bit_px[k] < 0.0D || bit_py[k] < 0.0D || bit_px[k] > (double)m_nAppX || bit_py[k] > (double)(m_nAppY - 3))
    bit_c[k] = 0xff000000;
    bit_f[k] = 0;
    } else
    if(bit_p[k] == 0)
    if((int)(rand.nextDouble() * 2D) == 0)
    bit_set((int)bit_px[k], (int)bit_py[k], -1);
    } else
    bit_set((int)bit_px[k], (int)bit_py[k], bit_c[k]);
    break;
    case 2: // '\002'
    bit_sy[k] -= 5;
    if((double)bit_sy[k] <= bit_py[k])
    bit_f[k] = 1;
    flag2 = true;
    if((int)(rand.nextDouble() * 20D) == 0)
    int i = (int)(rand.nextDouble() * 2D);
    int j = (int)(rand.nextDouble() * 5D);
    bit_set(bit_sx[k] + i, bit_sy[k] + j, -1);
    break;
    if(flag2 && bit_sound > 0)
    sound1.play();
    void bit_set(int i, int j, int k)
    int l = i + j * m_nAppX;
    pix0[l] = k;
    /*********************************end*******************************

    no one help me???????????

  • How to use Crystal Report with Java - need help

    Dear everyone,
    i am completely new to Crystal report , please can anyone help me to creat a very simple Report using the Crystal report,
    the report will show some records from oracle DB.
    How can i make it by a simple example and with code please?
    do i need any JAR or Bean for Crystal report?
    thanks for your help and please don't hesitate to contact me in case of any inquiries.
    my email: [email protected]
    Thanks in advance

    I what to use Crystal report to generate report.My programe in java swing .Iam retrive table from database in Jtable .But when giving print
    command its print half screen .so that why I wantto usecrystal report
    package file2;
    import file2.choice;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.sql.*;
    import java.util.*;
    import java.awt.print.*;
    import javax.swing.table.*;
    import com.sun.java.swing.*;
    import javax.swing.JTable;
    public class cour extends JFrame implements Printable
         //Menu fileMenu;
         public static void main(String[] a)
    cour n = new cour();
    n.setVisible(true);
    public cour()
         super("Course Report");
         report();
         protected void report()
              JPanel panel = new JPanel();
         JButton printButton = new JButton("Print");
         panel.add(printButton);
         JButton exitButton = new JButton("Exit");
         panel.add(exitButton);     
         DefaultTableModel defaulttablemodel = new DefaultTableModel();
              JTable jtable = new JTable(defaulttablemodel);
              panel.add(new JScrollPane(jtable));
              String      tempname="";
              int tempcnt;
              String driver="sun.jdbc.odbc.JdbcOdbcDriver";
              String url="jdbc:odbc:regs";
              Object[] data = new Object[4];
              try
                             Class.forName(driver);                         
                             Connection connection=DriverManager.getConnection(url,"sa","");
                             Statement statement = connection.createStatement();     
                             String query = "SELECT courseid as CourseID,coursen as CourseName,cfee as Fee,coursed as Duration FROM course";
                             ResultSet rs = statement.executeQuery(query);     
                             ResultSetMetaData rmeta = rs.getMetaData();
                             int numColumns=rmeta.getColumnCount();                         
                             for(int i=1;i<=numColumns;i++)
                                  if(i<=numColumns)
                                       defaulttablemodel.addColumn(rmeta.getColumnName(i));
                             while(rs.next())
                                  for(int i=1;i<=numColumns;++i)
                                       if( i<=numColumns)
                                            tempname = rs.getString(i);
                                            tempcnt=i-1;
                                            data[tempcnt] = tempname;          
                                  defaulttablemodel.addRow(data);                              
                   catch(Exception ex)
              printButton.addActionListener(new ActionListener()
         public void actionPerformed(ActionEvent ae)
              /*if(ae.getActionCommand().equals("Print"))
              PrinterJob pj = PrinterJob.getPrinterJob();
              pj.setPrintable(cour.this);
              if (pj.printDialog())
              try
              pj.print();
              catch (PrinterException pe)
              System.out.println(pe);
    exitButton.addActionListener(new ActionListener()
         public void actionPerformed(ActionEvent ae)
              choice ch=new choice();
                   setVisible(false);
                   ch.setVisible(true);
    setContentPane(panel);
         setSize(1040,780);
    /*Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    Dimension frameSize = getSize();
    int x = (screenSize.width - frameSize.width) / 2;
    int y = (screenSize.height - frameSize.height) / 2;
    setLocation(x, y);*/
    addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    dispose();
    System.exit(0);
    public int print(Graphics g, PageFormat pf, int pageIndex)
    if (pageIndex != 0) return NO_SUCH_PAGE;
    Graphics2D g2 = (Graphics2D)g;
    g2.translate(pf.getImageableX(), pf.getImageableY());
    getContentPane().paint(g2);
    return PAGE_EXISTS;
    }

  • Running java - need help ASAP

    I am running windows xp and trying to run java in the command prompt. I run javac and it creates the class file. When I run java, I get the error - Exception in thread "main" java.lang.NoclassDefFoundError: example.
    I have checked the classpath and it is pointing to the bin folder holding the java exe. What else should I try to get it working. I am trying the HelloWorldApp that was provided by the tutorial.

    http://java.sun.com/docs/books/tutorial/getStarted/problems/index.html
    Read the "runtime problems" section.
    > I have checked the classpath and it is pointing to the bin folder holding the java exe.
    The system PATH should point to the bin folder. The CLASSPATH should not.
    ~

  • XML tools for Java (need help getting started)

    Hi,
    I have been using Java for some time. However, I am new to XML and the tools Java has available to utilize such data.
    What packages, classes, etc are available to read and write XML data?
    Thank you in advance. Happy holidays.
    Cheers,
    Christopher

    I've been using a third-party library called JDOM for well over two years and I highly recommend it for your XML processing needs. It recently reached its first productions release and is available for download at http://www.jdom.org.
    Shaun

  • Having html difficulties need help

    We have created our webpage using Business Cataylist HTML and Dreamweaver. Instead of creating new CSS pages  we simply added a number and changed the information we wanted to be associated with each template page we created. Well, we have having difficulties with our www.divineunity1.com/du1tv page not algning correctly so I went into the css checker from w3c, uploaded the common.css page associated with the page and got this error. This code was already on the common page, what can I do to correct this?
    URI : common7.css
    175
    Property -webkit-border-radius is an unknown vendor extension
    176
    Property -moz-border-radius is an unknown vendor extension
    181
    :-moz-placeholder is an unknown vendor extended pseudo-class
    185
    ::-webkit-input-placeholder is an unknown vendor extended pseudo-element

    Okay, I have another issue if you don't mind lending me your adive on what we should do. On our site we have a videos, we want our videos to show where there is a large video at the top (which there is) and smaller video players on the side (which there is) one atop of the other, however when I go view the page say in Internet Explorer, after I have inserted the html code for the video player we are using (JWPlayers by the way), there is a huge gap inbetween each player. can you help me with what could be causing this issue. The webpage is www.divineunity1.com/du1tv the log in to the site you can use is test test.

  • New to java-need help for debugging

    hey there
    i just wanted my first program in java and here it is below with the error when i'm compiling it, i cant understand whats wrong:
    public class SquareArea {
    public static void main(String[] args); {
    float length;
    float width;
    float SquareArea;
    System.out.println ("Please enter length"+ length);
    System.out.println ("Please enter width"+ width);
    SquareArea= length*width;
    System.out.println ("The area of the square is" + SquareArea);
    The error is:C:\Documents and Settings\User\Desktop\SquareArea.java:5: missing method body, or declare abstract
    public static void main(String[] args); {
    ^
    1 error
    Tool completed with exit code 1

    Reading inputs from the command line is a bit complicated in java, here is how it is done:
    first add the line:
    import java.io.*;to the beginning of your program.
              float length;
              float width;
              float SquareArea;
              BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
              try
                   System.out.println ("Please enter length:");
                   String lengthStr = reader.readLine();
                   length = Float.parseFloat(lengthStr);
                   System.out.println ("Please enter width");
                   String widthStr = reader.readLine();
                   width = Float.parseFloat(widthStr);
                   SquareArea= length*width;
                   System.out.println ("The area of the square is" + SquareArea);
              catch (IOException ioe)
                   System.out.println("Error reading values.");
                   ioe.printStackTrace();
              }

  • Problem in compiling this java need help

    package test;
    public class simpleTest{
         public simpleTest(){
              int a =0;
    import test.*;
    public class testPackage{
         public static void main(String [] args){
              simpleTest sT=new simpleTest();
              System.out.println("Package from Test A value = "+a);
    }error got when compile this codes.
    --------------------Configuration: <Default>--------------------
    C:\Notes\testPackage.java:4: cannot access simpleTest
    bad class file: C:\Notes\simpleTest.java
    file does not contain class simpleTest
    Please remove or make sure it appears in the correct subdirectory of the classpath.
    simpleTest sT=new simpleTest();
    ^
    1 error
    Process completed.

    package test;
    public class simpleTest{
    private int a;
         public simpleTest(int a){
              // int a =0;
    this.a = a;
    public int getA() {
    return a;
    =============== 2 diff files===================
    import test.*;
    public class testPackage{
         public static void main(String [] args){
              simpleTest sT=new simpleTest();
    System.out.println("Package from Test A value =
    = "+st.getA());
    }- Saishu can compile the java package?

  • Making animation using java, need help, image doesn't get painted

    I was trying to make some sort of animation and it is done by painting a head and a body at a time. The problem is the body never gets painted but the head is perfect. Unless I replace the int variable within imgBodypics[int variable] with a variable at counts from 0 to N or an integer , the body doesn't get painted, that is not what i want, as the images that make up the animation consists of 8 frames starting from the image006.gif ~ image014.gif
    import java.awt.Image;
    import java.awt.Graphics;
    import java.awt.Color;
    public class Knight extends java.applet.Applet implements Runnable {
         Image imgBodypics[]= new Image[115];
         Image imgHeadpics[]= new Image[15];
         Image imgCurrentbody, imgCurrenthead;
         int intBodyposx,intBodyposy,intHeadposx,intHeadposy;
         int brainwalkxpos,brainwalkypos,bodywalkxpos,bodywalkypos;
         Thread thdRunner;
         public void init() {
              for (int i=0;i < 115; i++){
                   imgBodypics[i] = getImage(getCodeBase(),"images/knight/knight000"+i+".gif");
              for (int i=0;i < 15; i++){               
                   imgHeadpics[i] = getImage(getCodeBase(),"images/headboy02/headboy02000"+i+".gif");
         public void start() {
              if (thdRunner == null) {
                   thdRunner = new Thread(this);
                   thdRunner.start();
         public void stop() {
              if (thdRunner != null) {
                   thdRunner.stop();
                   thdRunner = null;
         public void paint(Graphics g) {
              g.drawImage(imgCurrentbody, intBodyposx, intBodyposy,this);
              g.drawImage(imgCurrenthead, intHeadposx, intHeadposy,this);
         public void walk(int intNumtimes, String strDirection) {
         int intDirectionx,intDirectiony,intBodyimagecode;
              if (strDirection == "down")      {     intDirectionx = 0;
                                                      intDirectiony = 1;
                                                      intBodyimagecode = 6;}
              else if(strDirection == "leftdown"){intDirectionx =-1;
                                                      intDirectiony =1;
                                                      intBodyimagecode = 14;}
              else if(strDirection == "left") {     intDirectionx = -1;
                                                      intDirectiony = 0;
                                                      intBodyimagecode = 22;}
              else if(strDirection =="leftup") {     intDirectionx =-1;
                                                      intDirectiony =-1;
                                                      intBodyimagecode = 30;}
              else if(strDirection == "up")      {     intDirectionx = 0;
                                                      intDirectiony = -1;
                                                      intBodyimagecode = 38;}
              else if(strDirection =="rightdown") {intDirectionx =1;
                                                      intDirectiony =1;
                                                      intBodyimagecode = 14;}
              else if(strDirection == "right") {     intDirectionx = 1;
                                                      intDirectiony = 0;
                                                      intBodyimagecode = 22;}
              else if(strDirection =="rightup") {     intDirectionx =1;
                                                      intDirectiony =-1;
                                                      intBodyimagecode = 30;}
              else{      intDirectionx = 0;
                        intDirectiony = 0;
                        intBodyimagecode = 6;}
              int intLastBodyimagecode = intBodyimagecode + 8;
              int intFirstBodyimagecode = intBodyimagecode;
         for (int intCount = intNumtimes; intCount > 0; intCount--){
              for (int i = 0; i < 8; i++){
              int intJ,intI;
              intJ = i;
              intI = intBodyimagecode + i;
              imgCurrentbody = imgBodypics[intI];
              intBodyposx = 250 - (imgCurrentbody.getWidth(this) / 2) + (intDirectionx * intJ * 12);
              intBodyposy = 200 - (imgCurrentbody.getHeight(this) / 2) + (intDirectiony * intJ * 12);
              imgCurrenthead = imgHeadpics[intJ];
              intHeadposx = 250 - (imgCurrenthead.getWidth(this) / 2) + (intDirectionx * intJ * 12);
              intHeadposy = 200 - (imgCurrenthead.getHeight(this) / 2) + (intDirectiony * intJ * 12);
              repaint();
              intBodyimagecode++;
              try { Thread.sleep(200); }
              catch (InterruptedException e) { }
         public void update(Graphics g) {
         paint(g);
         public void run() {
              setBackground(Color.lightGray);
              walk(1, "left");
              walk(1, "right");
              walk(1, "up");
              try {Thread.currentThread().sleep(5000);}
              catch (InterruptedException e) { }

    Erm, i tried to highlight the code and then press the code tag but after posting it is still plain, and there is no way to edit the post, sorry about that, next time i'll try. About the book "Filthy Rich Clients", no i don't have it, is there any free version of similiar resources?
    testing123

  • Newbe to Java NEED HELP about : field vs property vs attribute!!!!

    i am studying java now!i have a problem with field ,property, attribute of a java class!!!
    i am so confused!!!can everybody give me a clear definition and explain the difference between field , property and attribute in java???
    it is difficult to distinguish for me!!!

    I don't think there are any hard-and-fast rules.
    Roughly, though:
    A field is a member variable.
    A property is what is exposed via JavaBeans.
    An attribute is an abstract element of the abstract entity being modeled.
    Often times, they're all the same thing, but they don't have to be.
    For example, take a Person object. In the abstract sense, independent of Java, age is an attribute of a person. In addition to that, you might have an "age" member variable. And when you inspect a Person using JavaBeans, you will probably find an "age" property.
    And it's possible that the JavaBeans property will come directly from the field--the "age" member variable:
    public class Person {
      private int age;
      public int getAge() {
        return age;
    }JavaBeans inspection will find the getAge() method and by the "getter" convention will determine that there is an "age" property. The class has an "age" field that happens to have the same name as the "age" property, and the property's value comes straight from the field.
    And both the field and the property correspond to the age attribute of the abstract person concept.
    Of course, the problem there is that if we don't update the "age" field (member variable), then the state of the object becomes less accurate over time. So we might do this instead:
    public class Person {
      private Date birthDate;
      public int getAge() {
        // calculate age based on birthDate and the current day;
    }Here, we still have a property named "age" that corresponds to the age attribute, because JavaBeans inspection will find the getAge() method. But there's no "age" field.
    Now, having said all that, I should point out that in common usage, the three terms are used somewhat interchangeably.

  • Need help with usage of static functions

    Hi,
    I tried instantiating objects within static functions as follows: It gives error:
    If someone can explain an alternate way of doing things, I would appreciate:
    public class C {
    * @param args
    public static void main(String[] args) {
    Y.Fn1();
    public class X {
    public void Fn2(){
    int b=2;
    System.out.println("hello");
    public class Y {
    public static void Fn1()
    int a=2;
    X obj = new X();
    obj.Fn2();
    The actual error is:
    Cannot make a static referencxe to the nonstatic method Fn2() from the type X Y.java
    Need Help : If someone can comment on the following, I would appreciate:
    I have a class Session, which has a method ProcessEvent()
    public class Session{
    public synchronized void processEvent(Event e)
    // Processing of the event
    // Generate a response for the Event
    This Session class is the mainstream code..
    Now I want to write a TestClass that will test the main code.
    So I have a Test class as below:
    public class Test {
    public static void sendReq()
    // Construct an event and call processEvent Function from the main code
    Event ev = new Event();
    // Fill the event with parameters
    Session sess = new Session();
    sess.processEvent(ev);
    What I am thinking of doing is: Call the static method in another class called Manager of the mainstream code for test purpose as follows:
    public class Manager {
    public void somefunction()
    //*** Just for test purpose: do the following line **//
    Test.sendReq();
    I am not sure what I am trying to do will work. I would appreciate if you can comment on that or suggest something that would work for me.
    Another thing which I want to do is:
    Inside ProcessEvent(), I want to call another static method ParseandValidateResponse() of the TestClass This looks odd, but as long as it works, it would be fine for me because this is only for test purpose.
    In this case, I would write,
    public class Session{
    public synchronized void processEvent(Event e)
    // Processing of the event
    // Generate a response for the Event
    Test.parseandValidateResponse(Response res);
    public class Test {
    public static void sendReq()
    // AS SHOWN PREVIOUSLY
    public static void parseandValidateResponse(Response resp)
    // validate the response
    }

    Sorry I thought no one had replied. When I posted here, I missed seeing yr reply. Later just now I saw yr reply It was in the second Page
    (Earlier I was looking only in first page by mistake)
    Meena

Maybe you are looking for

  • I deleted unwanted photos from my iPhoto library, emptied iPhoto trash & Finder trash... this did not free up disk space. please help!

    I deleted unwanted photos from my iPhoto library, emptied iPhoto trash & Finder trash... this did not free up disk space. please help! I have a 15-inch MacBook Pro (Late 2011) with OS X Mavericks 10.9.5 Last week, my 500 GB Harddrive had 120 GB free

  • IMovie 7.1.4 crashing during import

    iMovie used to work like a champ. I moved to version 7.1.4, and now I can't import movie from A CERTAIN DIRECTORY. I can import from other directories, but just looking at this one makes iMovie crash. The only things in it are TIVO files and mp4 file

  • Cut and paste but keep formatting

    In Excel, when the Cut tool is use it removes the data and formatting within a cell. Is there a way to leave the formatting as it is?

  • Sproxy

    Hi Everyone,               I started practicing IDoc Scenario.I executed t-code sproxy in R/3 system.After executed message was "No Connection to Integration Builder(Only Generic data is visible)".how to solve this?thanks in advance Regards VinayPI

  • Media Player Prob

    Hello all, I had an interesting thing happen to me last week. I launched my Creative Media Player (just like I always have regularly for a couple years now) and wanted to play some music while I did some chores around the pad--but all of my music in