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

Have you tried installing XAMPP? It installs the whole stack for you.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Yes, I would second nmaillet's suggestion to try POI. You can probably find a simple example in the quick guide to get you started.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

> Also there are 9 questions marks.
Exactly. Eight of them are extras :P

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Passing the empty string array to the constructor of your JList is causing the weird font sizing issue.

If you want to add and remove items from your list, use a DefaulListModel instead of an array.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

first of all how do you know it is his homework?

Being deliberately obtuse won't win anyone over to your point of view.

Do you happen to know something I do not?????????

I know that adding 8 extra question marks doesn't really add any more weight to your question.

Also please Google "Complex Number java" and examine the first three results...... What do you see? Far more complete java source that handle complex numbers so please take into account what one could find online before one starts to berate one for giving someone an example.

That makes it even more egregious that he couldn't manage to even get started on his own. He just pasted the assignment on a forum with no code of his own to show, no intelligent questions, no indication of the merest hint of effort put into the assignment.

You weren't berated for giving him an example. You were berated for doing the assignment for him in its entirety. I think you can see the difference clearly.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I don't think you want to just group by last name though. Different families could have the same last name. I would stick to family id.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You could use group_concat() and group by student id.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

> I did not do this to spoon feed someone but rather to give them a road map as to how to approach this and similar problems.
Um... no. It is spoon feeding, plain and simple. You completed the entire assignment for him with absolutely no effort at all required on his part to figure out the solution.

You'll find that most here are pretty critical of that. Examples, code fragments, hints and explanations are all fine, but doing someone's homework for them isn't helping them and is harshly discouraged.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Nah. I have other more pressing things to work on.

Perhaps you should give it a try yourself. When you have some code or specific questions about the parts you are stuck on, come back and post them and perhaps someone can offer some assistance.

bbman commented: Reaching the goal is important...but not the path... -1
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Sorry, this isn't Code On Demand.

Perhaps you should try Google if you don't have any specific questions to ask.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

A couple of things to consider.
First, [1-9]\d{2} is the same as \d{3} . So you can simply that expression a bit.

Second, parenthesis are special characters in regex. You need to escape them if you want to use them as character literals in a pattern.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

> 99% of "SEO spammers" are people who would really make excellent contributing members of our community

I would say closer to 5% at best. The other 95% are blathering idiots that only sign up to parrot useless "advice" they copied from a poster above or some article farm content in an effort to spread their signatures around.

If they actually want to learn and have productive discussions about SEO and internet marketing then they should be willing to do it without any signatures. Turn off signatures completely for a month and see what happens. Just consider it an experiment.

iamthwee commented: No signatures is a good idea. +0
WaltP commented: I agree. 99%? Get real! +0
diafol commented: Sigs suck anyway - pointless nonsense - put crud in your profile if you want to - no need for sigs :) +0
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You didn't say which line the error was on, but if I had to guess I would imagine one these

int row = jTable2.getSelectedRow();
        int col = jTable2.getSelectedColumn();

if you don't have a cell selected in the table. They both return -1 if no selection exists.

It doesn't look like you're even using those values. Try removing those two lines.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Are you calling startGraphics() after the UI has been completely set up in the frame and set to visible?
Are you getting any of the println messages "KeyListener"?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You can also replace

Point temp = new Point (((int) x.getX()), ((int) x.getY())- 10);

with

x.y -= 10;
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Ok, I would say your thread is the problem. It will repaint just like you want it to - once. There is no loop. You get one repaint and you're done.

You could either add a loop with a sleep() in it or switch to a Swing Timer and put your current run() code into an ActionListener.

mKorbel commented: that's right +9
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Post the relevant bits of code where you request focus after constructing the UI.

What is handling your repaints? A separate timer?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Moving to PHP.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Seems like the PHP forum might be a better audience for this. Moving it over there.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

> I now have another problem... it has the focus..

Are you certain that it really has the focus? Make sure that you call requestFocusInWindow() on your panel just to be sure because by default the panel itself won't receive focus.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Glad you got it working. I think you'll find Points a lot more convenient to manage.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Pantera - F***ing Hostile
followed by
Soilwork - The Chainheart Machine

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You should still be able to get the model in the same manner you did before. If you need to access the model often, you can also keep a reference to it as an instance variable and use it without having to use getModel() all the time.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The get() method will return an element by index from a Vector.

