Example usage for java.awt Cursor HAND_CURSOR

List of usage examples for java.awt Cursor HAND_CURSOR

Introduction

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

Prototype

int HAND_CURSOR

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

Click Source Link

Document

The hand cursor type.

Usage

From source file:com.mirth.connect.client.ui.codetemplate.CodeTemplateImportDialog.java

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

    topPanel = new JPanel();
    topPanel.setBackground(getBackground());

    linkPanel = new JPanel();
    linkPanel.setBackground(topPanel.getBackground());

    linkLeftPanel = new JPanel();
    linkLeftPanel.setBackground(linkPanel.getBackground());

    linkLeftSelectAllLabel = new JLabel("<html><u>All</u></html>");
    linkLeftSelectAllLabel.setForeground(Color.BLUE);
    linkLeftSelectAllLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
    linkLeftSelectAllLabel.addMouseListener(new MouseAdapter() {
        public void mouseReleased(MouseEvent evt) {
            for (int row = 0; row < importTreeTable.getRowCount(); row++) {
                importTreeTable.getModel().setValueAt(true, row, IMPORT_SELECTED_COLUMN);
            }/* ww  w .  ja v  a2  s .co m*/
        }
    });

    linkLeftDeselectAllLabel = new JLabel("<html><u>None</u></html>");
    linkLeftDeselectAllLabel.setForeground(Color.BLUE);
    linkLeftDeselectAllLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
    linkLeftDeselectAllLabel.addMouseListener(new MouseAdapter() {
        public void mouseReleased(MouseEvent evt) {
            for (int row = 0; row < importTreeTable.getRowCount(); row++) {
                importTreeTable.getModel().setValueAt(false, row, IMPORT_SELECTED_COLUMN);
            }
        }
    });

    linkRightPanel = new JPanel();
    linkRightPanel.setBackground(linkPanel.getBackground());

    linkRightOverwriteAllLabel = new JLabel("<html><u>All</u></html>");
    linkRightOverwriteAllLabel.setForeground(Color.BLUE);
    linkRightOverwriteAllLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
    linkRightOverwriteAllLabel.addMouseListener(new MouseAdapter() {
        public void mouseReleased(MouseEvent evt) {
            for (int row = 0; row < importTreeTable.getRowCount(); row++) {
                TreePath path = importTreeTable.getPathForRow(row);
                if (path != null) {
                    ImportTreeTableNode node = (ImportTreeTableNode) path.getLastPathComponent();
                    if (node instanceof ImportLibraryTreeTableNode) {
                        ImportLibraryTreeTableNode libraryNode = (ImportLibraryTreeTableNode) node;
                        if (libraryNode.getConflicts().getMatchingLibrary() != null) {
                            importTreeTable.getModel().setValueAt(true, row, IMPORT_OVERWRITE_COLUMN);
                        }
                    } else if (node instanceof ImportCodeTemplateTreeTableNode) {
                        ImportCodeTemplateTreeTableNode codeTemplateNode = (ImportCodeTemplateTreeTableNode) node;
                        if (codeTemplateNode.getConflicts().getMatchingCodeTemplate() != null) {
                            importTreeTable.getModel().setValueAt(true, row, IMPORT_OVERWRITE_COLUMN);
                        }
                    }
                }
            }
        }
    });

    linkRightOverwriteNoneLabel = new JLabel("<html><u>None</u></html>");
    linkRightOverwriteNoneLabel.setForeground(Color.BLUE);
    linkRightOverwriteNoneLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
    linkRightOverwriteNoneLabel.addMouseListener(new MouseAdapter() {
        public void mouseReleased(MouseEvent evt) {
            for (int row = 0; row < importTreeTable.getRowCount(); row++) {
                TreePath path = importTreeTable.getPathForRow(row);
                if (path != null) {
                    ImportTreeTableNode node = (ImportTreeTableNode) path.getLastPathComponent();
                    if (node instanceof ImportLibraryTreeTableNode) {
                        ImportLibraryTreeTableNode libraryNode = (ImportLibraryTreeTableNode) node;
                        if (libraryNode.getConflicts().getMatchingLibrary() != null) {
                            importTreeTable.getModel().setValueAt(false, row, IMPORT_OVERWRITE_COLUMN);
                        }
                    } else if (node instanceof ImportCodeTemplateTreeTableNode) {
                        ImportCodeTemplateTreeTableNode codeTemplateNode = (ImportCodeTemplateTreeTableNode) node;
                        if (codeTemplateNode.getConflicts().getMatchingCodeTemplate() != null) {
                            importTreeTable.getModel().setValueAt(false, row, IMPORT_OVERWRITE_COLUMN);
                        }
                    }
                }
            }
        }
    });

    final TableCellEditor templateCellEditor = new NameCellEditor();

    importTreeTable = new JXTreeTable() {
        @Override
        public boolean isCellEditable(int row, int column) {
            return (column == IMPORT_OVERWRITE_COLUMN || column == IMPORT_SELECTED_COLUMN
                    || column == IMPORT_NAME_COLUMN);
        }

        @Override
        public TableCellEditor getCellEditor(int row, int column) {
            if (isHierarchical(column)) {
                return templateCellEditor;
            } else {
                return super.getCellEditor(row, column);
            }
        }
    };

    importTreeTable.setLargeModel(true);
    DefaultTreeTableModel model = new ImportTreeTableModel();
    model.setColumnIdentifiers(Arrays.asList(new String[] { "", "Name", "Overwrite", "Conflicts", "Id" }));

    DefaultMutableTreeTableNode rootNode = new DefaultMutableTreeTableNode();
    model.setRoot(rootNode);
    importTreeTable.setTreeTableModel(model);

    Set<String> addedCodeTemplateIds = new HashSet<String>();

    if (unassignedCodeTemplates) {
        ImportTreeTableNode libraryNode = new ImportUnassignedLibraryTreeTableNode("Select a library", "");
        CodeTemplateLibrary library = importLibraries.get(0);

        for (CodeTemplate codeTemplate : library.getCodeTemplates()) {
            if (!addedCodeTemplateIds.contains(codeTemplate.getId())) {
                libraryNode
                        .add(new ImportCodeTemplateTreeTableNode(codeTemplate.getName(), codeTemplate.getId()));
                addedCodeTemplateIds.add(codeTemplate.getId());
                importCodeTemplateMap.put(codeTemplate.getId(), codeTemplate);
            }
        }

        rootNode.add(libraryNode);
    } else {
        Set<String> addedLibraryIds = new HashSet<String>();

        for (CodeTemplateLibrary library : importLibraries) {
            if (!addedLibraryIds.contains(library.getId())) {
                ImportTreeTableNode libraryNode = new ImportLibraryTreeTableNode(library.getName(),
                        library.getId());
                importLibraryMap.put(library.getId(), library);

                for (CodeTemplate codeTemplate : library.getCodeTemplates()) {
                    if (!addedCodeTemplateIds.contains(codeTemplate.getId())) {
                        libraryNode.add(new ImportCodeTemplateTreeTableNode(codeTemplate.getName(),
                                codeTemplate.getId()));
                        addedCodeTemplateIds.add(codeTemplate.getId());
                        importCodeTemplateMap.put(codeTemplate.getId(), codeTemplate);
                    }
                }

                rootNode.add(libraryNode);
                addedLibraryIds.add(library.getId());
            }
        }
    }

    importTreeTable.setOpenIcon(null);
    importTreeTable.setClosedIcon(null);
    importTreeTable.setLeafIcon(null);
    importTreeTable.setRootVisible(false);
    importTreeTable.setDoubleBuffered(true);
    importTreeTable.setDragEnabled(false);
    importTreeTable.setRowSelectionAllowed(true);
    importTreeTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    importTreeTable.setRowHeight(UIConstants.ROW_HEIGHT);
    importTreeTable.setFocusable(true);
    importTreeTable.setOpaque(true);
    importTreeTable.getTableHeader().setReorderingAllowed(false);
    importTreeTable.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
    importTreeTable.setEditable(true);
    importTreeTable.setSortable(false);
    importTreeTable.setAutoCreateColumnsFromModel(false);
    importTreeTable.setShowGrid(true, true);

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

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

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

        private void checkSelection(MouseEvent evt) {
            int row = importTreeTable.rowAtPoint(new Point(evt.getX(), evt.getY()));

            if (row < 0) {
                importTreeTable.clearSelection();
            }
        }
    });

    importTreeTable.addTreeWillExpandListener(new TreeWillExpandListener() {
        @Override
        public void treeWillExpand(TreeExpansionEvent event) throws ExpandVetoException {
        }

        @Override
        public void treeWillCollapse(TreeExpansionEvent event) throws ExpandVetoException {
            throw new ExpandVetoException(event);
        }
    });

    importTreeTable.setTreeCellRenderer(new NameCellRenderer());

    importTreeTable.getModel().addTableModelListener(new TableModelListener() {
        @Override
        public void tableChanged(TableModelEvent evt) {
            if (evt.getColumn() != IMPORT_CONFLICTS_COLUMN) {
                for (int row = evt.getFirstRow(); row <= evt.getLastRow()
                        && row < importTreeTable.getRowCount(); row++) {
                    TreePath path = importTreeTable.getPathForRow(row);
                    if (path != null) {
                        ImportTreeTableNode node = (ImportTreeTableNode) path.getLastPathComponent();

                        if (path.getPathCount() == 2) {
                            if (node instanceof ImportUnassignedLibraryTreeTableNode) {
                                String libraryName = (String) node.getValueAt(IMPORT_NAME_COLUMN);
                                String libraryId = null;
                                for (CodeTemplateLibrary library : PlatformUI.MIRTH_FRAME.codeTemplatePanel
                                        .getCachedCodeTemplateLibraries().values()) {
                                    if (library.getName().equals(libraryName)) {
                                        libraryId = library.getId();
                                        break;
                                    }
                                }
                                node.setValueAt(libraryId, IMPORT_ID_COLUMN);
                            } else if (node instanceof ImportLibraryTreeTableNode) {
                                ImportLibraryTreeTableNode libraryNode = (ImportLibraryTreeTableNode) node;
                                libraryNode.setConflicts(getLibraryConflicts(node));
                            }

                            for (Enumeration<? extends TreeTableNode> codeTemplateNodes = node
                                    .children(); codeTemplateNodes.hasMoreElements();) {
                                ImportCodeTemplateTreeTableNode codeTemplateNode = (ImportCodeTemplateTreeTableNode) codeTemplateNodes
                                        .nextElement();
                                codeTemplateNode.setConflicts(getCodeTemplateConflicts(codeTemplateNode));
                            }

                            importTreeTable.updateUI();
                        } else if (path.getPathCount() == 3) {
                            ImportCodeTemplateTreeTableNode codeTemplateNode = (ImportCodeTemplateTreeTableNode) node;
                            codeTemplateNode.setConflicts(getCodeTemplateConflicts(node));
                        }
                    }
                }
            }

            updateImportButton();
            updateErrorsAndWarnings();
        }
    });

    importTreeTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent evt) {
            if (!evt.getValueIsAdjusting()) {
                updateImportButton();
                updateErrorsAndWarnings();
            }
        }
    });

    importTreeTable.expandAll();

    importTreeTable.getColumnModel().getColumn(IMPORT_SELECTED_COLUMN).setMinWidth(20);
    importTreeTable.getColumnModel().getColumn(IMPORT_SELECTED_COLUMN).setMaxWidth(20);
    importTreeTable.getColumnModel().getColumn(IMPORT_SELECTED_COLUMN)
            .setCellRenderer(new ImportSelectedCellRenderer());
    importTreeTable.getColumnModel().getColumn(IMPORT_SELECTED_COLUMN)
            .setCellEditor(new ImportSelectedCellEditor());

    importTreeTable.getColumnModel().getColumn(IMPORT_OVERWRITE_COLUMN).setMinWidth(60);
    importTreeTable.getColumnModel().getColumn(IMPORT_OVERWRITE_COLUMN).setMaxWidth(60);
    importTreeTable.getColumnModel().getColumn(IMPORT_OVERWRITE_COLUMN)
            .setCellRenderer(new OverwriteCellRenderer());
    importTreeTable.getColumnModel().getColumn(IMPORT_OVERWRITE_COLUMN)
            .setCellEditor(new OverwriteCellEditor());

    importTreeTable.getColumnModel().getColumn(IMPORT_CONFLICTS_COLUMN).setMinWidth(60);
    importTreeTable.getColumnModel().getColumn(IMPORT_CONFLICTS_COLUMN).setMaxWidth(60);
    importTreeTable.getColumnModel().getColumn(IMPORT_CONFLICTS_COLUMN).setCellRenderer(new IconCellRenderer());

    importTreeTable.getColumnModel().removeColumn(importTreeTable.getColumnModel().getColumn(IMPORT_ID_COLUMN));

    importTreeTableScrollPane = new JScrollPane(importTreeTable);
    importTreeTableScrollPane.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, new Color(0x6E6E6E)));

    warningsPanel = new JPanel();
    warningsPanel.setBackground(getBackground());
    warningsPanel.setVisible(false);

    warningsLabel = new JLabel(UIConstants.ICON_WARNING);

    warningsTextArea = new JTextArea();
    warningsTextArea.setLineWrap(true);
    warningsTextArea.setWrapStyleWord(true);

    errorsPanel = new JPanel();
    errorsPanel.setBackground(getBackground());
    errorsPanel.setVisible(false);

    errorsLabel = new JLabel(UIConstants.ICON_ERROR);

    errorsTextArea = new JTextArea();
    errorsTextArea.setLineWrap(true);
    errorsTextArea.setWrapStyleWord(true);

    separator = new JSeparator();

    buttonPanel = new JPanel();
    buttonPanel.setBackground(getBackground());

    importButton = new JButton("Import");
    importButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            try {
                boolean warnings = false;
                for (Enumeration<? extends TreeTableNode> libraryNodes = ((TreeTableNode) importTreeTable
                        .getTreeTableModel().getRoot()).children(); libraryNodes.hasMoreElements();) {
                    for (Enumeration<? extends TreeTableNode> codeTemplateNodes = libraryNodes.nextElement()
                            .children(); codeTemplateNodes.hasMoreElements();) {
                        ImportCodeTemplateTreeTableNode codeTemplateNode = (ImportCodeTemplateTreeTableNode) codeTemplateNodes
                                .nextElement();

                        if ((boolean) codeTemplateNode.getValueAt(IMPORT_SELECTED_COLUMN)) {
                            CodeTemplateConflicts conflicts = codeTemplateNode.getConflicts();
                            if (conflicts.getMatchingCodeTemplate() != null) {
                                warnings = true;
                                break;
                            }
                        }
                    }

                    if (warnings) {
                        break;
                    }
                }

                if (!warnings || PlatformUI.MIRTH_FRAME.alertOption(CodeTemplateImportDialog.this,
                        "Some selected rows have warnings. Are you sure you wish to continue?")) {
                    save();
                    dispose();
                }
            } catch (Exception e) {
                PlatformUI.MIRTH_FRAME.alertThrowable(CodeTemplateImportDialog.this, e,
                        "Unable to import: " + e.getMessage());
            }
        }
    });

    cancelButton = new JButton("Cancel");
    cancelButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            if (confirmClose()) {
                dispose();
            }
        }
    });

    updateImportButton();
}

