ben riches

Ranch Hand
+ Follow
since Nov 08, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by ben riches

I did not patchwork my code as I used Visual Age for Java.
19 years ago
Sorry if I sound rude, but is there anyone who can help me with this please?
Thanks
Ben
19 years ago
Hello all,
The code below pulls out the columnnames from a database and diplays them in a JList. How can I get the JList to display the data that is in a columnname called ben?
Thanks
Ben
19 years ago

Originally posted by Nigel Browne:
Try changing

to this
Regards
Nigel



Hi Nigel,
I have done what you said but I got this error
C:\j21work>javac ComboBoxTable.java
ComboBoxTable.java:98: cannot resolve symbol
symbol : constructor DefaultCellEditor (javax.swing.DefaultCellEditor)
location: class javax.swing.DefaultCellEditor
tcm.getColumn(0).setCellEditor(new DefaultCellEditor(editor2));
^
1 error
Thanks
Ben
19 years ago
Hello All,
I have posted here in the past about JComboBox and you lot have helped me out greatly. I have one more problem then I can stop nagging you.
the code below puts values from a database into 2 combo boxes, and puts those combo boxes in to the JTabel. when the code is run the cells in the JTable are first of all cells untill I click into a cell it then changes to a Combo Box, I want the JTable to always display each cell as Combo Boxes.
I hope you understand what I mean?
Thanks
Ben

[ March 30, 2004: Message edited by: ben riches ]
19 years ago

Originally posted by Brian Pipa:
Has it EVER shown up? You should probably put in some dummy/test values to begin with to see if your table shows up - once you confirm that it does, THEN try getting the data from a DB.
Brian



Yes I have got it to show with the ComBoxes showing all that I need but when one of the Table Names is not accepted it thows 1 Exception when I choose that Table Name, then thows the same Exception again when I go back into the ComboBox to change the table name.
Why do you think this is?

Thanks
Ben
19 years ago
Hello All,
Why is my Jtable not showing up?
Thanks
Ben
19 years ago

Originally posted by Nathan Pruett:
You would just need to make a TableCellRenderer using the panel holding the two comboboxes ( and a TableCellEditor, too... since you obviously expect users to select values from the comboboxes and change the cell's value). However, why would one cell hold two values? Why not use separate columns to hold each set of data?



I have the TableCellRenderer class but how would I do the suggested above.
Also I do want to coulmns the first column would get the Table names from the DataBase the second column gets the colum names from that table the user selected in the column.
Coould you helo me construct my code for the table cell renderer?
what I have at the moment
20 years ago
Hello All,
How can I get every cell within my JTable to have the two combo boxes that are in the code below to display what currently dispaly.
Thanks
Ben
20 years ago
Hello All,
I am still having problems with regrds to my code. When I select the first combo box and select a table Name that begins with 0 it thows an Exception but when I reselect the combo Box to change the table Name it thows the same Exceptiomn again before I can change the table Name.
How can I get my code so that it thows the Exception only once (the first Exception) ? I have posted on this topic before so I have been looking into it, but just can not find the answer.
Please could someone help me
Thankyou
Ben
20 years ago
So how can I pull all the tablenames out from the database without looking for 1?
Ben
Hi All,
When I run this code and I select a table with an 0 at the beggining it thows a Exception which is fine but when I click into the comboBox where I selected the table it thows the exception again.
Why does it thow the Exception twice and is there a way where I can have it thown only once.
Also is there a way where you can have a diffrent JOption pane (error message) pop up for every diffrent Exception that is thown?


Thanks
ben
20 years ago
Hello All,
When I click on a table name called 00_BPDCON I get the Exception:
SQL Exception: java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL Server] Line 1: Incorrent Syntax near '00' .
I don't know why this is happerning?

Rgds
Ben
Hello All,
I have two classes and I want to use one class with the other class, The first class pulls out the table names from a database and puts the names into a comboBox then when the user selectes a table in the first comboBox the second comboBox list all the column names in that table.
The second class is a JTable with every cell holding a comboBox displaying in each comboBox 1,2,3 and 4,5,6.
How I can I get all the comboBoxes in the first row on the JTable to display all the TableNames that are in the comboxes in the 1st class?
Thanks Ben
1ST CLASS:

2ND CLASS:
20 years ago

Originally posted by Tom Blough:
Have a look at DatabaseMetaData. The method getTables will return the information for your first listbox. The method getColumns will return the information for your second listbox based on the table selected in the first list.
Tom Blough


Hi Tom,
I have been able to get the table names fro the Database with this code

But when I am having trouble to get the Column names from the table the user has selected, could you help me with this part please.
Thanks
ben