Package com.alee.laf.text

Examples of com.alee.laf.text.WebTextField


    public WebFileTableCellEditor ()
    {
        super ();
        clickCountToStart = 3;

        editorComponent = new WebTextField ( false );
        editorComponent.setMargin ( 2 );
        editorComponent.setFieldMargin ( 0, 4, 0, 0 );

        delegate = new FileNameEditorDelegate ();
        editorComponent.addActionListener ( delegate );
View Full Code Here


    public Component getTreeCellEditorComponent ( final JTree tree, final Object value, final boolean isSelected, final boolean expanded,
                                                  final boolean leaf, final int row )
    {
        // todo Use delegate instead of direct access!
        this.sampleNode = ( SampleNode ) value;
        final WebTextField editor = ( WebTextField ) super.getTreeCellEditorComponent ( tree, value, isSelected, expanded, leaf, row );
        editor.setText ( sampleNode.getName () );
        return editor;
    }
View Full Code Here

     */
    @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 )
        {
            editor.setText ( ( ( Value ) val ).getLang () );
        }
        else if ( val instanceof Text )
        {
            editor.setText ( ( ( Text ) val ).getText () );
        }
        else if ( val instanceof Tooltip )
        {
            editor.setText ( ( ( Tooltip ) val ).getText () );
        }

        return editor;
    }
View Full Code Here

     * @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 = WebTextField.createWebTextField ( true, WebListStyle.selectionRound, WebListStyle.selectionShadeWidth );
        field.setDrawFocus ( false );
        field.setText ( value.getUserObject () != null ? value.getUserObject ().toString () : "" );
        field.selectAll ();
        return field;
    }
View Full Code Here

     * @return list cell editor created for the cell under specified index
     */
    @Override
    protected Component createCellEditor ( final JList list, final int index, final Object value )
    {
        final WebTextField field = WebTextField.createWebTextField ( true, WebListStyle.selectionRound, WebListStyle.selectionShadeWidth );
        field.setDrawFocus ( false );
        field.setText ( value != null ? value.toString () : "" );
        field.selectAll ();
        return field;
    }
View Full Code Here

     * {@inheritDoc}
     */
    @Override
    protected WebTextField createCellEditor ( final JList list, final int index, final FileElement value )
    {
        final WebTextField editor = WebTextField.createWebTextField ( true, WebListStyle.selectionRound, WebListStyle.selectionShadeWidth );
        editor.setDrawFocus ( false );
        FileUtils.displayFileName ( editor, value.getFile () );

        if ( list instanceof WebFileList )
        {
            final boolean tiles = ( ( WebFileList ) list ).getFileListViewType ().equals ( FileListViewType.tiles );
            editor.setHorizontalAlignment ( tiles ? WebTextField.LEFT : WebTextField.CENTER );
        }

        return editor;
    }
View Full Code Here

    /**
     * Constructs default tree cell editor with a text field as editor.
     */
    public WebTreeCellEditor ()
    {
        this ( new WebTextField () );
    }
View Full Code Here

                final TreeUI tui = tree.getUI ();
                final int sw =
                        tui instanceof WebTreeUI ? ( ( WebTreeUI ) tui ).getSelectionShadeWidth () : WebTreeStyle.selectionShadeWidth;

                // Field styling
                final WebTextField editor = ( WebTextField ) cellEditor;
                editor.setDrawFocus ( false );
                editor.setShadeWidth ( sw );
                editor.setDrawShade ( false );

                // Leading icon
                if ( autoUpdateLeadingIcon )
                {
                    editor.setLeadingComponent ( new WebImage ( label.getIcon () ) );
                }

                // Field side margin
                final int sm = sw + 1;
                final Insets margin = label.getInsets ();
                editor.setMargin ( margin.top - sm, margin.left - sm, margin.bottom - sm, margin.right - sm - 2 );

                // Gap between leading icon and text
                editor.setFieldMargin ( 0, label.getIconTextGap (), 0, 0 );
            }
        }

        // Applying component orientation
        cellEditor.applyComponentOrientation ( tree.getComponentOrientation () );
