TIP: Images in Tooltips
Here is a simple tip:
The Swing tooltips support html syntax via use of the <html> tag. This can be exploited to show images in tooltips.
For example, with the following layout:
src
org
mypackage
ImageInTooltip.java
tooltip.gif
and source code:
package org.mypackage;
import javax.swing.JFrame;
import javax.swing.JLabel;
public class ImageInTooltip {
public static void main(String[] args) {
JFrame frame = new JFrame();
JLabel label = new JLabel("Label with image in Tooltip!");
label.setToolTipText(
"<html><img src=\"" +
ImageInTooltip.class.getResource("tooltip.gif") +
"\"> Tooltip "
);
label.setHorizontalAlignment(JLabel.CENTER);
frame.setContentPane(label);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setBounds(100, 100, 200, 100);
frame.setVisible(true);
}
}
give you this:
Posted by sandipchitale
( May 21 2006, 04:59:23 PM PDT ) Permalink
UPDATED: Code Template Tools Module
I have updated the Code Template Tools Module on my NetBeans 5.0 update center described
(here).
What is new?
A new generalized code template parameter
${input-parameter name ...} :
${input-parameter name prompt="prompt string"
defaultValue="value1" valuesSeparator="," enumeratedValues="value1,value2,value3" suggestedValues="value1,value2,value3"}
- The user will be be prompted to enter the value of the parameter.
The parameter name part (excluding the input- prefix is used
as the default prompt and default value. The values of input-...
parameters can be strictly constrained using the enumeratedValues
hint. The values of input-...
parameters can be loosely constrained using the suggestedValues
hint. The values separator can be specified using valuesSeparator regexp hint.
DISCLAIMER: This module is experimental. So no guarantees. Use the module at your own risk.
Posted by sandipchitale
( May 21 2006, 08:51:56 AM PDT ) Permalink