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:com.vgi.mafscaling.OpenLoop.java

protected void calculateMafScaling() {
    setCursor(new Cursor(Cursor.WAIT_CURSOR));
    try {//from w w w .j  a  v  a  2 s. co  m
        clearData();
        clearChartData();
        clearChartCheckBoxes();

        TreeMap<Integer, ArrayList<Double>> result = new TreeMap<Integer, ArrayList<Double>>();
        if (!getMafTableData(voltArray, gsArray))
            return;
        if (!sortRunData(result) || result.isEmpty())
            return;
        calculateCorrectedGS(result);
        setCorrectedMafData();

        smoothGsArray.addAll(gsCorrected);
        checkBoxCorrectedMaf.setSelected(true);

        setXYTable(mafSmoothingTable, voltArray, smoothGsArray);

        setRanges();
        setSelectedIndex(1);
    } catch (Exception e) {
        e.printStackTrace();
        logger.error(e);
        JOptionPane.showMessageDialog(null, "Error: " + e, "Error", JOptionPane.ERROR_MESSAGE);
    } finally {
        setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
    }
}

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

private void initComponentsEscalavel(ArrayList<FerramentaDescricaoModel> erros) {
    Ferramenta_Imagens.carregaTexto(TokenLang.LANG);
    JPanel regraFonteBtn = new JPanel();
    regraFonteBtn.setLayout(new BorderLayout());

    textAreaSourceCode = new G_TextAreaSourceCode();
    textAreaSourceCode.setTipoHTML();//  ww w  . j ava 2s .c o m
    new OnChange(textAreaSourceCode, this);

    // parentFrame.setTitle("Associador de rtulos");
    tableLinCod = new TabelaDescricao(this, erros);
    arTextPainelCorrecao = new ArTextPainelCorrecao(this);

    // scrollPaneCorrecaoLabel = new ConteudoCorrecaoLabel();
    analiseSistematica = new JButton();
    salvar = new JButton();
    abrir = new JButton();
    cancelar = new JButton();
    strConteudoalt = new String();
    // panelLegenda = new JPanel();
    btnSalvar = new JMenuItem(GERAL.BTN_SALVAR);

    pnRegra = new JPanel();
    lbRegras1 = new JLabel();
    lbRegras2 = new JLabel();
    pnSetaDescricao = new JPanel();
    spTextoDescricao = new JScrollPane();
    tArParticipRotulo = new TArParticipRotulo(this);
    conteudoDoAlt = new JTextArea();
    pnListaErros = new JPanel();
    scrollPanetabLinCod = new JScrollPane();
    /**
     * Mostra pro usurio a imagem que est sem descrio
     */
    imagemSemDesc = new XHTMLPanel();

    pnBotoes = new JPanel();
    salvar.setEnabled(false);
    salvaAlteracoes = TxtBuffer.getInstanciaSalvaAlteracoes(textAreaSourceCode.getTextPane(), salvar,
            new JMenuItem(), parentFrame);
    adicionar = new JButton();
    aplicar = new JButton();
    conteudoParticRotulo = new ArrayList<String>();
    analiseSistematica.setEnabled(false);
    // setJMenuBar(this.criaMenuBar());
    // ======== this ========
    // setTitle("Associe explicitamente os r\u00f3tulos aos respectivos
    // controles:");

    setBackground(CoresDefault.getCorPaineis());
    Container contentPane = this;// ??
    contentPane.setLayout(new GridLayout(2, 1));

    // ======== pnRegra ========
    {
        pnRegra.setBorder(criaBorda(Ferramenta_Imagens.TITULO_REGRA));
        pnRegra.setLayout(new GridLayout(2, 1));
        pnRegra.add(lbRegras1);
        lbRegras1.setText(Ferramenta_Imagens.REGRAP1);
        lbRegras2.setText(Ferramenta_Imagens.REGRAP2);
        lbRegras1.setHorizontalAlignment(SwingConstants.CENTER);
        lbRegras2.setHorizontalAlignment(SwingConstants.CENTER);
        pnRegra.add(lbRegras1);
        pnRegra.add(lbRegras2);
        pnRegra.setPreferredSize(new Dimension(700, 60));
    }

    // G_URLIcon.setIcon(lbTemp,
    // "http://pitecos.blogs.sapo.pt/arquivo/pai%20natal%20o5.%20jpg.jpg");
    JScrollPane sp = new JScrollPane();

    sp.setViewportView(imagemSemDesc);
    sp.setPreferredSize(new Dimension(500, 300));

    // ======== pnDescricao ========

    // ---- Salvar ----
    salvar.setText(Ferramenta_Imagens.BTN_SALVAR);
    salvar.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            salvarActionPerformed(e);
        }
    });

    salvar.setToolTipText(Ferramenta_Imagens.DICA_SALVAR);
    salvar.getAccessibleContext().setAccessibleDescription(Ferramenta_Imagens.DICA_SALVAR);
    salvar.getAccessibleContext().setAccessibleName(Ferramenta_Imagens.DICA_SALVAR);
    salvar.setBounds(10, 0, 150, 25);

    abrir.setText(Ferramenta_Imagens.BTN_ABRIR);
    abrir.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AbrirActionPerformed(e);
        }
    });

    abrir.setToolTipText(Ferramenta_Imagens.DICA_ABRIR_HTML);
    abrir.getAccessibleContext().setAccessibleDescription(Ferramenta_Imagens.DICA_ABRIR_HTML);
    abrir.getAccessibleContext().setAccessibleName(Ferramenta_Imagens.DICA_ABRIR_HTML);
    abrir.setBounds(165, 0, 150, 25);

    cancelar.setText(Ferramenta_Imagens.TELA_ANTERIOR);
    cancelar.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            CancelarActionPerformed(e);
        }
    });

    cancelar.setToolTipText(Ferramenta_Imagens.DICA_TELA_ANTERIOR);
    cancelar.getAccessibleContext().setAccessibleDescription(Ferramenta_Imagens.DICA_TELA_ANTERIOR);
    cancelar.getAccessibleContext().setAccessibleName(Ferramenta_Imagens.TELA_ANTERIOR);
    cancelar.setBounds(320, 0, 150, 25);

    analiseSistematica.setText(GERAL.ANALISE_SISTEMATICA);
    analiseSistematica.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            buttonAction = e;
            Thread t = new Thread(new Runnable() {
                public void run() {
                    PainelStatusBar.showProgTarReq();
                    parentFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
                    analiseSistematicaActionPerformed(buttonAction);
                    parentFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
                    PainelStatusBar.hideProgTarReq();
                }
            });
            t.setPriority(9);
            t.start();

        }
    });

    analiseSistematica.setToolTipText(GERAL.DICA_ANALISE_SISTEMATICA);
    analiseSistematica.getAccessibleContext().setAccessibleDescription(GERAL.DICA_ANALISE_SISTEMATICA);
    analiseSistematica.getAccessibleContext().setAccessibleName(GERAL.DICA_ANALISE_SISTEMATICA);
    analiseSistematica.setBounds(480, 0, 150, 25);
    // ======== pnParticRotulo ========

    pnSetaDescricao.setBorder(criaBorda(Ferramenta_Imagens.TITULO_DIGITE_O_ALT));
    GridBagConstraints cons = new GridBagConstraints();
    GridBagLayout layout = new GridBagLayout();
    cons.fill = GridBagConstraints.BOTH;
    cons.weighty = 1;
    cons.weightx = 0.80;

    pnSetaDescricao.setLayout(layout);
    cons.anchor = GridBagConstraints.SOUTHEAST;
    cons.insets = new Insets(0, 0, 0, 10);
    conteudoDoAlt.addKeyListener(new KeyListener() {
        public void keyPressed(KeyEvent arg0) {
        }

        public void keyTyped(KeyEvent arg0) {
        }

        public void keyReleased(KeyEvent arg0) {
            if (conteudoDoAlt.getText().length() == 0) {
                System.out.println("conteudo vazio");
                aplicar.setEnabled(false);

            } else if (tableLinCod.getSelectedRow() != -1) {
                System.out.println("com conteudo");
                aplicar.setEnabled(true);

            }
        }
    });
    // ======== spParticRotulo ========
    {
        spTextoDescricao.setViewportView(conteudoDoAlt);
    }

    // lbRegras1.setText(Reparo_Imagens.REGRAP2);
    // lbRegras1.setHorizontalAlignment(SwingConstants.CENTER);

    // pnRegra.add(lbRegras1);

    pnSetaDescricao.add(spTextoDescricao, cons);
    cons.weightx = 0.20;
    pnSetaDescricao.setPreferredSize(new Dimension(400, 60));

    // ======== pnListaErros ========
    {

        pnListaErros.setBorder(criaBorda(Ferramenta_Imagens.LISTA_ERROS));
        pnListaErros.setLayout(new BorderLayout());
        // ======== scrollPanetabLinCod ========
        {
            scrollPanetabLinCod.setViewportView(tableLinCod);
        }
        pnListaErros.add(scrollPanetabLinCod, BorderLayout.CENTER);
    }
    // ======== pnBotoes ========
    {

        // pnBotoes.setBorder(criaBorda(""));

        pnBotoes.setLayout(null);
        // ---- adicionar ----
        adicionar.setText(Ferramenta_Imagens.BTN_ADICIONAR);
        adicionar.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                adicionarActionPerformed(e);
            }
        });

        adicionar.setToolTipText(Ferramenta_Imagens.DICA_ADICIONAR);
        adicionar.getAccessibleContext().setAccessibleDescription(Ferramenta_Imagens.DICA_ADICIONAR);
        adicionar.getAccessibleContext().setAccessibleName(Ferramenta_Imagens.DICA_ADICIONAR);
        adicionar.setBounds(10, 5, 150, 25);
        // pnBotoes.add(adicionar);

        // ---- aplicarRotulo ----
        aplicar.setEnabled(false);
        aplicar.setText(Ferramenta_Imagens.BTN_APLICAR);
        aplicar.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {

                aplicarRotuloActionPerformed(e);
            }
        });

        aplicar.setToolTipText(Ferramenta_Imagens.DICA_APLICAR);
        aplicar.getAccessibleContext().setAccessibleDescription(Ferramenta_Imagens.DICA_APLICAR);
        aplicar.getAccessibleContext().setAccessibleName(Ferramenta_Imagens.DICA_APLICAR);
        aplicar.setBounds(10, 5, 150, 25);
        pnBotoes.add(aplicar);
    }

    /*
     * Colocar os controles
     */
    pnRegra.setBackground(CoresDefault.getCorPaineis());
    regraFonteBtn.add(pnRegra, BorderLayout.NORTH);
    textAreaSourceCode.setBorder(criaBorda(""));
    textAreaSourceCode.setBackground(CoresDefault.getCorPaineis());

    JSplitPane splitPane = null;

    Dimension minimumSize = new Dimension(0, 0);
    // JScrollPane ajudaScrollPane = new
    // JScrollPane(ajuda,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);

    sp.setMinimumSize(minimumSize);
    sp.setPreferredSize(new Dimension(150, 90));
    splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sp, textAreaSourceCode);
    splitPane.setOneTouchExpandable(true);
    // splitPane.set
    // splitPane.setDividerLocation(0.95);
    int w = parentFrame.getWidth();
    int s = w / 4;
    splitPane.setDividerLocation(s);

    // regraFonteBtn.add(scrollPaneCorrecaoLabel, BorderLayout.CENTER);
    regraFonteBtn.add(splitPane, BorderLayout.CENTER);
    pnBotoes.setPreferredSize(new Dimension(600, 35));
    pnBotoes.setBackground(CoresDefault.getCorPaineis());
    // regraFonteBtn.add(pnBotoes, BorderLayout.SOUTH);
    regraFonteBtn.setBackground(CoresDefault.getCorPaineis());
    contentPane.add(regraFonteBtn);

    JPanel textoErrosBtn = new JPanel();
    textoErrosBtn.setLayout(new BorderLayout());
    pnSetaDescricao.setBackground(CoresDefault.getCorPaineis());
    pnSetaDescricao.add(pnBotoes, cons);
    textoErrosBtn.add(pnSetaDescricao, BorderLayout.NORTH);

    textoErrosBtn.add(pnListaErros, BorderLayout.CENTER);
    JPanel pnSalvarCancelar = new JPanel();
    pnSalvarCancelar.setLayout(null);
    pnSalvarCancelar.setPreferredSize(new Dimension(600, 35));
    pnSalvarCancelar.add(salvar);
    pnSalvarCancelar.add(abrir);
    pnSalvarCancelar.add(cancelar);
    if (!original) {
        reverter = new JButton("Reverter");
        reverter.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                setVisible(false);
                TxtBuffer.setContent(TxtBuffer.getContentOriginal());
                parentFrame.showPainelFerramentaImgPArq(TxtBuffer.getContentOriginal(), enderecoPagina);
                setVisible(true);
            }
        });
        //reverter.setActionCommand("Reverter");
        reverter.setText(TradPainelRelatorio.REVERTER);
        reverter.setToolTipText(TradPainelRelatorio.DICA_REVERTER);
        reverter.getAccessibleContext().setAccessibleDescription(TradPainelRelatorio.DICA_REVERTER);
        reverter.getAccessibleContext().setAccessibleName(TradPainelRelatorio.DICA_REVERTER);
        if (EstadoSilvinha.conteudoEmPainelResumo) {
            reverter.setBounds(640, 0, 150, 25);
        } else {
            reverter.setBounds(480, 0, 150, 25);
        }
        pnSalvarCancelar.add(reverter);
    }

    if (EstadoSilvinha.conteudoEmPainelResumo) {
        pnSalvarCancelar.add(analiseSistematica);
    }
    pnSalvarCancelar.setBackground(CoresDefault.getCorPaineis());
    textoErrosBtn.add(pnSalvarCancelar, BorderLayout.SOUTH);
    pnListaErros.setBackground(CoresDefault.getCorPaineis());
    textoErrosBtn.add(pnListaErros, BorderLayout.CENTER);
    if (tableLinCod.getRowCount() == 0)
        tableLinCod.addLinha(0, 0, GERAL.DOC_SEM_ERROS);
    contentPane.setBackground(CoresDefault.getCorPaineis());
    contentPane.add(textoErrosBtn);

    this.setVisible(true);

}