I'd recommend using ArrayList instead of Vector unless you need a synchronized collection (and I doubt that you do). The get() method is still the same.

You might also consider using Point objects instead of keeping separate lists for the x and y values.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

And where are you initializing your jTable2 instance?

Edit: cross-post. I knew you would see it eventually :)

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

What error did you receive in the previous code you posted?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The statement you added would work, though I would imagine it's giving you fits about a null pointer. You can't assign a model to a table you haven't created yet.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You tried what? I wrote above what you need to do. Post your revised code.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Yes, the trouble is in your constructor. You declare a variable 'tableModel', initialize it, and add a listener to it - and then you don't do anything with it. It goes out of scope.

Your JTable is still using whatever default model it had in initComponents(). If you want to use the 'tableModel' you created, you can use the JTable.setModel(); method or pass that model to the JTable constructor when you create the table.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I think you need to read a little about what a List is.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Switches operate on integers and enums. How do you see that relating to your requirement?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

What's your question? Seems like you still need to work on this part

//Code goes here...
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

And requesting pirated software is not tolerated on DaniWeb. Thread closed.

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

I don't think the OP is still working on this 2 years later. Closing.

Killer_Typo commented: if he is working on this 2yrs later there might be something wrong! :) +9
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Did you check the query plan on the query I posted to see if it was using the indexes?

You could also try a UNION ALL of the sets for each corner, but there again I would expect that to be slower than the simple inner join.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The import part of that example code is the listener being added to the JTable

jTable2.getModel().addTableModelListener(new TableModelListener() {

          public void tableChanged(TableModelEvent e) {
             System.out.println(e+"  cacat");
             //jTable2.setValueAt("",0,0);
          }
        });

You need to put that in your code somewhere after you have initialized 'jTable2'. It only needs to be done once when you are setting up the table.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You should be able to export a SQL dump of the old database from phpMyAdmin and then import that into your new database.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

"Does not work" is pretty vague. Using the TableModelListener as mKorbel linked to should work just fine.

Post the code that you used for your listener.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You're going to need to show a little more effort on your homework than this.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Why not just a simple join?

SELECT DISTINCT
	N.id,
	N.Alias,
        N.Weight
FROM
	Ninja N, Matchup M 
WHERE
	M.BlueCornerNinjaID = N.id
OR
	M.RedCornerNinjaID = N.id
ORDER BY
	N.Alias
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

> There are no rules regards to spoon feeding in rule section.
Correct, but re-writing someone's code and just handing it to them is generally discouraged here. You didn't even tell them what you fixed, just "Here ya go, I fixed it".

It's usually preferable to try to guide them towards a solution themselves, because fixing a problem on your own is much more of a learning experience than having the answer just given to you with no explanation.

Norm's rep comment is merely expressing his own feelings and the community sentiment on this. He is not limited to only commenting on things that violate a rule.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You should ask for a refund.

katmai539 commented: And sue them for being "not very helpful" +4
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Did start at [nrrows] or [nrrows-1]?

Put in a println debug statement just before the line the error occurs on and figure out why it's sending too high an index value.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

> in my case if I have a table with 20 rows I'd have 20 different highlight conditions.

It's really just two highlighting conditions that you mentioned:
- table.getValueAt(row, whateverColumnToCheck) < threshold => change font on component
- value < 0 => change color on component

The parameters to getTableCellRendererComponent() pass you all that info you need to check those conditions.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

No, the note at the bottom about overriding getCellRenderer() is about how you set the renderer on the column. You can override that method to return an instance of your custom TableCellRenderer or you can set it explicitly through the column model with the TableColumn.setCellRenderer() method. Those two methods only deal with how you specify the renderer component to use.

Don't confuse that with the getTableCellRendererComponent() method of the TableCellRenderer interface, which is what you override to specify how the cell is rendered.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Nice work. I never noticed that method before - never had to select a bunch of single cells either though.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You can add various selection intervals through the methods on ListSelectionModel, but setting multiple, non-contiguous single cells is tricky and not really that useful.

You are better off highlighting them and perhaps selecting the first.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Then you will need to loop the cells and find it before you can select it.