Java Code Examples for com.alee.laf.optionpane.WebOptionPane#YES_OPTION

The following examples show how to use com.alee.laf.optionpane.WebOptionPane#YES_OPTION . 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: UISystemProxyConfirmationSupport.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
@Override
public boolean shouldUseSystemProxy ()
{
    // Whether should save the choice or not
    alwaysDoTheSame = new WebCheckBox ();
    alwaysDoTheSame.setLanguage ( "weblaf.proxy.use.system.save" );
    alwaysDoTheSame.setSelected ( false );
    alwaysDoTheSame.setFocusable ( false );

    // Ask for settings replacement with system ones
    final String message = LM.get ( "weblaf.proxy.use.system.text" );
    final String title = LM.get ( "weblaf.proxy.use.system.title" );
    final int options = WebExtendedOptionPane.YES_NO_OPTION;
    final int type = WebExtendedOptionPane.QUESTION_MESSAGE;
    final WebExtendedOptionPane dialog =
            WebExtendedOptionPane.showConfirmDialog ( SwingUtils.getActiveWindow (), message, alwaysDoTheSame, title, options, type );

    return dialog.getResult () == WebOptionPane.YES_OPTION;
}
 
Example 2
Source File: GenerateShortcutAction.java    From lnk2pwn with MIT License 5 votes vote down vote up
@Override
public void actionPerformed(ActionEvent event) {
    LOGGER.info("Generate button clicked");
    
    if (directoryChooser == null) {
        directoryChooser = new WebDirectoryChooser(windowController.getRootFrame());
    }
        
    LOGGER.info("Openning the directory chooser");
    directoryChooser.setVisible(true);
    if (directoryChooser.getResult () == DialogOptions.CANCEL_OPTION){
        LOGGER.info("No output path selected, canceling the action");
        return;
    }
            
    File outputPath = directoryChooser.getSelectedDirectory();		
    shortcut.setOutputPath(outputPath.getAbsolutePath());
                
    try {
        
        controller.generateShortcut(shortcut);
        int result = WebOptionPane.showConfirmDialog(
                windowController.getRootFrame(), 
                "Shortcut successfully generated!\nWould you like to open the folder location?", 
                "Shortcut", 
                WebOptionPane.YES_NO_OPTION,
                WebOptionPane.INFORMATION_MESSAGE);
        
        if (WebOptionPane.YES_OPTION == result) {
            LOGGER.info("Openning the output path");
            Desktop.getDesktop().open(outputPath);
        }
        
    } catch (Exception e) {
        LOGGER.error(e);
    }
}
 
Example 3
Source File: NinePatchEditorPanel.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
public boolean continueAfterSave ()
{
    if ( ninePatchEditor.isChanged () )
    {
        final String message = LM.get ( "weblaf.ex.npeditor.saveChanges.text" );
        final String title = LM.get ( "weblaf.ex.npeditor.saveChanges.title" );
        final int option = WebOptionPane.YES_NO_CANCEL_OPTION;
        final int messageType = WebOptionPane.QUESTION_MESSAGE;
        final int confirm = WebOptionPane.showConfirmDialog ( this, message, title, option, messageType );

        if ( confirm == WebOptionPane.YES_OPTION )
        {
            // Save changes before open
            if ( save.isEnabled () )
            {
                save.doClick ();
            }
            else
            {
                saveAs.doClick ();
            }

            // Save operation cancelled or failed
            if ( ninePatchEditor.isChanged () )
            {
                return false;
            }
        }
        else if ( confirm == WebOptionPane.CANCEL_OPTION )
        {
            // Cancel open
            return false;
        }
    }
    return true;
}
 
Example 4
Source File: WebFileChooserPanel.java    From weblaf with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Delete all selected in view files.
 */
public void deleteSelectedFiles ()
{
    final List<File> files = getAllSelectedFiles ();
    if ( files.isEmpty () )
    {
        return;
    }

    final WebPanel all = new WebPanel ( new BorderLayout ( 0, 5 ) );
    all.add ( new WebLabel ( "weblaf.filechooser.delete.confirm.text" ), BorderLayout.NORTH );

    final VerticalFlowLayout removalListLayout = new VerticalFlowLayout ( VerticalFlowLayout.TOP, 0, 5, true, false );
    final WebPanel deleteFilesPanel = new WebPanel ( StyleId.filechooserRemovalListPanel.at ( this ), removalListLayout );
    for ( final File file : files )
    {
        deleteFilesPanel.add ( new WebLabel ( file.getName (), FileUtils.getFileIcon ( file ), WebLabel.LEFT ) );
    }
    final WebScrollPane scroll = new WebScrollPane ( deleteFilesPanel )
    {
        @NotNull
        @Override
        public Dimension getPreferredSize ()
        {
            final Dimension ps = super.getPreferredSize ();

            final JScrollBar vsb = getVerticalScrollBar ();
            if ( vsb != null && vsb.isShowing () )
            {
                ps.width = ps.width + vsb.getPreferredSize ().width;
            }

            ps.height = Math.min ( ps.height, 100 );

            return ps;
        }
    };
    all.add ( scroll, BorderLayout.CENTER );

    final int confirm = WebOptionPane.showConfirmDialog ( WebFileChooserPanel.this,
            all, LM.get ( "weblaf.filechooser.delete.confirm.title" ),
            WebOptionPane.YES_NO_OPTION, WebOptionPane.QUESTION_MESSAGE );

    if ( confirm == WebOptionPane.YES_OPTION )
    {
        FileUtils.deleteFiles ( files );
        reloadCurrentFolder ();
    }
}