javax.swing.JLabel.getToolTipText()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(234)

本文整理了Java中javax.swing.JLabel.getToolTipText()方法的一些代码示例,展示了JLabel.getToolTipText()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JLabel.getToolTipText()方法的具体详情如下:
包路径:javax.swing.JLabel
类名称:JLabel
方法名:getToolTipText

JLabel.getToolTipText介绍

暂无

代码示例

代码示例来源:origin: xyz.cofe/gui.swing

public String getTabToolTipText() {
    return titleLabel.getToolTipText();
  }// </editor-fold>
}

代码示例来源:origin: stackoverflow.com

JLabel label;
...//initialize label, etc
String text = label.getToolTipText();

代码示例来源:origin: chatty/chatty

protected String getChannelInfoTooltipText() {
  if (currentChannelInfo != null) {
    return createdAt.getToolTipText().replace("<br />", "\n").replace("<html>", "");
  }
  return null;
}

代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2

public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean hasFocus) {

    JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, hasFocus);

    if (value instanceof JLabel) {
      JLabel labelNew = (JLabel) value;
      label.setText(labelNew.getText());
      label.setToolTipText(labelNew.getToolTipText());
    }
    return label;
  }
}

代码示例来源:origin: protegeproject/protege

@Override
public synchronized String getToolTipText(MouseEvent event) {
  if (lastImportantEvent != null) {
    return String.format(LOG_EVENT_TOOLTIP_,
        truncate(lastImportantEvent.toString()));
  } else {
    return super.getToolTipText(event);
  }
}

代码示例来源:origin: com.eas.platypus/platypus-js-forms

