Package com.alee.laf.filechooser

Examples of com.alee.laf.filechooser.WebFileChooser


            @Override
            public void actionPerformed ( ActionEvent e )
            {
                if ( fileChooser == null )
                {
                    fileChooser = new WebFileChooser ();
                    fileChooser.setMultiSelectionEnabled ( false );
                }
                if ( file != null )
                {
                    fileChooser.setSelectedFile ( file );
                }
                if ( fileChooser.showOpenDialog ( owner ) == WebFileChooser.APPROVE_OPTION )
                {
                    file = fileChooser.getSelectedFile ();
                    fileChooserButton1.setIcon ( FileUtils.getFileIcon ( file ) );
                    fileChooserButton1.setText ( FileUtils.getDisplayFileName ( file ) );
                }
            }
        } );

        // Images only chooser
        final WebButton fileChooserButton2 = new WebButton ( "Choose any image..." );
        fileChooserButton2.addActionListener ( new ActionListener ()
        {
            private WebFileChooser imageChooser = null;
            private File file = null;

            @Override
            public void actionPerformed ( ActionEvent e )
            {
                if ( imageChooser == null )
                {
                    imageChooser = new WebFileChooser ();
                    imageChooser.setMultiSelectionEnabled ( false );
                    imageChooser.setAcceptAllFileFilterUsed ( false );
                    imageChooser.addChoosableFileFilter ( GlobalConstants.IMAGES_FILTER );
                }
                if ( file != null )
View Full Code Here


            @Override
            public void actionPerformed ( ActionEvent e )
            {
                if ( fileChooser == null )
                {
                    fileChooser = new WebFileChooser ();
                    fileChooser.setDialogTitle ( "Choose an image to add" );
                    fileChooser.setMultiSelectionEnabled ( true );
                    fileChooser.setAcceptAllFileFilterUsed ( false );
                    fileChooser.addChoosableFileFilter ( GlobalConstants.IMAGES_FILTER );
                }
View Full Code Here

            private WebFileChooser getFileChooser ()
            {
                if ( fileChooser == null )
                {
                    fileChooser = new WebFileChooser ();
                }
                return fileChooser;
            }

            @Override
View Full Code Here

        scroll.getViewport ().setOpaque ( false );
        add ( scroll, BorderLayout.CENTER );

        if ( this.showChooseButton )
        {
            webFileChooser = new WebFileChooser ();
            webFileChooser.setMultiSelectionEnabled ( multiSelectionEnabled );
            webFileChooser.addActionListener ( new ActionListener ()
            {
                @Override
                public void actionPerformed ( final ActionEvent e )
View Full Code Here

            @Override
            public void actionPerformed ( final ActionEvent e )
            {
                if ( wfc == null )
                {
                    wfc = new WebFileChooser ( imageSrc );
                    wfc.setDialogTitleKey ( "weblaf.ex.npeditor.openImage.title" );
                    wfc.setMultiSelectionEnabled ( false );
                    wfc.addChoosableFileFilter ( GlobalConstants.IMAGES_FILTER );
                    wfc.setFileFilter ( GlobalConstants.IMAGES_FILTER );
                }
                if ( imageSrc != null )
                {
                    wfc.setSelectedFile ( imageSrc );
                }
                if ( wfc.showOpenDialog ( SwingUtils.getWindowAncestor ( NinePatchEditorPanel.this ) ) == WebFileChooser.APPROVE_OPTION )
                {
                    openImage ( wfc.getSelectedFile () );
                }
            }
        } );
        toolBar.add ( open );

        toolBar.addSeparator ();

        save = new WebButton ( SAVE_ICON );
        save.setLanguage ( "weblaf.ex.npeditor.saveImage" );
        save.addHotkey ( NinePatchEditorPanel.this, Hotkey.CTRL_S );
        save.setRolloverDecoratedOnly ( true );
        save.setEnabled ( false );
        save.addActionListener ( new ActionListener ()
        {
            @Override
            public void actionPerformed ( final ActionEvent e )
            {
                if ( imageSrc != null )
                {
                    try
                    {
                        saveImage ( new File ( imageSrc ) );
                    }
                    catch ( final IOException e1 )
                    {
                        Log.error ( this, e1 );
                    }
                }
            }
        } );
        toolBar.add ( save );

        saveAs = new WebButton ( SAVE_AS_ICON );
        saveAs.setLanguage ( "weblaf.ex.npeditor.saveImageAs" );
        saveAs.addHotkey ( NinePatchEditorPanel.this, Hotkey.CTRL_SHIFT_S );
        saveAs.setRolloverDecoratedOnly ( true );
        saveAs.addActionListener ( new ActionListener ()
        {
            private WebFileChooser wfc = null;

            @Override
            public void actionPerformed ( final ActionEvent e )
            {
                if ( wfc == null )
                {
                    wfc = new WebFileChooser ( imageSrc );
                    wfc.setDialogTitleKey ( "weblaf.ex.npeditor.saveImageAs.title" );
                    wfc.setMultiSelectionEnabled ( false );
                }
                if ( imageSrc != null )
                {
View Full Code Here

TOP

Related Classes of com.alee.laf.filechooser.WebFileChooser

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.