Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

It is a "live" reference to the Player object itself - not a snapshot. Any data that your panel gets from the object will be current.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

It's certainly not urgent to me.

Post what you have started with and specific questions or error messages. No one will do your homework for you.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Doesn't your PlayerDetails panel keeping a reference to the Player object that it is displaying? There isn't any reason to remove the panel. Just update the info that it is showing by getting the values from the player object.

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

You set your frame layout to null, but never set the location of your panel. The following will make them show up within the panel (though it's not a layout you're going to want to keep once you see it)

JPanel p=new JPanel();
p.setLayout(new FlowLayout());
p.setBounds(20,20,100,130);
p.add(sizes);
p.add(small);
p.add(med);
p.add(large);

I'd recommend going though some of the layout tutorial linked above. Absolute positioning with null layout is usually not the best way to approach a design.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Put the same println outside the loop in paintComponent() and you'll see it's called three times by the time the screen is finished displaying itself.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

That's not a Java question, it's a SQL question. Look up how to use the LIKE condition.

Then you can refer the tutorials mKorbel posted above for questions about the UI.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You never reset yIncrement though, so after the first time paintComponent is called, possibly even before the window is completely done showing itself, it will go below 25 and never again enter that loop. paintComponent() gets called every time the component needs to be redrawn, which can be triggered by many things such as layout change, window resize, dragging another window over it, etc. The method needs to re-render the current state of the component from scratch when called, so keep that in mind when writing the code.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You haven't stated what you are having trouble with.

Aside: I'd recommend changing your indentation to no more than 4 spaces and use it consistently. You've got code pushed all over the place there.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

This post was just copied and pasted here by a lame spammer so I'm closing it but leaving the replies intact, since the answers may help someone else.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

This post was just copied and pasted here for spam purposes. Closing, but leaving intact to preserve the effort of those who answered.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Be sure that you have specified the main-class attribute in your manifest file.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Copied directly from here.

If the OP can't even determine if the code he blindly copies meets the requirements for his assignment, he deserves to fail the course.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The real question ought to be should you create an mdb with Java and I would answer: Only if you absolutely have to due to other constraints on the project.

If you can use any other database, do so. For a file-based database, H2 is great.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I don't think applets cannot do any of those things to the browser.
http://download.oracle.com/javase/tutorial/deployment/applet/security.html

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

This may work for you. Assuming textPane on a panel

SwingUtilities.convertPoint(textPane, textPane.getCaret().getMagicCaretPosition(), panel)
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I understood the intent, but as a general strategy for participation I think it would be unwise for him to go looking for threads to ask more questions about points he is unclear on.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I would have to disagree with AD there. That seems to be a guaranteed recipe for derailing other people's threads.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Several things:
As mKorbel mentioned above, you need to pack() your Frame after adding the components to it.
You never start the timer in Frame.
You have an infinite loop in the Watch constructor and the timer that is updating the time never actually changes the "time" string.

I'd say you have a bit more to work on there.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

He should be able to do that directly within her Timer because the Swing Timer executes on the event dispatch thread. I don't think the invokeLater will be needed.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Start your own thread if you have questions about your homework.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

No, revalidate() is for layout changes such as adding or removing components in a container. You are needing to setText() on your text field again with the updated time value.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, the first would simply involve creating a getTime() method on your watch class and making a Swing Timer in your frame to call getTime() and update the text field (of course that is somewhat redundant with the watch to begin with eh? :) )

The second is a standard listener or observer pattern. Once you see it you'll recognize that Java uses it quite extensively for event notification (ie MouseListener, ActionListener, etc). Here are several simple examples.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You need a mechanism for the UI to get an updated time value. You could either poll the watch on an update timer in your frame (a "pull" model) or you could register your frame as a listener or "observer" in the Watch class (a "push" model) and let Watch notify the frame via a callback method like updateTime() on your frame.

ps: You may want to chose another name for your Frame class since there is already a Frame class in the java.awt package.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

And that is what I was referring to.

How to you determine how many "hundreds" are in 123.45 (or other number)?
How many "tens"?
These are basic math operations.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Do you think people here can read your mind or see over your shoulder? Post your code and the stack trace.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Actually I'm referring to basic math to break it down to it's parts. Just think about the steps you mentally go through to write it out your self and then write the statements to gather each piece, like hundreds, tens, etc.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

> so, you create an array of Asn07Employees Objects
That would actually make a bit of sense, but the skeleton code provided appears to indicate they are to be handle as a wad of arrays stuffed into a single class. Looks like a bunch of useless nonsense to me.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

... and? You now have some input to work with. What have you thought about doing with it?

How can you reduce that number to it's parts? You have to separate it before you can translate each to a string.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I don't know where to start either because that has to be the poorest written assignment I have ever seen.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Post the code you have to start with. Ask specific questions about what you are having trouble with and what you have tried so far.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Why not use substring() instead of the loop? It reduces the whole method to about 5 lines.

You still need to reduce the string each invocation until you reach a terminating condition. Your current code has no termination condition and hence the infinite loop.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

There are a few different ways to manage that with relative paths or getResource(). Take a look at this info in the tutorial on using Icons.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Perhaps you should read up on the 'else' statement.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Merged duplicate threads.

@casinoua: please do not create multiple threads for the same question.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You do realize you are potentially reassigning the value of a many times, right?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Java cares about capitalization.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

> or am I trying to do something that is either impossible or close to impossible
Not at all. You should definitely use a loop to create all of those components. They only differ by the player index. You could also use a for-each style loop

for(Player p : players){...}
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Yes. The JList will display the string representation of the objects by calling their toString() method. If you customize that, you can display any string that you wish.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I already told you above - override toString() in your SmsMsg class to display the phone number.

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

That's an applet. It doesn't need a main method. How are you trying to run it that you are getting that error?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

> I only want to display a list of incoming string phonenumber
JList will display the toString() result of objects in the model, so you can override toString() in your SmsMsg class to display the phone number.

As for double-clicking, you can retrieve the currently selected item with list.getSelectedValue() and cast that to SmsMsg to do anything you want with the object (ie print data from it)

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You declared envelope by itself in a try-catch block and then tried to use it in a different block. It went out of scope when the first block ended, so essentially the second try-catch block can't "see" that variable.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Yeah, zoom is probably the culprit there. I leave my forum listing zoomed out one step and that shifts the community center link down to the second line.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

... and did you have a question about something?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Actually both of the code "solutions" above are bad and I wouldn't recommend either one of them.

Also please note that we do not encourage just completing someone's homework for them here. Offer advice, examples, and code fragments rather than simply fixing and re-posting their code with no explanation.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

They are zero-based.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

They're working properly now.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The gridx and gridy properties specify which "cells" the components are placed in. gridwidth and gridheight specify how many cells on each axis the components occupy.