Example usage for java.awt Cursor DEFAULT_CURSOR

List of usage examples for java.awt Cursor DEFAULT_CURSOR

Introduction

In this page you can find the example usage for java.awt Cursor DEFAULT_CURSOR.

Prototype

int DEFAULT_CURSOR

To view the source code for java.awt Cursor DEFAULT_CURSOR.

Click Source Link

Document

The default cursor type (gets set if no cursor is defined).

Usage

From source file:org.pegadi.client.ApplicationLauncher.java

void tetrisButton_actionPerformed(ActionEvent e) {
    if (tet == null) {

        this.setCursor(new Cursor(Cursor.WAIT_CURSOR));

        tet = new Tetris();

        tet.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                tet = null;//from   w ww  . j a  v a2 s  . c o  m
            }

            public void windowClosed(WindowEvent e) {
                tet = null;
            }
        });

        tet.setSize(750, 550);
        tet.setLocationRelativeTo(this);

        this.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
    }
    tet.setVisible(true);
}

From source file:me.mayo.telnetkek.MainPanel.java

@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    splitPane = new javax.swing.JSplitPane();
    jPanel3 = new javax.swing.JPanel();
    mainOutputScoll = new javax.swing.JScrollPane();
    mainOutput = new javax.swing.JTextPane();
    btnDisconnect = new javax.swing.JButton();
    btnSend = new javax.swing.JButton();
    txtServer = new javax.swing.JComboBox<>();
    chkAutoScroll = new javax.swing.JCheckBox();
    txtCommand = new javax.swing.JTextField();
    btnConnect = new javax.swing.JButton();
    jLabel1 = new javax.swing.JLabel();
    jLabel2 = new javax.swing.JLabel();
    jTabbedPane1 = new javax.swing.JTabbedPane();
    jPanel2 = new javax.swing.JPanel();
    tblPlayersScroll = new javax.swing.JScrollPane();
    tblPlayers = new javax.swing.JTable();
    jLabel3 = new javax.swing.JLabel();
    txtNumPlayers = new javax.swing.JTextField();
    jPanel1 = new javax.swing.JPanel();
    chkIgnorePlayerCommands = new javax.swing.JCheckBox();
    chkIgnoreServerCommands = new javax.swing.JCheckBox();
    chkShowChatOnly = new javax.swing.JCheckBox();
    chkIgnoreErrors = new javax.swing.JCheckBox();
    jPanel4 = new javax.swing.JPanel();
    favoriteButtonsPanelHolder = new javax.swing.JPanel();
    favoriteButtonsPanelScroll = new javax.swing.JScrollPane();
    favoriteButtonsPanel = new me.mayo.telnetkek.button.FavoriteButtonsPanel(favButtonList);

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    setTitle("BukkitTelnetClient");

    splitPane.setBackground(new java.awt.Color(68, 68, 68));
    splitPane.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(68, 68, 68), 5));
    splitPane.setResizeWeight(1.0);//from  w w w.  j  a  v a  2  s  .c  o m

    jPanel3.setBackground(new java.awt.Color(68, 68, 68));

    mainOutput.setEditable(false);
    mainOutput.setFont(new java.awt.Font("Lucida Sans Unicode", 0, 12)); // NOI18N
    mainOutput.setForeground(new java.awt.Color(255, 255, 255));
    mainOutputScoll.setViewportView(mainOutput);

    btnDisconnect.setBackground(new java.awt.Color(68, 68, 68));
    btnDisconnect.setFont(new java.awt.Font("Lucida Sans Unicode", 0, 12)); // NOI18N
    btnDisconnect.setText("Leave");
    btnDisconnect.setEnabled(false);
    btnDisconnect.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnDisconnectActionPerformed(evt);
        }
    });

    btnSend.setBackground(new java.awt.Color(68, 68, 68));
    btnSend.setFont(new java.awt.Font("Lucida Sans Unicode", 0, 12)); // NOI18N
    btnSend.setText("Send");
    btnSend.setEnabled(false);
    btnSend.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnSendActionPerformed(evt);
        }
    });

    txtServer.setBackground(new java.awt.Color(91, 91, 91));
    txtServer.setEditable(true);
    txtServer.setFont(new java.awt.Font("Lucida Sans Unicode", 0, 12)); // NOI18N
    txtServer.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            txtServerActionPerformed(evt);
        }
    });

    chkAutoScroll.setBackground(new java.awt.Color(68, 68, 68));
    chkAutoScroll.setFont(new java.awt.Font("Lucida Sans Unicode", 0, 12)); // NOI18N
    chkAutoScroll.setForeground(new java.awt.Color(255, 255, 255));
    chkAutoScroll.setSelected(true);
    chkAutoScroll.setText("Auto Scroll");

    txtCommand.setEnabled(false);
    txtCommand.addKeyListener(new java.awt.event.KeyAdapter() {
        public void keyPressed(java.awt.event.KeyEvent evt) {
            txtCommandKeyPressed(evt);
        }
    });

    btnConnect.setBackground(new java.awt.Color(68, 68, 68));
    btnConnect.setFont(new java.awt.Font("Lucida Sans Unicode", 0, 12)); // NOI18N
    btnConnect.setText("Join");
    btnConnect.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnConnectActionPerformed(evt);
        }
    });

    jLabel1.setBackground(new java.awt.Color(68, 68, 68));
    jLabel1.setFont(new java.awt.Font("Lucida Sans Unicode", 0, 12)); // NOI18N
    jLabel1.setForeground(new java.awt.Color(255, 255, 255));
    jLabel1.setText("Command:");

    jLabel2.setBackground(new java.awt.Color(68, 68, 68));
    jLabel2.setFont(new java.awt.Font("Lucida Sans Unicode", 0, 12)); // NOI18N
    jLabel2.setForeground(new java.awt.Color(255, 255, 255));
    jLabel2.setText("Server:");

    javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
    jPanel3.setLayout(jPanel3Layout);
    jPanel3Layout.setHorizontalGroup(jPanel3Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup().addContainerGap()
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(mainOutputScoll)
                            .addGroup(jPanel3Layout.createSequentialGroup().addGroup(jPanel3Layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jLabel1)).addGap(18, 18, 18)
                                    .addGroup(jPanel3Layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(txtCommand)
                                            .addComponent(txtServer, 0, 411, Short.MAX_VALUE))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(jPanel3Layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
                                                    false)
                                            .addComponent(btnConnect, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addComponent(btnSend, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(jPanel3Layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(btnDisconnect).addComponent(chkAutoScroll))))
                    .addContainerGap()));

    jPanel3Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL,
            new java.awt.Component[] { btnConnect, btnDisconnect, btnSend, chkAutoScroll });

    jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup().addContainerGap()
                    .addComponent(mainOutputScoll, javax.swing.GroupLayout.DEFAULT_SIZE, 345, Short.MAX_VALUE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtCommand, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel1).addComponent(btnSend).addComponent(chkAutoScroll))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel2).addComponent(btnConnect).addComponent(btnDisconnect)
                            .addComponent(txtServer, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap()));

    splitPane.setLeftComponent(jPanel3);

    jTabbedPane1.setBackground(new java.awt.Color(68, 68, 68));
    jTabbedPane1.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
    jTabbedPane1.setFont(new java.awt.Font("Lucida Sans Unicode", 0, 12)); // NOI18N

    jPanel2.setBackground(new java.awt.Color(68, 68, 68));

    tblPlayers.setAutoCreateRowSorter(true);
    tblPlayers.setFont(new java.awt.Font("Lucida Sans Unicode", 0, 12)); // NOI18N
    tblPlayers.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
    tblPlayersScroll.setViewportView(tblPlayers);
    tblPlayers.getColumnModel().getSelectionModel()
            .setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);

    jLabel3.setBackground(new java.awt.Color(68, 68, 68));
    jLabel3.setFont(new java.awt.Font("Lucida Sans Unicode", 0, 12)); // NOI18N
    jLabel3.setForeground(new java.awt.Color(255, 255, 255));
    jLabel3.setText("Number of Players:");

    txtNumPlayers.setEditable(false);
    txtNumPlayers.setBackground(new java.awt.Color(255, 255, 255));
    txtNumPlayers.setFont(new java.awt.Font("Lucida Sans Unicode", 0, 12)); // NOI18N

    javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
    jPanel2.setLayout(jPanel2Layout);
    jPanel2Layout.setHorizontalGroup(jPanel2Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup().addContainerGap().addGroup(jPanel2Layout
                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(tblPlayersScroll, javax.swing.GroupLayout.DEFAULT_SIZE, 329, Short.MAX_VALUE)
                    .addGroup(jPanel2Layout.createSequentialGroup().addComponent(jLabel3)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(txtNumPlayers, javax.swing.GroupLayout.PREFERRED_SIZE, 65,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(0, 0, 0)))
                    .addContainerGap()));
    jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup().addContainerGap()
                    .addComponent(tblPlayersScroll, javax.swing.GroupLayout.DEFAULT_SIZE, 349, Short.MAX_VALUE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel3).addComponent(txtNumPlayers,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap()));

    jTabbedPane1.addTab("Player List", jPanel2);

    jPanel1.setBackground(new java.awt.Color(68, 68, 68));
    jPanel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(68, 68, 68)));

    chkIgnorePlayerCommands.setBackground(new java.awt.Color(68, 68, 68));
    chkIgnorePlayerCommands.setFont(new java.awt.Font("Lucida Sans Unicode", 0, 12)); // NOI18N
    chkIgnorePlayerCommands.setForeground(new java.awt.Color(255, 255, 255));
    chkIgnorePlayerCommands.setSelected(true);
    chkIgnorePlayerCommands.setText("Ignore \"[PLAYER_COMMAND]\" messages");

    chkIgnoreServerCommands.setBackground(new java.awt.Color(68, 68, 68));
    chkIgnoreServerCommands.setFont(new java.awt.Font("Lucida Sans Unicode", 0, 12)); // NOI18N
    chkIgnoreServerCommands.setForeground(new java.awt.Color(255, 255, 255));
    chkIgnoreServerCommands.setSelected(true);
    chkIgnoreServerCommands.setText("Ignore \"issued server command\" messages");
    chkIgnoreServerCommands.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            chkIgnoreServerCommandsActionPerformed(evt);
        }
    });

    chkShowChatOnly.setBackground(new java.awt.Color(68, 68, 68));
    chkShowChatOnly.setFont(new java.awt.Font("Lucida Sans Unicode", 0, 12)); // NOI18N
    chkShowChatOnly.setForeground(new java.awt.Color(255, 255, 255));
    chkShowChatOnly.setText("Show chat only");
    chkShowChatOnly.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            chkShowChatOnlyActionPerformed(evt);
        }
    });

    chkIgnoreErrors.setBackground(new java.awt.Color(68, 68, 68));
    chkIgnoreErrors.setFont(new java.awt.Font("Lucida Sans Unicode", 0, 12)); // NOI18N
    chkIgnoreErrors.setForeground(new java.awt.Color(255, 255, 255));
    chkIgnoreErrors.setText("Ignore warnings and errors");
    chkIgnoreErrors.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            chkIgnoreErrorsActionPerformed(evt);
        }
    });

    javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(jPanel1Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup().addContainerGap()
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(chkIgnorePlayerCommands).addComponent(chkIgnoreServerCommands)
                            .addComponent(chkShowChatOnly).addComponent(chkIgnoreErrors))
                    .addContainerGap(68, Short.MAX_VALUE)));
    jPanel1Layout
            .setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup().addContainerGap()
                            .addComponent(chkIgnorePlayerCommands, javax.swing.GroupLayout.PREFERRED_SIZE, 23,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(chkIgnoreServerCommands, javax.swing.GroupLayout.PREFERRED_SIZE, 23,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(chkShowChatOnly, javax.swing.GroupLayout.PREFERRED_SIZE, 23,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(chkIgnoreErrors, javax.swing.GroupLayout.PREFERRED_SIZE, 23,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addContainerGap(307, Short.MAX_VALUE)));

    jTabbedPane1.addTab("Filters", jPanel1);

    jPanel4.setBackground(new java.awt.Color(68, 68, 68));
    jPanel4.setFont(new java.awt.Font("Lucida Sans Unicode", 0, 12)); // NOI18N

    favoriteButtonsPanelHolder.setLayout(new java.awt.BorderLayout());

    favoriteButtonsPanelScroll.setBorder(null);

    favoriteButtonsPanel.setBackground(new java.awt.Color(68, 68, 68));
    favoriteButtonsPanel.setLayout(null);
    favoriteButtonsPanelScroll.setViewportView(favoriteButtonsPanel);

    favoriteButtonsPanelHolder.add(favoriteButtonsPanelScroll, java.awt.BorderLayout.CENTER);

    javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
    jPanel4.setLayout(jPanel4Layout);
    jPanel4Layout
            .setHorizontalGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout
                            .createSequentialGroup().addGap(0, 0, 0).addComponent(favoriteButtonsPanelHolder,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, 349, Short.MAX_VALUE)
                            .addGap(0, 0, 0)));
    jPanel4Layout.setVerticalGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup().addContainerGap()
                    .addComponent(favoriteButtonsPanelHolder, javax.swing.GroupLayout.DEFAULT_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap()));

    jTabbedPane1.addTab("Commands", jPanel4);

    splitPane.setRightComponent(jTabbedPane1);

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup().addGap(0, 0, 0).addComponent(splitPane).addGap(0, 0, 0)));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(splitPane, javax.swing.GroupLayout.Alignment.TRAILING));

    pack();
}