From source file:edu.harvard.mcz.imagecapture.ImageCaptureApp.java

/**
 * Carry out actions to set up system after a successful login.
 *//* ww  w .  j  av a 2  s.  co m*/
public static void doStartUp() {
    boolean isCurrentAllowed = false;
    try {
        isCurrentAllowed = AllowedVersionLifeCycle.isCurrentAllowed();
    } catch (HibernateException e) {
        log.error(e.getMessage(), e);
        String allowed = AllowedVersionLifeCycle.listAllowedVersions();
        if (allowed == null || allowed.trim().length() == 0) {
            Singleton.getSingletonInstance().getMainFrame()
                    .setStatusMessage("Database does not support this version, schema update needed.");
            JOptionPane.showMessageDialog(Singleton.getSingletonInstance().getMainFrame(),
                    "The database does not support" + APP_NAME + " version " + APP_VERSION
                            + ".  A database schema update to version 1.3 is required.",
                    "Schema Update Required", JOptionPane.OK_OPTION);
            log.error("Database does not test for versioning. Added in 1.3.0 Schema, and required by "
                    + ImageCaptureApp.APP_VERSION + "  Unable to Start");
            ImageCaptureApp.exit(EXIT_ERROR);
        }
    }
    if (isCurrentAllowed) {
        Singleton.getSingletonInstance().getMainFrame().setStatusMessage(ImageCaptureApp.APP_VERSION + " OK");
    } else {
        String allowed = AllowedVersionLifeCycle.listAllowedVersions();
        Singleton.getSingletonInstance().getMainFrame()
                .setStatusMessage("Database does not support version, update needed.");
        JOptionPane.showMessageDialog(Singleton.getSingletonInstance().getMainFrame(),
                "The database does not support" + APP_NAME + " version " + APP_VERSION
                        + ".  A software update to " + allowed + " is required.",
                "Update Required", JOptionPane.OK_OPTION);
        log.error("Database does not allow version " + ImageCaptureApp.APP_VERSION + "  Unable to Start");
        log.error("Database recognises version(s): " + allowed.toString());
        ImageCaptureApp.exit(EXIT_ERROR);
    }

    // Setup to store a list of running RunnableJobs.
    Singleton.getSingletonInstance().setJobList(new RunnableJobTableModel());

    Singleton.getSingletonInstance().getMainFrame()
            .setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    Singleton.getSingletonInstance().getMainFrame().setState(MainFrame.STATE_RUNNING);
}

