Example usage for javax.swing JLabel setToolTipText

List of usage examples for javax.swing JLabel setToolTipText

Introduction

In this page you can find the example usage for javax.swing JLabel setToolTipText.

Prototype

@BeanProperty(bound = false, preferred = true, description = "The text to display in a tool tip.")
public void setToolTipText(String text) 

Source Link

Document

Registers the text to display in a tool tip.

Usage

From source file:SwingLabelDemo.java

public SwingLabelDemo() {
    super(new GridLayout(3, 1)); //3 rows, 1 column
    JLabel label1, label2, label3;

    ImageIcon icon = createImageIcon("images/middle.gif", "a pretty but meaningless splat");

    //Create the first label.
    label1 = new JLabel("Image and Text", icon, JLabel.CENTER);
    //Set the position of its text, relative to its icon:
    label1.setVerticalTextPosition(JLabel.BOTTOM);
    label1.setHorizontalTextPosition(JLabel.CENTER);

    //Create the other labels.
    label2 = new JLabel("Text-Only Label");
    label3 = new JLabel(icon);

    //Create tool tips, for the heck of it.
    label1.setToolTipText("A label containing both image and text");
    label2.setToolTipText("A label containing only text");
    label3.setToolTipText("A label containing only an image");

    //Add the labels.
    add(label1);/*from   w  w  w  . ja v  a 2 s  .c om*/
    add(label2);
    add(label3);
}

From source file:com.rapidminer.gui.plotter.charts.ParetoChartPlotter.java

@Override
public JComponent getOptionsComponent(int index) {
    switch (index) {
    case 0:/*  w ww.  j a  v  a 2 s.  c o m*/
        JLabel label = new JLabel("Count Value:");
        label.setToolTipText("Select the value which should be counted in the count dimension.");
        return label;
    case 1:
        return countValues;
    case 2:
        label = new JLabel("Sorting Direction:");
        label.setToolTipText("Select the sorting type and direction.");
        return label;
    case 3:
        return sortingDirection;
    case 4:
        return showBarLabels;
    case 5:
        return showCumulativeLabels;
    case 6:
        return getRotateLabelComponent();
    }
    return null;
}

From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.preenchedor_formulario.PanelPreenchedorFormulario.java

