Java Code Examples for com.alee.laf.text.WebTextField#setText()

The following examples show how to use com.alee.laf.text.WebTextField#setText() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SampleTreeCellEditor.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Component getTreeCellEditorComponent ( final JTree tree, final Object value, final boolean isSelected, final boolean expanded,
                                              final boolean leaf, final int row )
{
    this.sampleNode = ( SampleNode ) value;
    final WebTextField editor = ( WebTextField ) super.getTreeCellEditorComponent ( tree, value, isSelected, expanded, leaf, row );
    editor.setText ( sampleNode.getTitle () );
    return editor;
}
 
Example 2
Source File: WebCheckBoxListCellEditor.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates list cell editor component for the cell under specified index.
 *
 * @param list  list to process
 * @param index cell index
 * @param value cell value
 * @return list cell editor created for the cell under specified index
 */
@Override
protected WebTextField createCellEditor ( final JList list, final int index, final CheckBoxCellData value )
{
    final WebTextField field = new WebTextField ( StyleId.checkboxlistCellEditor.at ( list ) );
    field.setText ( value.getUserObject () != null ? value.getUserObject ().toString () : "" );
    field.selectAll ();
    return field;
}
 
Example 3
Source File: DictionariesTreeEditor.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Returns custom tree cell editor component.
 *
 * @param tree       tree
 * @param value      cell value
 * @param isSelected whether cell is selected or not
 * @param expanded   whether cell is expanded or not
 * @param leaf       whether cell is leaf or not
 * @param row        cell row index
 * @return cell editor component
 */
@Override
public Component getTreeCellEditorComponent ( final JTree tree, final Object value, final boolean isSelected, final boolean expanded,
                                              final boolean leaf, final int row )
{
    final WebTextField editor = ( WebTextField ) super.getTreeCellEditorComponent ( tree, value, isSelected, expanded, leaf, row );

    lastValue = ( DefaultMutableTreeNode ) value;
    final Object val = lastValue.getUserObject ();
    if ( val instanceof Dictionary )
    {
        editor.setText ( ( ( Dictionary ) val ).getPrefix () );
    }
    else if ( val instanceof Record )
    {
        editor.setText ( ( ( Record ) val ).getKey () );
    }
    else if ( val instanceof Value )
    {
        // todo Add country editing
        editor.setText ( ( ( Value ) val ).getLocale ().getLanguage () );
    }
    else if ( val instanceof Text )
    {
        // todo Add mnemonic editor
        editor.setText ( ( ( Text ) val ).getText () );
    }

    return editor;
}