From source file:org.tinymediamanager.ui.tvshows.settings.TvShowSettingsPanel.java

/**
 * Instantiates a new tv show settings panel.
 *//* ww  w.j  av a  2  s  . c o  m*/
public TvShowSettingsPanel() {
    setLayout(new FormLayout(
            new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"),
                    FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"),
                    FormSpecs.RELATED_GAP_COLSPEC, },
            new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"),
                    FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow(3)"), }));

    JPanel panelGeneral = new JPanel();
    panelGeneral.setBorder(new TitledBorder(null, BUNDLE.getString("Settings.general"), TitledBorder.LEADING, //$NON-NLS-1$
            TitledBorder.TOP, null, null));
    add(panelGeneral, "2, 2, fill, fill");
    panelGeneral.setLayout(new FormLayout(
            new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC,
                    FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC,
                    FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"),
                    FormSpecs.RELATED_GAP_COLSPEC, },
            new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
                    FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, }));

    lblImageCache = new JLabel(BUNDLE.getString("Settings.imagecacheimport"));
    panelGeneral.add(lblImageCache, "2, 2");

    chckbxImageCache = new JCheckBox("");
    panelGeneral.add(chckbxImageCache, "4, 2");

    lblImageCacheHint = new JLabel(BUNDLE.getString("Settings.imagecacheimporthint")); //$NON-NLS-1$
    panelGeneral.add(lblImageCacheHint, "6, 2, 3, 1");
    TmmFontHelper.changeFont(lblImageCacheHint, 0.833);

    final JSeparator separator = new JSeparator();
    panelGeneral.add(separator, "2, 4, 7, 1");

    JLabel lblTraktTv = new JLabel(BUNDLE.getString("Settings.trakt"));//$NON-NLS-1$
    panelGeneral.add(lblTraktTv, "2, 6");

    chckbxTraktTv = new JCheckBox("");
    panelGeneral.add(chckbxTraktTv, "4, 6");
    btnClearTraktTvShows = new JButton(BUNDLE.getString("Settings.trakt.cleartvshows"));//$NON-NLS-1$
    btnClearTraktTvShows.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            int confirm = JOptionPane.showOptionDialog(null,
                    BUNDLE.getString("Settings.trakt.cleartvshows.hint"),
                    BUNDLE.getString("Settings.trakt.cleartvshows"), JOptionPane.YES_NO_OPTION, //$NON-NLS-1$
                    JOptionPane.QUESTION_MESSAGE, null, null, null);
            if (confirm == JOptionPane.YES_OPTION) {
                TmmTask task = new ClearTraktTvTask(false, true);
                TmmTaskManager.getInstance().addUnnamedTask(task);
            }
        }
    });
    panelGeneral.add(btnClearTraktTvShows, "6, 6");

    JPanel panelBadWords = new JPanel();
    panelBadWords.setBorder(new TitledBorder(null, BUNDLE.getString("Settings.tvshow.badwords"), //$NON-NLS-1$
            TitledBorder.LEADING, TitledBorder.TOP, null, null));
    add(panelBadWords, "4, 2, fill, fill");
    panelBadWords.setLayout(new FormLayout(
            new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("50px:grow"),
                    FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, },
            new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                    FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"),
                    FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, }));

    JTextPane txtpntBadWordsHint = new JTextPane();
    txtpntBadWordsHint.setBackground(UIManager.getColor("Panel.background"));
    txtpntBadWordsHint.setText(BUNDLE.getString("Settings.tvshow.badwords.hint")); //$NON-NLS-1$
    TmmFontHelper.changeFont(txtpntBadWordsHint, 0.833);
    panelBadWords.add(txtpntBadWordsHint, "2, 2, 3, 1, fill, default");

    JScrollPane scpBadWords = new JScrollPane();
    panelBadWords.add(scpBadWords, "2, 4, fill, fill");

    listBadWords = new JList<>();
    scpBadWords.setViewportView(listBadWords);

    JButton btnRemoveBadWord = new JButton(IconManager.LIST_REMOVE);
    btnRemoveBadWord.setToolTipText(BUNDLE.getString("Button.remove")); //$NON-NLS-1$
    btnRemoveBadWord.setMargin(new Insets(2, 2, 2, 2));
    btnRemoveBadWord.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            int row = listBadWords.getSelectedIndex();
            if (row != -1) {
                String badWord = TvShowModuleManager.SETTINGS.getBadWords().get(row);
                TvShowModuleManager.SETTINGS.removeBadWord(badWord);
            }
        }
    });
    panelBadWords.add(btnRemoveBadWord, "4, 4, default, bottom");

    tfAddBadword = new JTextField();
    tfAddBadword.setColumns(10);
    panelBadWords.add(tfAddBadword, "2, 6, fill, default");

    JButton btnAddBadWord = new JButton(IconManager.LIST_ADD);
    btnAddBadWord.setToolTipText(BUNDLE.getString("Button.add")); //$NON-NLS-1$
    btnAddBadWord.setMargin(new Insets(2, 2, 2, 2));
    btnAddBadWord.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (StringUtils.isNotEmpty(tfAddBadword.getText())) {
                TvShowModuleManager.SETTINGS.addBadWord(tfAddBadword.getText());
                tfAddBadword.setText("");
            }
        }
    });
    panelBadWords.add(btnAddBadWord, "4, 6");

    {
        JPanel panelTvShowDataSources = new JPanel();

        panelTvShowDataSources.setBorder(new TitledBorder(null, BUNDLE.getString("Settings.tvshowdatasource"), //$NON-NLS-1$
                TitledBorder.LEADING, TitledBorder.TOP, null, null));
        add(panelTvShowDataSources, "2, 4, 3, 1, fill, top");
        panelTvShowDataSources.setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC,
                FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC,
                FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("50dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC,
                FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.UNRELATED_GAP_COLSPEC,
                FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("200dlu:grow(2)"),
                FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC,
                FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, },
                new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                        FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("160px:grow"),
                        FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                        FormSpecs.RELATED_GAP_ROWSPEC, }));

        JLabel lblDataSource = new JLabel(BUNDLE.getString("Settings.source")); //$NON-NLS-1$
        panelTvShowDataSources.add(lblDataSource, "2, 2, 5, 1");

        JLabel lblSkipFolders = new JLabel(BUNDLE.getString("Settings.ignore"));//$NON-NLS-1$
        panelTvShowDataSources.add(lblSkipFolders, "12, 2, 3, 1");

        JScrollPane scrollPaneDatasource = new JScrollPane();
        panelTvShowDataSources.add(scrollPaneDatasource, "2, 4, 5, 1, fill, fill");

        listDatasources = new JList<>();
        scrollPaneDatasource.setViewportView(listDatasources);

        JPanel panelTvShowSourcesButtons = new JPanel();
        panelTvShowDataSources.add(panelTvShowSourcesButtons, "8, 4, default, top");
        panelTvShowSourcesButtons.setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.DEFAULT_COLSPEC, },
                new RowSpec[] { FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
                        FormSpecs.DEFAULT_ROWSPEC, }));

        JButton btnAdd = new JButton(IconManager.LIST_ADD);
        btnAdd.setToolTipText(BUNDLE.getString("Button.add")); //$NON-NLS-1$
        btnAdd.setMargin(new Insets(2, 2, 2, 2));
        btnAdd.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
                Path file = TmmUIHelper
                        .selectDirectory(BUNDLE.getString("Settings.tvshowdatasource.folderchooser")); //$NON-NLS-1$
                if (file != null && Files.isDirectory(file)) {
                    settings.addTvShowDataSources(file.toAbsolutePath().toString());
                }
            }
        });

        panelTvShowSourcesButtons.add(btnAdd, "1, 1, fill, top");

        JButton btnRemove = new JButton(IconManager.LIST_REMOVE);
        btnRemove.setToolTipText(BUNDLE.getString("Button.remove")); //$NON-NLS-1$
        btnRemove.setMargin(new Insets(2, 2, 2, 2));
        btnRemove.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent arg0) {
                int row = listDatasources.getSelectedIndex();
                if (row != -1) { // nothing selected
                    String path = settings.getTvShowDataSource().get(row);
                    String[] choices = { BUNDLE.getString("Button.continue"), //$NON-NLS-1$
                            BUNDLE.getString("Button.abort") };
                    int decision = JOptionPane.showOptionDialog(null,
                            String.format(BUNDLE.getString("Settings.tvshowdatasource.remove.info"), path),
                            BUNDLE.getString("Settings.datasource.remove"), JOptionPane.YES_NO_OPTION,
                            JOptionPane.PLAIN_MESSAGE, null, choices, BUNDLE.getString("Button.abort")); //$NON-NLS-1$
                    if (decision == 0) {
                        setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                        settings.removeTvShowDataSources(path);
                        setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
                    }
                }
            }
        });
        panelTvShowSourcesButtons.add(btnRemove, "1, 3, fill, top");

        JScrollPane scrollPane = new JScrollPane();
        panelTvShowDataSources.add(scrollPane, "12, 4, fill, fill");

        listExclude = new JList<>();
        scrollPane.setViewportView(listExclude);

        JPanel panelSkipFolderButtons = new JPanel();
        panelTvShowDataSources.add(panelSkipFolderButtons, "14, 4, fill, fill");
        panelSkipFolderButtons.setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.DEFAULT_COLSPEC, },
                new RowSpec[] { FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
                        FormSpecs.DEFAULT_ROWSPEC, }));

        JButton btnAddSkipFolder = new JButton(IconManager.LIST_ADD);
        btnAddSkipFolder.setToolTipText(BUNDLE.getString("Settings.addignore")); //$NON-NLS-1$
        btnAddSkipFolder.setMargin(new Insets(2, 2, 2, 2));
        btnAddSkipFolder.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                Path file = TmmUIHelper.selectDirectory(BUNDLE.getString("Settings.ignore")); //$NON-NLS-1$
                if (file != null && Files.isDirectory(file)) {
                    settings.addTvShowSkipFolder(file.toAbsolutePath().toString());
                }
            }
        });
        panelSkipFolderButtons.add(btnAddSkipFolder, "1, 1");

        JButton btnRemoveSkipFolder = new JButton(IconManager.LIST_REMOVE);
        btnRemoveSkipFolder.setToolTipText(BUNDLE.getString("Settings.removeignore")); //$NON-NLS-1$
        btnRemoveSkipFolder.setMargin(new Insets(2, 2, 2, 2));
        btnRemoveSkipFolder.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                int row = listExclude.getSelectedIndex();
                if (row != -1) { // nothing selected
                    String ingore = settings.getTvShowSkipFolders().get(row);
                    settings.removeTvShowSkipFolder(ingore);
                }
            }
        });
        panelSkipFolderButtons.add(btnRemoveSkipFolder, "1, 3");

        JLabel lblDvdOrder = new JLabel(BUNDLE.getString("Settings.dvdorder")); //$NON-NLS-1$
        panelTvShowDataSources.add(lblDvdOrder, "2, 6, right, default");

        cbDvdOrder = new JCheckBox("");
        panelTvShowDataSources.add(cbDvdOrder, "4, 6");
    }

    initDataBindings();

    if (!Globals.isDonator()) {
        chckbxTraktTv.setSelected(false);
        chckbxTraktTv.setEnabled(false);
        btnClearTraktTvShows.setEnabled(false);
    }
}

