Example usage for java.awt Cursor getPredefinedCursor

List of usage examples for java.awt Cursor getPredefinedCursor

Introduction

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

Prototype

public static Cursor getPredefinedCursor(int type) 

Source Link

Document

Returns a cursor object with the specified predefined type.

Usage

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

/**
 * This method initializes the main frame.
 * //w  w  w  . j  a va  2  s  .  c o m
 */
private void initialize() {
    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    this.setDefaultCloseOperation(EXIT_ON_CLOSE);
    this.setSize(new Dimension(1280, 750));
    this.setPreferredSize(new Dimension(1280, 800));
    this.setMinimumSize(new Dimension(300, 200));
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    this.setLocation((screenSize.width - this.getWidth()) / 2, (screenSize.height - this.getHeight()) / 2);
    //String iconFile = this.getClass().getResource("resources/icon.ico").getFile();
    URL iconFile = this.getClass().getResource("/edu/harvard/mcz/imagecapture/resources/icon.png");
    try {
        setIconImage(new ImageIcon(iconFile).getImage());
    } catch (Exception e) {
        log.error("Can't open icon file: " + iconFile);
        log.error(e);
    }
    this.setTitle(ImageCaptureApp.APP_NAME + ": MCZ Rapid Data Capture Application.  Configured For: "
            + Singleton.getSingletonInstance().getProperties().getProperties()
                    .getProperty(ImageCaptureProperties.KEY_COLLECTION));
    this.setJMenuBar(getJJMenuBar());
    this.setContentPane(getJPanel());

}

From source file:net.technicpack.launcher.ui.InstallerFrame.java

private void initComponents() {
    setSize(DIALOG_WIDTH, DIALOG_HEIGHT);
    setIconImage(resources.getImage("icon.png"));
    setLayout(new BorderLayout());

    JPanel header = new JPanel();
    header.setBackground(Color.black);
    header.setLayout(new BoxLayout(header, BoxLayout.LINE_AXIS));
    header.setBorder(BorderFactory.createEmptyBorder(4, 8, 4, 8));
    add(header, BorderLayout.PAGE_START);

    JLabel title = new JLabel(resources.getString("launcher.installer.title"));
    title.setFont(resources.getFont(ResourceLoader.FONT_RALEWAY, 34));
    title.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    title.setOpaque(false);//from  ww  w.j a v a2  s  .  c  o  m
    title.setIcon(resources.getIcon("options_cog.png"));
    header.add(title);

    header.add(Box.createHorizontalGlue());

    JButton closeButton = new JButton();
    closeButton.setIcon(resources.getIcon("close.png"));
    closeButton.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    closeButton.setContentAreaFilled(false);
    closeButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    closeButton.setFocusPainted(false);
    closeButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            mainFrame.setVisible(true);
            dispose();
        }
    });
    header.add(closeButton);

    SimpleTabPane centerPanel = new SimpleTabPane();
    centerPanel.setBackground(LauncherFrame.COLOR_FORMELEMENT_INTERNAL);
    centerPanel.setForeground(LauncherFrame.COLOR_GREY_TEXT);
    centerPanel.setSelectedBackground(LauncherFrame.COLOR_BLUE);
    centerPanel.setSelectedForeground(LauncherFrame.COLOR_WHITE_TEXT);
    centerPanel.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 14));
    centerPanel.setOpaque(true);
    add(centerPanel, BorderLayout.CENTER);

    JPanel standardInstallPanel = new JPanel();
    standardInstallPanel.setBackground(LauncherFrame.COLOR_CENTRAL_BACK_OPAQUE);

    setupStandardInstall(standardInstallPanel);

    JPanel portableModePanel = new JPanel();
    portableModePanel.setBackground(LauncherFrame.COLOR_CENTRAL_BACK_OPAQUE);

    setupPortableMode(portableModePanel);

    centerPanel.addTab(resources.getString("launcher.installer.standard").toUpperCase(), standardInstallPanel);
    centerPanel.addTab(resources.getString("launcher.installer.portable").toUpperCase(), portableModePanel);

    if (settings.isPortable()) {
        centerPanel.setSelectedIndex(1);
    } else
        centerPanel.setSelectedIndex(0);

    setLocationRelativeTo(null);
}

From source file:edu.ucla.stat.SOCR.analyses.util.moduls.frm.Panels.Jpan_btn.java

