Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2004-10-26
5
Medium Priority
?
151 Views
Last Modified: 2010-03-31
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;
}

}
0
Comment
Question by:chenwei
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 92

Expert Comment

by:objects
ID: 12408659
you can add whatever object you want as a table cell value.
0
 
LVL 92

Expert Comment

by:objects
ID: 12408664
use a cell renderer to define how you want it displayed.
0
 
LVL 92

Accepted Solution

by:
objects earned 150 total points
ID: 12408668
Lots of examples of cell renderers at:

http://www.objects.com.au/java/examples.do
0
 
LVL 37

Expert Comment

by:zzynx
ID: 12408670
Well, you can let your table cell renderer return whatever component you want.
Don't know hows that going to look however ;°)
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question