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:org.drugis.addis.gui.WelcomeDialog.java

private JButton createButton(String text, String icon, AbstractAction action) {
    JButton button = new JButton(text, Main.IMAGELOADER.getIcon(icon));
    button.setPreferredSize(new Dimension(BUTTON_WIDTH, COMP_HEIGHT));
    button.setHorizontalAlignment(SwingConstants.LEFT);
    button.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    button.addActionListener(action);//  w w w.  j a v  a  2  s .  co m
    return button;
}

From source file:view.ImagePanel.java

public void refreshSignatureValidationListPanels() {
    for (JPanel jp : panelList) {
        remove(jp);//from  w  w  w  .  j ava 2s  .  c  o m
    }

    if (buf == null) {
        return;
    }

    if (pdfDocument != null) {
        if (svList != null) {
            Point p = getImageLocation();
            for (final SignatureValidation sv : svList) {
                try {
                    int pgNumber = sv.getPosList().get(0).page - 1;
                    if (this.pageNumber == pgNumber) {
                        for (AcroFields.FieldPosition pos : sv.getPosList()) {
                            int p1 = (int) (p.x + (pos.position.getLeft() * scale));
                            int p2 = (int) (p.y
                                    + Math.floor((pdfDocument.getPage(pageNumber).getCropBox().getHeight()
                                            - pos.position.getTop()) * scale));
                            int p3 = (int) (pos.position.getWidth() * scale);
                            int p4 = (int) (pos.position.getHeight() * scale);

                            final JPanel jp1 = sv.getPanel();
                            jp1.setLocation(p1, p2);
                            jp1.setSize(p3, p4);

                            if (sv.equals(selectedSignature)) {
                                jp1.setBackground(new Color(0, 0, 0, 45));
                                jp1.setBorder(new LineBorder(Color.BLACK, 1));
                            } else {
                                jp1.setBackground(new Color(0, 0, 0, 0));
                                jp1.setBorder(null);
                            }

                            jp1.setVisible(true);
                            jp1.addMouseListener(new MouseAdapter() {
                                @Override
                                public void mouseEntered(java.awt.event.MouseEvent evt) {
                                    if (mainWindow.getWorkspacePanel()
                                            .getStatus() != WorkspacePanel.Status.SIGNING) {
                                        jp1.setCursor(new Cursor(Cursor.HAND_CURSOR));
                                        jp1.setBackground(new Color(0, 0, 0, 45));
                                        jp1.setBorder(new LineBorder(Color.BLACK, 1));
                                        repaint();
                                    } else {
                                        jp1.setCursor(null);
                                    }
                                }

                                @Override
                                public void mouseExited(java.awt.event.MouseEvent evt) {
                                    if (mainWindow.getWorkspacePanel()
                                            .getStatus() != WorkspacePanel.Status.SIGNING) {
                                        if (selectedSignature == null) {
                                            jp1.setBackground(new Color(0, 0, 0, 0));
                                            jp1.setBorder(null);
                                            repaint();
                                        } else if (!selectedSignature.equals(sv)) {
                                            jp1.setBackground(new Color(0, 0, 0, 0));
                                            jp1.setBorder(null);
                                            repaint();
                                        }
                                    }
                                }
                            });
                            panelList.add(jp1);
                            add(jp1);
                            repaint();
                        }
                    }
                } catch (Exception e) {
                }
            }
        }
    }
}

From source file:Proiect.uploadFTP.java

