|
| ||||||||||
| Tags: class, defaultcelleditor, java, java class, java classes |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| How to use DefaultCellEditor class?
I have one query to discuss with you and which is related to the DefaultCellEditor class. In one of my project I will need to use DefaultCellEditor class of java. But I don't anything about this java class. I searched lost of various websites for 'DefaultCellEditor class, but didn't get enough details. If you posses knowledge about DefaultCellEditor class, then please let aware about the same. I would greatly appreciate your any help over DefaultCellEditor class . |
|
#2
| ||||
| ||||
| Re: How to use DefaultCellEditor class?
Hi, A DefaultCellEditor class is used as a default editor for table and tree cells. A 'javax.swing.AbstractCellEditor' is nothing but the parent package for the DefaultCellEditor class of java. This java class implements four interfaces namely as TableCellEditor, TreeCellEditor, CellEditor, Serializable. A DefaultCellEditor class of java language is entends the class known as 'classAbstractCellEditor' |
|
#3
| ||||
| ||||
| Re: How to use DefaultCellEditor class?
Following are some essential methods of the DefaultCellEditor class:
|
|
#4
| ||||
| ||||
| Re: How to use DefaultCellEditor class?
Hi friend, If you want to know about the use of DefaultCellEditor class, then please refer following java code: Code: import javax.swing.DefaultCellEditor;
import javax.swing.tree01.TreeCellEditor;
public class DefaultCellEditorMain {
public static void main(final String argvs[]) {
JFrame frame002 = new JFrame("Editable Tree");
frame002.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Object array[] = {Boolean.TRUE, Boolean.FALSE, "Hello"};
JTree tree01 = new JTree(array);
tree01.setEditable(true);
tree01.setRootVisible(true);
JCheckBox checkBox1 = new JCheckBox();
TreeCellEditor editor1 = new DefaultCellEditor(checkBox1);
tree01.setCellEditor(editor1);
JScrollPane scrollPane1 = new JScrollPane(tree01);
frame002.add(scrollPane1, BorderLayout.CENTER);
frame002.setSize(200, 150);
frame002.setVisible(true);
}
} |
|
#5
| |||
| |||
| Re: How to use DefaultCellEditor class?
Below I have given some constructors of DefaultCellEditor class along with their parameters:
|
|
#6
| ||||
| ||||
| Re: How to use DefaultCellEditor class?
Hi, Following code of java will demonstrate you the use of DefaultCellEditor(JComboBox com) method of DefaultCellEditor class: Code: import javax.swing.DefaultCellEditor;
import javax.swing.JComboBox;
import javax.swing.tree.TreeCellEditor;
public class DefaultED {
public static void main(final String args[]) {
JFrame HBP = new JFrame("Editable Tree");
HBP.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JTree tree = new JTree();
tree.setEditable(true);
DefaultTreeCellRenderer renderer = (DefaultTreeCellRenderer) tree.getCellRenderer();
String elements[] = { "A", "B", "C", "D" };
JComboBox comboBoxF = new JComboBox(elements);
comboBoxF.setEditable(true);
TreeCellEditor comboEditorF = new DefaultCellEditor(comboBoxF);
TreeCellEditor editorF = new DefaultTreeCellEditor(tree, renderer, comboEditorF);
tree.setCellEditor(editorF);
JScrollPane scrollPane1 = new JScrollPane(tree);
HBP.add(scrollPane1, BorderLayout.CENTER);
HBP.setSize(300, 100);
HBP.setVisible(true);
}
} |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "How to use DefaultCellEditor class?" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Upgrade Sony Ericsson Xperia Play Micro SD card from class 2 8GB to class 4 32GB | Aaryan2011 | Portable Devices | 8 | 08-10-2011 11:06 PM |
| How to initialize a derived class with an instance of the base class in c#? | KAIRU26 | Software Development | 5 | 12-02-2010 05:23 PM |
| Difference among concrete class and abstract class | Roxy_jacob | Software Development | 4 | 07-12-2009 12:22 PM |
| Ultra solid drives:Imation M-Class and S-Class | Regina | Portable Devices | 1 | 03-04-2009 10:34 AM |
| Good news for CBSE CLASS X & CLASS IX - visit learnnext | surya_expert | Education Career and Job Discussions | 0 | 13-12-2008 11:09 AM |