File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Verifcation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Verifcation" Watch "Verifcation" New topic
Author

Verifcation

Lucas McDaniels
Greenhorn

Joined: Feb 07, 2011
Posts: 7
Trying to figure out if the picture z and the zebra are in the rectangle.


marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

My first suggestion is a Short, Self-Contained, Correct Example (SSCCE).


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Unnar Björnsson
Ranch Hand

Joined: Apr 30, 2005
Posts: 164
Whole lot of code, with many repetitions, are you sure can't achieve the same functionality with fewer lines of code?

For example, by putting the x' and y's in an array and making use of a single while loop instead of tons of if-else statements


Or something similar>
Lucas McDaniels
Greenhorn

Joined: Feb 07, 2011
Posts: 7
marc weber wrote:My first suggestion is a Short, Self-Contained, Correct Example (SSCCE).

okay i think the updated code is what I want with the SSCCE, but am still stuck on where to start the process of verifying that the z is in the rectangle along with the Zebra picture.
Lucas McDaniels
Greenhorn

Joined: Feb 07, 2011
Posts: 7
Unnar Björnsson wrote:Whole lot of code, with many repetitions, are you sure can't achieve the same functionality with fewer lines of code?

I tried to put the picture into an array, but couldn't get the pictures, trying the x y array but with no uck,
http://download.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html, and intro to java applets about arrays(http://www.cs.colostate.edu/~boese/JavaApplets/), Plus a few things from Google on java arrays. But it was confusing, anyone have a good easy to understand doc on arrays?
Lucas McDaniels
Greenhorn

Joined: Feb 07, 2011
Posts: 7
I am trying to verify that the image "z" is next to the image "zebra" and so on. any help would be greatly appreciated.


Ralph Cook
Ranch Hand

Joined: May 29, 2005
Posts: 479
I'll help, but I would like more info first.

Before I spend time attempting to figure out your 230 lines of code, why don't you tell me where your problem is? What attempts have you made to debug this yourself, and what values do you get that you do not understand?

This is partly because I don't want to spend my time figuring out stuff that is not related to the SPECIFIC problem, and partly because we do get people here from time to time that want us to do their programming for them. I don't want to spend my time doing that when I might be spending time helping people who are trying to help themselves and just need some (specific) questions answered.

Put another way -- I don't find the question specific enough. Other people might. But I think you're more likely to get help from more people if you narrow what you're asking for.

rc
Lucas McDaniels
Greenhorn

Joined: Feb 07, 2011
Posts: 7
Alright The applet puts ten pictures on the JPanel randomly, then you can drag the ten pictures around. they are 2 sets of five, one being animals. The other is the letter associated with the animal, z for zebra. Which is running correctly. The next thing I would like to do is check to see if the user actually put the z next to the zebra, not the letter o next to the zebra. So what I guess I am asking is the logic behind it, not for actual code, I just don't know where to start.

EDIT:
was trying rectangle, and seeing if it contains picture[0] && picture[1] but i was not getting the response I was expecting.
Ralph Cook
Ranch Hand

Joined: May 29, 2005
Posts: 479
Ok, I'm going to try one guess, even though I still don't have enough information.

You have code that (you say) handles a drag of a picture from one place to another. And you want to know whether that picture and another picture ended up next to each other. Can't you, at the end of a drag operation, put the location of the dragged picture somewhere, and then look at it when it's time to figure out if it's where it's supposed to be?

You've given me (us) a start on what your program is attempting to do, and the fact that you "don't know where to start". Well, I'm not sure either, since what your program is to do is still pretty vague in my mind. If you want a place to start, then perhaps start by telling us the data structures and algorithms you've already got.

rc
Lucas McDaniels
Greenhorn

Joined: Feb 07, 2011
Posts: 7
Resolved, still not what I would like but it does what I wanted.


Thanks To everyone that helped me jog my brain for ideas.


Final code:
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Verifcation
 
Similar Threads
New College Project
enabling the scrollbar when components are dynamically added in jpanel
How to code optimization..
Help me how to drag and move drawing shaps
drawRect() issues