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.
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.
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);
How much code gets executed after a return statement?
If the class StackX is not in the same directory as this file, you will need to import the StackX class to reference it.
The error is pretty clear. You don't have a main method defined in that class, so you cannot run it directly.
Post the code here and ask specific questions.
Seems like your friend who said it could easily be done in a few lines of code would be the best place to start.
Welcome aboard!
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.
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.
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.
Your class needs a main() method defined if you are going to run it directly.
public static void main(String[] args){
...
}
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.
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.
Yes, it's showing all numbers now.
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.
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.
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;
}
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.
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.
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.
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.
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.
Ask specific questions.
Merged three threads for the same question. Please do not post the same question multiple times.
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.
Well, you should probably start by referring to your class notes on how to get a value from the user.
Perhaps you should actually ask a question.
And
3) Learn to indent.
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.
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?
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.
Agreed. Let's keep further discussion in a single thread:
http://www.daniweb.com/software-development/java/threads/411255
Closing this one.
Sure, just use SQL "CREATE TABLE..."
Example: http://www.herongyang.com/JDBC/JDBC-ODBC-Access-CREATE-TABLE.html
What on earth are you trying to do with this code?
new PeerLogin.2(this)
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
Are you unable to glance back in the thread?: http://www.daniweb.com/software-development/java/threads/411022/1753724#post1753724
That's true. Replies to moderated posts may get whacked as well in the clean up.
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
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).
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.
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.
Components placed in BorderLayout.CENTER expand to fill the available space in the container.
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().
Want to share what it says is not public?
Fixed the OP's code tags, but I can't help with the error messages.
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.
I believe he means 'dos' (just command window these days)
Is there a reason not to just use JInternalFrames for this? It seems that is what you're trying to mimic.