From source file:ca.canuckcoding.wosqi.FeedViewer.java

public FeedViewer(java.awt.Frame parent, WebOSConnection wc, PackageManager pm) {
    super(parent);
    bundle = WebOSQuickInstallApp.bundle;
    URL bgURL = getClass().getResource("resources/background2.jpg");
    background = new ImageIcon(bgURL).getImage();
    initComponents();/*from  w w  w .j a va  2  s .  c  o m*/
    loaded = false;
    UNKNOWN_VALUE = bundle.getString("UNKNOWN");
    NO_SCREENSHOT = jLabel1.getIcon();
    TAB_FILTER = new PackageFilter[] { PackageFilter.Applications, PackageFilter.Services,
            PackageFilter.Plugins, PackageFilter.Linux_Apps, PackageFilter.Linux_Daemons, PackageFilter.Kernels,
            PackageFilter.Patches, PackageFilter.Themes };
    CATEGORY = new JComboBox[] { jComboBox1, jComboBox2, jComboBox3, jComboBox4, jComboBox9, jComboBox5,
            jComboBox6, jComboBox7 };
    SEARCH = new JTextField[] { jTextField1, jTextField2, jTextField3, jTextField4, jTextField9, jTextField5,
            jTextField6, jTextField7 };
    LIST = new JList[] { jList1, jList2, jList3, jList4, jList9, jList5, jList6, jList7, jList8 };
    NAME = new JLabel[] { jLabel2, jLabel13, jLabel24, jLabel35, jLabel90, jLabel46, jLabel57, jLabel68,
            jLabel79 };
    VERSION = new JLabel[] { jLabel5, jLabel16, jLabel27, jLabel38, jLabel93, jLabel49, jLabel60, jLabel71,
            jLabel82 };
    DEVELOPER = new JLabel[] { jLabel9, jLabel20, jLabel31, jLabel42, jLabel97, jLabel53, jLabel64, jLabel75,
            jLabel86 };
    LASTUPDATED = new JLabel[] { jLabel6, jLabel17, jLabel28, jLabel39, jLabel94, jLabel50, jLabel61, jLabel72,
            jLabel83 };
    SCREENSHOT = new JLabel[] { jLabel1, jLabel12, jLabel23, jLabel34, jLabel89, jLabel45, jLabel56, jLabel67,
            jLabel78 };
    LICENSE = new JLabel[] { jLabel10, jLabel21, jLabel32, jLabel43, jLabel98, jLabel54, jLabel65, jLabel76,
            jLabel87 };
    FEED = new JLabel[] { jLabel7, jLabel19, jLabel30, jLabel41, jLabel96, jLabel52, jLabel63, jLabel74,
            jLabel85 };
    DESCRIPTION_LABEL = new JLabel[] { jLabel8, jLabel18, jLabel29, jLabel40, jLabel95, jLabel51, jLabel62,
            jLabel73, jLabel84 };
    HOMEPAGE = new JLabel[] { jLabel11, jLabel22, jLabel33, jLabel44, jLabel99, jLabel55, jLabel66, jLabel77,
            jLabel88 };
    LICENSE_LABEL = new JLabel[] { jLabel3, jLabel15, jLabel26, jLabel37, jLabel92, jLabel48, jLabel59,
            jLabel70, jLabel81 };
    FEED_LABEL = new JLabel[] { jLabel4, jLabel14, jLabel25, jLabel36, jLabel91, jLabel47, jLabel58, jLabel69,
            jLabel80 };
    DESCRIPTION = new JTextPane[] { jTextPane1, jTextPane2, jTextPane3, jTextPane4, jTextPane9, jTextPane5,
            jTextPane6, jTextPane7, jTextPane8 };
    INSTALL_BUTTON = new JButton[] { jButton2, jButton4, jButton6, jButton8, jButton18, jButton10, jButton12,
            jButton14, jButton16 };
    packages = new ArrayList[9];
    filtered = new ArrayList[9];
    selected = new PackageEntry[9];
    webOS = wc;
    pkgMgr = pm;
    t = new Timer();
    if (!webOS.isConnected()) {
        DeviceInfo info = webOS.getDeviceInfo();
        if (info != null && !info.model().equals(DeviceInfo.Model.Unknown.toString())) {
            JOptionPane.showMessageDialog(rootPane,
                    MessageFormat.format(
                            bundle.getString("{0}_IS_DISCONNECTED._PLEASE_RECONNECT_THEN_TRY_AGAIN."),
                            new Object[] { info.model() }));
        } else {
            JOptionPane.showMessageDialog(rootPane,
                    bundle.getString("DEVICE_IS_DISCONNECTED._PLEASE_RECONNECT_THEN_TRY_AGAIN."));
        }
        t.schedule(new DoDispose(), 200);
    } else {
        for (int i = 0; i < HOMEPAGE.length; i++) {
            HOMEPAGE[i].setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        }
        for (int i = 0; i < NAME.length; i++) {
            NAME[i].setVisible(false);
        }
        t.schedule(new DoLoad(), 200);
    }
}