@Override
public void actionPerformed(final ActionEvent evt) {
    String action = null;//from  w w  w .j  av  a2 s  .c  om
    FitxerDades fitxTmp;
    boolean ambDades = false;
    InternalFrameData ifd;
    double minBase;
    MDComputation mdComputation;

    if (evt.getActionCommand().equals(strLoad)) {
        // LOAD

        if (currentInternalFrame != null)
            currentInternalFrame = null;

        buttonClicked = true;
        action = "Load";
        // Load data from file
        if (fitx == null) {
            fitxTmp = getFitxerDades();
        } else {
            // Last directory
            fitxTmp = getFitxerDades(fitx.getPath());
        }
        if (fitxTmp == null) {
            // Cancel pressed
            ambDades = false;
        } else {
            fitx = fitxTmp;
            ambDades = true;
        }
    } else if (evt.getActionCommand().equals(strUpdate)) {
        // UPDATE        
        buttonClicked = true;

        if (action1 == "Calculate") {
            action = "CalUpdate";

            doLoad(action);
            return;
        }

        ifd = currentInternalFrame.getInternalFrameData();
        if ((Jpan_Menu.getTypeData() == ifd.getTypeData()) && (Jpan_Menu.getMethod() == ifd.getMethod())
                && (Jpan_Menu.getPrecision() == ifd.getPrecision())) {
            action = "Redraw";
        } else {
            action = "Reload";
        }
        ambDades = true;
    }
    if (ambDades && (action.equals("Load") || action.equals("Reload"))) {
        try {
            de = new DadesExternes(fitx);
            if (action.equals("Load")) {
                Jpan_Menu.setPrecision(de.getPrecisio());
            }
            multiDendro = null;
            try {
                multiDendro = de.getMatriuDistancies();
                minBase = Double.MAX_VALUE;
                progressBar.setBorderPainted(true);
                progressBar.setString(null);
                fr.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                // Instances of javax.swing.SwingWorker are not reusable,
                // so we create new instances as needed.
                mdComputation = new MDComputation(action, Jpan_Menu.getTypeData(), Jpan_Menu.getMethod(),
                        Jpan_Menu.getPrecision(), multiDendro.getCardinalitat(), minBase);
                mdComputation.addPropertyChangeListener(this);
                mdComputation.execute();
            } catch (final Exception e2) {
                buttonClicked = false;
                showError(e2.getMessage());
            }
        } catch (Exception e1) {
            buttonClicked = false;
            showError(e1.getMessage());
        }
    } else if (ambDades && action.equals("Redraw")) {
        showCalls(action);
    } else {
        buttonClicked = false;
    }
}

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

