Package com.alee.laf.text

Examples of com.alee.laf.text.WebTextArea


    }

    @Override
    public Component getPreview ( WebLookAndFeelDemo owner )
    {
        WebTextArea textArea = new WebTextArea ();
        textArea.setText ( "Some content\nnext line\nand one more\nand some plain text" );
        textArea.setLineWrap ( true );
        textArea.setWrapStyleWord ( true );

        WebScrollPane areaScroll = new WebScrollPane ( textArea );
        areaScroll.setPreferredSize ( new Dimension ( 200, 150 ) );

        return new GroupPanel ( areaScroll );
View Full Code Here


        // Output area
        final TitledBorderPainter painter = new TitledBorderPainter ( "Focus changes:" );
        painter.setTitleAlignment ( SwingConstants.CENTER );
        final WebPanel panel = new WebPanel ( painter );
        final WebTextArea info = new WebTextArea ();
        info.setEditable ( false );
        info.setRows ( 1 );
        info.setMargin ( 5 );
        final WebScrollPane infoScroll = new WebScrollPane ( info );
        infoScroll.setPreferredWidth ( 150 );
        panel.add ( infoScroll );

        // Form #1 focus tracker
View Full Code Here

    {
        final WebOverlay overlayPanel = new WebOverlay ();

        // Overlayed area
        final String text = "Try resizing this area...";
        final WebTextArea textArea = new WebTextArea ( text, 3, 20 );
        textArea.setLineWrap ( true );
        textArea.setWrapStyleWord ( true );

        // Scroll pane that will be sized by resize corner
        final WebScrollPane scrollPane = new WebScrollPane ( textArea );
        overlayPanel.setComponent ( scrollPane );
View Full Code Here

        centeredOverlay.setVisible ( false );
        EmptyMouseAdapter.install ( centeredOverlay );
        overlayPanel.addOverlay ( centeredOverlay );

        // Overlayed text area
        final WebTextArea component = new WebTextArea ();
        component.setColumns ( 20 );
        component.setRows ( 3 );
        component.setLineWrap ( true );
        component.setWrapStyleWord ( true );
        component.addMouseListener ( new MouseAdapter ()
        {
            private String toAdd = "";
            private int step = 5;

            @Override
            public void mousePressed ( MouseEvent e )
            {
                // Block action on disabled state
                if ( !component.isEnabled () )
                {
                    return;
                }

                // Updating string to write
                if ( toAdd.length () == 0 )
                {
                    toAdd = ExamplesManager.createSmallString ();
                }

                // Disabling textarea editing
                component.setEditable ( false );
                component.setSelectionStart ( component.getText ().length () );
                component.setSelectionEnd ( component.getText ().length () );
                component.setCaretPosition ( component.getText ().length () );

                // Initializing progress
                overlay.setMinimum ( 0 );
                overlay.setValue ( 0 );
                overlay.setMaximum ( toAdd.length () );

                // Displaying overlay
                centeredOverlay.setVisible ( true );

                // Starting update thread
                new Thread ( new Runnable ()
                {
                    @Override
                    public void run ()
                    {
                        while ( toAdd.length () > 0 )
                        {
                            final int left = Math.min ( step, toAdd.length () );
                            SwingUtils.invokeAndWaitSafely ( new Runnable ()
                            {
                                @Override
                                public void run ()
                                {
                                    component.append ( toAdd.substring ( 0, left ) );
                                    overlay.setValue ( overlay.getValue () + left );
                                }
                            } );
                            toAdd = toAdd.substring ( left );
                            ThreadUtils.sleepSafely ( 50 );
                        }
                        SwingUtilities.invokeLater ( new Runnable ()
                        {
                            @Override
                            public void run ()
                            {
                                // Hiding overlay
                                centeredOverlay.setVisible ( false );

                                // Enabling textarea editing
                                component.setEditable ( false );
                            }
                        } );
                    }
                } ).start ();
            }
View Full Code Here

    @Override
    public Component getPreview ( final WebLookAndFeelDemo owner )
    {
        // Text area styled with nine-patch state painter
        final WebTextArea textArea = new WebTextArea ();
        textArea.setRows ( 2 );
        textArea.setText ( "Multiline\nStyled\nTextarea" );
        textArea.setPainter ( NinePatchUtils.loadNinePatchStatePainter ( getResource ( "area.xml" ) ) );
        return textArea;
    }
View Full Code Here

    }

    public static WebScrollPane createCustomContent ( final int w, final int h )
    {
        // Content text area
        final WebTextArea textArea = new WebTextArea ( ExamplesManager.createLongString () );
        textArea.setLineWrap ( true );
        textArea.setWrapStyleWord ( true );

        // Text area scroll
        final WebScrollPane scrollPane = new WebScrollPane ( textArea, false );
        scrollPane.setPreferredSize ( new Dimension ( w, h ) );
View Full Code Here

    //    }

    public static WebScrollPane createCustomContent ( final int w, final int h )
    {
        // Content text area
        final WebTextArea textArea = new WebTextArea ( ExamplesManager.createLongString () );
        textArea.setLineWrap ( true );
        textArea.setWrapStyleWord ( true );

        // Text area scroll
        final WebScrollPane scrollPane = new WebScrollPane ( textArea, false );
        scrollPane.setPreferredSize ( new Dimension ( w, h ) );
View Full Code Here

     * {@inheritDoc}
     */
    @Override
    public Component getPreview ( final WebLookAndFeelDemo owner )
    {
        final WebTextArea scrollableArea = new WebTextArea ( ExamplesManager.createLongString () );
        scrollableArea.setLineWrap ( true );
        scrollableArea.setWrapStyleWord ( true );
        scrollableArea.setMargin ( 5 );

        final WebScrollPane webScrollPane = new WebScrollPane ( scrollableArea, false, true );
        webScrollPane.setPreferredSize ( new Dimension ( 0, 0 ) );
        return webScrollPane;
    }
View Full Code Here

        // Overlay panel
        final WebProgressOverlay progressOverlay = new WebProgressOverlay ();
        progressOverlay.setProgressWidth ( 35 );

        // Overlay content
        final WebTextArea textArea = new WebTextArea ();
        textArea.setText ( "Click to load some text..." );
        textArea.setLineWrap ( true );
        textArea.setWrapStyleWord ( true );
        WebScrollPane scrollPane = new WebScrollPane ( textArea );
        scrollPane.setPreferredSize ( new Dimension ( 250, 100 ) );
        progressOverlay.setComponent ( scrollPane );

        // Overlaying components
        final WebLabel progressLabel = new WebLabel ( "0%", WebLabel.CENTER );
        progressLabel.setBoldFont ();
        progressLabel.setMargin ( 5, 10, 5, 10 );
        final WebPanel overlayPanel = new WebPanel ( true, progressLabel );
        overlayPanel.setShadeWidth ( 5 );
        overlayPanel.setVisible ( false );
        overlayPanel.setPreferredSize ( new Dimension ( 60, 40 ) );
        progressOverlay.addOverlay ( overlayPanel, SwingConstants.CENTER, SwingConstants.CENTER );

        // Animation start action
        textArea.addMouseListener ( new MouseAdapter ()
        {
            private String base = ExamplesManager.createSmallString ();
            private String toAdd = "";
            private int step = 5;

            @Override
            public void mousePressed ( MouseEvent e )
            {
                // Updating string to write
                if ( toAdd.length () == 0 )
                {
                    textArea.clear ();
                    toAdd = base;
                }

                progressOverlay.setShowLoad ( true );
                overlayPanel.setVisible ( true );
                new Thread ( new Runnable ()
                {
                    @Override
                    public void run ()
                    {
                        while ( toAdd.length () > 0 )
                        {
                            final int left = Math.min ( step, toAdd.length () );
                            SwingUtils.invokeAndWaitSafely ( new Runnable ()
                            {
                                @Override
                                public void run ()
                                {
                                    textArea.append ( toAdd.substring ( 0, left ) );
                                    progressLabel.setText ( ( base.length () - toAdd.length () ) * 100 / base.length () + " %" );
                                }
                            } );
                            toAdd = toAdd.substring ( left );
                            ThreadUtils.sleepSafely ( 50 );
View Full Code Here

    @Override
    public Component getPreview ( final WebLookAndFeelDemo owner )
    {
        // Text area styled with nine-patch state painter
        final WebTextArea textArea = new WebTextArea ();
        textArea.setRows ( 2 );
        textArea.setText ( "Multiline\nStyled\nTextarea" );
        textArea.setPainter ( NinePatchUtils.loadNinePatchStatePainter ( getResource ( "area.xml" ) ) );
        textArea.setForeground ( Color.WHITE );
        return textArea;
    }
View Full Code Here

TOP

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

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.