From source file:org.ut.biolab.medsavant.client.view.Menu.java

public void addSection(SectionView section) {

    final JPanel sectionPanel = ViewUtil.getClearPanel();
    sectionPanel.setLayout(new BoxLayout(sectionPanel, BoxLayout.Y_AXIS));
    sectionPanel.setVisible(false);//from  w w w .  j  a v a 2 s.c o m

    //HoverButton sectionButton = new SectionButton(section, sectionPanel);
    //sectionButton.setSelectedColor(ViewUtil.getSecondaryMenuColor());

    final JToggleButton sectionButton = ViewUtil.getTogglableIconButton(section.getIcon());
    sectionButton.setName(section.getName());
    sectionButton.setCursor(new Cursor(Cursor.HAND_CURSOR));
    sectionButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent ae) {
            primaryMenuButtons.setSelected(sectionButton.getModel(), true);
            if (previousSectionPanel != null) {
                previousSectionPanel.setVisible(false);
            }
            // Act as if we clicked the first sub-section button.
            ((SubSectionButton) sectionPanel.getComponent(0)).subSectionClicked();
            sectionPanel.setVisible(true);

            previousSectionPanel = sectionPanel;
            primaryMenu.invalidate();
        }
    });

    ButtonGroup subSectionsGroup = new ButtonGroup();

    for (SubSectionView v : section.getSubSections()) {
        subSectionViews.add(v);

        SubSectionButton subSectionButton = new SubSectionButton(v, subSectionsGroup);
        sectionPanel.add(subSectionButton);
        subSectionsGroup.add(subSectionButton);

        map.put(v, subSectionButton);
    }

    primaryMenuButtons.add(sectionButton);

    sectionPanel.add(Box.createVerticalStrut(50));

    secondaryMenu.add(sectionPanel);

    primaryMenuSectionButtonContainer.add(ViewUtil.subTextComponent(sectionButton, section.getName()));
    primaryMenuSectionButtonContainer.add(ViewUtil.getLargeSeparator());

}

