Maria Sachhause

Greenhorn
+ Follow
since Nov 30, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Maria Sachhause

Hello,
I have a program where is lots of values(speed in one second) that are depending on angle of heading.

For example I have read ollowing values from a file:

int angle50 = 550;
int angle75 = 435;
int angle110 = 500;
...

So, the question and problem is how to get values between for example angle50 and angle75. So I mean what is for example value of the angle60.
I can solve my problem with using lots of IF:s but code is getting quite long. I know it has something to do with interpolation... but with java? How to do that(simplies way)?
16 years ago
I have a drawing panel where I can draw lines etc.

Program works like this:

1. First mouse click makes start point (coordinates)
2. Second mouse click makes destination point (coordinates)
3. Line is drawn between those points
4. Third click draw a line from it coordinates toward center of jpanel

problem is this....

How to make Jbutton RESET, which set panel empty(as it was when program where started)without restarting.

What is the easiest way to do that?
16 years ago
Hi, few days have passed and new and last problem has risen.

Now I can make this.

step-by-step

1. First mouse press defines start point
2. Second mouse press defines destination point
3. Line is drawn between start and destination points
4. Third mouse press draws a line towards center

I have this coordinates: north is 0 and clockwise 360 degrees

-----------------360/0-------------------
-------------------*---------------------
270************************************90
-------------------*---------------------
-----------------180---------------------


And my problem is this:

-How can I draw a line from the start point towards degree 140 (which is hardcoded to for example to variable int heading=140)???
16 years ago
Thanks again You are really helping me

What if I want that third mouse pressing draws a line from given coordinate to the center?
So, I mean that if I want that first and second mouse press draws a line between those points like now it does but the third press draws a line from its coordinates toward center.

Should I do like this, where windSetLine x and y are global variables which tells where center is (250 and 250).
g.drawLine(x3, y3, Global2.windSetLineX,Global2.windSetLineY );
16 years ago
Thank you, Craig Wood. You helped me a lot

Now I am trying to add one more point. Now if I press mouse twise I get two points(start and destination), but when I try to add third it does not work.

Below is how I try to do it, I don't get it why it doesn't work?


[ October 30, 2007: Message edited by: Maria Sachhause ]
16 years ago
Hi,
(sorry if my english is not understandable enough)

I have created a program where user can define start point and destination point with a mouse. After doing this line is drawn between these points(coordinates using drawLine).

Then I have this Run button and when it is pressed letter X starts to move to a direction which is "hard coded" to method (updateXPosition). This letter X moves once in a second(I am using thread and timer but timer is for other purposes). Starting point of letter X is start point(point what user has pressed first).

So I know:
+ coordinates of the start and destination
+ when to move letter X (thread/timer, it has to move once in a second)
+ coordinates where to start to move letter X
+ my current location (X current location)

My problem is:
How do I get that letter X to moves towards destination point once in a second???
What is a simpliest way to do it with my code??


Below is code of the program:
it is quite long but I really need help with this one.. Tried for days to solve this problem.


"Main"



Class for Global variables
[code]


/* This class exist because it is easiest way to use "global" variables
*
*/
public class Global
{
// Must have some value at beginning otherwise main does not work as it should be
public static int gX1 = 5;
public static int gY1 = 5;
public static int gX2 = 5;
public static int gY2 = 5;
public static int secondFromBeginning = 0;

public static int sailLocationX = 10;
public static int sailLocationY = 10;

public static double distance = 0;

public static int counter=1;


public static int xx = 0;
public static int yy = 0;


}
[code]
16 years ago
Hi,
I have manage to make a program which can read XML files to Java variables.
Now my problem is how to get user given information to the xml file?
I mean that user gives boat name, year, class and something and then new xml file is created. Created file should look like my �hand made� BOAT.xml.
How can I do this?
Please help me I have tried to do this quite hard without success....  Maria


Below is an example xml file BOAT.xml and my Java code (if it helps).

<BOAT><boatInfo>
<boat name="Testeri"
year="1958"
class="10"
something="will sink"/>

</boatInfo></BOAT>



16 years ago
Hi,

(Sorry about broken english)
I have read the nanoxml tutorial and I have manage to do a little program(based on tutorial).

In this program:
1.User gives a name of the .xml file which he/she wants to open
2.File is opened and printed to the screen in this format: <BOAT><BOAT><NAME>Hank</NAME><YEAR>1980</YEAR><CLASS>10</CLASS></BOAT></BOAT>

Now my problem is how to get for example <NAME> value(Hank) from BOAT.xml to Java variable...called String Name??

So I need to get every piece of information from BOAT.xml to different Java variable, but I cannot do that...
I have tried to do this in many ways.... without success, help me on this one please..

-Maria-

JAVA CODE:



BOAT.xml

16 years ago
First, sorry about broken english.

I have tried to make NanoXML work on Ecplipse without success.
This is what I have tried do so far step-by-step:

1. I create new project (file-new-java project) and name it for example as TEST
then I select Add External JARs and I select nanoxml-2.2.1.jar

2. I create a class called DumpXML(it's from nanoxml tutorial)

3. Then Eclipse says "The Import net cannot be resolved"

Why it cannot be resolved is a mystery to me, please help me.

Can you describe how I can configure it on Eclipse?
please step by step. thanks.


Code is below if it helps.

Hi,
I am learning to use Db4o database with Java and now I have a small Java related problem. (and sorry about broken english )
1. First I search database for movies of given genre and there is no problem.
2. I also can print out movies of given genre without promblem
3. Problem comes when I try to save founded list items to new objects (see code below).

How can I save founded list items to objects?
What is wrong in my code?
I wound be very happy for help.


17 years ago