No, that's really about it. You have to check against all four bounds for containment.
If you're using Rectangle to store the rectangles, you can use its contains() method, but it does pretty much the same calcs you are doing there.
No, that's really about it. You have to check against all four bounds for containment.
If you're using Rectangle to store the rectangles, you can use its contains() method, but it does pretty much the same calcs you are doing there.
Take a look through the tutorial on using tables and stop hijacking the OP's thread with your own questions.
>Data can not be edited in a Jtable.
It certainly can be edited and saved back to the database. Ignore this nonsense.
I already solved it......
Yes, I am aware of that.
Pardon me for mentioning additional information that I though you might find useful. String matching error messages isn't really the most robust way to isolate the nature of error conditions.
To get it to actually render in the correct location, I also had to negate the x position in the super.paintIcon() call to account for the inverted scaling:
super.paintIcon(c, g2, -x, y);
@yancuoto: I would also recommend extending JComponent instead of Component and overriding paintComponent() unless you have to mix this with other heavyweight AWT components.
Yes, but one is partially occluded by the other because I did not alter any of the positioning code to account for differences in image width.
The code works just fine here. Check the size and positions you're painting the icons, because I think you're just overlapping them.
Take a look at the SQLException api. There are methods to get SQL State and the Error Code, which will often provide the specific info you're wanting.
It's currently optimized for the key phases "Thanks for sharing" and "Do SEO to get backlinks to ur site."
Yes, but the docs on using that service are very thin. I chose to point out the spelling difference because String-keyed locators like that do not provide much feedback for minor errors such as a key misspelling.
Spelling counts in service provider look-ups. Try
ScriptEngine engine=manager.getEngineByName("JavaScript");
It would really depend on how you created the renders and assigned them to the column. If you did it the same way as the first then I don't see any reason why it would not work fine.
Try using this for your cell renderer. You can pass it the combo box that you are using for the cell editor.
class CheckBoxCellRenderer implements TableCellRenderer {
JComboBox combo;
public CheckBoxCellRenderer(JComboBox comboBox) {
this.combo = new JComboBox();
for (int i=0; i<comboBox.getItemCount(); i++){
combo.addItem(comboBox.getItemAt(i));
}
}
public Component getTableCellRendererComponent(JTable jtable, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
combo.setSelectedItem(value);
return combo;
}
}
On your table column, column.setCellRenderer(new CheckBoxCellRenderer(comboBox));
Why not mark it solved yourself? Click the link at the bottom of the thread that says "Mark This Thread As Solved".
Did you Google it?
At the bottom of the thread, above the quick reply box, there is a question "Has this thread been answered?" with a link "Mark this Thread as Solved". Click the link.
Check how you are creating your output label.
I wouldn't think so. Perhaps it was just an incompatible file or it was corrupted.
Have you tried a different wav file?
Eclipse is obviously not happy that you are directly accessing sun classes. Those are just warnings though and won't prevent you from using them.
Did you change your catch block to print the stack trace of the IOException?
> i have a bunch of warning signs on a bunch of my lines in the program. is it possibly because of my settings in eclipse?
Well, reading them seems to be a good place to start?
Use error.printStackTrace()
instead of just printing "file not found".
Ok, you can see that your search is basically working because it does print out the days for the month that matches.
The problem is that you are printing out something for every single iteration of the loop. You really only want to print out the result of your search. To do that, perhaps you should make a variable to hold the search results you want to display. If you find a match, set the variable to that information.
After you have completed the search loop, print out your result.
Are you kidding? I can't possibly explain what floor() does in any clearer terms.
If you want to scold people that try to explain things for you, just forget it. RTFM. I won't trouble you with any further attempts to help.
The description of floor() is pretty straightforward:
Returns the next lowest integer value by rounding down value if necessary.
It basically gives you integer portion of your number without any of the decimal portion.
So think about that in the context of dividing your number by 10 and how the result compares to the values that you have hard-coded in that block of if statements.
They are initialized once, but can be re-assigned. "Final" variables cannot be re-assigned after they are initialized.
It will change B every time an instance of A is created. Static is not the same as final.
Static merely means that all instances of a class share that reference instead of each having their own instance variable for it.
Why do you think they need to be static?
So simply provide instance methods on Main that return reference to A,B, and C. Let the instance of Main decide how to handle them internally. There isn't any need to make them static.
Post the error instead of making people guess.
Use String.valueOf(int)
to convert your int to a string for the writer.
We can just move it :)
Nope. Show some effort if you expect help with your homework.
The path to your database can be specified in your JDBC connection URL. See the following page about that: http://db.apache.org/derby/docs/10.8/devguide/
Examples are shown on this page
That's a JVM crash message, not an exception. Check the hs_err log file indicated and search the net for the specific crash info reported there.
Why do you need to start the db as a server at all on a single machine? Do you have more than one client sharing the data?
In your earlier posts, it sounded as if you were wanting an embedded database for use with a single application instance.
Is it possible that you have included an old version of the Carrot2 jar? Because the archived 2.x version API does not have that constructor for DirLocator. It only has the DirLocator(String) constructor.
That all looks reasonable to me. Assuming you don't have any custom classes named File or DirLocator within that same package, I would wonder if some other issue is preventing the Eclipse parser from correctly seeing that constructor. It's obviously there and is public.
Post the import statements for your class.
See How to Write a Key Listener. Check the key code and increment your positional variables based on that. Repaint as needed.
Be mindful about focus issue with key listeners. The listener will only receive events if that component has the focus.
BigDecimal not work for you?
I recommended that you move the table creation code into initUI, not all of the database and model code. Create only your UI components in initUI(). Do not create your table model there. The entire point is to create the UI components only once.
In your action listener, create or update your table model. The model will initially be null, so you create it the first time a selection is made. If the model is not null, simply call setQuery() with the new query string.
Do NOT re-create your entire UI just because they selected a different value to query.
Marking this solved. I think the OP has found an answer by now.
Post your updated code.
I would recommend moving the table creation code out of conn()
into your initUI()
method.
Your action listener for the combo box then needs to initialize the table model if it is null or setQuery()
with the new query string if the model has already been created.
You are correct that they are adding a new JTable every time, but the solution is not to remove those tables before adding the new one. The solution is to keep one JTable.
There is absolutely no need to create a new table just to update the data. The data is the model's responsibility and that is all that needs to change here. There is even a method to change the query without creating a new ResultSetTableModel, so it's simply a matter of calling that method on the existing model instance with a new query string.
No need to remove or create new JTables at all. Change the data that is within the model instead.
It looks like you can call setQuery()
on your ResultSetTableModel
to query a new set of data. If you maintain a single instance of that model, you can just update it's query when your combobox selection changes.