From source file:com.apatar.ui.JPublishToApatarDialog.java

private void createDialog() {

    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();

    this.setLayout(gridbag);

    c.gridwidth = GridBagConstraints.REMAINDER;
    c.weightx = 1.0;/*from w w w  .  j  a  va  2s.c om*/
    c.weighty = 0.0;
    c.fill = GridBagConstraints.HORIZONTAL;
    //c.insets = new Insets(5, 5, 5, 5);

    JPanel panelLogin = new JPanel();
    panelLogin.setBorder(new EmptyBorder(10, 10, 0, 10));
    panelLogin.setLayout(new BoxLayout(panelLogin, BoxLayout.X_AXIS));
    panelLogin.add(new JLabel("User Name"));
    panelLogin.add(Box.createHorizontalStrut(5));
    panelLogin.add(username);
    username.setComponentPopupMenu(new JDefaultContextMenu(username));
    panelLogin.add(Box.createHorizontalStrut(5));
    panelLogin.add(new JLabel("Password"));
    panelLogin.add(Box.createHorizontalStrut(5));
    panelLogin.add(password);

    JPanel panelForgotPassLink = new JPanel();
    panelForgotPassLink.setBorder(new EmptyBorder(10, 10, 0, 10));
    panelForgotPassLink.setLayout(new BoxLayout(panelForgotPassLink, BoxLayout.X_AXIS));
    panelForgotPassLink.add(new JLabel("Lost your password? "));
    panelForgotPassLink.add(Box.createHorizontalStrut(5));
    panelForgotPassLink.add(forgotPassLinkLabel);

    forgotPassLinkLabel.setFont(UiUtils.NORMAL_SIZE_12_FONT);
    forgotPassLinkLabel.addMouseListener(new MouseHyperLinkEvent());
    forgotPassLinkLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    forgotPassLinkLabel.setText(
            "<html><a href='http://www.apatarforge.org/profile/lostpassword.html'>Click here to retrieve it</a></html>");

    JPanel panelFile = new JPanel();
    panelFile.setBorder(new EmptyBorder(10, 10, 0, 10));
    panelFile.setLayout(new BoxLayout(panelFile, BoxLayout.X_AXIS));
    panelFile.add(selectFromFile);
    panelFile.add(Box.createHorizontalStrut(5));
    panelFile.add(new JLabel("New File "));
    panelFile.add(Box.createHorizontalStrut(5));
    panelFile.add(nameFile);
    panelFile.add(Box.createHorizontalStrut(5));
    panelFile.add(browse);
    nameFile.setEnabled(false);
    nameFile.setComponentPopupMenu(new JDefaultContextMenu(nameFile));
    browse.setEnabled(false);

    JPanel panelLocation = new JPanel();
    panelLocation.setBorder(new EmptyBorder(10, 10, 0, 10));
    panelLocation.setLayout(new BoxLayout(panelLocation, BoxLayout.X_AXIS));
    panelLocation.add(new JLabel("Suggest Location:"));
    panelLocation.add(Box.createHorizontalStrut(5));
    panelLocation.add(location);

    JPanel panelDMName = new JPanel();
    panelDMName.setBorder(new EmptyBorder(10, 10, 0, 10));
    panelDMName.setLayout(new BoxLayout(panelDMName, BoxLayout.X_AXIS));
    JLabel datamapNameLabel = new JLabel("DataMap Name:");
    datamapNameLabel.setBorder(new EmptyBorder(0, 0, 0, 10));
    panelDMName.add(datamapNameLabel);
    panelDMName.add(Box.createHorizontalStrut(5));
    panelDMName.add(dataMapName);
    dataMapName.setComponentPopupMenu(new JDefaultContextMenu(dataMapName));

    JPanel panelDMDescription = new JPanel();
    panelDMDescription.setBorder(new EmptyBorder(10, 10, 0, 10));
    panelDMDescription.setLayout(new BoxLayout(panelDMDescription, BoxLayout.X_AXIS));
    panelDMDescription.add(new JLabel("DataMap Description (16000 Chars)"));
    panelDMDescription.add(Box.createHorizontalStrut(5));
    //JScrollPane scroll = new JScrollPane(dataMapDescription);
    //scroll.setSize(300, 50);
    dataMapDescription.setLineWrap(true);
    dataMapDescription.setWrapStyleWord(true);
    panelDMDescription.add(new JScrollPane(dataMapDescription));

    JPanel panelDMShortDescription = new JPanel();
    panelDMShortDescription.setBorder(new EmptyBorder(10, 10, 0, 10));
    panelDMShortDescription.setLayout(new BoxLayout(panelDMShortDescription, BoxLayout.X_AXIS));
    JLabel labelShort = new JLabel("Short Description:");
    labelShort.setBorder(new EmptyBorder(0, 0, 0, 85));
    panelDMShortDescription.add(labelShort);
    panelDMShortDescription.add(Box.createHorizontalStrut(5));
    shortDescription.setLineWrap(true);
    shortDescription.setWrapStyleWord(true);
    panelDMShortDescription.add(new JScrollPane(shortDescription));
    setEnableShortDescription(false);

    // -------------

    JPanel panelTitleForTags = new JPanel();
    panelTitleForTags.setBorder(new EmptyBorder(10, 10, 0, 10));
    panelTitleForTags.setLayout(new BoxLayout(panelTitleForTags, BoxLayout.X_AXIS));
    panelTitleForTags.add(new JLabel("Add tags associated with your DataMap:"));

    // -------------

    JPanel panelListAddedTags = new JPanel();
    panelListAddedTags.setBorder(new EmptyBorder(0, 10, 10, 10));
    panelListAddedTags.setLayout(new BoxLayout(panelListAddedTags, BoxLayout.X_AXIS));

    // --
    JPanel panelFrom = new JPanel();
    panelFrom.setLayout(new BoxLayout(panelFrom, BoxLayout.Y_AXIS));
    JPanel panelMiddle = new JPanel();
    panelMiddle.setLayout(new BoxLayout(panelMiddle, BoxLayout.X_AXIS));
    JPanel panelTo = new JPanel();
    panelTo.setLayout(new BoxLayout(panelTo, BoxLayout.Y_AXIS));

    // --
    JPanel panelAddNewTag = new JPanel();
    panelAddNewTag.setLayout(new BoxLayout(panelAddNewTag, BoxLayout.X_AXIS));
    panelAddNewTag.add(new JLabel("Add new tag:"));
    panelAddNewTag.add(Box.createHorizontalStrut(5));
    textfieldAddNewTag = new JTextField();
    textfieldAddNewTag.setComponentPopupMenu(new JDefaultContextMenu(textfieldAddNewTag));
    panelAddNewTag.add(textfieldAddNewTag);
    panelAddNewTag.add(Box.createHorizontalStrut(5));
    JButton buttonAddTag = new JButton("Add");
    buttonAddTag.addActionListener(addNewTagMouseListener);
    panelAddNewTag.add(buttonAddTag);

    // --
    JPanel panelDeleteTags = new JPanel();
    panelDeleteTags.setLayout(new BoxLayout(panelDeleteTags, BoxLayout.X_AXIS));

    panelDeleteTags.add(new JLabel("Delete selected tag(s):"));
    panelDeleteTags.add(Box.createHorizontalStrut(5));
    JButton buttonDeleteTag = new JButton("Delete");
    buttonDeleteTag.addActionListener(deleteTagMouseListener);
    panelDeleteTags.add(buttonDeleteTag);
    panelDeleteTags.add(new JPanel());

    // --

    JButton moveTag = new JButton(UiUtils.ARROW_ICON);
    moveTag.addActionListener(addTagsMouseListener);
    panelMiddle.add(moveTag);

    tblModelFrom = new DefaultTableModel();
    tblModelTo = new DefaultTableModel();
    tblModelFrom.addColumn("Tag Name");
    tblModelTo.addColumn("Tag Name");

    tagsTableFrom = new JTable(tblModelFrom);
    tagsTableTo = new JTable(tblModelTo);

    tagsTableFrom.setOpaque(false);
    tagsTableFrom.setBackground(null);
    tagsTableFrom.setBorder(null);
    tagsTableFrom.setShowGrid(false);

    tagsTableTo.setOpaque(false);
    tagsTableTo.setBackground(null);
    tagsTableTo.setBorder(null);
    tagsTableTo.setShowGrid(false);

    tagsTableFrom.getColumn("Tag Name").setCellEditor(new CellEditor(new JTextField()));
    tagsTableTo.getColumn("Tag Name").setCellEditor(new CellEditor(new JTextField()));

    fillTableTags();

    tagsTableFrom.setComponentPopupMenu(new JDefaultContextMenu(tagsTableFrom));
    tagsTableTo.setComponentPopupMenu(new JDefaultContextMenu(tagsTableTo));

    JScrollPane srollPane = new JScrollPane(tagsTableFrom);
    srollPane.setBorder(null);

    JScrollPane srollPane2 = new JScrollPane(tagsTableTo);
    srollPane.setBorder(null);

    panelFrom.add(srollPane);
    panelFrom.add(Box.createVerticalStrut(5));
    panelFrom.add(panelAddNewTag);

    panelTo.add(srollPane2);
    panelTo.add(Box.createVerticalStrut(5));
    panelTo.add(panelDeleteTags);

    panelListAddedTags.add(panelFrom);
    panelListAddedTags.add(Box.createHorizontalStrut(5));
    panelListAddedTags.add(panelMiddle);
    panelListAddedTags.add(Box.createHorizontalStrut(5));
    panelListAddedTags.add(panelTo);

    // -------

    JPanel panelButton = new JPanel();
    panelButton.setLayout(new BoxLayout(panelButton, BoxLayout.X_AXIS));
    panelButton.add(Box.createHorizontalGlue());
    panelButton.add(bOk);
    panelButton.add(Box.createHorizontalStrut(5));
    panelButton.add(bCancel);
    panelButton.add(Box.createHorizontalStrut(5));

    ComponentBuilder.makeComponent(new JCommentPanel(), gridbag, c, getContentPane());

    ComponentBuilder.makeComponent(panelLogin, gridbag, c, getContentPane());
    ComponentBuilder.makeComponent(panelForgotPassLink, gridbag, c, getContentPane());
    ComponentBuilder.makeComponent(panelFile, gridbag, c, getContentPane());
    ComponentBuilder.makeComponent(panelLocation, gridbag, c, getContentPane());
    ComponentBuilder.makeComponent(panelDMName, gridbag, c, getContentPane());

    c.fill = GridBagConstraints.BOTH;

    c.weighty = 2.0;
    ComponentBuilder.makeComponent(panelDMDescription, gridbag, c, getContentPane());

    c.weighty = 0.0;
    ComponentBuilder.makeComponent(autoGenerateShortDescription, gridbag, c, getContentPane());

    c.weighty = 1.0;
    ComponentBuilder.makeComponent(panelDMShortDescription, gridbag, c, getContentPane());

    c.weighty = 1.0;
    ComponentBuilder.makeComponent(panelTitleForTags, gridbag, c, getContentPane());

    c.weighty = 3.0;
    ComponentBuilder.makeComponent(panelListAddedTags, gridbag, c, getContentPane());

    c.weighty = 0.0;
    ComponentBuilder.makeComponent(new JSeparator(), gridbag, c, getContentPane());

    c.weighty = 1.0;
    ComponentBuilder.makeComponent(panelButton, gridbag, c, getContentPane());
}