From source file:org.geworkbench.engine.ccm.ComponentConfigurationManagerWindow.java

/**
 * Persist users component selections // ww  w  .  ja v a 2  s  .c om
 * Add newly selected components 
 * Remove newly unselected components Leave CCM Window open
 * 
 * @param ActionEvent
 * @return void
 */
private void applyCcmSelections_actionPerformed(ActionEvent e) {
    Cursor hourglassCursor = new Cursor(Cursor.WAIT_CURSOR);
    frame.setCursor(hourglassCursor);

    for (int i = 0; i < ccmTableModel.getModelRowCount(); i++) {

        boolean choice = ((Boolean) ccmTableModel.getModelValueAt(i, CCMTableModel.SELECTION_INDEX))
                .booleanValue();

        boolean originalChoice = this.originalChoices.get(i).booleanValue();
        /* No change in selection */
        if (choice == originalChoice) {
            continue;
        }

        String resource = ccmTableModel.getResourceFolder(i);
        File file = ccmTableModel.getFile(i);
        String filename = file.getName();

        String propFileName = null;
        if (filename.endsWith(".cwb.xml")) {
            propFileName = filename.replace(".cwb.xml", ".ccmproperties");
        } else {
            log.error("File name is " + filename + " when .cwb.xml file is expected");
            continue;
        }
        String sChoice = (new Boolean(choice)).toString();

        ComponentConfigurationManager.writeProperty(resource, propFileName, "on-off", sChoice);

        if (choice) {
            manager.loadComponent(file);
            continue;
        }

        /* Remove Component */
        manager.removeComponent(resource, file.getAbsolutePath());

        ccmTableModel.fireTableDataChanged();
        if (textPane.getCaretPosition() > 1) {
            textPane.setCaretPosition(1);
        }
    }
    ProjectPanel.getInstance().ccmUpdate();

    setOriginalChoices();

    Cursor normalCursor = new Cursor(Cursor.DEFAULT_CURSOR);
    frame.setCursor(normalCursor);
}

