aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Jtable  retreiving data Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Jtable  retreiving data" Watch "Jtable  retreiving data" New topic
Author

Jtable retreiving data

Fernando Hood
Greenhorn

Joined: May 23, 2008
Posts: 20
I have a one column jtable with values of type byte.

I want to retreive the data at a particular column as a byte and not an object.

Any ideas?
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2227
    
    8
The API only supports Objects, but a Byte is an Object so I don't understand the problem.

If you need further help then you need to create a SSCCE (Short, Self Contained, Compilable and Executable, Example Program), that demonstrates the incorrect behaviour.

Don't forget to use the Code Formatting Tags so the posted code retains its original formatting. That is done by selecting the code and then clicking on the "Code" button above the question input area.
Fernando Hood
Greenhorn

Joined: May 23, 2008
Posts: 20
can I assign the object value returned to a byte variable.
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2227
    
    8
Did you try it?
Fernando Hood
Greenhorn

Joined: May 23, 2008
Posts: 20
incompatible types..
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10535
    
    9

Fernando,
Please check your private messages for an important administrative matter.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2227
    
    8
Did you cast the value to a Boolean?
Fernando Hood
Greenhorn

Joined: May 23, 2008
Posts: 20
Problem resolved. Just amazed that such task take so much effort to research and resolve.

I have an index comming from a micro-controller through the serial port.

Based on the value I would like to highlight the row corresponding to the index.
The user will therefore see a color jumping up and down the table depending on the incoming index values. Any ideas?

I have been able to send the data from the table to the ram of the microcontroller which subsequently stores
it into rom. I send the entire table . In the future if I change only on cell I would like to send this value out to the controller.

I am a novie at Java but realise it very important for GUI.

Regards.

Fernando Hood
Greenhorn

Joined: May 23, 2008
Posts: 20
Still trying to highlight rows in table based on a row value. Created a stand alone close that does it but cannot get it integrated
with netbeans .At the end of the loop all of the cells are painted red.Help Required.


Main Class






Rendering





Fernando Hood
Greenhorn

Joined: May 23, 2008
Posts: 20
This the code I have been trying to alter to meet my needs.

Fernando Hood
Greenhorn

Joined: May 23, 2008
Posts: 20
I have put everthing in the main class.

Main




subclass




Fernando Hood
Greenhorn

Joined: May 23, 2008
Posts: 20
Is there any one on this forum with experience to solve this issue?
Fernando Hood
Greenhorn

Joined: May 23, 2008
Posts: 20
I have written 8000 lines of asembly code and I am now stuck at a couple of lines of JAVA and no one can help.

Hmmmm!!!
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2227
    
    8
Fernando Hood
Greenhorn

Joined: May 23, 2008
Posts: 20
Thanks but I am trying to understand what I need to do with this code.

Should I abandon the custom cell renderer subclass? Where should this method go?




JTable table = new JTable() {
This is confusing me. What is the code doing. You are creating a table and calling a method at the same time?
Netbeans already created the table .


My problem is that at the end of the scan through the table I am only seeing the last row pinted red.
as the index get incremented from 1 to 16 it is not shoing me the row corresponding to the index.It is as if it can only display the contents
after it get out of the routine and returns control to the main program.
The sample code I used is somehow able to show me each row in red as the indexd goes from 0 to 16.


Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2227
    
    8
If you don't know what the code is doing, then why did you change the code?

The code is creating a table and overriding the prepareRenderer() method, so you don't need to use any custom renderers.

If you don't know how to do this in Netbeans, then don't use Netbeans. Learn how to write your own code and don't depend on generated code.
Fernando Hood
Greenhorn

Joined: May 23, 2008
Posts: 20
Rob,

I am getting there slowly. I now understand.

However this creates the table but I want to dynamically update the table so that
as the row is changed it will turn red.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Jtable retreiving data