public void propFTP() {
    uploadFTP.setBackground(Encrypter.color_light);
    pan1.setBackground(Encrypter.color_light);
    pan1.setBorder(BorderFactory.createEmptyBorder(6, 5, 10, 5));
    pan2.setBackground(Encrypter.color_light);
    inpan1.setBackground(Encrypter.color_light);
    inpan2.setBackground(Encrypter.color_light);
    pan3.setBackground(Encrypter.color_light);
    pan4.setBackground(Encrypter.color_light);

    adress.setForeground(Encrypter.color_blue);
    user.setForeground(Encrypter.color_blue);
    pass.setForeground(Encrypter.color_blue);
    folder.setForeground(Encrypter.color_blue);
    filen.setForeground(Encrypter.color_blue);

    adressf.setBorder(BorderFactory.createMatteBorder(0, 0, 2, 0, Encrypter.color_dark));
    adressf.setSelectionColor(Encrypter.color_black);
    adressf.setSelectedTextColor(Encrypter.color_white);
    adressf.setBackground(Encrypter.color_light);

    userf.setBorder(BorderFactory.createMatteBorder(0, 0, 2, 0, Encrypter.color_dark));
    userf.setSelectionColor(Encrypter.color_black);
    userf.setSelectedTextColor(Encrypter.color_white);
    userf.setBackground(Encrypter.color_light);

    passf.setBorder(BorderFactory.createMatteBorder(0, 0, 2, 0, Encrypter.color_dark));
    passf.setSelectionColor(Encrypter.color_black);
    passf.setSelectedTextColor(Encrypter.color_white);
    passf.setBackground(Encrypter.color_light);

    folderf.setBorder(BorderFactory.createMatteBorder(0, 0, 2, 0, Encrypter.color_dark));
    folderf.setSelectionColor(Encrypter.color_black);
    folderf.setSelectedTextColor(Encrypter.color_white);
    folderf.setBackground(Encrypter.color_light);

    status.setHorizontalAlignment(SwingConstants.RIGHT);

    ImageIcon title_icon = getImageIcon("assets/icons/upload.png");
    titleFTP.setForeground(Encrypter.color_blue);
    titleFTP.setFont(Encrypter.font16);//w w  w.j  a  va2s . c  o  m
    titleFTP.setIcon(title_icon);

    connect.setBackground(Encrypter.color_light);
    connect.setBorder(BorderFactory.createEmptyBorder());
    connect.setForeground(Encrypter.color_black);
    connect.setFont(Encrypter.font16);
    connect.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    connect.setToolTipText("Transfer File");

    browsef.setBackground(Encrypter.color_light);
    browsef.setBorder(BorderFactory.createEmptyBorder());
    browsef.setForeground(Encrypter.color_black);
    browsef.setFont(Encrypter.font16);
    browsef.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    browsef.setToolTipText("Add file");

    ImageIcon exit_icon = getImageIcon("assets/icons/exit.png");
    exit.setBackground(Encrypter.color_light);
    exit.setBorder(BorderFactory.createLineBorder(Encrypter.color_dark, 0));
    exit.setForeground(Encrypter.color_black);
    exit.setFont(Encrypter.font16);
    exit.setIcon(exit_icon);
    exit.setToolTipText("Exit");

    ImageIcon adv_icon = getImageIcon("assets/icons/adv_ftp.png");
    adv.setIcon(adv_icon);
    adv.setBackground(Encrypter.color_light);
    adv.setBorder(BorderFactory.createLineBorder(Encrypter.color_light, 0));
    adv.setFont(Encrypter.font16);
    adv.setToolTipText("Display server files");
    adv.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

    chooserf.addChoosableFileFilter(new FileNameExtensionFilter("Text", "txt"));
    chooserf.addChoosableFileFilter(new FileNameExtensionFilter("HTM", "htm"));
    chooserf.addChoosableFileFilter(new FileNameExtensionFilter("XHTML", "xhtml"));
    chooserf.addChoosableFileFilter(new FileNameExtensionFilter("HTML", "html"));
    chooserf.setAcceptAllFileFilterUsed(false);
}

From source file:com.projity.pm.graphic.graph.GraphInteractor.java

protected Cursor getSplitCursor() {
    if (splitCursor == null) {
        try {//from   w  w  w.  j a  va2s.  co  m
            splitCursor = Toolkit.getDefaultToolkit().createCustomCursor(
                    IconManager.getImage("gantt.split.cursor"), new Point(10, 4), "splitCursor");
        } catch (Exception e) {
            splitCursor = new Cursor(Cursor.HAND_CURSOR);
        }
    }
    return splitCursor;
}

From source file:com.intel.stl.ui.common.view.JumpChartPanel.java

@Override
public void chartMouseMoved(ChartMouseEvent cme) {
    JPopupMenu popup = getPopupMenu();
    if (popup != null && popup.isShowing()) {
        return;/* w w  w.  j ava 2  s .  c  om*/
    }

    ChartEntity xyItem = cme.getEntity();
    if (xyItem instanceof CategoryLabelEntity) {
        CategoryLabelEntity newCatEntity = (CategoryLabelEntity) xyItem;
        if (highlightedEntity != null && newCatEntity.getKey().equals(highlightedEntity.getKey())) {
            return;
        }

        if (highlightedEntity != null) {
            highlightEntity(highlightedEntity, false);
        }

        highlightedEntity = (CategoryLabelEntity) xyItem;
        if (categoryAxis == null) {
            CategoryPlot plot = getChart().getCategoryPlot();
            categoryAxis = plot.getDomainAxis();
        }
        highlightEntity(highlightedEntity, true);
        setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    } else {
        if (highlightedEntity != null) {
            highlightEntity(highlightedEntity, false);
            highlightedEntity = null;
        }
        setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    }
}