/**
 * Instantiates a new tv show settings panel.
 *//*from  w  w  w. j  a  v  a2  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:op.care.values.PnlValues.java

private CollapsiblePane createCP4Type(final ResValueTypes vtype) {
    final String keyType = vtype.getID() + ".xtypes";
    final CollapsiblePane cpType = getCP(keyType);

    final DefaultCPTitle cptitle = new DefaultCPTitle(vtype.getText(), new ActionListener() {
        @Override/*from  w w w  . j a v a  2  s .  c  om*/
        public void actionPerformed(ActionEvent e) {
            try {
                cpType.setCollapsed(!cpType.isCollapsed());
            } catch (PropertyVetoException pve) {
                // BAH!
            }
        }
    });
    cptitle.getButton().setFont(SYSConst.ARIAL24);
    cptitle.getButton().setForeground(vtype.getColor());
    cpType.setBackground(Color.white);

    cpType.setTitleLabelComponent(cptitle.getMain());
    cpType.setSlidingDirection(SwingConstants.SOUTH);

    if (OPDE.getAppInfo().isAllowedTo(InternalClassACL.UPDATE, internalClassID)) {
        /***
         *         _       _     _    __                  _____               __
         *        / \   __| | __| |  / /_ __   ___ _ __  |_   _|   _ _ __   __\ \
         *       / _ \ / _` |/ _` | | || '_ \ / _ \ '__|   | || | | | '_ \ / _ \ |
         *      / ___ \ (_| | (_| | | || |_) |  __/ |      | || |_| | |_) |  __/ |
         *     /_/   \_\__,_|\__,_| | || .__/ \___|_|      |_| \__, | .__/ \___| |
         *                           \_\_|                     |___/|_|       /_/
         */
        final JButton btnAdd = new JButton(SYSConst.icon22add);
        btnAdd.setPressedIcon(SYSConst.icon22addPressed);
        btnAdd.setAlignmentX(Component.RIGHT_ALIGNMENT);
        btnAdd.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        btnAdd.setContentAreaFilled(false);
        btnAdd.setBorder(null);
        btnAdd.setToolTipText(
                SYSTools.xx("nursingrecords.vitalparameters.btnAdd.tooltip") + " (" + vtype.getText() + ")");
        btnAdd.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent actionEvent) {
                addValue(vtype);
            }
        });
        cptitle.getRight().add(btnAdd);
        btnAdd.setEnabled(resident.isActive());
    }

    cpType.addCollapsiblePaneListener(new CollapsiblePaneAdapter() {
        @Override
        public void paneExpanded(CollapsiblePaneEvent collapsiblePaneEvent) {
            cpType.setContentPane(createContentPanel4Type(vtype));
        }
    });

    if (!cpType.isCollapsed()) {
        cpType.setContentPane(createContentPanel4Type(vtype));
    }

    if (!ResValueTools.getYearsWithValues(resident, vtype).isEmpty()) {
        //            cptitle.getTitleButton().setIcon(SYSConst.icon22ledGreenOn);
        cpType.setCollapsible(true);
    } else {
        //            cptitle.getTitleButton().setIcon(SYSConst.icon22ledGreenOff);
        cpType.setCollapsible(false);
    }

    cpType.setHorizontalAlignment(SwingConstants.LEADING);
    cpType.setOpaque(false);
    //        cpType.setBackground(getColor(vtype, SYSConst.medium1));

    return cpType;
}

From source file:JavaXWin.java

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

From source file:com.mirth.connect.client.ui.dependencies.ChannelDependenciesPanel.java

