use of java.awt.event.MouseAdapter in project HWpopup by Mu0n.
the class SwingLink method setup.
public void setup(String t, URI u) {
text = t;
uri = u;
setText(text);
setToolTipText(uri.toString());
addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
open(uri);
}
public void mouseEntered(MouseEvent e) {
setText(text, false);
}
public void mouseExited(MouseEvent e) {
setText(text, true);
}
});
}
use of java.awt.event.MouseAdapter in project intellij-community by JetBrains.
the class PopupHandler method installFollowingSelectionTreePopup.
public static MouseListener installFollowingSelectionTreePopup(final JTree tree, @NotNull final ActionGroup group, final String place, final ActionManager actionManager) {
if (ApplicationManager.getApplication() == null)
return new MouseAdapter() {
};
PopupHandler handler = new PopupHandler() {
public void invokePopup(Component comp, int x, int y) {
if (tree.getPathForLocation(x, y) != null && Arrays.binarySearch(tree.getSelectionRows(), tree.getRowForLocation(x, y)) > -1) {
//do not show popup menu on rows other than selection
final ActionPopupMenu popupMenu = actionManager.createActionPopupMenu(place, group);
popupMenu.getComponent().show(comp, x, y);
}
}
};
tree.addMouseListener(handler);
return handler;
}
use of java.awt.event.MouseAdapter in project intellij-community by JetBrains.
the class CustomizationUtil method installPopupHandler.
public static MouseListener installPopupHandler(JComponent component, @NotNull final String groupId, final String place) {
if (ApplicationManager.getApplication() == null)
return new MouseAdapter() {
};
PopupHandler popupHandler = new PopupHandler() {
@Override
public void invokePopup(Component comp, int x, int y) {
ActionGroup group = (ActionGroup) CustomActionsSchema.getInstance().getCorrectedAction(groupId);
final ActionPopupMenu popupMenu = ActionManager.getInstance().createActionPopupMenu(place, group);
popupMenu.getComponent().show(comp, x, y);
}
};
component.addMouseListener(popupHandler);
return popupHandler;
}
use of java.awt.event.MouseAdapter in project intellij-community by JetBrains.
the class InfoAndProgressPanel method createInlineDelegate.
@NotNull
private InlineProgressIndicator createInlineDelegate(@NotNull TaskInfo info, @NotNull ProgressIndicatorEx original, final boolean compact) {
final Collection<InlineProgressIndicator> inlines = myOriginal2Inlines.get(original);
if (inlines != null) {
for (InlineProgressIndicator eachInline : inlines) {
if (eachInline.isCompact() == compact)
return eachInline;
}
}
final InlineProgressIndicator inline = new MyInlineProgressIndicator(compact, info, original);
myInline2Original.put(inline, original);
myOriginal2Inlines.put(original, inline);
if (compact) {
inline.getComponent().addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
handle(e);
}
@Override
public void mouseReleased(MouseEvent e) {
handle(e);
}
});
}
return inline;
}
use of java.awt.event.MouseAdapter in project intellij-community by JetBrains.
the class HoverHyperlinkLabel method setupListener.
private void setupListener() {
addMouseListener(new MouseAdapter() {
public void mouseEntered(MouseEvent e) {
HoverHyperlinkLabel.super.setText(underlineTextInHtml(myOriginalText));
setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
}
public void mouseExited(MouseEvent e) {
HoverHyperlinkLabel.super.setText(myOriginalText);
setCursor(Cursor.getDefaultCursor());
}
});
new ClickListener() {
@Override
public boolean onClick(@NotNull MouseEvent e, int clickCount) {
HyperlinkEvent event = new HyperlinkEvent(HoverHyperlinkLabel.this, HyperlinkEvent.EventType.ACTIVATED, null);
for (HyperlinkListener listener : myListeners) {
listener.hyperlinkUpdate(event);
}
return true;
}
}.installOn(this);
}
Aggregations