From source file:com.cmsoftware.keyron.vista.Login.java

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

    panelContenido = new javax.swing.JPanel();
    logo = new javax.swing.JLabel();
    separador = new javax.swing.JLabel();
    mensajeAcceso = new javax.swing.JLabel();
    labelUsuario = new javax.swing.JLabel();
    labelClave = new javax.swing.JLabel();
    usuario = new javax.swing.JTextField();
    acceder = new javax.swing.JButton();
    cerrar = new javax.swing.JLabel();
    clave = new javax.swing.JPasswordField();
    panelMensajes = new javax.swing.JPanel();
    labelError = new javax.swing.JLabel();

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    java.util.ResourceBundle bundle = java.util.ResourceBundle
            .getBundle("com/cmsoftware/keyron/vista/idioma/idioma"); // NOI18N
    setTitle(bundle.getString("iniciar_sesion")); // NOI18N
    setName("Login"); // NOI18N
    setUndecorated(true);//from   w  w  w . ja  va  2  s.  c  o  m
    setResizable(false);

    panelContenido.setBackground(new java.awt.Color(246, 246, 246));
    panelContenido.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(119, 41, 83)));
    panelContenido.setMaximumSize(new java.awt.Dimension(382, 318));
    panelContenido.setMinimumSize(new java.awt.Dimension(382, 318));
    panelContenido.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            panelContenidoMouseClicked(evt);
        }

        public void mousePressed(java.awt.event.MouseEvent evt) {
            panelContenidoMousePressed(evt);
        }

        public void mouseReleased(java.awt.event.MouseEvent evt) {
            panelContenidoMouseReleased(evt);
        }
    });
    panelContenido.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
        public void mouseDragged(java.awt.event.MouseEvent evt) {
            panelContenidoMouseDragged(evt);
        }

        public void mouseMoved(java.awt.event.MouseEvent evt) {
            panelContenidoMouseMoved(evt);
        }
    });

    logo.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    logo.setIcon(new javax.swing.ImageIcon(
            getClass().getResource("/com/cmsoftware/keyron/recursos/encabezado.png"))); // NOI18N

    separador.setForeground(new java.awt.Color(119, 41, 83));
    separador.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    separador.setText("______________________________________________________________");

    mensajeAcceso.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
    mensajeAcceso.setForeground(new java.awt.Color(89, 89, 89));
    mensajeAcceso.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    mensajeAcceso.setText(Configuracion.getInstancia().getBundle().getString("mensaje_acceso")); // NOI18N

    labelUsuario.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
    labelUsuario.setForeground(new java.awt.Color(89, 89, 89));
    labelUsuario.setText(Configuracion.getInstancia().getBundle().getString("campo_usuario")); // NOI18N

    labelClave.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
    labelClave.setForeground(new java.awt.Color(89, 89, 89));
    labelClave.setText(Configuracion.getInstancia().getBundle().getString("campo_clave")); // NOI18N

    usuario.setFont(com.cmsoftware.keyron.controlador.Optimizacion.getInstancia().getFuente().MyFont(0, 14f));
    usuario.setForeground(new java.awt.Color(89, 89, 89));
    usuario.addKeyListener(new java.awt.event.KeyAdapter() {
        public void keyTyped(java.awt.event.KeyEvent evt) {
            usuarioKeyTyped(evt);
        }
    });

    acceder.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
    acceder.setForeground(new java.awt.Color(89, 89, 89));
    acceder.setText(Configuracion.getInstancia().getBundle().getString("boton_acceder")); // NOI18N
    acceder.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
    acceder.setMargin(new java.awt.Insets(6, 14, 6, 14));
    acceder.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            accederActionPerformed(evt);
        }
    });

    cerrar.setFont(new java.awt.Font("Arial", 1, 11)); // NOI18N
    cerrar.setText("X");
    cerrar.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
    cerrar.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            cerrarMouseClicked(evt);
        }

        public void mouseEntered(java.awt.event.MouseEvent evt) {
            cerrarMouseEntered(evt);
        }

        public void mouseExited(java.awt.event.MouseEvent evt) {
            cerrarMouseExited(evt);
        }
    });

    clave.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
    clave.setForeground(new java.awt.Color(89, 89, 89));
    clave.addKeyListener(new java.awt.event.KeyAdapter() {
        public void keyTyped(java.awt.event.KeyEvent evt) {
            claveKeyTyped(evt);
        }
    });

    javax.swing.GroupLayout panelContenidoLayout = new javax.swing.GroupLayout(panelContenido);
    panelContenido.setLayout(panelContenidoLayout);
    panelContenidoLayout.setHorizontalGroup(panelContenidoLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelContenidoLayout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(panelContenidoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                            .addComponent(logo, javax.swing.GroupLayout.Alignment.LEADING,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    Short.MAX_VALUE)
                            .addComponent(separador, javax.swing.GroupLayout.Alignment.TRAILING,
                                    javax.swing.GroupLayout.PREFERRED_SIZE, 384,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(0, 0, 0).addComponent(cerrar).addGap(8, 8, 8))
            .addGroup(panelContenidoLayout.createSequentialGroup().addGap(25, 25, 25)
                    .addGroup(panelContenidoLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(acceder)
                            .addGroup(panelContenidoLayout
                                    .createSequentialGroup()
                                    .addGroup(panelContenidoLayout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(labelUsuario).addComponent(labelClave))
                                    .addGap(29, 29, 29)
                                    .addGroup(panelContenidoLayout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                            .addComponent(usuario, javax.swing.GroupLayout.PREFERRED_SIZE, 262,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(clave, javax.swing.GroupLayout.PREFERRED_SIZE, 262,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addGap(0, 0, Short.MAX_VALUE))
            .addComponent(mensajeAcceso, javax.swing.GroupLayout.DEFAULT_SIZE,
                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
    panelContenidoLayout.setVerticalGroup(
            panelContenidoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelContenidoLayout.createSequentialGroup()
                            .addGroup(panelContenidoLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(panelContenidoLayout.createSequentialGroup().addContainerGap()
                                            .addComponent(logo))
                                    .addComponent(cerrar))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(separador)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(mensajeAcceso).addGap(18, 18, 18)
                            .addGroup(panelContenidoLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(labelUsuario).addComponent(usuario,
                                            javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGap(18, 18, 18)
                            .addGroup(panelContenidoLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(labelClave).addComponent(clave,
                                            javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(acceder)
                            .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    panelContenidoLayout.linkSize(javax.swing.SwingConstants.VERTICAL,
            new java.awt.Component[] { clave, usuario });

    panelMensajes.setBackground(new java.awt.Color(119, 41, 83));

    labelError.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
    labelError.setForeground(new java.awt.Color(255, 255, 255));
    labelError.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

    javax.swing.GroupLayout panelMensajesLayout = new javax.swing.GroupLayout(panelMensajes);
    panelMensajes.setLayout(panelMensajesLayout);
    panelMensajesLayout.setHorizontalGroup(
            panelMensajesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(labelError, javax.swing.GroupLayout.DEFAULT_SIZE, 426, Short.MAX_VALUE));
    panelMensajesLayout.setVerticalGroup(panelMensajesLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelMensajesLayout.createSequentialGroup().addComponent(labelError,
                    javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 0, Short.MAX_VALUE)));

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(panelMensajes, javax.swing.GroupLayout.DEFAULT_SIZE,
                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(panelContenido, javax.swing.GroupLayout.DEFAULT_SIZE,
                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                    .addComponent(panelContenido, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 0, Short.MAX_VALUE)
                    .addComponent(panelMensajes, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 0, 0)));

    pack();
}

From source file:com.github.benchdoos.weblocopener.updater.gui.UpdateDialog.java

private void createGUI() {
    setContentPane(contentPane);/*from ww w  .j  a  v  a2 s.  c  o  m*/
    getRootPane().setDefaultButton(buttonOK);
    if (IS_WINDOWS_XP) {
        //for windows xp&server 2003
        setIconImage(Toolkit.getDefaultToolkit()
                .getImage(UpdateDialog.class.getResource("/images/updaterIcon64_white.png")));
    } else {
        setIconImage(Toolkit.getDefaultToolkit()
                .getImage(UpdateDialog.class.getResource("/images/updaterIcon64.png")));

    }

    createDefaultActionListeners();

    // call onCancel() when cross is clicked
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            onCancel();
        }
    });

    // call onCancel() on ESCAPE
    contentPane.registerKeyboardAction(e -> onCancel(), KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
            JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);

    updateInfoButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            onUpdateInfoButton();
        }
    });

    updateInfoButton.setCursor(new Cursor(Cursor.HAND_CURSOR));

    manualDownloadButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            openSetupUrl();
        }

        private void openSetupUrl() {
            log.debug("Calling to download setup manually");
            URL url = null;
            if (updater != null) {
                if (updater.getAppVersion() != null) {
                    try {
                        log.debug("Trying to open [" + updater.getAppVersion().getDownloadUrl() + "]");
                        url = new URL(updater.getAppVersion().getDownloadUrl());
                        UrlValidator urlValidator = new UrlValidator();
                        UserUtils.openWebUrl(url);
                    } catch (MalformedURLException e1) {
                        openWebsite(url);
                    }
                } else
                    UserUtils.openWebUrl(ApplicationConstants.UPDATE_WEB_URL);

            } else
                UserUtils.openWebUrl(ApplicationConstants.UPDATE_WEB_URL);
        }

        private void openWebsite(URL url) {
            log.warn("Could not open setup url: [" + url + "]\n" + "Opening "
                    + ApplicationConstants.UPDATE_WEB_URL);
            UserUtils.openWebUrl(ApplicationConstants.UPDATE_WEB_URL);
        }
    });

    pack();
    setLocation(FrameUtils.getFrameOnCenterLocationPoint(this));
    setSize(new Dimension(400, 170));
    setResizable(false);
}

From source file:com.github.cric.app.ui.SettingPanel.java

private Component helpLabel() {

    JLabel help = new JLabel(HELP_TEXT);
    help.addMouseListener(new MouseAdapter() {

        @Override/*from   ww w.  j a v  a 2  s . c  om*/
        public void mouseEntered(MouseEvent e) {

            help.setCursor(new Cursor(Cursor.HAND_CURSOR));
        }

        @Override
        public void mouseExited(MouseEvent e) {

            help.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
        }

        @Override
        public void mouseClicked(MouseEvent e) {

            if (Desktop.isDesktopSupported()) {
                try {
                    Desktop.getDesktop().browse(HELP_PAGE);
                } catch (Exception ex) {
                    LOG.warn("unable to open link", ex);
                }
            }
        }
    });
    return help;
}

From source file:org.datacleaner.panels.WelcomePanel.java

private JComponent createContentPanel() {
    JComponent result = null;/*w w w .  j  av  a2  s .c o m*/

    final String welcomePanelClassName = SystemProperties.getString(SystemProperties.UI_DESKTOP_WELCOME_PANEL,
            null);
    if (!Strings.isNullOrEmpty(welcomePanelClassName)) {
        final Injector injector = _dcModule.createInjectorBuilder().with(WelcomePanel.class, this)
                .createInjector();
        try {
            @SuppressWarnings("unchecked")
            final Class<? extends JComponent> componentClass = (Class<? extends JComponent>) Class
                    .forName(welcomePanelClassName);

            result = injector.getInstance(componentClass);
        } catch (Exception e) {
            logger.error("Failed to instantiate welcome panel class: {}", welcomePanelClassName, e);
        }
    }

    if (result == null) {
        result = new DCPanel();
        if (Version.isCommunityEdition()) {
            final JXEditorPane editorPane = new JXEditorPane("text/html",
                    "You're now using the <b>Community Edition</b> of DataCleaner.<br/><br/>"
                            + "We hope that you enjoy this free product. We encourage you to also check out the "
                            + "commercial DataCleaner editions which feature added functionality, "
                            + "helpful getting started wizards and commercial support. "
                            + "You can find more information about them online.");
            editorPane.setEditable(false);
            editorPane.setOpaque(false);
            editorPane.setFont(WidgetUtils.FONT_HEADER2);
            editorPane.setPreferredSize(new Dimension(DCSplashPanel.WIDTH_CONTENT, 120));

            final JButton tryProfessionalButton = WidgetFactory.createDefaultButton("Try professional edition",
                    IconUtils.APPLICATION_ICON);
            tryProfessionalButton
                    .addActionListener(new OpenBrowserAction("http://datacleaner.org/get_datacleaner"));

            final JButton readMoreButton = WidgetFactory.createDefaultButton("Compare the editions",
                    IconUtils.WEBSITE);
            readMoreButton.addActionListener(new OpenBrowserAction("http://datacleaner.org/editions"));

            final JButton discussionForumButton = WidgetFactory
                    .createDefaultButton("Visit the discussion forum", "images/menu/forum.png");
            discussionForumButton.setToolTipText(
                    "Visit the online discussion forum for questions and answers in the community");
            final OpenBrowserAction forumActionListener = new OpenBrowserAction("http://datacleaner.org/forum");
            discussionForumButton.addActionListener(forumActionListener);

            final JButton twitterButton = WidgetFactory.createDefaultButton(null, "images/menu/twitter.png");
            twitterButton.setToolTipText("Spread the message about #DataCleaner on Twitter");
            twitterButton.addActionListener(new OpenBrowserAction("https://twitter.com/intent/tweet?text="
                    + UrlEscapers.urlFormParameterEscaper().escape("I'm using @DataCleaner (v. "
                            + Version.getVersion() + ") for some really fancy #dataquality stuff!")));

            final JButton linkedInButton = WidgetFactory.createDefaultButton(null, "images/menu/linkedin.png");
            linkedInButton.setToolTipText("Join our LinkedIn group of users and professionals");
            linkedInButton
                    .addActionListener(new OpenBrowserAction("http://www.linkedin.com/groups?gid=3352784"));

            final JLabel loveFeedbackAnimation = new JLabel(
                    ImageManager.get().getImageIcon("images/window/we_love_community_and_feedback.gif"),
                    JLabel.LEFT);
            loveFeedbackAnimation.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            loveFeedbackAnimation.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    forumActionListener.actionPerformed(null);
                }
            });

            final DCPanel innerPanel = new DCPanel();
            innerPanel.setLayout(new VerticalLayout());
            innerPanel.setBorder(
                    new CompoundBorder(WidgetUtils.BORDER_LIST_ITEM_LEFT_ONLY, new EmptyBorder(0, 20, 0, 0)));
            innerPanel.add(editorPane);
            innerPanel.add(DCPanel.flow(tryProfessionalButton, readMoreButton));
            innerPanel.add(Box.createVerticalStrut(80));
            innerPanel.add(loveFeedbackAnimation);
            innerPanel.add(Box.createVerticalStrut(20));
            innerPanel.add(DCPanel.flow(discussionForumButton, twitterButton, linkedInButton));
            innerPanel.add(Box.createVerticalStrut(5));

            result.setLayout(new VerticalLayout());
            result.add(Box.createVerticalStrut(100));
            result.add(innerPanel);
        }
    }

    return wrapContent(result);
}