From source file:org.graphwalker.GUI.App.java

private void setDefaultCursor() {
    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}

From source file:uk.chromis.pos.forms.JRootApp.java

/**
 *
 */
@Override
public void waitCursorEnd() {
    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}

From source file:org.kepler.gui.kar.ImportModuleDependenciesAction.java

/** Check the dependencies and ask the user how to proceed. */
public ImportChoice checkDependencies() {

    ConfigurationManager cman = ConfigurationManager.getInstance();
    ConfigurationProperty cprop = cman.getProperty(KARFile.KARFILE_CONFIG_PROP_MODULE);
    ConfigurationProperty KARComplianceProp = cprop.getProperty(KARFile.KAR_COMPLIANCE_PROPERTY_NAME);
    String KARCompliance = KARComplianceProp.getValue();

    final ArrayList<String> dependencies = new ArrayList<String>();
    try {//  w  ww.  j a  v a  2 s . c  o m
        if (_dependencies != null) {
            // dependencies were given
            dependencies.addAll(_dependencies);
        } else if (_archiveFile != null) {
            // kar file was given
            KARFile karFile = null;
            try {
                karFile = new KARFile(_archiveFile);
                dependencies.addAll(karFile.getModuleDependencies());
            } finally {
                if (karFile != null) {
                    karFile.close();
                }
            }
        } else {
            // karxml was given
            dependencies.addAll(_karXml.getModuleDependencies());
        }
    } catch (Exception ex) {
        ex.printStackTrace();
    }

    //ModuleTree moduleTree = ModuleTree.instance();
    //String currentModList = formattedCurrentModuleList(moduleTree);

    boolean dependencyMissingFullVersion = !(ModuleDependencyUtil
            .isDependencyVersioningInfoComplete(dependencies));
    LinkedHashMap<String, Version> unsatisfiedDependencies = ModuleDependencyUtil
            .getUnsatisfiedDependencies(dependencies);

    String keplerRestartMessage = null;
    String unableToOpenOrExportInStrictKARComplianceMessage = null;
    String manualActionRequired = null;
    String unSats = formattedUnsatisfiedDependencies(unsatisfiedDependencies);
    final List<String> unSatsAsList = new ArrayList<String>(unsatisfiedDependencies.keySet());

    String formattedDependencies = formatDependencies(dependencies);
    String htmlBGColor = "#"
            + Integer.toHexString(UIManager.getColor("OptionPane.background").getRGB() & 0x00ffffff);
    //XXX augment if additional strictness levels added
    if (KARCompliance.equals(KARFile.KAR_COMPLIANCE_STRICT)) {
        if (dependencyMissingFullVersion) {
            if (_exportMode) {
                unableToOpenOrExportInStrictKARComplianceMessage = "<html><body bgcolor=\"" + htmlBGColor
                        + "\">This KAR "
                        + "lacks complete versioning information in its module-dependency list:<strong>"
                        + formattedDependencies
                        + "</strong><br><br>You must change your KAR opening compliance "
                        + "preference to Relaxed before trying to export this KAR.<br><br>"
                        + "You can Force Export, but some artifacts may not be included in the KAR.</body></html>";
            } else {
                unableToOpenOrExportInStrictKARComplianceMessage = "<html><body bgcolor=\"" + htmlBGColor
                        + "\">This KAR "
                        + "lacks complete versioning information in its module-dependency list:<strong>"
                        + formattedDependencies
                        + "</strong><br><br>You must change your KAR opening compliance "
                        + "preference to Relaxed before trying to open this KAR.<br><br>"
                        + "You can attempt a Force Open, but this may cause unexpected errors.</body></html>";
            }
        } else {
            if (!unsatisfiedDependencies.isEmpty()) {
                if (_exportMode) {
                    keplerRestartMessage = "<html><body bgcolor=\"" + htmlBGColor
                            + "\">Your KAR opening compliance preference is set to Strict. To export this KAR in<br>"
                            + "Strict mode you must restart Kepler with these additional module(s):<strong>"
                            + unSats
                            + "</strong><br><br>Would you like to download (if necessary) and restart Kepler using these modules now?"
                            + "<br><br><strong>WARNING: All unsaved work will be lost, and auto-updating turned off if it's on<br>"
                            + "(re-enable using the Tools=>Module Manager...)</strong><br><br>"
                            + "You can Force Export, but some artifacts may not be included in the KAR.</body></html>";
                } else {
                    keplerRestartMessage = "<html><body bgcolor=\"" + htmlBGColor
                            + "\">Your KAR opening compliance preference is set to Strict. To open this KAR in<br>"
                            + "Strict mode you must restart Kepler with these additional module(s):<strong>"
                            + unSats
                            + "</strong><br><br>Would you like to download (if necessary) and restart Kepler using these modules now?"
                            + "<br><br><strong>WARNING: All unsaved work will be lost, and auto-updating turned off if it's on<br>"
                            + "(re-enable using the Tools=>Module Manager...)</strong><br><br>"
                            + "You can attempt a Force Open, but this may cause unexpected errors.</body></html>";
                }
            } else {
                if (_exportMode) {
                    keplerRestartMessage = "<html><body bgcolor=\"" + htmlBGColor
                            + "\">Your KAR opening compliance preference is set to Strict. To export this KAR in<br>"
                            + "Strict mode you must restart Kepler using this module set in this order:<strong>"
                            + formattedDependencies
                            + "</strong><br><br>Would you like to restart Kepler using these modules now?"
                            + "<br><br><strong>WARNING: All unsaved work will be lost, and auto-updating turned off if it's on<br>"
                            + "(re-enable using the Tools=>Module Manager...)</strong><br><br>"
                            + "You can Force Export, but some artifacts may not be included in the KAR.</body></html>";
                } else {
                    keplerRestartMessage = "<html><body bgcolor=\"" + htmlBGColor
                            + "\">Your KAR opening compliance preference is set to Strict. To open this KAR in<br>"
                            + "Strict mode you must restart Kepler using this module set in this order:<strong>"
                            + formattedDependencies
                            + "</strong><br><br>Would you like to restart Kepler using these modules now?"
                            + "<br><br><strong>WARNING: All unsaved work will be lost, and auto-updating turned off if it's on<br>"
                            + "(re-enable using the Tools=>Module Manager...)</strong><br><br>"
                            + "You can attempt a Force Open, but this may cause unexpected errors.</body></html>";
                }
            }
        }
    } else if (KARCompliance.equals(KARFile.KAR_COMPLIANCE_RELAXED)) {
        if (dependencyMissingFullVersion) {
            // if there's a dependency missing full version info, situation should be either 1) a 2.0 kar, in which case
            // it lacks the full mod dep list and so user must use MM, or 2) it's a 2.1 kar created from an svn 
            // checkout of kepler, in which case, the power user should use the build system to 
            // change to unreleased versions of a suite containing the required modules as necessary
            if (_exportMode) {
                manualActionRequired = "<html><body bgcolor=\"" + htmlBGColor + "\">This KAR "
                        + "requires the following unsatisfied module dependencies that lack complete versioning information:<strong>"
                        + unSats
                        + "</strong><br><br>Please use the Module Manager or build system to change to a suite that uses these modules.</strong>"
                        + "<br><br>You can Force Export, but some artifacts may not be included in the KAR.</body></html>";
            } else {
                manualActionRequired = "<html><body bgcolor=\"" + htmlBGColor + "\">This KAR "
                        + "requires the following unsatisfied module dependencies that lack complete versioning information:<strong>"
                        + unSats
                        + "</strong><br><br>Please use the Module Manager or build system to change to a suite that uses these modules.</strong>"
                        + "<br><br>You can attempt a Force Open, but this may cause unexpected errors.</body></html>";
            }
        } else {
            if (!unsatisfiedDependencies.isEmpty()) {
                if (_exportMode) {
                    keplerRestartMessage = "<html><body bgcolor=\"" + htmlBGColor
                            + "\">This KAR requires you restart Kepler with these "
                            + "additional module(s):<strong>" + unSats + "</strong><br><br>Would you like to "
                            + "download (if necessary) and restart Kepler using these modules now?"
                            + "<br><br><strong>WARNING: All unsaved work will be lost</strong><br><br>"
                            + "You can Force Export, but some artifacts may not be included in the KAR.</body></html>";
                } else {
                    keplerRestartMessage = "<html><body bgcolor=\"" + htmlBGColor
                            + "\">This KAR requires you restart Kepler with these "
                            + "additional module(s):<strong>" + unSats + "</strong><br><br>Would you like to "
                            + "download (if necessary) and restart Kepler using these modules now?"
                            + "<br><br><strong>WARNING: All unsaved work will be lost</strong><br><br>"
                            + "You can attempt a Force Open, but this may cause unexpected errors.</body></html>";
                }
            } else {
                //THIS SHOULDN'T HAPPEN
                log.error(
                        "ImportModuleDependenciesAction WARNING unsatisfiedDependencies is empty, this shouldn't happen, but is non fatal");
                if (_exportMode) {
                    keplerRestartMessage = "<html><body bgcolor=\"" + htmlBGColor
                            + "\">This KAR requires you restart Kepler with these " + "module(s):<strong>"
                            + formattedDependencies + "</strong><br><br>Would you like to "
                            + "restart Kepler using these modules now?"
                            + "<br><br><strong>WARNING: All unsaved work will be lost</strong><br><br>"
                            + "You can Force Export, but some artifacts may not be included in the KAR.</body></html>";
                } else {
                    keplerRestartMessage = "<html><body bgcolor=\"" + htmlBGColor
                            + "\">This KAR requires you restart Kepler with these " + "module(s):<strong>"
                            + formattedDependencies + "</strong><br><br>Would you like to "
                            + "restart Kepler using these modules now?"
                            + "<br><br><strong>WARNING: All unsaved work will be lost</strong><br><br>"
                            + "You can attempt a Force Open, but this may cause unexpected errors.</body></html>";
                }
            }
        }
    }

    String[] optionsOkForceopen = { "OK", "Force Open" };
    String[] optionsOkForceexport = { "OK", "Force Export" };
    String[] optionsYesNoForceopen = { "Yes", "No", "Force Open" };
    String[] optionsYesNoForceexport = { "Yes", "No", "Force Export" };

    if (unableToOpenOrExportInStrictKARComplianceMessage != null) {
        JLabel label = new JLabel(unableToOpenOrExportInStrictKARComplianceMessage);
        if (_exportMode) {
            int choice = JOptionPane.showOptionDialog(parent, label, "Unable to export in Strict mode",
                    JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, optionsOkForceexport,
                    optionsOkForceexport[0]);
            if (optionsOkForceexport[choice].equals("Force Export")) {
                return ImportChoice.FORCE_EXPORT;
            }
        } else {
            int choice = JOptionPane.showOptionDialog(parent, label, "Unable to open in Strict mode",
                    JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, optionsOkForceopen,
                    optionsOkForceopen[0]);
            if (optionsOkForceopen[choice].equals("Force Open")) {
                return ImportChoice.FORCE_OPEN;
            }
        }
        return ImportChoice.DO_NOTHING;
    }

    if (manualActionRequired != null) {
        JLabel label = new JLabel(manualActionRequired);
        if (_exportMode) {
            int choice = JOptionPane.showOptionDialog(parent, label, "Use Module Manager",
                    JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, optionsOkForceexport,
                    optionsOkForceexport[0]);
            if (optionsOkForceexport[choice].equals("Force Export")) {
                return ImportChoice.FORCE_EXPORT;
            }
        } else {
            int choice = JOptionPane.showOptionDialog(parent, label, "Use Module Manager",
                    JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, optionsOkForceopen,
                    optionsOkForceopen[0]);
            if (optionsOkForceopen[choice].equals("Force Open")) {
                return ImportChoice.FORCE_OPEN;
            }
        }
        return ImportChoice.DO_NOTHING;
    }

    JLabel label = new JLabel(keplerRestartMessage);
    if (_exportMode) {
        int choice = JOptionPane.showOptionDialog(parent, label, "Confirm Kepler Restart",
                JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, optionsYesNoForceexport,
                optionsYesNoForceexport[1]);

        if (optionsYesNoForceexport[choice] == "No") {
            // user doesn't want to download.
            return ImportChoice.DO_NOTHING;
        } else if (optionsYesNoForceexport[choice].equals("Force Export")) {
            return ImportChoice.FORCE_EXPORT;
        }
    } else {
        int choice = JOptionPane.showOptionDialog(parent, label, "Confirm Kepler Restart",
                JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, optionsYesNoForceopen,
                optionsYesNoForceopen[1]);

        if (optionsYesNoForceopen[choice] == "No") {
            // user doesn't want to download.
            return ImportChoice.DO_NOTHING;
        } else if (optionsYesNoForceopen[choice].equals("Force Open")) {
            return ImportChoice.FORCE_OPEN;
        }
    }

    parent.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

    SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() {
        @Override
        public Void doInBackground() throws Exception {
            try {

                //download needed modules
                ModuleDownloader downloader = new ModuleDownloader();
                ModuleDownloadProgressMonitor mdpm = new ModuleDownloadProgressMonitor(parent);
                downloader.addListener(mdpm);
                if (!unSatsAsList.isEmpty()) {
                    downloader.downloadModules(unSatsAsList);
                } else {
                    // this shouldn't happen, but if it does, resorting
                    // to downloading all dependencies should be a safe bet
                    log.error("ImportModuleDependenciesAction WARNING unSatsAsList is empty, "
                            + "this shouldn't happen, but is non fatal");
                    downloader.downloadModules(dependencies);
                }

                //rewrite modules.txt
                ModulesTxt modulesTxt = ModulesTxt.instance();
                modulesTxt.clear();
                for (String dependency : dependencies) {
                    //System.out.println("ImportModuleDependency doInBackground modulesTxt.add("+dependency+")");
                    modulesTxt.add(dependency);
                }
                modulesTxt.write();

                //delete and write "unknown" to current-suite.txt
                CurrentSuiteTxt.delete();
                CurrentSuiteTxt.setName("unknown");

                // if KARCompliance is Strict, user is restarting w/ specific versions of modules
                // and we don't want them to potentially auto update on restart to available patches
                turnOffAutoUpdatesIfStrictMode();

                //restart Kepler using new modules
                spawnNewKeplerAndQuitCurrent();

                return null;
            } catch (Exception ex) {
                ex.printStackTrace();
                JOptionPane.showMessageDialog(parent, "Error downloading module: " + ex.getMessage());
                return null;
            }
        }

        @Override
        protected void done() {
            //never reached.
        }

    };

    worker.execute();

    parent.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));

    return ImportChoice.DOWNLOADING_AND_RESTARTING;
}