View Full Code Here

        selectedFilesViewField = new WebFileChooserField ( false );
        selectedFilesViewField.setShowRemoveButton ( false );
        selectedFilesViewField.setShowFileShortName ( true );
        selectedFilesViewField.setFilesDropEnabled ( false );

        selectedFilesTextField = new WebTextField ( 0, true );
        selectedFilesTextField.addCaretListener ( new CaretListener ()
        {
            @Override
            public void caretUpdate ( final CaretEvent e )
            {
View Full Code Here

        // Hue
        final WebLabel hueButton = new WebLabel ( "H:" );
        hueButton.setDrawShade ( true );
        colorsPanel.add ( hueButton, "0,0" );
        hueField = new WebTextField ();
        colorsPanel.add ( hueField, "2,0" );
        final WebLabel hueSuffix = new WebLabel ( "°" );
        hueSuffix.setDrawShade ( true );
        colorsPanel.add ( hueSuffix, "4,0" );

        // Saturation
        final WebLabel saturationButton = new WebLabel ( "S:" );
        saturationButton.setDrawShade ( true );
        colorsPanel.add ( saturationButton, "0,2" );
        saturationField = new WebTextField ();
        colorsPanel.add ( saturationField, "2,2" );
        final WebLabel saturationSuffix = new WebLabel ( "%" );
        saturationSuffix.setDrawShade ( true );
        colorsPanel.add ( saturationSuffix, "4,2" );

        // Brightness
        final WebLabel brightnessButton = new WebLabel ( "B:" );
        brightnessButton.setDrawShade ( true );
        colorsPanel.add ( brightnessButton, "0,4" );
        brightnessField = new WebTextField ();
        colorsPanel.add ( brightnessField, "2,4" );
        final WebLabel brightnessSuffix = new WebLabel ( "%" );
        brightnessSuffix.setDrawShade ( true );
        colorsPanel.add ( brightnessSuffix, "4,4" );

        final CaretListener hsbListener = new CaretListener ()
        {
            @Override
            public void caretUpdate ( final CaretEvent e )
            {
                if ( !adjustingText )
                {
                    palette.removeChangeListener ( paletteListener );

                    try
                    {
                        final float h = ( float ) Integer.parseInt ( hueField.getText () ) / 360;
                        final float s = ( float ) Integer.parseInt ( saturationField.getText () ) / 100;
                        final float b = ( float ) Integer.parseInt ( brightnessField.getText () ) / 100;
                        color = new HSBColor ( h, s, b ).getColor ();
                        updateColors ( color, UpdateSource.hsbField );
                    }
                    catch ( final Throwable ex )
                    {
                        //
                    }

                    palette.addChangeListener ( paletteListener );
                }
            }
        };
        hueField.addCaretListener ( hsbListener );
        saturationField.addCaretListener ( hsbListener );
        brightnessField.addCaretListener ( hsbListener );


        colorsPanel.add ( new WebSeparator ( WebSeparator.HORIZONTAL ), "0,6,4,6" );


        final WebLabel redButton = new WebLabel ( "R:" );
        redButton.setDrawShade ( true );
        colorsPanel.add ( redButton, "0,8" );
        redField = new WebTextField ();
        redField.setColumns ( 3 );
        colorsPanel.add ( redField, "2,8" );

        final WebLabel greenButton = new WebLabel ( "G:" );
        greenButton.setDrawShade ( true );
        colorsPanel.add ( greenButton, "0,10" );
        greenField = new WebTextField ();
        greenField.setColumns ( 3 );
        colorsPanel.add ( greenField, "2,10" );

        final WebLabel blueButton = new WebLabel ( "B:" );
        blueButton.setDrawShade ( true );
        colorsPanel.add ( blueButton, "0,12" );
        blueField = new WebTextField ();
        blueField.setColumns ( 3 );
        colorsPanel.add ( blueField, "2,12" );

        final CaretListener rgbListener = new CaretListener ()
        {
            @Override
            public void caretUpdate ( final CaretEvent e )
            {
                if ( !adjustingText )
                {
                    palette.removeChangeListener ( paletteListener );

                    try
                    {
                        final int r = Integer.parseInt ( redField.getText () );
                        final int g = Integer.parseInt ( greenField.getText () );
                        final int b = Integer.parseInt ( blueField.getText () );
                        color = new Color ( r, g, b );
                        updateColors ( color, UpdateSource.rgbField );
                    }
                    catch ( final Throwable ex )
                    {
                        //
                    }

                    palette.addChangeListener ( paletteListener );
                }
            }
        };
        redField.addCaretListener ( rgbListener );
        greenField.addCaretListener ( rgbListener );
        blueField.addCaretListener ( rgbListener );


        infoPanel.add ( new WebSeparator ( WebSeparator.HORIZONTAL ), "0,9,2,9" );


        final WebLabel hexLabel = new WebLabel ( "#" );
        hexLabel.setDrawShade ( true );
        infoPanel.add ( hexLabel, "0,11" );
        hexColor = new WebTextField ();
        updateHexField ( color );
        final CaretListener hexListener = new CaretListener ()
        {
            @Override
            public void caretUpdate ( final CaretEvent e )
View Full Code Here

TOP

Related Classes of com.alee.laf.text.WebTextField

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.