From source file:org.gitools.ui.core.components.boxes.DetailsBox.java

private Component createValueLabel(DetailsDecoration property, int maxLength) {

    String value = property.getFormatedValue();
    boolean abbreviate = (value.length() > maxLength);
    String abbreviatedValue;/*from ww w .j av a  2  s  . c o m*/

    if (value.matches("[0-9\\.]+e-?[0-9]+")) {
        value = "<html><body>" + value.replaceAll("e(-?[0-9]+)", "10<sup>$1</sup>") + "</body></html>";
    }

    if (abbreviate) {
        abbreviatedValue = StringUtils.abbreviate(value, maxLength);
    } else {
        abbreviatedValue = value;
    }

    WebLabel label;
    if (StringUtils.isEmpty(property.getValueLink())) {
        label = new WebLabel(abbreviatedValue);
    } else {
        DetailsWebLinkLabel webLabel = new DetailsWebLinkLabel(abbreviatedValue);
        webLabel.setLink(property.getValueLink(), false);
        label = webLabel;
    }

    SwingUtils.changeFontSize(label, -1);

    if (abbreviate) {
        TooltipManager.setTooltip(label, value, TooltipWay.down, 0);
    }

    label.setCursor(new Cursor(Cursor.HAND_CURSOR));
    label.addMouseListener(new PropertyMouseListener(property));

    if (property.isSelected()) {
        SwingUtils.setBoldFont(label);
    }

    if (property.getBgColor() != null) {
        WebPanel colorBox = new WebPanel();
        colorBox.setPreferredSize(new Dimension(15, 15));
        colorBox.setBackground(property.getBgColor());
        return new GroupPanel(4, colorBox, label);
    }

    return label;
}