Search in sources :

Example 1 with JHintIcon

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;
}
Also used : JPanel(javax.swing.JPanel) BorderLayout(java.awt.BorderLayout) EmptyBorder(javax.swing.border.EmptyBorder) JHintIcon(com.google.security.zynamics.zylib.gui.JHint.JHintIcon)

Example 2 with JHintIcon

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);
}
Also used : JPanel(javax.swing.JPanel) BorderLayout(java.awt.BorderLayout) JLabel(javax.swing.JLabel) EmptyBorder(javax.swing.border.EmptyBorder) JHintIcon(com.google.security.zynamics.zylib.gui.JHint.JHintIcon)

Aggregations

JHintIcon (com.google.security.zynamics.zylib.gui.JHint.JHintIcon)2 BorderLayout (java.awt.BorderLayout)2 JPanel (javax.swing.JPanel)2 EmptyBorder (javax.swing.border.EmptyBorder)2 JLabel (javax.swing.JLabel)1