How to add a class as row-element in a table cell?

I asked a similar question yesterday. Now what I want is to add a class as element into the table cell. This class is a DesktopPane and has some components such as button on it. It looks as follow:

public class AddToken extends JDesktopPane implements ComponentListener{

private JButton jButtonAddButton = null;
      
AddToken(){
  initialize();
}
      

private void initialize() {
 // TODO Automatisch erstellter Methoden-Stub
 addComponents();
}

private void addComponents() {
 // TODO Automatisch erstellter Methoden-Stub
 this.add(getJButtonAddButton(), null);
}

private Component getJButtonAddButton() {
// TODO Automatisch erstellter Methoden-Stub
 if(jButtonAddButton == null){
  jButtonAddButton = new JButton();
  jButtonAddButton.setText("Set");
  jButtonAddButton.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 12));
                    jButtonAddButton.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
  jButtonAddButton.setSize(60,23);
  jButtonAddButton.setLocation(5,5);
 
  return jButtonAddButton;
}

}
chenweiAsked:
Who is Participating?
 
objectsCommented:
Lots of examples of cell renderers at:

http://www.objects.com.au/java/examples.do
0
 
objectsCommented:
you can add whatever object you want as a table cell value.
0
 
objectsCommented:
use a cell renderer to define how you want it displayed.
0
 
zzynxSoftware engineerCommented:
Well, you can let your table cell renderer return whatever component you want.
Don't know hows that going to look however ;°)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.