@ScriptFunction(jsDoc = TOOLTIP_TEXT_JSDOC)
@Override
public String getToolTipText() {
  return super.getToolTipText();
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-swingapp

private void setValidValue(boolean valid) {
  validValue = valid;
  invalidLabel.setVisible(!valid);
  valueTextField.setToolTipText(valid ? null : invalidLabel.getToolTipText());
  if (!valid) {
    valueTextField.setSelectionStart(0);
    valueTextField.setSelectionEnd(valueTextField.getDocument().getLength());
  }
}

代码示例来源:origin: edu.toronto.cs.medsavant/medsavant-client

public String getValue(String key) {
  JComponent c = getComponent(key);
  if (c instanceof JLabel) {
    // the text of the label may be truncated, use the tooltip instead
    return ((JLabel) c).getToolTipText();
  } else {
    LOG.warn("WARNING: accessing string value of non-string label");
    return c.toString();
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-kenai-ui

@Override
  public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
    JPanel panel = new JPanel();
    JCheckBox checkBox = new JCheckBox();
    panel.setLayout(new BorderLayout());
    panel.setOpaque(false);
    checkBox.setOpaque(false);
    Component renderer = delegateRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
    checkBox.setSelected(model.isSelectedIndex(index));
    panel.add(checkBox, BorderLayout.WEST);
    panel.add(renderer, BorderLayout.CENTER);
    panel.setToolTipText(((JLabel)renderer).getToolTipText());
    return panel;
  }
}

代码示例来源:origin: net.sourceforge.mydoggy/mydoggy-plaf

protected void installListeners(JLabel c) {
  super.installListeners(c);
  // Forse PropertyChangeListener
  String oldText = c.getText();
  if (oldText != null) {
    c.setText(null);
    c.setText(oldText);
  }
  oldText = c.getToolTipText();
  if (oldText != null) {
    c.setToolTipText(null);
    c.setToolTipText(oldText);
  }
  adapter = new RepresentativeAnchorMouseAdapter();
  c.addMouseListener(adapter);
  c.addMouseMotionListener(adapter);
}

代码示例来源:origin: net.sourceforge.mydoggy/mydoggy-plaf

protected void installListeners(JLabel c) {
  super.installListeners(c);
  // Forse PropertyChangeListener
  String oldText = c.getText();
  if (oldText != null) {
    c.setText(null);
    c.setText(oldText);
  }
  oldText = c.getToolTipText();
  if (oldText != null) {
    c.setToolTipText(null);
    c.setToolTipText(oldText);
  }
  adapter = new RepresentativeAnchorMouseAdapter();
  c.addMouseListener(adapter);
  c.addMouseMotionListener(adapter);
  descriptor.getToolWindow().addPlafPropertyChangeListener(this);
}

代码示例来源:origin: dsukhoroslov/bagri

public Map<String, TypedValue> getBindings() { //throws Exception {
  Component[] comps = ctrlPanel.getComponents();
  Map<String, TypedValue> result = new HashMap<>();
  for (int i=3; i < comps.length; i++) {
    String name = ((JLabel) comps[i]).getToolTipText();
    i++;
    String type = (String) ((JComboBox) comps[i]).getSelectedItem();
    i++;
    String value = ((JTextField) comps[i]).getText();
    Class cls = type2Class(type);
    if (cls.equals(String.class)) {
      result.put(name, new TypedValue(type, value));
    //} else if (cls.equals(java.util.Date.class)) {
    //	new java.util.Date()
    } else {
      result.put(name, new TypedValue(type, getValue(cls, value)));
    }
  }
  return result;
}

代码示例来源:origin: igniterealtime/Spark

public String getToolTipText(MouseEvent e) {
  int r = rowAtPoint(e.getPoint());
  int c = columnAtPoint(e.getPoint());
  Object value;
  try {
    value = getValueAt(r, c);
  }
  catch (Exception e1) {
    // If we encounter a row that should not actually exist and therefore
    // has a null value. Just return an empty string for the tooltip.
    return "";
  }
  String tooltipValue = null;
  if (value instanceof JLabel) {
    tooltipValue = ((JLabel)value).getToolTipText();
  }
  if (value instanceof JLabel && tooltipValue == null) {
    tooltipValue = ((JLabel)value).getText();
  }
  else if (value != null && tooltipValue == null) {
    tooltipValue = value.toString();
  }
  else if (tooltipValue == null) {
    tooltipValue = "";
  }
  return GraphicUtils.createToolTip(tooltipValue);
}

代码示例来源:origin: igniterealtime/Spark

public String getToolTipText(MouseEvent e) {
  int r = rowAtPoint(e.getPoint());
  int c = columnAtPoint(e.getPoint());
  Object value;
  try {
    value = getValueAt(r, c);
  }
  catch (Exception e1) {
    // If we encounter a row that should not actually exist and therefore
    // has a null value. Just return an empty string for the tooltip.
    return "";
  }
  String tooltipValue = null;
  if (value instanceof JLabel) {
    tooltipValue = ((JLabel)value).getToolTipText();
  }
  if (value instanceof JLabel && tooltipValue == null) {
    tooltipValue = ((JLabel)value).getText();
  }
  else if (value != null && tooltipValue == null) {
    tooltipValue = value.toString();
  }
  else if (tooltipValue == null) {
    tooltipValue = "";
  }
  return GraphicUtils.createToolTip(tooltipValue);
}

代码示例来源:origin: icza/scelight

/**
 * Overridden to return label text as tool tip if it's truncated (due to not fitting into its size).
 */
@Override
public String getToolTipText( final MouseEvent event ) {
  // First check if super implementation returns a tool tip (tool tip set on the label itself)
  final String tip = super.getToolTipText( event );
  if ( tip != null )
    return tip;
  
  if ( getVisibleRect().width >= getPreferredSize().width )
    return null;
  
  return getText();
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-makeproject

if (libraryItem instanceof LibraryItem.ProjectItem && ((LibraryItem.ProjectItem) libraryItem).getProject(baseDir) == null) {
  iconImage = ImageUtilities.mergeImages(iconImage, brokenProjectBadge, 8, 0);
  label.setToolTipText(getString("BROKEN") + label.getToolTipText());

代码示例来源:origin: de.sciss/scisslib

lbWarn.setIcon( icn );
if( lbWarn.getToolTipText() != tt )
  lbWarn.setToolTipText( tt );

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-xml-xam-ui

/**
 * Creates new form ExternalReferenceCustomizer
 *
 * @param  component  external reference to customize.
 */
public ExternalReferenceCustomizer(T component, Model model) {
  super(component);
  initComponents();
  sourceFO = (FileObject) component.getModel().getModelSource().
      getLookup().lookup(FileObject.class);
  catalogSupport = DefaultProjectCatalogSupport.getInstance(sourceFO);
  init(component, model);
  initializeUI();
  // View for selecting an external reference.
  BeanTreeView locationView = new BeanTreeView();
  locationView.setPopupAllowed(false);
  locationView.setDefaultActionAllowed(false);
  locationView.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
  locationView.setRootVisible(false);
  locationView.getAccessibleContext().setAccessibleName(locationLabel.getToolTipText());
  locationView.getAccessibleContext().setAccessibleDescription(locationLabel.getToolTipText());
  locationPanel.add(locationView, BorderLayout.CENTER);
  explorerManager = new ExplorerManager();
  explorerManager.addPropertyChangeListener(this);
  explorerManager.setRootContext(createRootNode());
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-xml-xam-ui

locationView.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
locationView.setRootVisible(false);
locationView.getAccessibleContext().setAccessibleName(locationLabel.getToolTipText());
locationView.getAccessibleContext().setAccessibleDescription(locationLabel.getToolTipText());
Node.Property[] columns = new Node.Property[] {
  new Column(ExternalReferenceDataNode.PROP_NAME, String.class, true),

代码示例来源:origin: icza/scelight

public Point getToolTipLocation( MouseEvent event ) {
  if ( super.getToolTipText( event ) != null )
    return super.getToolTipLocation( event );

相关文章

JLabel类方法