private void criaInterfaceVisualEscalavel() {
    miBtnSalvar = new JMenuItem(XHTML_Panel.BTN_SALVAR);
    painel = new JPanel();
    textAreaSourceCode = new G_TextAreaSourceCode();
    // frameSilvinha.setJMenuBar(this.criaMenuBar());
    new OnChange(textAreaSourceCode, this);

    textAreaSourceCode.setTipoHTML();//from w w  w .  j  ava2s .  co  m
    textAreaSourceCode.setBorder(criaBorda(XHTML_Panel.COD_FONTE));

    painel.setLayout(new GridLayout(2, 1));
    setBackground(frameSilvinha.corDefault);

    Container contentPane = this;
    contentPane.setLayout(new GridLayout(1, 1));
    painel.add(textAreaSourceCode);

    JPanel panelBtnTabela = new JPanel();

    panelBtnTabela.setLayout(new BorderLayout());

    /*
     * Barra de botes
     */
    btnPanel = new JPanel();
    btnPanel.setLayout(null);
    btn_salvar = new JButton(XHTML_Panel.BTN_SALVAR);
    btn_salvar.setToolTipText(XHTML_Panel.DICA_SALVAR);
    btn_salvar.setBounds(10, 0, 150, 25);
    btnPanel.add(btn_salvar);

    btn_abrir = new JButton(XHTML_Panel.BTN_ABRIR);
    btn_abrir.setToolTipText(XHTML_Panel.DICA_ABRIR);
    btn_abrir.setBounds(165, 0, 150, 25);
    btnPanel.add(btn_abrir);

    btn_salvarComo = new JButton(XHTML_Panel.BTN_SALVAR_COMO);
    btn_salvarComo.setToolTipText(XHTML_Panel.DICA_SALVAR_COMO);
    btn_salvarComo.setBounds(320, 0, 150, 25);
    btnPanel.add(btn_salvarComo);

    btn_cancelar = new JButton(XHTML_Panel.TELA_ANTERIOR);
    btn_cancelar.setToolTipText(XHTML_Panel.DICA_TELA_ANTERIOR);
    btn_cancelar.setBounds(480, 0, 150, 25);
    btnPanel.add(btn_cancelar);

    btnPanel.setPreferredSize(new Dimension(430, 30));

    /*
     * Barra de correcao
     */
    btnAplicar = new JButton(XHTML_Panel.BTN_APLICAR);
    btnAplicar.setToolTipText(XHTML_Panel.DICA_BTN_APLICAR);
    btnAplicar.setEnabled(false);

    texto = new JTextField();

    texto.setBorder(BorderFactory.createLineBorder(Color.BLACK));
    JPanel borda = new JPanel(new BorderLayout());
    JLabel lbl_texto = new JLabel(XHTML_Panel.ROTULO_TEXTO);
    lbl_texto.setToolTipText(XHTML_Panel.DICA_ROTULO_TEXTO);
    borda.add(lbl_texto, BorderLayout.WEST);
    borda.add(texto, BorderLayout.CENTER);
    borda.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
    borda.setOpaque(false);
    panelCorretor = new JPanel(new BorderLayout());
    panelCorretor.add(borda, BorderLayout.CENTER);
    panelCorretor.add(btnAplicar, BorderLayout.EAST);
    //panelCorretor.add(btnPanel, BorderLayout.WEST);
    panelCorretor.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10));
    panelCorretor.setOpaque(false);

    /*
     * Tabela de erros
     */
    tabelaDeErros = new TabelaErros();
    scrollPaneTabela = new JScrollPane();
    scrollPaneTabela.setViewportView(tabelaDeErros);
    panelBtnTabela.add(panelCorretor, BorderLayout.NORTH);
    panelBtnTabela.add(scrollPaneTabela, BorderLayout.CENTER);
    panelBtnTabela.add(btnPanel, BorderLayout.SOUTH);
    scrollPaneTabela.setBorder(criaBorda(XHTML_Panel.LISTA_ERROS));
    painel.add(panelBtnTabela);

    btnPanel.setBackground(frameSilvinha.corDefault);

    if (!original) {
        reverter = new JButton("Reverter");
        reverter.setText(TradPainelRelatorio.REVERTER);
        reverter.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                setVisible(false);
                TxtBuffer.setContent(TxtBuffer.getContentOriginal());
                frameSilvinha.showPainelPreencheCampo();
                setVisible(true);
            }
        });
        //reverter.setActionCommand("Reverter");
        reverter.setToolTipText(TradPainelRelatorio.DICA_REVERTER);
        reverter.getAccessibleContext().setAccessibleDescription(TradPainelRelatorio.DICA_REVERTER);
        reverter.getAccessibleContext().setAccessibleName(TradPainelRelatorio.DICA_REVERTER);
        reverter.setBounds(640, 0, 150, 25);
        btnPanel.add(reverter);
    }

    panelBtnTabela.setBackground(frameSilvinha.corDefault);
    painel.setBackground(frameSilvinha.corDefault);
    contentPane.setBackground(frameSilvinha.corDefault);
    scrollPaneTabela.setBackground(frameSilvinha.corDefault);
    textAreaSourceCode.setBackground(frameSilvinha.corDefault);
    miBtnSalvar.setEnabled(false);
    btn_salvar.setEnabled(false);
    salvaAlteracoes = TxtBuffer.getInstanciaSalvaAlteracoes(textAreaSourceCode.getTextPane(), btn_salvar,
            miBtnSalvar, frameSilvinha);
    contentPane.add(painel);
    // pack();
    this.setVisible(true);
}

From source file:com.rapidminer.gui.plotter.charts.BarChartPlotter.java

@Override
public JComponent getOptionsComponent(int index) {
    switch (index) {
    case 0://from  www  .  j  a  v  a 2s. c o  m
        JLabel label = new JLabel("Aggregation:");
        label.setToolTipText(
                "Select the type of the aggregation function which should be used for grouped values.");
        return label;
    case 1:
        return aggregationFunction;
    case 2:
        return useDistinct;
    case 3:
        return getRotateLabelComponent();
    case 4:
        return orientationType;
    }
    return null;
}

From source file:com.microsoft.azure.hdinsight.spark.ui.SparkSubmissionContentPanel.java

private void addReferencedJarsLineItem() {
    JLabel commandLineArgs = new JLabel("Referenced Jars");
    commandLineArgs.setToolTipText(
            "Files to be placed on the java classpath; The path needs to be a Azure Blob Storage Path (path started with wasb://); Multiple paths should be split by semicolon (;)");

    add(commandLineArgs, new GridBagConstraints(0, ++displayLayoutCurrentRow, 1, 1, 1, 0,
            GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(margin, margin, 0, 0), 0, 0));

    referencedJarsTextField = new JTextField();
    referencedJarsTextField.setToolTipText(
            "Files to be placed on the java classpath; The path needs to be a Azure Blob Storage Path (path started with wasb://); Multiple paths should be split by semicolon (;)");
    add(referencedJarsTextField,//from  ww w. ja  v  a2s.  c  o  m
            new GridBagConstraints(1, displayLayoutCurrentRow, 0, 1, 1, 0, GridBagConstraints.NORTHWEST,
                    GridBagConstraints.HORIZONTAL, new Insets(margin, margin, 0, margin), 0, 0));
}