From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.imagem.analise_geral.PanelAnaliseGeral.java

private void aplicarATodosActionPerformed() {
    PainelStatusBar.showProgTarReq();/*from ww w. j ava  2s. co  m*/
    parentFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
    aplicarTod.setEnabled(false);
    int progresso = 0;
    int numLinhas = tableLinCod.getNumLinhas();
    while (tableLinCod.getNumLinhas() > 0) {
        progresso = tableLinCod.getNumLinhas() * 100 / numLinhas;
        PainelStatusBar.setValueProgress(100 - progresso);
        aplicando();
    }
    hashCodeModfcd.add(hashCodAnterior);
    endModfcd.add(enderecoAnterior);
    G_File arq = new G_File("temp/" + ProjetoDoSite.getNomeDoProjeto() + "/reparo/temp/" + hashCodAnterior);
    arq.write(codigoAnterior);
    // FerramentaAnaliseGeralCtrl flc =
    new FerramentaAnaliseGeralCtrl(codigoAnterior, hashCodAnterior);
    boxCode.getTextPane().setText("");
    aplicarTod.setEnabled(true);
    parentFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
    salvarPag.setEnabled(false);
    aplicarPag.setEnabled(false);
    aplicarTod.setEnabled(false);
    PainelStatusBar.hideProgTarReq();
}

