use of com.google.security.zynamics.zylib.gui.JHint.JHintIcon in project binnavi by google.
the class CHintCreator method createHintPanel.
/**
* Adds a hint icon to a component.
*
* @param component The component the hint icon is added to.
* @param message The message shown by the hint icon when the cursor hovers over it.
*
* @return The new component that contains both the passed component and the hint icon.
*/
public static Component createHintPanel(final Component component, final String message) {
Preconditions.checkNotNull(component, "IE01256: Component argument can not be null");
Preconditions.checkNotNull(message, "IE01257: Message argument can not be null");
final JPanel panel = new JPanel(new BorderLayout());
panel.add(component, BorderLayout.CENTER);
final JHintIcon hintPopup = new JHintIcon(message);
hintPopup.setBorder(new EmptyBorder(0, 3, 0, 0));
panel.add(hintPopup, BorderLayout.EAST);
return panel;
}
use of com.google.security.zynamics.zylib.gui.JHint.JHintIcon in project binnavi by google.
the class CSettingsPanelBuilder method addComponent.
/**
* Adds a component that is used to configure a setting.
*
* @param panel The panel the component is added to.
* @param component The component to add to the panel.
* @param description The text of the label to be put next to the combobox.
* @param hint Tooltip shown when the user mouse-overs the created hint icon.
*/
private static void addComponent(final JPanel panel, final Component component, final String description, final String hint) {
final JPanel settingPanel = new JPanel(new BorderLayout());
settingPanel.setBorder(STANDARD_EMPTY_BORDER);
settingPanel.add(new JLabel(description), BorderLayout.CENTER);
final JPanel innerPanel = new JPanel(new BorderLayout());
innerPanel.add(component, BorderLayout.CENTER);
final JHintIcon hintPopup = new JHintIcon(hint);
hintPopup.setBorder(new EmptyBorder(0, 3, 0, 0));
innerPanel.add(hintPopup, BorderLayout.EAST);
settingPanel.add(innerPanel, BorderLayout.EAST);
panel.add(settingPanel);
}
Aggregations