• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Rendering

 
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everybody.

Can any body clear cut idea about rendering in swings. What is the purpose inside applications? How should we use that? when should we use that?

Please, if you know any resources also please let me know

Thanks in Advance
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
rendering refers to the process of creating a 2D bitmapped image of a graphic scene that's described in terms of objects. E.g., if you have a number of Swing components, then the process of creating a 2D presentation of them that can be shown on a screen might be referred to as rendering. Or the process of creating an image from a 3D scene via raytracing is a form of rendering.
 
Shashidhar Yarabati
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It seems to be it is not related to Swings?
Iam thinking about Cell rendering in JTable. What does it mean(Cell Rendering in JTable). Why should we require. How to implement that?
Any resources on that?
Please help me to learn on this?

Thanks in advance
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rendering in JTables (and JTrees, JLists and JComboBoxes as well) is done through Renderers (TableCellRenderer, TreeCellRenderer, ListCellRenderer). All these interfaces have a default implementation called Default<InterfaceName>.

You must assign these renderers to the control. JTrees, JLists and JComboBoxes have simple getter and setter methods.

JTables work a little differently. First of all, you can explicitly set a renderer for a TableColumn.
However, you can also specify it for a complete set of classes. JTable has methods called getDefaultRenderer and setDefaultRenderer, where you give a TableCellRenderer and a class. When painting the table, it will call the TableModel's getColumnClass method to determine the class of the column. It will then use best matching to find the renderer. Let's say the class is Integer, it will look for Integer first. If it can't find a renderer for that class, it will look for Number next, and finally Object. This works on classes only, not interfaces, so setting the default renderer for let's say a Serializable or Cloneable will make no sense.

Explicit renderers overwrite this behaviour though.
 
Shashidhar Yarabati
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there any tutorial on this in online. Iam searching in google. But i didn't got.
Please let me know if any?

Thanks for your prompt reply
Shashi
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know that there's a 'one tutorial fits all'

this might be a good place to start
http://java.sun.com/docs/books/tutorial/uiswing/TOC.html

if you click on many of the 'How to use....' links, when the page loads there
is generally another link 'Providing a Custom Renderer', which is specific to that component
 
Shashidhar Yarabati
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi again!

I got some Idea regarding this. Now what i want I want to implement Tree structure inside JTable.
For that what should I do I need to render TableColumn or Table Row.

Please help me if any body knows

Thanks in advance
 
They worship nothing. They say it's because nothing is worth fighting for. Like this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic