本文整理了Java中javax.swing.JLabel.setToolTipText()
方法的一些代码示例,展示了JLabel.setToolTipText()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JLabel.setToolTipText()
方法的具体详情如下:
包路径:javax.swing.JLabel
类名称:JLabel
方法名:setToolTipText
暂无
代码示例来源:origin: jersey/jersey
@Override
public void run() {
label.setBackground(PROGRESS_COLOR);
label.setToolTipText("Running...");
label.setBorder(javax.swing.BorderFactory.createLineBorder(new Color(0, 0, 0)));
label.setOpaque(true);
messagePanel.add(label);
messagePanel.revalidate();
}
});
代码示例来源:origin: skylot/jadx
public void addRow(String label, String tooltip, JComponent comp) {
c.gridy = row++;
JLabel jLabel = new JLabel(label);
jLabel.setLabelFor(comp);
jLabel.setHorizontalAlignment(SwingConstants.LEFT);
c.gridx = 0;
c.gridwidth = 1;
c.anchor = GridBagConstraints.LINE_START;
c.weightx = 0.8;
c.fill = GridBagConstraints.NONE;
add(jLabel, c);
c.gridx = 1;
c.gridwidth = GridBagConstraints.REMAINDER;
c.anchor = GridBagConstraints.CENTER;
c.weightx = 0.2;
c.fill = GridBagConstraints.HORIZONTAL;
if (tooltip != null) {
jLabel.setToolTipText(tooltip);
comp.setToolTipText(tooltip);
}
add(comp, c);
comp.addPropertyChangeListener("enabled", evt -> jLabel.setEnabled((boolean) evt.getNewValue()));
}
代码示例来源:origin: wiztools/rest-client
jp_form_label.add(new JLabel("<html>Host: </html>"));
jp_form_label.add(new JLabel("<html>Realm: </html>"));
jp_form_label.add(new JLabel("<html>Username: <font color=red>*</font></html>"));
jp_form_label.add(new JLabel("<html>Password: </html>"));
JLabel jl_premptive = new JLabel("Preemptive?");
String toolTipText = "Send authentication credentials before challenge";
jl_premptive.setToolTipText(toolTipText);
jcb_preemptive.setToolTipText(toolTipText);
jl_premptive.setLabelFor(jcb_preemptive);
代码示例来源:origin: magefree/mage
pnlHelperHandButtonsStackArea = new javax.swing.JPanel();
pnlShortCuts = new javax.swing.JPanel();
lblPhase = new javax.swing.JLabel();
txtPhase = new javax.swing.JLabel();
lblStep = new javax.swing.JLabel();
txtStep = new javax.swing.JLabel();
lblTurn = new javax.swing.JLabel();
txtSpellsCast.setBackground(Color.LIGHT_GRAY);
txtSpellsCast.setOpaque(true);
txtSpellsCast.setToolTipText("spells cast during the current turn");
txtHoldPriority = new javax.swing.JLabel();
txtHoldPriority.setBackground(Color.LIGHT_GRAY);
txtHoldPriority.setOpaque(true);
txtHoldPriority.setToolTipText("Holding priority after the next spell cast or ability activation");
txtHoldPriority.setVisible(false);
hoverButton.setAlignmentX(LEFT_ALIGNMENT);
hoverButton.setBounds(X_PHASE_WIDTH - 36, i * 36, 36, 36);
jPhases.add(hoverButton);
i++;
JPanel empty1 = new JPanel();
empty1.setBackground(new Color(0, 0, 0, 0));
phasesContainer.add(empty1, ratio);
phasesContainer.add(jPhases);
代码示例来源:origin: runelite/runelite
confirmLabel.setToolTipText("Confirm and save");
confirmLabel.addMouseListener(new MouseAdapter()
JLabel cancelLabel = new JLabel(CANCEL_ICON);
cancelLabel.setToolTipText("Cancel");
cancelLabel.addMouseListener(new MouseAdapter()
actionsContainer.add(confirmLabel);
actionsContainer.add(cancelLabel);
代码示例来源:origin: apache/ignite
/**
* Add name and value labels.
*
* @param c Component.
* @param name Name.
* @param val Value.
* @param border Border.
*/
private void addAboutItem(JComponent c, String name, Object val, Border border) {
String v = val != null ? val.toString() : "n/a";
String tip = String.format("<html><b>%s</b> ➯ %s</html>", name, val);
JLabel lb = new JLabel(name);
lb.setToolTipText(tip);
JLabel field = new JLabel(v);
field.setOpaque(true);
field.setBackground(Color.WHITE);
field.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(VALUE_BORDER_COLOR, 1),
BorderFactory.createEmptyBorder(0, 3, 0, 3)));
field.setToolTipText(tip);
if (border != null)
field.setBorder(border);
c.add(lb, gbcLicenseLabel());
c.add(field, gbcLicenseField());
}
代码示例来源:origin: kiegroup/optaplanner
private JPanel createTableHeader(JLabel label, String toolTip) {
if (toolTip != null) {
label.setToolTipText(toolTip);
}
JPanel headerPanel = new JPanel(new BorderLayout());
headerPanel.add(label, BorderLayout.NORTH);
headerPanel.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createLineBorder(TangoColorFactory.ALUMINIUM_5),
BorderFactory.createEmptyBorder(2, 2, 2, 2)));
return headerPanel;
}
代码示例来源:origin: kiegroup/optaplanner
Guest guest = seatDesignation.getGuest();
if (guest == null) {
add(new JLabel("Empty seat"), BorderLayout.CENTER);
return;
JPanel infoPanel = new JPanel(new GridLayout(0, 1));
infoPanel.setOpaque(false);
infoPanel.add(new JLabel(guest.getName()));
JPanel jobPanel = new JPanel();
jobPanel.setLayout(new BoxLayout(jobPanel, BoxLayout.Y_AXIS));
jobPanel.setOpaque(false);
jobPanel.add(new JLabel(guest.getJob().getJobType().getCode()));
JLabel jobLabel = new JLabel(" " + guest.getJob().getName());
jobLabel.setFont(jobLabel.getFont().deriveFont(jobLabel.getFont().getSize() - 2.0F));
jobPanel.add(jobLabel);
infoPanel.add(jobPanel);
add(infoPanel, BorderLayout.CENTER);
Hobby hobby = hobbyPractician.getHobby();
JLabel hobbyLabel = new JLabel(hobbyImageIconMap.get(hobby));
hobbyLabel.setToolTipText(hobby.getLabel());
hobbyPanel.add(hobbyLabel);
代码示例来源:origin: skylot/jadx
private Component makeCell(JNode node, int column) {
if (column == 0) {
JLabel label = new JLabel(node.makeLongString() + " ", node.getIcon(), SwingConstants.LEFT);
label.setFont(font);
label.setOpaque(true);
label.setToolTipText(label.getText());
return label;
}
if (!node.hasDescString()) {
return emptyLabel;
}
RSyntaxTextArea textArea = CodeArea.getDefaultArea(mainWindow);
textArea.setLayout(new GridLayout(1, 1));
textArea.setEditable(false);
textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
textArea.setText(" " + node.makeDescString());
textArea.setRows(1);
textArea.setColumns(textArea.getText().length() + 1);
if (highlightText != null) {
SearchContext searchContext = new SearchContext(highlightText);
searchContext.setMatchCase(!highlightTextCaseInsensitive);
searchContext.setMarkAll(true);
SearchEngine.markAll(textArea, searchContext);
}
return textArea;
}
代码示例来源:origin: kiegroup/optaplanner
private JPanel createTableHeader(JLabel label, String toolTip) {
if (toolTip != null) {
label.setToolTipText(toolTip);
}
JPanel headerPanel = new JPanel(new BorderLayout());
headerPanel.add(label, BorderLayout.NORTH);
headerPanel.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createLineBorder(TangoColorFactory.ALUMINIUM_5),
BorderFactory.createEmptyBorder(2, 2, 2, 2)));
return headerPanel;
}
代码示例来源:origin: runelite/runelite
setPreferredSize(new Dimension(PluginPanel.PANEL_WIDTH, 20));
JLabel nameLabel = new JLabel(name);
nameLabel.setForeground(Color.WHITE);
nameLabel.setToolTipText("<html>" + name + ":<br>" + description + "</html>");
buttonPanel.add(configButton);
buttonPanel.add(toggleButton);
代码示例来源:origin: kiegroup/optaplanner
int employeeIndex = 0;
for (Employee employee : employeeList) {
JLabel employeeLabel = new JLabel(employee.getLabel(), new TaskOrEmployeeIcon(employee), SwingConstants.LEFT);
employeeLabel.setOpaque(true);
employeeLabel.setToolTipText(employee.getToolText());
employeeLabel.setLocation(0, HEADER_ROW_HEIGHT + employeeIndex * ROW_HEIGHT);
employeeLabel.setSize(HEADER_COLUMN_WIDTH, ROW_HEIGHT);
JLabel timeLabel = new JLabel((hours < 10 ? "0" : "") + hours + ":" + (minutes < 10 ? "0" : "") + minutes);
timeLabel.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
timeLabel.setLocation(x, 0);
代码示例来源:origin: runelite/runelite
title.setForeground(Color.WHITE);
northPanel.add(title, BorderLayout.WEST);
northPanel.add(addMarker, BorderLayout.EAST);
markerView.add(new ScreenMarkerPanel(plugin, marker), constraints);
constraints.gridy++;
constraints.gridy++;
addMarker.setToolTipText("Add new screen marker");
addMarker.addMouseListener(new MouseAdapter()
代码示例来源:origin: RipMeApp/ripme
gbc.gridx = 0; ripPanel.add(new JLabel("URL:", JLabel.RIGHT), gbc);
gbc.weightx = 1;
gbc.weighty = 1;
gbc.gridx = 1; ripPanel.add(ripTextfield, gbc);
gbc.weighty = 0;
gbc.weightx = 0;
gbc.gridx = 2; ripPanel.add(ripButton, gbc);
gbc.gridx = 3; ripPanel.add(stopButton, gbc);
gbc.weightx = 1;
statusLabel = new JLabel(rb.getString("inactive"));
statusLabel.setHorizontalAlignment(JLabel.CENTER);
openButton = new JButton();
configUpdateLabel = new JLabel( rb.getString("current.version") + ": " + UpdateUtils.getThisJarVersion(), JLabel.RIGHT);
configThreadsLabel = new JLabel(rb.getString("max.download.threads") + ":", JLabel.RIGHT);
configTimeoutLabel = new JLabel(rb.getString("timeout.mill"), JLabel.RIGHT);
configSaveDirLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
} catch (Exception e) { }
configSaveDirLabel.setToolTipText(configSaveDirLabel.getText());
configSaveDirLabel.setHorizontalAlignment(JLabel.RIGHT);
configSaveDirButton = new JButton(rb.getString("select.save.dir") + "...");
代码示例来源:origin: haraldk/TwelveMonkeys
private static void addImage(Container pParent, ImageReader pReader, int pImageNo, String pName) throws IOException {
final JLabel label = new JLabel();
final BufferedImage image = pReader.read(pImageNo);
label.setIcon(new Icon() {
private static final int SIZE = 110;
public void paintIcon(Component c, Graphics g, int x, int y) {
((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g.setColor(Color.DARK_GRAY);
g.fillRoundRect(x, y, SIZE, SIZE, 10, 10);
g.drawImage(image, (SIZE - image.getWidth()) / 2 + x, (SIZE - image.getHeight()) / 2 + y, null);
}
public int getIconWidth() {
return SIZE;
}
public int getIconHeight() {
return SIZE;
}
});
label.setText("" + image.getWidth() + "x" + image.getHeight() + ": " + pName);
label.setToolTipText(image.toString());
pParent.add(label);
}
代码示例来源:origin: runelite/runelite
singleLootBtn.setToolTipText("Show each kill separately");
singleLootBtn.addMouseListener(new MouseAdapter()
groupedLootBtn.setToolTipText("Group loot by source");
groupedLootBtn.addMouseListener(new MouseAdapter()
viewHiddenBtn.setToolTipText("Show ignored items");
viewHiddenBtn.addMouseListener(new MouseAdapter()
viewControls.add(groupedLootBtn);
viewControls.add(singleLootBtn);
viewControls.add(viewHiddenBtn);
changeGrouping(true);
changeItemHiding(true);
代码示例来源:origin: runelite/runelite
final JLabel imageLabel = new JLabel();
imageLabel.setToolTipText(buildToolTip(item));
imageLabel.setVerticalAlignment(SwingConstants.CENTER);
imageLabel.setHorizontalAlignment(SwingConstants.CENTER);
slotContainer.add(imageLabel);
itemContainer.add(slotContainer);
代码示例来源:origin: stackoverflow.com
label = new JLabel();
label.setOpaque(true);
fileSystemView = FileSystemView.getFileSystemView();
label.setIcon(fileSystemView.getSystemIcon(file));
label.setText(fileSystemView.getSystemDisplayName(file));
label.setToolTipText(file.getPath());
if (selected) {
label.setBackground(backgroundSelectionColor);
代码示例来源:origin: runelite/runelite
nameActions.add(save, BorderLayout.EAST);
nameActions.add(cancel, BorderLayout.WEST);
nameActions.add(rename, BorderLayout.CENTER);
leftActions.setBackground(ColorScheme.DARKER_GRAY_COLOR);
borderColorIndicator.setToolTipText("Edit border color");
borderColorIndicator.addMouseListener(new MouseAdapter()
fillColorIndicator.setToolTipText("Edit fill color");
fillColorIndicator.addMouseListener(new MouseAdapter()
thicknessSpinner.addChangeListener(ce -> updateThickness(true));
opacityIndicator.setToolTipText("Toggle background transparency");
opacityIndicator.addMouseListener(new MouseAdapter()
rightActions.setBackground(ColorScheme.DARKER_GRAY_COLOR);
visibilityLabel.setToolTipText(visible ? "Hide screen marker" : "Show screen marker");
visibilityLabel.addMouseListener(new MouseAdapter()
deleteLabel.setToolTipText("Delete screen marker");
deleteLabel.addMouseListener(new MouseAdapter()
代码示例来源:origin: runelite/runelite
topPanelBackButton.addActionListener(e -> openConfigList());
topPanelBackButton.setToolTipText("Back");
topPanel.add(topPanelBackButton, BorderLayout.WEST);
topPanel.add(listItem.createToggleButton(), BorderLayout.EAST);
JLabel title = new JLabel(name);
title.setForeground(Color.WHITE);
title.setToolTipText("<html>" + name + ":<br>" + listItem.getDescription() + "</html>");
topPanel.add(title);
item.setMinimumSize(new Dimension(PANEL_WIDTH, 0));
name = cid.getItem().name();
JLabel configEntryName = new JLabel(name);
configEntryName.setForeground(Color.WHITE);
configEntryName.setToolTipText("<html>" + name + ":<br>" + cid.getItem().description() + "</html>");
item.add(configEntryName, BorderLayout.CENTER);
dimensionPanel.add(widthSpinner, BorderLayout.WEST);
dimensionPanel.add(new JLabel(" x "), BorderLayout.CENTER);
dimensionPanel.add(heightSpinner, BorderLayout.EAST);
内容来源于网络,如有侵权,请联系作者删除!