473,387 Members | 1,485 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

JTable

168 100+
Hi dears!
I have some questions about JTable:
1- how can set some columns of my table in editable mode and som
uneditable?

2- how can I create in some columns controls such as JButton or
something like link to a file that these address save to my DB?

3- can I determine # of table rows in run time(when I create my
JTable)?
for example to number of records that I retrieve? When I
create my table rows with Math.random() method in run time, my applet
works, but when I set this with my number (by Integer.ParseInt(str))
it compile successfully but nothing appear! (I get the str from
servlet that is one number In string format)
can anybody help me!
Thanks very much!
Feb 1 '08 #1
1 1266
BigDaddyLH
1,216 Expert 1GB
Hi dears!
I have some questions about JTable:
1- how can set some columns of my table in editable mode and som
uneditable?

2- how can I create in some columns controls such as JButton or
something like link to a file that these address save to my DB?

3- can I determine # of table rows in run time(when I create my
JTable)?
for example to number of records that I retrieve? When I
create my table rows with Math.random() method in run time, my applet
works, but when I set this with my number (by Integer.ParseInt(str))
it compile successfully but nothing appear! (I get the str from
servlet that is one number In string format)
can anybody help me!
Thanks very much!
  1. You can subclass JTable and override isCellEditable
    http://java.sun.com/javase/6/docs/ap...le(int,%20int)
    or you can do something similar with the table model method isCellEditable
    http://java.sun.com/javase/6/docs/ap...le(int,%20int)

    For me the choice is comes down to: is it in the nature of the display that I don't want the user to edit the data (JTable choice) or is it in the nature of the data itself (data model solution).
  2. I don't understand what you are trying to say. Are you talking about changing the column header or changing what is rendered in the table's cells?
  3. Both JTabkle and TableModel have a getRowCount method. Because of filtering, they may return different values. Have you bothered to look up anything in the API? http://java.sun.com/javase/6/docs/api/
Feb 1 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Ben Munday | last post by:
Hi all, I have a problem with a Checkbox in a JTable. When i add the Checkbox into the JTable it displays the String representation of the Checkbox, which is not what i want. So, i created a...
1
by: asd | last post by:
I need to make the cells in the 1st column look like the column header. I tried the following code but it didn't change anything: private void rendererTest() { TableColumn column =...
1
by: raysaun | last post by:
I am trying to set a TableCellEditor for a JTable, however, the editor never seems to get called. I can not even get a simplified version (below) to work. When I put a breakpoint on the return...
0
by: sivaprasad06 | last post by:
Hi, I have a editable combo box editor as a cell editor for JTable. I want use only key board to enter data into jtable. so i am using ALT+Down comobination for making cell editiable in the...
0
by: nuria | last post by:
hi, I have an editable JTable, when you are editing it and press F8 shows a dialog and then go again to the JTable window but the focus goes to a JtextField component, go with the tab for the...
1
by: Andrea Sansottera | last post by:
Hi fellows, I was wondering if in the Java API there's a way to easily map a disconnected RowSet to a JTable... I have looked at the doc but i did not found anything. What I want is simply do...
1
by: onsir | last post by:
I have code like this, but still wrong. how to show data from database in JTable. package my.JavaNetBean; import java.sql.*; import java.io.*; import java.sql.Connection; import...
7
blazedaces
by: blazedaces | last post by:
Hi guys, what I'm I have is a jtable with boolean variables in the first column and text in the next two (checkboxes). I want my tableChanged method to make it so when I check one of the checkboxes...
5
by: moizpalitanawala | last post by:
Hello friends, How to add data to JTable from a .txt file. I had seen this code from one of the tutorial from java.com. This code doesnt take any input. But shows what is written in the array....
1
by: emekadavid | last post by:
can anyone help me flesh out the problem? I wanted to insert a combo box into one of the columns of a JTable. although the combo box is drawn, the list of the data model fails to render. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.