From source file:JavaXWin.java

public void mouseExited(MouseEvent e) {
    if (!m_dragging)
        setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}

From source file:base.BasePlayer.BedCanvas.java

void drawScreen(Graphics g) {

    if (Main.readingbeds) {
        buf.setColor(Draw.backColor);/*from   ww  w.j  av a2 s  .c om*/
        buf.fillRect(Main.sidebarWidth - 4, 0, this.getWidth(), nodeImage.getHeight());
        buf.drawString("Loading tracks...", 10, Main.bedScroll.getViewport().getHeight());
        g.drawImage(bufImage, 0, 0, null);
        return;
    }
    if (this.trackDivider.size() > 0 && this.trackDivider.get(this.trackDivider.size() - 1) != 1.0) {
        for (int i = 0; i < Main.bedCanvas.trackDivider.size(); i++) {
            Main.bedCanvas.trackDivider.set(i,
                    ((i + 1) * (this.getHeight() / (double) trackDivider.size()) / this.getHeight()));
        }
    }

    drawSidebar();

    if (Settings.wallpaper == null) {
        buf.setColor(Draw.backColor);
        buf.fillRect(Main.sidebarWidth - 4, 0, this.getWidth(), this.getHeight());
    } else {

        buf.drawImage(Settings.wallpaper, Main.sidebarWidth - 4, 0, this);
        buf.setColor(Draw.backColor);
        buf.fillRect(Main.sidebarWidth - 4, 0, this.getWidth(), this.getHeight());
    }
    //buf.setColor(Color.gray);

    if (!zoomDrag && !resize) {

        try {

            drawNodes();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    if (resizer && !mouseDrag) {
        resizer = false;
    }
    if (resize) {
        buf.drawImage(nodeImage, Main.sidebarWidth - 4, 0, nodeImage.getWidth(),
                (int) (Main.vardivider * Main.varPaneDivider.getY()), null);
    } else {
        buf.drawImage(nodeImage, Main.sidebarWidth - 4, 0, null);
    }
    for (int i = 0; i < bedTrack.size(); i++) {
        if (i < bedTrack.size() - 1) {
            buf.setColor(Color.lightGray);
            buf.drawLine(0, (int) (trackDivider.get(i) * this.getHeight()), this.getWidth(),
                    (int) (trackDivider.get(i) * this.getHeight()));

            buf.setColor(Color.gray);
            buf.drawLine(0, (int) (trackDivider.get(i) * this.getHeight()) + 1, this.getWidth(),
                    (int) (trackDivider.get(i) * this.getHeight()) + 1);

            if (!lineZoomer && mouseY < (int) (trackDivider.get(i) * this.getHeight()) + 4
                    && mouseY > (int) (trackDivider.get(i) * this.getHeight()) - 4) {
                resizer = true;
                if (getCursor().getType() != Cursor.N_RESIZE_CURSOR) {
                    resizeDivider = i;
                    setCursor(Cursor.getPredefinedCursor(Cursor.N_RESIZE_CURSOR));
                }
            }
        }
        if (bedTrack.get(i).graph && bedTrack.get(i).minvalue != Double.MAX_VALUE
                && bedTrack.get(i).getHead().getNext() != null) {
            if (!buf.getColor().equals(Color.white)) {
                buf.setColor(Color.white);
            }
            if (bedTrack.get(i).getLogscale().isSelected()) {
                scaletext = "Log scale [" + MethodLibrary.round(bedTrack.get(i).minvalue, 2) + ", "
                        + MethodLibrary.round(bedTrack.get(i).maxvalue, 2) + "]";

                scalewidth = buf.getFontMetrics().stringWidth(scaletext);
                buf.fillRoundRect(Main.sidebarWidth + 5,
                        (int) (trackDivider.get(i) * this.getHeight()) - 5 - (Main.defaultFontSize + 4),
                        scalewidth + 4, Main.defaultFontSize + 4, 4, 4);
                buf.setColor(Color.black);
                buf.drawString(scaletext, Main.sidebarWidth + 7,
                        (int) (trackDivider.get(i) * this.getHeight()) - 9);

            } else {
                scaletext = "Scale [" + MethodLibrary.round(bedTrack.get(i).minvalue, 2) + ", "
                        + MethodLibrary.round(bedTrack.get(i).maxvalue, 2) + "]";
                scalewidth = buf.getFontMetrics().stringWidth(scaletext);
                buf.fillRoundRect(Main.sidebarWidth + 5,
                        (int) (trackDivider.get(i) * this.getHeight()) - 5 - (Main.defaultFontSize + 4),
                        scalewidth + 4, Main.defaultFontSize + 4, 4, 4);
                buf.setColor(Color.black);
                buf.drawString(scaletext, Main.sidebarWidth + 7,
                        (int) (trackDivider.get(i) * this.getHeight()) - 9);
            }
            buf.setColor(Color.black);
        }
    }
    if (overlap) {

        drawInfo();
    }
    if (!resizer && !overlapping) {
        if (getCursor().getType() != Cursor.DEFAULT_CURSOR) {
            setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
        }
    }
    if (Main.drawCanvas.splits.get(0).pixel > 1) {
        // Middle line      
        buf.setColor(Color.black);
        buf.setStroke(Draw.dashed);
        buf.drawLine((Main.drawCanvas.getDrawWidth()) / 2 + Main.sidebarWidth - 2, 0,
                ((Main.drawCanvas.getDrawWidth())) / 2 + Main.sidebarWidth - 2,
                Main.bedScroll.getViewport().getHeight());
        buf.drawLine(
                (int) ((Main.drawCanvas.getDrawWidth()) / 2 + Main.drawCanvas.splits.get(0).pixel
                        + Main.sidebarWidth - 2),
                0, (int) (((Main.drawCanvas.getDrawWidth())) / 2 + Main.drawCanvas.splits.get(0).pixel
                        + Main.sidebarWidth - 2),
                Main.bedScroll.getViewport().getHeight());
        //      buf.setStroke(Draw.doubleStroke);
        buf.setStroke(Draw.basicStroke);
    }
    for (int i = 1; i < Main.drawCanvas.splits.size(); i++) {
        buf.setColor(Color.gray);
        buf.fillRect(Main.drawCanvas.splits.get(i).offset - 3, 0, 5, this.getHeight());
        buf.setColor(Color.lightGray);
        buf.fillRect(Main.drawCanvas.splits.get(i).offset - 1, 0, 2, this.getHeight());

    }
    if (getCursor().getType() != Cursor.N_RESIZE_CURSOR) {

        drawZoom();
    }
    g.drawImage(bufImage, 0, 0, null);
}

From source file:com.qspin.qtaste.ui.TestCaseTree.java

public void loadSelectedTestCase(TreePath path) {
    if (path != null) {
        FileNode fn = getFileNode(path);
        if (fn != null && fn.isTestcaseDir()) {
            File testcaseFile = fn.getTestcaseFile();
            if (testCasePane.getTestScripPane() != null) {
                try {
                    if (testcaseFile.getAbsoluteFile().getCanonicalPath()
                            .equals(testCasePane.getTestScripPane().getFileName())) {
                        return;
                    }//from   w  w w. j av  a 2s  .c  om
                } catch (IOException e) {
                    logger.error(e.getMessage());
                    return;
                }
            }
            if (testcaseFile != null) {
                testCasePane.setCurrentSelectedFileNode(fn);
                if (fn.getFile().getName().equals("TestSuite")) {
                    testCasePane.setCurrentSelectedTestsuite("TestSuite");
                } else {
                    String parentDir = testcaseFile.getParent();
                    testCasePane.setCurrentSelectedTestsuite(parentDir);
                }
                setTestCaseSource(testcaseFile, false);

            }
            File testcaseData = fn.getPythonTestScript().getTestcaseData();
            if (testcaseData != null) {
                setTestCaseData(testcaseData, false);
            }
            File testcaseRequirement = fn.getPythonTestScript().getTestcaseRequirements();
            if (testcaseRequirement != null) {
                setTestCaseRequirement(testcaseRequirement, false);
            }
            //  regenerate the doc if file date of script > file date of doc
            PythonTestScript script = fn.getPythonTestScript();
            boolean generateDoc = testCasePane.isDocTabSelected() && !script.isDocSynchronized();

            if (generateDoc) {
                testCasePane.parent.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                script.generateDoc();
                // Generate the documentation
                setTestCaseDoc(script.getTestcaseDoc(), false);
                testCasePane.parent.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
            } else
                // update the screen with the doc of the selected test script
                setTestCaseDoc(script.getTestcaseDoc(), false);
            // Get the user preferences to display the testcase tab
            GUIConfiguration guiConfiguration = GUIConfiguration.getInstance();
            String testCaseTabOnSelect = "none"; // default
            if (guiConfiguration.containsKey(TEST_CASE_TAB_ON_SELECT_PROPERTY)) {
                testCaseTabOnSelect = guiConfiguration.getString(TEST_CASE_TAB_ON_SELECT_PROPERTY)
                        .toLowerCase();
            } else {
                guiConfiguration.setProperty(TEST_CASE_TAB_ON_SELECT_PROPERTY, testCaseTabOnSelect);
                try {
                    guiConfiguration.save();
                } catch (ConfigurationException ex) {
                    logger.error("Error while saving GUI configuration: " + ex.getMessage());
                }
            }
            if (testCaseTabOnSelect.equals("doc")) {
                testCasePane.getTabbedPane().setSelectedIndex(TestCasePane.DOC_INDEX);
            } else if (testCaseTabOnSelect.equals("source")) {
                testCasePane.getTabbedPane().setSelectedIndex(TestCasePane.SOURCE_INDEX);
            } else if (testCaseTabOnSelect.equals("results")) {
                testCasePane.getTabbedPane().setSelectedIndex(TestCasePane.RESULTS_INDEX);
            } else if (testCaseTabOnSelect.equals("logs")) {
                testCasePane.getTabbedPane().setSelectedIndex(TestCasePane.LOGS_INDEX);
            } else if (!testCaseTabOnSelect.equals("none")) {
                logger.warn("Invalid value for GUI configuration property " + TEST_CASE_TAB_ON_SELECT_PROPERTY
                        + " (" + guiConfiguration.getString(TEST_CASE_TAB_ON_SELECT_PROPERTY) + ")");
            }
        }
    }
}

From source file:AST.DesignPatternDetection.java

private void btRunSgisoActionPerformed(ActionEvent e) throws IOException, InterruptedException {
    // TODO add your code here
    try {/* w w  w .  ja  v a 2s.  c  om*/
        Cursor hourglassCursor = new Cursor(Cursor.WAIT_CURSOR);
        setCursor(hourglassCursor);

        String myCommand = programPath + "/Projects/script_" + cbSelectionDP.getSelectedItem().toString()
                + ".sh";
        ProcessBuilder pb = new ProcessBuilder(myCommand);

        long startTime = TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis());

        Process p = pb.start(); // Start the process.
        p.waitFor(); // Wait for the process to finish.

        long endTime = TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis());

        long duration = (endTime - startTime);
        String duration_ = Long.toString(duration);

        DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
        Date date = new Date();
        PrintWriter writer_time = new PrintWriter(programPath + "/Projects/" + tfProjectName.getText()
                + "/outputs/" + cbSelectionDP.getSelectedItem().toString() + "_outputs/time_"
                + cbSelectionDP.getSelectedItem().toString() + ".txt");
        writer_time.println(
                "Script lasts " + duration_ + " seconds. --" + dateFormat.format(date).toString() + "--");
        writer_time.close();

        taInfo.append("5. Subdue-Sgiso isomorphic search algorithm runned in " + duration_
                + " seconds.(/Projects/" + tfProjectName.getText() + "/outputs/"
                + cbSelectionDP.getSelectedItem().toString() + "_outputs)" + "\n");

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

        //remove the executable file.
        String myShellScript = "";
        myShellScript = "rm " + programPath + "/Projects/script_" + cbSelectionDP.getSelectedItem().toString()
                + ".sh ";
        Runtime.getRuntime().exec(myShellScript);

        JOptionPane.showMessageDialog(null, "Sgiso script executed successfully");

    } catch (Exception e2) {
        // TODO: handle exception
        System.out.println(e2.toString());
        JOptionPane.showMessageDialog(null, e2.toString());
        e2.printStackTrace();
    }

}

From source file:org.jas.dnd.DragTooltipDialog.java

private void initialize() {
    this.setSize(this.getPreferredSize());
    this.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
    this.setContentPane(getJContentPane());
    this.setUndecorated(true);
    this.setAlwaysOnTop(true);
}