Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

"problem occurs" isn't much to go on. Post the specific error message.

The only thing I could say at this point is that you need to add the node to another node, not the JTree component itself.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Please remember the forum rules regarding help via email. The forums are here for all to participate and benefit from. If the questions are posted here, let's keep the solutions here as well.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Yes, if you need to print them then just loop through the collection and print each.

I would point out that printing them to the console doesn't really have anything to do with reading them. I'd make a separate method for output to maintain a separation of responsibilities. readData() should just read data.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

So your console output class has no method to print out an entire ArrayList. You'll need to iterate through the list and print each element then.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You would want to define the list outside of your loop, since you will add to it each line read.

You'd need to clarify "errors" a bit if you want more advice on that one.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

"Split" how? If you just need to store each line separately, use an ArrayList.

If you need to further split up multiple words in a line, look at String.split().

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

What you have written there should read multiple lines just fine, but you're replacing 'words' each time, so it is going to end up null at the end.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, I imagine that one of the administrators can help you out with that, but none are online right at the moment. You'll have to hang tight for a bit.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Important to you or the teacher you registered to impersonate?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

So essentially this thread has no point. 'Lukester3' never did bother to show the slightest effort towards solving this problem and the posts have devolved to discussion of a classroom prank.

The tech forums don't need useless clutter like this. Thread closed.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Not if you can't demonstrate the slightest bit of effort on your own.

What do you have so far? What specific questions do you have?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You can only edit for 30 minutes. If you need to add additional info, you'll need to post it in a reply.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

^^ all that and a note from our forum rules (you did read those when you signed up, right?):
- Do provide evidence of having done some work yourself if posting questions from assignments.

Thread closed. Feel free to repost if you can demonstrate that you've made some effort on this yourself.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You can use regex to find your matching text and return match results.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You must call rs.next() to advance through your result set. Initially your row pointer is positioned before the first result.

Typically you will use if(rs.next()) or while(rs.next()) to advance while there are records to read.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Probably not - you haven't really asked a question.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Please do not resurrect old threads just to promote blog entries. Thread closed.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

There are two pieces to consider with an array: the array object itself and the contents of the array.

Let's look at the one that is just fine:
You declared a variable of type String[] called 'units'

String[] units

and you create it to hold 40 elements

units = new String[40]

and then you initialize the elements themselves to empty strings

units[i] = ""

That is fine and good. One of those steps is missing however for your ingredientName array. That is what I described above in my previous post.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Java is a general programming language. Minecraft is an application written in Java and any interfaces available to it would be those created by the writers or other modders.

You need to hit the Minecraft wiki/forums/docs etc for more specific information.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Then you need to read up on the APIs and tools Minecraft (may) provide for such things. This isn't really a Java question.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

If Minecraft is executing the code, then all your program needs to do is write the correct instructions to a text file and send it along. Right?

Why would you need to execute it?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

whitespace? I'm saying you have a variable that you declared but never initialized at all. You've written private String[] ingredientName , but you never sized it. The "," you've used does not make all of your variables share that = new String[40]; (which is one more reason why it's just not a good idea to declare multiple variables on a single line)


You're attempting to access elements of something that is completely null.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

What "other program" is generating the code? Why the need for two programs?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You can implement as many interfaces as you like. You could also write a separate inner class for your mouse listener, or you could use an anonymous inner class declaration

preCrypTxt.addMouseListener(new MouseAdapter() {
    @Override
    public void mouseEntered(MouseEvent e) {
        ...
    }
});
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You would use a mouse listener for that.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Try getContentPane().setBackground(Color.BLUE);

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

'ingredientName' is still null when you get to that loop.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You have not initialized all of your arrays.

Also, you don't need to use String constructor directly like this new String("") . Just use the literal ""

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Please note the forum rule regarding effort and school assignments:
- Do provide evidence of having done some work yourself if posting questions from assignments.

Post your code and specific questions about the issues you are having trouble with.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

@mKorbel: I'm not really concerned about an up vote and I'm not sure what exactly you are inferring with the 'her majesty' comment. It is a matter of asking for help, receiving it, and then never acknowledging that the posts had even been read or if they solved the issue. It's solely a matter of basic courtesy when others expend their time to help out.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Parkway Drive - Frostbite

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Direction is the enumeration class. You need to switch on a variable that holds the direction.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Evidently neither answer really makes any difference because the OP hasn't bothered to say another word on the matter and I wasted my time writing code for him.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Threads merged.

@popsyjonhson: Please do not create multiple threads for a single question.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

It's not much shorter, but to specify exactly three digits you can use \d{3} instead of \d\d\d . Not much difference for just three, but 43 would be a different story :).

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You declared it as SortedSet, use that. TreeSet is just an implementation detail.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Since "\" is itself an escape character in strings, you have to escape them as well "\\".

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Keep a List of the dependent frames in your base frame. When closing one of the dependents, call a method on the base to dispose of all dependents.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

At the bottom of the page, there is a section "Has this thread been answered?" and a link to "Mark this thread as solved". Simply click that link.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Good question. Did it solve the problem? Does the method do what you intend?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Look up the return type of ArrayList.add(). Why are you trying to assign that to your ArrayList variable?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The exception should include a line number, which will help you locate where exactly the problem is.

Keep in mind, for a zero-length array, even index 0 is out of bounds. There are no elements at all in the array.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

No. No one wants to "fix for you" some code you copied off the internet.

If you post the exact error message, which will include the line on which the error is occurring, perhaps someone will help you solve the issue yourself.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You're welcome. Glad you completed it.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Consider the steps you would go through with a pencil to note the shortest or longest in a series of numbers. You need a place to keep the min/max that you have found so far. Then you simply start going through the list one by one. If you find one shorter/longer, you update your min/max.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Revising that slightly: division shouldn't occur in the loop.

You have the answer right there in your code, you just need to alter the location of a single calculation and return that instead.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

@mKorbel: Yes, your component would be useful if he wants to rotate the image as an animation. I don't know if he intends to do that or not. I was only providing a code fragment to rotate an image and keep that rotated version as a separate instance.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You have already gotten the object. It is ProdArray. You call methods on it just the same as you would any Product4 object. You don't specify any indexes in the method call parenthesis.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Ok, third time: look at line 89.

Do you see anything that looks like getProductNumber(i)?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You specify the index of the element on the array itself. As I said, look at lines 89,90,91... in your code above. On those lines, you are calling methods on a particular element in the ProdArray array.

ProdArray[0] is the first element in ProdArray. It is an object of type 'Product4'. ProdArray[1] is the second element in ProdArray.