From source file:org.giswater.controller.MenuController.java

public void downloadNewVersion() {

    Utils.getLogger().info("Downloading last version...");

    if (ftp == null)
        return;//w w  w .ja  v  a 2  s.c  o m

    String ftpVersion = ftp.getFtpVersion();
    String remoteName = UPDATE_FILE + ftpVersion + ".exe";
    // Choose file to download
    mainFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
    String localePath = chooseFileSetup(remoteName);
    if (!localePath.equals("")) {
        DownloadPanel panel = new DownloadPanel(remoteName, localePath, ftp);
        JDialog downloadDialog = Utils.openDialogForm(panel, mainFrame,
                Utils.getBundleString("MenuController.download_process"), 290, 135); //$NON-NLS-1$
        downloadDialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
        downloadDialog.setVisible(true);
        mainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
    }

}

From source file:org.openmicroscopy.shoola.agents.treeviewer.browser.BrowserComponent.java

/**
 * Implemented as specified by the {@link Browser} interface.
 * @see Browser#accept(TreeImageDisplayVisitor, int)
 *///from w ww  . j a v  a 2s  .  c o  m
public void accept(TreeImageDisplayVisitor visitor, int algoType) {
    view.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    view.getTreeRoot().accept(visitor, algoType);
    view.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}

From source file:com.codejumble.opentube.Main.java

/**
 * Updates the download manager with a new link, if the manager hasn't
 * started it will be initialized.//from w  ww . jav  a2s.com
 *
 * @param url URL address to add
 */
private void updateDownloadManagerWithNewURL(String url) {
    videoURLDownloadButton.setEnabled(false);
    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    try {
        if (isWaitingForTasks() && defaultDownloadManager.getState().equals(SwingWorker.StateValue.DONE)) {
            defaultDownloadManager = new DownloadManager(this, tmpFilesFolder,
                    configuredFolderForDownloadedMedia);
        }
        defaultDownloadManager.addDownloadToQueue(url, fileNameField.getText(), getSelectedFormatOption());
        defaultDownloadManager.execute();

    } catch (MalformedURLException ex) {
        createErrorDialog(this, "The inputted URL doesn't match a valid format", "Wrong URL format");
    } catch (RuntimeException ex) {
        createErrorDialog(this, "The provided website is not supported", "Unsupported website");
    } catch (Exception e) {
        createErrorDialog(this, e.getMessage(), "Unexpected error");
    }
    videoURLDownloadButton.setEnabled(true);
    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    resetVideoFileName();
}