private void initComponents() {
    setBackground(UIConstants.BACKGROUND_COLOR);

    dependencyLabel = new JLabel("This channel depends upon:");

    dependencyTreeTable = new MirthTreeTable();

    DefaultTreeTableModel dependencyModel = new SortableTreeTableModel();
    DefaultMutableTreeTableNode dependencyRootNode = new DefaultMutableTreeTableNode();
    dependencyModel.setRoot(dependencyRootNode);

    dependencyTreeTable.setTreeTableModel(dependencyModel);
    dependencyTreeTable.setRootVisible(false);
    dependencyTreeTable.setDoubleBuffered(true);
    dependencyTreeTable.setDragEnabled(false);
    dependencyTreeTable.setRowSelectionAllowed(true);
    dependencyTreeTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    dependencyTreeTable.setRowHeight(UIConstants.ROW_HEIGHT);
    dependencyTreeTable.setFocusable(true);
    dependencyTreeTable.setOpaque(true);
    dependencyTreeTable.setEditable(false);
    dependencyTreeTable.setSortable(true);
    dependencyTreeTable.putClientProperty("JTree.lineStyle", "Horizontal");
    dependencyTreeTable.setAutoCreateColumnsFromModel(false);
    dependencyTreeTable.setShowGrid(true, true);
    dependencyTreeTable.setTableHeader(null);

    if (Preferences.userNodeForPackage(Mirth.class).getBoolean("highlightRows", true)) {
        dependencyTreeTable.setHighlighters(HighlighterFactory
                .createAlternateStriping(UIConstants.HIGHLIGHTER_COLOR, UIConstants.BACKGROUND_COLOR));
    }/*from  w  ww .  jav a  2s  .c  o m*/

    dependencyTreeTable.setTreeCellRenderer(new DependencyTreeCellRenderer(dependencyTreeTable));

    dependencyTreeTable.addMouseListener(new MouseAdapter() {
        @Override
        public void mousePressed(MouseEvent evt) {
            checkSelection(evt);
        }

        @Override
        public void mouseReleased(MouseEvent evt) {
            checkSelection(evt);
        }

        private void checkSelection(MouseEvent evt) {
            if (dependencyTreeTable.rowAtPoint(new Point(evt.getX(), evt.getY())) < 0) {
                dependencyTreeTable.clearSelection();
            }
        }
    });

    dependencyTreeTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent evt) {
            if (!evt.getValueIsAdjusting()) {
                boolean removeEnabled = false;
                int[] rows = dependencyTreeTable.getSelectedModelRows();

                if (rows.length == 1) {
                    TreePath selectedPath = dependencyTreeTable.getPathForRow(rows[0]);

                    if (selectedPath != null) {
                        if (selectedPath.getPathCount() == 2) {
                            removeEnabled = true;
                        }
                    }
                }

                dependencyRemoveButton.setEnabled(removeEnabled);
            }
        }
    });

    dependencyScrollPane = new JScrollPane(dependencyTreeTable);

    dependencyExpandAllLabel = new JLabel("<html><u>Expand All</u></html>");
    dependencyExpandAllLabel.setForeground(Color.BLUE);
    dependencyExpandAllLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    dependencyExpandAllLabel.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseReleased(MouseEvent evt) {
            dependencyTreeTable.expandAll();
        }
    });

    dependencyCollapseAllLabel = new JLabel("<html><u>Collapse All</u></html>");
    dependencyCollapseAllLabel.setForeground(Color.BLUE);
    dependencyCollapseAllLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    dependencyCollapseAllLabel.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseReleased(MouseEvent evt) {
            dependencyTreeTable.collapseAll();
        }
    });

    dependencyAddButton = new JButton("Add");
    dependencyAddButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            Map<String, String> allowedChannelsMap = getAllowedChannels(true);

            if (MapUtils.isNotEmpty(allowedChannelsMap)) {
                AddDialog dialog = new AddDialog(allowedChannelsMap, true);

                if (dialog.wasSaved()) {
                    for (String dependencyId : dialog.getSelectedChannelIds()) {
                        dependencies.add(new ChannelDependency(channel.getId(), dependencyId));
                    }

                    updateTreeTable(true, dependencies);
                    updateAddButton();
                }
            }
        }
    });

    dependencyRemoveButton = new JButton("Remove");
    dependencyRemoveButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            int[] rows = dependencyTreeTable.getSelectedModelRows();

            if (rows.length == 1) {
                TreePath selectedPath = dependencyTreeTable.getPathForRow(rows[0]);

                if (selectedPath != null && selectedPath.getPathCount() == 2) {
                    Pair<String, String> pair = (Pair<String, String>) ((MutableTreeTableNode) selectedPath
                            .getLastPathComponent()).getUserObject();

                    for (Iterator<ChannelDependency> it = dependencies.iterator(); it.hasNext();) {
                        ChannelDependency dependency = it.next();
                        if (StringUtils.equals(channel.getId(), dependency.getDependentId())
                                && StringUtils.equals(pair.getLeft(), dependency.getDependencyId())) {
                            it.remove();
                        }
                    }

                    updateTreeTable(true, dependencies);
                    updateAddButton();
                }
            }
        }
    });
    dependencyRemoveButton.setEnabled(false);

    dependentLabel = new JLabel("This channel is depended upon by:");

    dependentTreeTable = new MirthTreeTable();

    DefaultTreeTableModel dependentModel = new SortableTreeTableModel();
    DefaultMutableTreeTableNode dependentRootNode = new DefaultMutableTreeTableNode();
    dependentModel.setRoot(dependentRootNode);

    dependentTreeTable.setTreeTableModel(dependentModel);
    dependentTreeTable.setRootVisible(false);
    dependentTreeTable.setDoubleBuffered(true);
    dependentTreeTable.setDragEnabled(false);
    dependentTreeTable.setRowSelectionAllowed(true);
    dependentTreeTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    dependentTreeTable.setRowHeight(UIConstants.ROW_HEIGHT);
    dependentTreeTable.setFocusable(true);
    dependentTreeTable.setOpaque(true);
    dependentTreeTable.setEditable(false);
    dependentTreeTable.setSortable(true);
    dependentTreeTable.putClientProperty("JTree.lineStyle", "Horizontal");
    dependentTreeTable.setAutoCreateColumnsFromModel(false);
    dependentTreeTable.setShowGrid(true, true);
    dependentTreeTable.setTableHeader(null);

    if (Preferences.userNodeForPackage(Mirth.class).getBoolean("highlightRows", true)) {
        dependentTreeTable.setHighlighters(HighlighterFactory
                .createAlternateStriping(UIConstants.HIGHLIGHTER_COLOR, UIConstants.BACKGROUND_COLOR));
    }

    dependentTreeTable.setTreeCellRenderer(new DependencyTreeCellRenderer(dependentTreeTable));

    dependentTreeTable.addMouseListener(new MouseAdapter() {
        @Override
        public void mousePressed(MouseEvent evt) {
            checkSelection(evt);
        }

        @Override
        public void mouseReleased(MouseEvent evt) {
            checkSelection(evt);
        }

        private void checkSelection(MouseEvent evt) {
            if (dependentTreeTable.rowAtPoint(new Point(evt.getX(), evt.getY())) < 0) {
                dependentTreeTable.clearSelection();
            }
        }
    });

    dependentTreeTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent evt) {
            if (!evt.getValueIsAdjusting()) {
                boolean removeEnabled = false;
                int[] rows = dependentTreeTable.getSelectedModelRows();

                if (rows.length == 1) {
                    TreePath selectedPath = dependentTreeTable.getPathForRow(rows[0]);

                    if (selectedPath != null) {
                        if (selectedPath.getPathCount() == 2) {
                            removeEnabled = true;
                        }
                    }
                }

                dependentRemoveButton.setEnabled(removeEnabled);
            }
        }
    });

    dependentScrollPane = new JScrollPane(dependentTreeTable);

    dependentExpandAllLabel = new JLabel("<html><u>Expand All</u></html>");
    dependentExpandAllLabel.setForeground(Color.BLUE);
    dependentExpandAllLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    dependentExpandAllLabel.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseReleased(MouseEvent evt) {
            dependentTreeTable.expandAll();
        }
    });

    dependentCollapseAllLabel = new JLabel("<html><u>Collapse All</u></html>");
    dependentCollapseAllLabel.setForeground(Color.BLUE);
    dependentCollapseAllLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    dependentCollapseAllLabel.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseReleased(MouseEvent evt) {
            dependentTreeTable.collapseAll();
        }
    });

    dependentAddButton = new JButton("Add");
    dependentAddButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            Map<String, String> allowedChannelsMap = getAllowedChannels(false);

            if (MapUtils.isNotEmpty(allowedChannelsMap)) {
                AddDialog dialog = new AddDialog(allowedChannelsMap, false);

                if (dialog.wasSaved()) {
                    for (String dependentId : dialog.getSelectedChannelIds()) {
                        dependencies.add(new ChannelDependency(dependentId, channel.getId()));
                    }

                    updateTreeTable(false, dependencies);
                    updateAddButton();
                }
            }
        }
    });

    dependentRemoveButton = new JButton("Remove");
    dependentRemoveButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            int[] rows = dependentTreeTable.getSelectedModelRows();

            if (rows.length == 1) {
                TreePath selectedPath = dependentTreeTable.getPathForRow(rows[0]);

                if (selectedPath != null && selectedPath.getPathCount() == 2) {
                    Pair<String, String> pair = (Pair<String, String>) ((MutableTreeTableNode) selectedPath
                            .getLastPathComponent()).getUserObject();

                    for (Iterator<ChannelDependency> it = dependencies.iterator(); it.hasNext();) {
                        ChannelDependency dependency = it.next();
                        if (StringUtils.equals(pair.getLeft(), dependency.getDependentId())
                                && StringUtils.equals(channel.getId(), dependency.getDependencyId())) {
                            it.remove();
                        }
                    }

                    updateTreeTable(false, dependencies);
                    updateAddButton();
                }
            }
        }
    });
    dependentRemoveButton.setEnabled(false);
}

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 ava  2  s. c  o  m*/
                } 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:JavaXWin.java

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

From source file:com.konifar.material_icon_generator.MaterialDesignIconGenerateDialog.java

private void initLabelLink(JLabel label, final String url) {
    label.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    label.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent event) {
            if (event.getClickCount() > 0) {
                if (Desktop.isDesktopSupported()) {
                    Desktop desktop = Desktop.getDesktop();
                    try {
                        URI uri = new URI(url);
                        desktop.browse(uri);
                    } catch (IOException e) {
                        e.printStackTrace();
                    } catch (URISyntaxException e) {
                        e.printStackTrace();
                    }//w  ww  .  j ava  2s .co  m
                }
            }
        }
    });
}