Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

and no this question is not Homework what so ever

How do you expect anyone to buy that when you are obviously in a Java class currently?

Show some effort and at least make a start on it or ask specific questions about what you are confused about.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The API doc on ResultSet says getRow() is optionally supported on forward-only result sets. Sounds like your JDBC driver opted to not support it.

Try creating your statement to be scrollable

Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

How much code gets executed after a return statement?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

If the class StackX is not in the same directory as this file, you will need to import the StackX class to reference it.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The error is pretty clear. You don't have a main method defined in that class, so you cannot run it directly.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Post the code here and ask specific questions.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Seems like your friend who said it could easily be done in a few lines of code would be the best place to start.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Welcome aboard!

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

So, your modification continues to loop even after the result is known. Seems pointless, doesn't it?

There is no "algoritmic issue" with the returning once the condition is met. A flag may be your preference, but it's not more correct.

It's certainly not worth resurrecting this old thread to add.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Is there a way to highlight and copy this code so I can try it out?

You can double-click the code to change it to easily copied plain text.

The fact that the OP added extra line numbers does complicate that though.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The general gist of it would go as follows:

You already (should) know the coord of the center of the cue ball. While the mouse is pressed, your mouse point becomes the endpoint of a line to the cue and is easily updated in mouseDragged().

The length of that line, up to a certain length, is your "power" right? Shouldn't be any problem to draw a line segment for that.

For the target, you just need to calc the equation of your line to the cue and project a new point beyond the cue to for the "target" line segment.

You'll need to store those lines or endpoints in your class so paint() can use them to render the lines when they are non-null or mouseDrag is true.

Once you've calc'd the new line segments, call repaint() in mouseDragged().

On mouseRelease() you'll need calculate the direction and velocity to apply in your cue ball animation update routine.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Your class needs a main() method defined if you are going to run it directly.

public static void main(String[] args){
    ...
}
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You've cleary shown that you don't want to make an effort on this yourself and just want someone to finish it for you.

Thread closed.

syed300 commented: Abussing mod powers +0
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

syed,
Helping is one thing. Asking others to just give you the code is something else entirely. You don't seem to be putting any effort into this. Even the original piece of code you posted was copied from elsewhere.

Students are expected to make an effort if they wish to receive help here. Norm's already given you some advice on how to proceed. If you won't bother to try to follow it, then you're probably just out of luck.

happygeek commented: absolutely correct, of course :) +11
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Yes, it's showing all numbers now.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Still not numbering correctly: http://www.daniweb.com/software-development/java/threads/418966/what-is-the-proper-use-of-static-function
The section from 10-15 is only 4 lines.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The line number mis-counting bug also only seems to appear when some are hidden. If you remove the CSS that hides all but the 5's and show all numbers, the numbering is correct.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Yes, if you take out the list-style-type: none setting and remove the background change for alternating lines it should show all numbers and have a consistent background:

/* Specify class=linenums on a pre to get line numbering */
ol.linenums { margin-top: 0; margin-bottom: 0 } /* IE indents via margin-left */
li.L0,
li.L1,
li.L2,
li.L3,
li.L5,
li.L6,
li.L7,
li.L8 {  }
/* Alternate shading for lines */
li.L1,
li.L3,
li.L5,
li.L7,
li.L9 { }

Though it looks like the prettyprint alternate line colers are getting set here as well:

div#static-posts pre.prettyprint li.L1, li.L3, li.L5, li.L7, li.L9 {
    background-color: #F5F5FF;
}
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

What about ditching the alternating line highlight? It seems to make it less readable rather than more.

Such highlight is helpful for tabular reports - not so much for code.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Obviously these aren't priorities, just general observations:
"Show Comments" link is visible when there aren't actually any comments.
"Show Comments" is still displayed when comments are showing. Perhaps it should change to "Hide Comments" to reflect its functionality if clicked again.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Ok, this thread is going nowhere fast.

The bottom line is that the syntax that MARIE expects has no resemblance at all to Java and therefore the Java forum will be of no help whatsoever. Computer Science or Legacy and Other Languages might yield something.

Edit: I'm going to move this into Computer Science, since it seems to be related to teaching architecture.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

So everyone is supposed to know what some obscure "MARIE" simulator is? As bibki pointed out, you're in the Java forum - which MARIE is not. "Written in Java" != Java.

No need to be a jerk when you are the one posting in the wrong forum about some simulator syntax.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Some of your variables will only be initialized if conditions are met. The compiler requires that they be initialized under all conditions.

If you declare them to have an initial value, the compiler will be satisfied

String ch2="";

Edit: cross-posted with above.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Ask specific questions.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Merged three threads for the same question. Please do not post the same question multiple times.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

If you don't have any notes from class on how to do it, then look up the Scanner class in the Java API docs.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, you should probably start by referring to your class notes on how to get a value from the user.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Perhaps you should actually ask a question.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

And
3) Learn to indent.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Direct quote from that page:

You are free to choose one of these or suggest your own project, however, you must obtain your instructor's permission before starting.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Jesus, just pick one already. You have an entire list and you're waiting for people on the internet to tell you what to do? Seriously?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Moving to MySQL.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

What more are you expecting?

Yes, it's a scam. No, they are not from DaniWeb. Case closed.

You don't even have other threads posted here, so referencing your posting history makes little sense.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Agreed. Let's keep further discussion in a single thread:
http://www.daniweb.com/software-development/java/threads/411255

Closing this one.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Sure, just use SQL "CREATE TABLE..."

Example: http://www.herongyang.com/JDBC/JDBC-ODBC-Access-CREATE-TABLE.html

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

What on earth are you trying to do with this code?

new PeerLogin.2(this)
DavidKroukamp commented: lmfao +8
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Put a blank label placeholder in your UI where you want the picture displayed. When the guess is wrong, use the JLabel.setIcon() method to put the correct picture in the label.

Helpful tutorial: How to use icons

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

That's true. Replies to moderated posts may get whacked as well in the clean up.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You're welcome to wag your finger if you like, but if you want the hijack corrected then you can Flag Bad Post to bring to a mod's attention.

Personally pleb finger-wagging doesn't bother me at all :P

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

That is a random hijack. Report them as bad posts so they can be split to new threads (which I did on that one you linked above).

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I was thinking you might know when you placed it whether a wall lay along the X axis or Y axis, in which case you could keep track of that when you built them. Axis could be an int or enum property on a Wall class.

If you're building them block by block, the outcode() method on Rectangle2D might be more helpful in determining where your sprite is located in relation to the rectangle.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

If you used a small custom class for your wall, you could have an axis property for horizontal or vertical. On collision you can check the wall axis to know which velocity to change.

You can still keep a Rectangle inside the class to manage the bounds and forward your intersect calls to that rectangle.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Components placed in BorderLayout.CENTER expand to fill the available space in the container.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You don't show where you have declared x, but in your loop it doesn't need to be public anyway. Just declare int x=0; in your loop. It's only needed locally.

Other things to note:
-You also want to reconsider your increment x by one unless you really want to color the whole area black.
- The calls to super.paintComponent() and draw() shouldn't be in the loop.
- Loop variables don't do much for you when you hard-code the coordinates in drawLine().

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Want to share what it says is not public?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Fixed the OP's code tags, but I can't help with the error messages.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Break it down to a simple loop that draws the vertical lines stepping across from x=0 to x=width, adding 10 each time. After that write a second loop that draws your horizontal lines, from y=0 adding 10 until y=height. You don't need an array for that.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I believe he means 'dos' (just command window these days)

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Is there a reason not to just use JInternalFrames for this? It seems that is what you're trying to mimic.