From source file:org.apache.cayenne.swing.components.textpane.JCayenneTextPane.java

public String getToolTipText(MouseEvent e) {

    if (e.getPoint().y > endYPositionToolTip && e.getPoint().y < startYPositionToolTip && imageError) {
        setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        String htmlText = getTooltipTextError().replaceAll("\n", "<br>&nbsp;").replaceAll("\t", "&nbsp;")
                .replaceAll("\r", "<br>&nbsp;");

        return "<HTML>" + "<body bgcolor='#FFEBCD' text='black'>" + htmlText + "</body>";
    } else {//  w ww.j av a  2s  .  c o m
        setCursor(Cursor.getDefaultCursor());
        return null;
    }
}

From source file:org.apache.jmeter.gui.MainFrame.java

/**
 * Create a new JMeter frame.// w w  w.j  a  va 2  s. c  om
 *
 * @param treeModel
 *            the model for the test tree
 * @param treeListener
 *            the listener for the test tree
 */
public MainFrame(TreeModel treeModel, JMeterTreeListener treeListener) {

    // TODO: Make the running indicator its own class instead of a JButton
    runningIndicator = new JButton(stoppedIcon);
    runningIndicator.setFocusable(false);
    runningIndicator.setBorderPainted(false);
    runningIndicator.setContentAreaFilled(false);
    runningIndicator.setMargin(new Insets(0, 0, 0, 0));

    testTimeDuration = new JLabel("00:00:00"); //$NON-NLS-1$
    testTimeDuration.setToolTipText(JMeterUtils.getResString("duration_tooltip")); //$NON-NLS-1$
    testTimeDuration
            .setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

    totalThreads = new JLabel("0"); // $NON-NLS-1$
    totalThreads.setToolTipText(JMeterUtils.getResString("total_threads_tooltip")); // $NON-NLS-1$

    activeThreads = new JLabel("0"); // $NON-NLS-1$
    activeThreads.setToolTipText(JMeterUtils.getResString("active_threads_tooltip")); // $NON-NLS-1$

    warnIndicator = new JButton(warningIcon);
    warnIndicator.setMargin(new Insets(0, 0, 0, 0));
    // Transparent JButton with no border
    warnIndicator.setOpaque(false);
    warnIndicator.setContentAreaFilled(false);
    warnIndicator.setBorderPainted(false);
    warnIndicator.setCursor(new Cursor(Cursor.HAND_CURSOR));
    warnIndicator.setToolTipText(JMeterUtils.getResString("error_indicator_tooltip")); // $NON-NLS-1$
    warnIndicator.addActionListener(this);

    errorsOrFatalsLabel = new JLabel("0"); // $NON-NLS-1$
    errorsOrFatalsLabel.setToolTipText(JMeterUtils.getResString("error_indicator_tooltip")); // $NON-NLS-1$

    tree = makeTree(treeModel, treeListener);

    GuiPackage.getInstance().setMainFrame(this);
    init();
    initTopLevelDndHandler();
    setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
}

