• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Jtable retreiving data

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can I assign the object value returned to a byte variable.
 
Rob Camick
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you try it?
 
Fernando Hood
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
incompatible types..
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Fernando,
Please check your private messages for an important administrative matter.
 
Rob Camick
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you cast the value to a Boolean?
 
Fernando Hood
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This the code I have been trying to alter to meet my needs.

 
Fernando Hood
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have put everthing in the main class.

Main




subclass




 
Fernando Hood
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there any one on this forum with experience to solve this issue?
 
Fernando Hood
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Fernando Hood
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
CLUCK LIKE A CHICKEN! Now look at this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic