You need to set the alignment on the label. It's filling the scrollpane by default.
label.setVerticalAlignment(SwingConstants.TOP);
You need to set the alignment on the label. It's filling the scrollpane by default.
label.setVerticalAlignment(SwingConstants.TOP);
Try
jScrollPane1.setViewportView(new JLabel("Connecting to the database. Please wait...")
and when the table is ready
jScrollPane1.setViewportView(table);
I would recommend constructing your UI components as you normally would, outside of the done() method, and just use done() to add the List contents.
Remove the left parenthesis so you just have };
It's just a minor syntax error in the anonymous class declaration.
Take a look through this tutorial on concurrency in Swing
SwingWorker invokes a worker thread in the background that does not tie up the event queue. SwingWorker may publish results for updates on the event queue, but it does not have to.
SwingUtilities.invokeLater() schedules a task to run on the event queue. While the task runs, nothing else on the event queue will be processed - so your GUI will be unresponsive pending completion of that task. That is why you don't want to process long-running tasks directly on the event queue.
Or just create your own small wrapper model.
No one is going to answer quiz questions for you.
Formulate your own answers and if you have uncertainties, ask specific questions. Explain your reasoning or thoughts on the areas you doubt,
Demonstrate some effort in the process if you want others to take their own time to help you.
Take a look at this section on using JList with a mutable model:
http://download.oracle.com/javase/tutorial/uiswing/components/list.html#mutable
This is not a homework completion service. Post the code that you have done so far and post specific questions or error messages that you are having trouble with.
Re-read that for() line. You have two unnecessary characters in it.
getString() returns the value of the column in the current row of the result set. This means that you already have a reference to the row or its location, so it is simply a matter of returning the value of the column as a String. Your iteration or access methods will need to maintain that reference to the current row.
You already have a section where you are updating the maxScore. You can update more than one thing in that if() block if you add some braces (which you should always use anyway).
You don't need to grab a previous string - you just need a new variable to hold the max score player name.
Take a look at the Space Invaders tutorial there. It is a 2D sprite game.
Can you post your getValueAt() code?
Did you make any changes in your getColumnClass() method? What prompted the class cast exception?
You only have a partial expression after your OR operator
if (outsideTemperature < -58 || > 41)
You aren't comparing anything to 41 in that statement. If you want to check it against 'outsideTemperature' then you must state that explicitly. The compiler just sees that you have nothing on the left hand side of the '>'.
Well, line 12 is generating a random int from 0-5. So what effect do you think that has in line 13?
Sure, with an embedded database it's no trouble. We do this with H2 for every new project when it's first created. You just run a script with your data definition code in it.
Edit: H2 can also create an in-memory database that does not persist when closed.
Add "\n" for a line break. You can inline that with the text if you like. ie +"\nBall position: "
Edit: You can also look into the String.format() method if you like.
Calculate the center point (appW/2, appH/2) and then use those to figure where to place your upper left corner of the rect.
Here you are checking pieces [a][b]
for null, but calling print on pieces [9-a][b]
if(pieces [a][b]!=null){
array[a][b]=pieces [9-a][b].print();
}
You've used an invalid identifier to get the column. I used the column name in the code above, since the identifier defaults to the header value.
You stack trace will indicate the exact line that the error is occurring on.
You can probably use BorderLayout for that with your tree in the center and buttons at south.
There are plenty of other layout options if you want to gain more control over positioning. Just take a look at the contents listing at the left side of that tutorial link.
>open=fun.java // my program name
You cannot run ".java" files. You can run classes or jars.
Actually, Jon is very helpful around here. He assumption that you don't know the language well stems directly from the fact that you posted that you didn't know how to use classes and method within interfaces.
Perhaps you can start here to learn interfaces: http://download.oracle.com/javase/tutorial/uiswing/
Some issues from the redesign were discussed and have now fallen well off the radar so I wanted to bring them back to page one:
- "Edit/Delete" button: Complete misnomer, because it does not offer the ability to delete.
- No [icode] button on either of the post editors. Some who answer questions here do use that tag.
- Page navigation on multi-page threads and forums is still only at the bottom, along with the Mark Forum Read option. It's a pain in the ass to have to scroll to the bottom to see/navigate other pages of a thread. You cannot even tell that a thread has more than one page unless you go to the bottom of the page.
- The "Start A New Thread" button at the top of the forums is barely distinguishable from a line of text and does not readily present itself in the forum listing.
- Font/table size on the forum thread listings is still huge. Luckily this can be dialed back smaller in Firefox or I would have given up trying to read the listings at all.
Write a project topic generator. Please.
So start coding!
Post specific questions when you run into troubles and perhaps someone can help you through them.
You aren't expecting someone to write this for you, are you?
Create a method in your Dimensions class to add a Dimension to the instance and return a new Dimension with the result
public Dimension add(Dimension d){
... add dimensions and return the result ...
}
Please mark this thread as solved :)
The "Edit/Delete" button continues to cause confusion amongst users, since it doesn't actually allow them to delete the post. I believe this was on the list of things to address with the new design months ago and may have fallen off the radar.
Maybe.
You're welcome.
It seems to work fine if you make the combo box uneditable and add the key listener directly to the JComboBox component instead of the editor
fromComboBox.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent event) {
fromComboBoxKeyKeyPressed(event);
}
});
Perhaps someone can, but you're going to need to show some effort on your own.
> can nay on etell me tht why if i am moving a ball thn my hurdl also moving .
Why should anyone waste their time replying to this lazy gibberish? Perhaps you should take the extra 10 seconds to type a legible question if you want others to take it seriously.
Question post more words.
Step into the elevator and look in the lower left corner by the door. There is a loose edge of carpet. Peel that back and open the small hatch below. Inside the hatch, you'll see a very tiny monkey. If you hand him a baloney sandwich, he will share a secret with you: "Resurrecting 6-year-old threads on IT discussion forums won't open this elevator."
I can't help you much beyond that. Sorry.
Narue >> That quoting method is worse than awful. Pick one method and stick to it, don't combine them.
okay, fine. I like the concept of quote tags, and i like the boxed out separation, but the font face makes me ill.
so i'll go back to the old newsgroup variation.
But there are still possibilities remaining! :icon_surprised:
nope googled my name and this came up, not cool theres no need for that. I've since deleted all my info but still its the principal.
The acceptable use policy clearly states that member profile information may be publicly visible and entering it is entirely optional: http://www.daniweb.com/forums/faq.php?faq=privacy_policy#faq_member_profiles
If your info is still showing in Google after you removed it, then I suppose that's an issue you'd need to take up with them. DaniWeb has little input into Google's searching, indexing, and caching mechanisms. It may be that it will disappear the next time they spider the site. I really can't say.
I can haz more chaos?
She's referring to putting "..." in quote and placing the quoted text below the actual quote.
Edit: Cross-posted :)
So they do have more colors than purple! :P
me i lways eating vegetables..
You could stir-fry them with spam.
Yes, I'd agree that it's somewhat hidden up there at the top. I think it's previous location just below the last post is probably the best place for it if we're to have any chance of new posters using it.