Re: integers and arrays in Java - how?
- From: Robert Baer <robertbaer@xxxxxxxxxxxxx>
- Date: Thu, 06 Apr 2006 07:02:17 GMT
Sigmund Hansen wrote:
Robert Baer wrote:Thanks.
Robert Baer wrote:
I used Google and found some references for integer in Java.Here is the code i have so far:
But "int" not only does not work, it also prevents reading X and Y coordinates of the mouse.
What i would like to do:
1) Get X and Y mouse coordinates into a variable that i can do real math on.
So far, i can do math on the values "read" and that result goes into a "variable" that is useful *only* for display.
If i try "int" in that math, the values are then zero for everything - even those where i do no calculation.
2) Use the calculated integer values as an index to a table or array.
It is acceptable to use an HTML "table" as the source for the lookup; W(CalcFromX) and P(CalcFromX) would be the resulting values to be displayed on the screen somewhere.
Can this be done, and eXactly how?
<html code starts here; this is altered to help protect some>
<head>
<title>Test page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="style***" type="text/css" href="style.css">
</head>
<!--
var with "Netscape" makes Netscape happy
adding "int" or "integer" in any way totally kills operation
-->
<SCRIPT LANGUAGE="JavaScript">
<!--
var isNav = (navigator.appName.indexOf("Netscape") !=-1);
function handlerMM(e){
Xmm = (isNav) ? e.pageX : event.clientX;
Ymm = (isNav) ? e.pageY : event.clientY;
document.dataholder.mmX.value=((Xmm-173)/6.8+1938);
document.dataholder.mmY1.value=Ymm;
document.dataholder.mmY2.value=Xmm;
document.dataholder.mmZ.value=((Xmm-173)/6.8+1938);
}
if (isNav) {
document.captureEvents(Event.MOUSEMOVE);
}
document.onmousemove = handlerMM;
// -->
</SCRIPT>
<body>
<center>
<form name="dataholder">
<table border=1>
<tr>
<td><i>Year(wide)</i></td>
<td><input type="text" size=9 name="mmX" value="0"></td>
<td><i>Year(narrow)</i></td>
<td><input type="number" size=3.8 name="mmX" value="0"></td>
<td><i>Number of wells</i></td>
<td><input type="text" size=5 name="mmY1" value="0"></td>
<td><i>Production BBLs</i></td>
<td><input type="text" size=5 name="mmY2" value="0"></td>
<td><i>Z value</i></td>
<td><input type="text" size=9 name="mmZ" value="0"></td>
</tr>
</table>
</form>
</div>
<!--
This code *used to* work, showing a calculated year in the first 2 boxes; the width
of the second box was made narrow to visually "truncate" the numbers to integer.
I have no idea as to why they no longer work.
I added "Z value" and *that* works (!!). Go figure.
-->
<table align="center">
<tr>
<td align=center>
<center>
<div><i>© 2006 Oil 4 Less LLC</i></div>
</center>
</td>
</tr>
</table>
<!-- style and then img src as seperate items makes IE happy; GIF is 90% BMP -->
<div style="position: absolute; height: 316px; width: 697px; top: 100px; left: 20px; "
<style="height: 316px; width: 697px; top: 100px; left: 20px; " >
<img src="Arkansas.gif" alt="" usemap="#AK" style="border-style:none" >
</div>
</body>
</html>
Yeah,
this is JavaScript,
which basically has nothing to do with Java...
I believe there is some Object Orientation in it,
but not as advanced as Java's.
I'd recommend you go to the comp.lang.javascript group instead, or a similar one...
.
- References:
- Re: integers and arrays in Java - how?
- From: Robert Baer
- Re: integers and arrays in Java - how?
- From: Sigmund Hansen
- Re: integers and arrays in Java - how?
- Prev by Date: Re: integers and arrays in Java - how?
- Next by Date: Re: Double buffer help
- Previous by thread: Re: integers and arrays in Java - how?
- Next by thread: Re: integers and arrays in Java - how?
- Index(es):