From source file:io.github.jeddict.jpa.modeler.widget.attribute.AttributeWidget.java

protected void addOpenSourceCodeAction() {
    this.getImageWidget().setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    this.getImageWidget().getActions()
            .addAction(new OpenSourceCodeAction(() -> this.getClassWidget().getFileObject(),
                    this.getBaseElementSpec(), this.getModelerScene().getModelerFile()));
}

From source file:gg.pistol.sweeper.gui.component.DecoratedPanel.java

/**
 * Helper factory method for creating clickable links.
 *
 * @param linkText/*from   ww w. j  a v  a  2 s.com*/
 *         a string that will be displayed as a link
 * @param action
 *         the action performed at click
 * @return the link component
 */
protected JComponent createLink(String linkText, final Runnable action) {
    Preconditions.checkNotNull(linkText);
    Preconditions.checkNotNull(action);

    JLabel link = new JLabel("<html><a href=''>" + linkText + "</a></html>");
    link.setComponentOrientation(ComponentOrientation.getOrientation(i18n.getLocale()));
    link.setCursor(new Cursor(Cursor.HAND_CURSOR));
    link.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            action.run();
        }
    });
    return link;
}

From source file:ca.phon.app.session.editor.view.segmentation.SegmentationEditorView.java

private void updateParticipantPanel() {
    participantPanel.removeAll();/*from w  w  w .java2  s.  c o  m*/

    // setup layout
    String colLayout = "fill:default";
    String rowLayout = "pref, 5px";
    for (int i = 0; i <= getEditor().getSession().getParticipantCount(); i++) {
        rowLayout += ", pref, 5px";
    }
    FormLayout layout = new FormLayout(colLayout, rowLayout);
    participantPanel.setLayout(layout);
    CellConstraints cc = new CellConstraints();
    int currentRow = 1;

    String ksStr = (OSInfo.isMacOs() ? "\u2318" : "CTRL +") + "0";
    PhonUIAction noPartSegmentAct = new PhonUIAction(this, "performSegmentation", null);
    noPartSegmentAct.putValue(Action.NAME, ksStr + " speaker undefined");

    // setup labels to be used like buttons
    String segMsg = "Click name to create a new record:";
    JLabel segLbl = new JLabel(segMsg);

    participantPanel.add(segLbl, cc.xy(1, currentRow));
    currentRow += 2;

    JLabel noPartLbl = new JLabel();
    String noPartMsg = ksStr + " <no speaker>";
    noPartLbl.setText(noPartMsg);
    noPartLbl.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    noPartLbl.addMouseListener(new SegmentLabelMouseHandler());
    noPartLbl.setOpaque(false);
    participantPanel.add(noPartLbl, cc.xy(1, currentRow));
    currentRow += 2;

    final Session session = getEditor().getSession();
    int pIdx = 1;
    for (Participant p : session.getParticipants()) {
        ksStr = (OSInfo.isMacOs() ? "\u2318" : "CTRL +") + pIdx;

        final NewSegmentAction segmentAction = new NewSegmentAction(getEditor(), this, p);
        segmentAction.putValue(Action.NAME, ksStr + " " + p.toString());

        JLabel participantLbl = new JLabel();
        String participantStr = ksStr + " " + (p.getName() != null ? p.getName() : p.getId());
        participantLbl.setText(participantStr);
        participantLbl.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        participantLbl.addMouseListener(new SegmentLabelMouseHandler(p));
        participantLbl.setOpaque(false);
        participantPanel.add(participantLbl, cc.xy(1, currentRow));
        currentRow += 2;

        pIdx++;
    }
}

From source file:org.yccheok.jstock.gui.LoadFromCloudJDialog.java

private void jLabel5MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel5MouseEntered
    this.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
}