From source file:com.microsoft.azure.hdinsight.spark.ui.SparkSubmissionContentPanel.java

private void addReferencedFilesLineItem() {
    JLabel commandLineArgs = new JLabel("Referenced Files");
    commandLineArgs.setToolTipText(
            "Files to be placed in executor working directory. The path needs to be a Azure Blob Storage Path (path started with wasb://); Multiple paths should be split by semicolon (;) ");
    add(commandLineArgs, new GridBagConstraints(0, ++displayLayoutCurrentRow, 1, 1, 1, 0,
            GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(margin, margin, 0, 0), 0, 0));

    referencedFilesTextField = new JTextField();
    referencedFilesTextField.setToolTipText(
            "Files to be placed in executor working directory. The path needs to be a Azure Blob Storage Path (path started with wasb://); Multiple paths should be split by semicolon (;) ");
    add(referencedFilesTextField,//  w w  w.  ja  va 2  s .  co  m
            new GridBagConstraints(1, displayLayoutCurrentRow, 0, 1, 1, 0, GridBagConstraints.NORTHWEST,
                    GridBagConstraints.HORIZONTAL, new Insets(margin, margin, 0, margin), 0, 0));
}

From source file:Installer.java

public static JLabel linkify(final String text, String URL, String toolTip) {
    URI temp = null;//from   ww  w. ja v a 2 s.  c  o  m
    try {
        temp = new URI(URL);
    } catch (Exception e) {
        e.printStackTrace();
    }
    final URI uri = temp;
    final JLabel link = new JLabel();
    link.setText("<HTML><FONT color=\"#000099\">" + text + "</FONT></HTML>");
    if (!toolTip.equals(""))
        link.setToolTipText(toolTip);
    link.setCursor(new Cursor(Cursor.HAND_CURSOR));
    link.addMouseListener(new MouseListener() {
        public void mouseExited(MouseEvent arg0) {
            link.setText("<HTML><FONT color=\"#000099\">" + text + "</FONT></HTML>");
        }

        public void mouseEntered(MouseEvent arg0) {
            link.setText("<HTML><FONT color=\"#000099\"><U>" + text + "</U></FONT></HTML>");
        }

        public void mouseClicked(MouseEvent arg0) {
            if (Desktop.isDesktopSupported()) {
                try {
                    Desktop.getDesktop().browse(uri);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            } else {
                JOptionPane pane = new JOptionPane("Could not open link.");
                JDialog dialog = pane.createDialog(new JFrame(), "");
                dialog.setVisible(true);
            }
        }

        public void mousePressed(MouseEvent e) {
        }

        public void mouseReleased(MouseEvent e) {
        }
    });
    return link;
}

From source file:com.microsoft.azure.hdinsight.spark.ui.SparkSubmissionContentPanel.java

private void addCommandlineArgsLineItem() {
    JLabel commandLineArgs = new JLabel("Command line arguments");
    commandLineArgs.setToolTipText(
            "Command line arguments used in your main class; multiple arguments should be split by space.");

    add(commandLineArgs, new GridBagConstraints(0, ++displayLayoutCurrentRow, 1, 1, 1, 0,
            GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(margin, margin, 0, 0), 0, 0));

    commandLineTextField = new JTextField();
    commandLineTextField.setToolTipText(
            "Command line arguments used in your main class; multiple arguments should be split by space.");

    add(commandLineTextField,//from   w  ww.  j  av a2  s. c  o  m
            new GridBagConstraints(1, displayLayoutCurrentRow, 0, 1, 1, 0, GridBagConstraints.NORTHWEST,
                    GridBagConstraints.HORIZONTAL, new Insets(margin, margin, 0, margin), 0, 0));
}

From source file:com.microsoft.azure.hdinsight.spark.ui.SparkSubmissionContentPanel.java

private void addMainClassNameLineItem() {
    JLabel sparkMainClassLabel = new JLabel("Main class name");
    sparkMainClassLabel.setToolTipText("Application's java/spark main class");
    GridBagConstraints c31 = new GridBagConstraints();
    c31.gridx = 0;//from w w  w .ja v  a  2s . c  o  m
    c31.gridy = 2;
    c31.insets = new Insets(margin, margin, margin, margin);
    add(sparkMainClassLabel, new GridBagConstraints(0, ++displayLayoutCurrentRow, 1, 1, 1, 0,
            GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(margin, margin, 0, 0), 0, 0));

    mainClassTextField = new TextFieldWithBrowseButton();
    mainClassTextField.setToolTipText("Application's java/spark main class");
    ManifestFileUtil.setupMainClassField(submitModel.getProject(), mainClassTextField);

    add(mainClassTextField,
            new GridBagConstraints(1, displayLayoutCurrentRow, 0, 1, 1, 0, GridBagConstraints.WEST,
                    GridBagConstraints.HORIZONTAL, new Insets(margin, margin, 0, margin), 0, 0));

    errorMessageLabels[ErrorMessageLabelTag.MainClass.ordinal()] = new JLabel(
            "Main Class Name should not be null");
    errorMessageLabels[ErrorMessageLabelTag.MainClass.ordinal()]
            .setForeground(DarkThemeManager.getInstance().getErrorMessageColor());
    errorMessageLabels[ErrorMessageLabelTag.MainClass.ordinal()].setVisible(true);

    mainClassTextField.getTextField().getDocument().addDocumentListener(new DocumentListener() {
        @Override
        public void insertUpdate(DocumentEvent e) {
            setVisibleForFixedErrorMessageLabel(3, e.getDocument().getLength() == 0);
        }

        @Override
        public void removeUpdate(DocumentEvent e) {
            setVisibleForFixedErrorMessageLabel(3, e.getDocument().getLength() == 0);
        }

        @Override
        public void changedUpdate(DocumentEvent e) {
        }
    });

    add(errorMessageLabels[ErrorMessageLabelTag.MainClass.ordinal()],
            new GridBagConstraints(1, ++displayLayoutCurrentRow, 0, 1, 1, 0, GridBagConstraints.WEST,
                    GridBagConstraints.HORIZONTAL, new Insets(0, margin, 0, margin), 0, 0));
}

From source file:com.microsoft.azure.hdinsight.spark.ui.SparkSubmissionContentPanel.java

private void addSparkClustersLineItem() {
    JLabel sparkClusterLabel = new JLabel("Spark clusters(Linux only)");
    sparkClusterLabel.setToolTipText(
            "The HDInsight Spark cluster you want to submit your application to. Only Linux cluster is supported.");
    GridBagConstraints c11 = new GridBagConstraints();
    c11.gridx = 0;//from w  w w . j  a  v a  2  s  . co m
    c11.gridy = 0;
    c11.insets = new Insets(margin, margin, 0, margin);
    add(sparkClusterLabel, new GridBagConstraints(0, displayLayoutCurrentRow, 1, 1, 0, 0,
            GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(margin, margin, 0, margin), 0, 0));

    clustersListComboBox = new ComboboxWithBrowseButton();
    clustersListComboBox.setButtonIcon(StreamUtil.getImageResourceFile(REFRESH_BUTTON_PATH));
    clustersListComboBox.getButton().setToolTipText("Refresh");
    clustersListComboBox.getButton().addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            Cursor cursor = getCursor();
            setCursor(new Cursor(Cursor.WAIT_CURSOR));
            List<IClusterDetail> clusterDetails = ClusterManagerEx.getInstance()
                    .getClusterDetails(submitModel.getProject());
            setCursor(cursor);
            submitModel.setClusterComboBoxModel(clusterDetails);
        }
    });
    clustersListComboBox.getComboBox().setToolTipText(
            "The HDInsight Spark cluster you want to submit your application to. Only Linux cluster is supported.");
    clustersListComboBox.getComboBox().addPropertyChangeListener(new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if (evt.getPropertyName() == "model" && evt.getNewValue() instanceof DefaultComboBoxModel) {
                int size = ((DefaultComboBoxModel) evt.getNewValue()).getSize();
                setVisibleForFixedErrorMessageLabel(ErrorMessageLabelTag.ClusterName.ordinal(), size <= 0);
            }
        }
    });

    add(clustersListComboBox,
            new GridBagConstraints(1, displayLayoutCurrentRow, 0, 1, 1, 0, GridBagConstraints.WEST,
                    GridBagConstraints.HORIZONTAL, new Insets(margin, margin, 0, margin), 0, 0));

    errorMessageLabels[ErrorMessageLabelTag.ClusterName.ordinal()] = new JLabel(
            "Cluster Name Should not be null");
    errorMessageLabels[ErrorMessageLabelTag.ClusterName.ordinal()]
            .setForeground(DarkThemeManager.getInstance().getErrorMessageColor());

    clustersListComboBox.getComboBox().addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            setVisibleForFixedErrorMessageLabel(0, clustersListComboBox.getComboBox().getItemCount() == 0);
        }
    });

    add(errorMessageLabels[ErrorMessageLabelTag.ClusterName.ordinal()],
            new GridBagConstraints(1, ++displayLayoutCurrentRow, 0, 1, 1, 0, GridBagConstraints.WEST,
                    GridBagConstraints.NONE, new Insets(0, margin, 0, 0), 0, 0));
}