Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read SiteMap

Tags: , , , ,

Sponsored Links


How to use DefaultCellEditor class?

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 19-02-2010
Member
 
Join Date: Dec 2009
Posts: 32
How to use DefaultCellEditor class?

Sponsored Links
Hi friend,

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 .

Reply With Quote
  #2  
Old 19-02-2010
MindSpace's Avatar
Member
 
Join Date: Feb 2008
Posts: 1,839
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'
Reply With Quote
  #3  
Old 19-02-2010
Modifier's Avatar
Member
 
Join Date: Jan 2008
Posts: 1,507
Re: How to use DefaultCellEditor class?

Following are some essential methods of the DefaultCellEditor class:
  • shouldSelectCell(EventObject anEvnt)
  • setClickCountToStart(int cnt)
  • isCellEditable(EventObject anEvnt)
  • getTreeCellEditorComponent(JTree tree, Object val, boolean bl, boolean expanded, boolean leaf, int rw)
  • getTableCellEditorComponent(JTable table, Object val, boolean bl, int row1, int clm)
Reply With Quote
  #4  
Old 19-02-2010
Praetor's Avatar
Member
 
Join Date: Apr 2008
Posts: 1,943
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);
  }
}
Reply With Quote
  #5  
Old 19-02-2010
Member
 
Join Date: May 2008
Posts: 2,000
Re: How to use DefaultCellEditor class?

Below I have given some constructors of DefaultCellEditor class along with their parameters:
  1. DefaultCellEditor(JComboBox cmbBox1)
  2. DefaultCellEditor(JTextField txtField1)
  3. DefaultCellEditor(JCheckBox chkBox1)
  4. getClickCountToStart()
Reply With Quote
  #6  
Old 19-02-2010
kelfro's Avatar
Member
 
Join Date: Apr 2008
Posts: 1,990
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);
  }
}
Reply With Quote
Reply

  TechArena Community > Software > Software Development


Thread Tools Search this Thread
Search this Thread:

Advanced Search


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


All times are GMT +5.5. The time now is 06:37 PM.