use of java.awt.event.MouseAdapter in project jadx by skylot.
the class TextStandardActions method registerListeners.
private void registerListeners() {
textComponent.addMouseListener(new MouseAdapter() {
public void mouseReleased(MouseEvent e) {
if (e.getModifiers() == InputEvent.BUTTON3_MASK && e.getSource() == textComponent) {
process(e);
}
}
});
textComponent.getDocument().addUndoableEditListener(new UndoableEditListener() {
public void undoableEditHappened(UndoableEditEvent event) {
undoManager.addEdit(event.getEdit());
}
});
}
use of java.awt.event.MouseAdapter in project dbeaver by serge-rider.
the class TrayIconHandler method show.
public void show() {
if (trayItem != null) {
return;
}
File logoFile;
try {
logoFile = RuntimeUtils.getPlatformFile(UIIcon.DBEAVER_LOGO.getLocation());
} catch (IOException e) {
log.error(e);
return;
}
trayItem = new TrayIcon(Toolkit.getDefaultToolkit().getImage(logoFile.getAbsolutePath()));
trayItem.setImageAutoSize(true);
trayItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
}
});
trayItem.addMouseListener(new MouseAdapter() {
@Override
public void mouseReleased(MouseEvent e) {
}
});
// Add tooltip and menu to tray icon
trayItem.setToolTip(GeneralUtils.getProductTitle());
// area
try {
SystemTray.getSystemTray().add(trayItem);
} catch (AWTException e) {
log.error(e);
}
}
use of java.awt.event.MouseAdapter in project jgnash by ccavanaugh.
the class RecurringPanel method initComponents.
private void initComponents() {
JPanel toolPanel = new JPanel(new BorderLayout());
JToolBar toolBar = new JToolBar();
toolBar.setFloatable(false);
toolBar.setRollover(true);
newButton = new RollOverButton(rb.getString("Button.New"), IconUtils.getIcon("/jgnash/resource/document-new.png"));
modifyButton = new RollOverButton(rb.getString("Button.Modify"), IconUtils.getIcon("/jgnash/resource/document-properties.png"));
deleteButton = new RollOverButton(rb.getString("Button.Delete"), IconUtils.getIcon("/jgnash/resource/edit-delete.png"));
remindersButton = new RollOverButton(rb.getString("Button.CheckReminders"), IconUtils.getIcon("/jgnash/resource/view-refresh.png"));
reminderTable = new FormattedJTable();
reminderTable.setAutoCreateRowSorter(true);
reminderTable.setFillsViewportHeight(true);
reminderTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
reminderTable.addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(final KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_DELETE) {
deleteReminder();
}
}
});
reminderTable.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(final MouseEvent e) {
if (e.getClickCount() == 2) {
showModifyDialog();
}
}
});
setLayout(new BorderLayout());
toolBar.add(newButton);
toolBar.add(modifyButton);
toolBar.add(deleteButton);
toolBar.addSeparator();
toolBar.add(remindersButton);
toolPanel.add(toolBar, BorderLayout.NORTH);
toolPanel.add(new JSeparator(), BorderLayout.CENTER);
add(toolPanel, java.awt.BorderLayout.NORTH);
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBorder(new EmptyBorder(new Insets(0, 0, 0, 0)));
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
scrollPane.setAutoscrolls(true);
scrollPane.setViewportView(reminderTable);
add(scrollPane, java.awt.BorderLayout.CENTER);
deleteButton.addActionListener(this);
modifyButton.addActionListener(this);
newButton.addActionListener(this);
remindersButton.addActionListener(this);
}
use of java.awt.event.MouseAdapter in project jdk8u_jdk by JetBrains.
the class MotifFileChooserUI method createFilesList.
protected JScrollPane createFilesList() {
fileList = new JList<File>();
if (getFileChooser().isMultiSelectionEnabled()) {
fileList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
} else {
fileList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
}
fileList.setModel(new MotifFileListModel());
fileList.getSelectionModel().removeSelectionInterval(0, 0);
fileList.setCellRenderer(new FileCellRenderer());
fileList.addListSelectionListener(createListSelectionListener(getFileChooser()));
fileList.addMouseListener(createDoubleClickListener(getFileChooser(), fileList));
fileList.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
JFileChooser chooser = getFileChooser();
if (SwingUtilities.isLeftMouseButton(e) && !chooser.isMultiSelectionEnabled()) {
int index = SwingUtilities2.loc2IndexFileList(fileList, e.getPoint());
if (index >= 0) {
File file = fileList.getModel().getElementAt(index);
setFileName(chooser.getName(file));
}
}
}
});
align(fileList);
JScrollPane scrollpane = new JScrollPane(fileList);
scrollpane.setPreferredSize(prefListSize);
scrollpane.setMaximumSize(MAX_SIZE);
align(scrollpane);
fileList.setInheritsPopupMenu(true);
scrollpane.setInheritsPopupMenu(true);
return scrollpane;
}
use of java.awt.event.MouseAdapter in project jabref by JabRef.
the class EntryEditor method setupToolBar.
private void setupToolBar() {
JPanel leftPan = new JPanel();
leftPan.setLayout(new BorderLayout());
JToolBar toolBar = new OSXCompatibleToolbar(SwingConstants.VERTICAL);
toolBar.setBorder(null);
toolBar.setRollover(true);
toolBar.setMargin(new Insets(0, 0, 0, 2));
// The toolbar carries all the key bindings that are valid for the whole window.
ActionMap actionMap = toolBar.getActionMap();
InputMap inputMap = toolBar.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
inputMap.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_ENTRY_EDITOR), "close");
actionMap.put("close", closeAction);
inputMap.put(Globals.getKeyPrefs().getKey(KeyBinding.ENTRY_EDITOR_STORE_FIELD), "store");
actionMap.put("store", storeFieldAction);
inputMap.put(Globals.getKeyPrefs().getKey(KeyBinding.AUTOGENERATE_BIBTEX_KEYS), "generateKey");
actionMap.put("generateKey", generateKeyAction);
inputMap.put(Globals.getKeyPrefs().getKey(KeyBinding.AUTOMATICALLY_LINK_FILES), "autoLink");
actionMap.put("autoLink", autoLinkAction);
inputMap.put(Globals.getKeyPrefs().getKey(KeyBinding.ENTRY_EDITOR_PREVIOUS_ENTRY), "prev");
actionMap.put("prev", prevEntryAction);
inputMap.put(Globals.getKeyPrefs().getKey(KeyBinding.ENTRY_EDITOR_NEXT_ENTRY), "next");
actionMap.put("next", nextEntryAction);
inputMap.put(Globals.getKeyPrefs().getKey(KeyBinding.UNDO), "undo");
actionMap.put("undo", undoAction);
inputMap.put(Globals.getKeyPrefs().getKey(KeyBinding.REDO), "redo");
actionMap.put("redo", redoAction);
inputMap.put(Globals.getKeyPrefs().getKey(KeyBinding.HELP), "help");
actionMap.put("help", helpAction);
toolBar.setFloatable(false);
// Add actions (and thus buttons)
JButton closeBut = new JButton(closeAction);
closeBut.setText(null);
closeBut.setBorder(null);
closeBut.setMargin(new Insets(8, 0, 8, 0));
leftPan.add(closeBut, BorderLayout.NORTH);
// Create type-label
TypedBibEntry typedEntry = new TypedBibEntry(entry, panel.getBibDatabaseContext().getMode());
leftPan.add(new TypeLabel(typedEntry.getTypeForDisplay()), BorderLayout.CENTER);
TypeButton typeButton = new TypeButton();
toolBar.add(typeButton);
toolBar.add(generateKeyAction);
toolBar.add(autoLinkAction);
toolBar.add(writeXmp);
JPopupMenu fetcherPopup = new JPopupMenu();
for (EntryBasedFetcher fetcher : WebFetchers.getEntryBasedFetchers(Globals.prefs.getImportFormatPreferences())) {
fetcherPopup.add(new JMenuItem(new AbstractAction(fetcher.getName()) {
@Override
public void actionPerformed(ActionEvent e) {
new EntryFetchAndMergeWorker(panel, getEntry(), fetcher).execute();
}
}));
}
JButton fetcherButton = new JButton(IconTheme.JabRefIcon.REFRESH.getIcon());
fetcherButton.setToolTipText(Localization.lang("Update with bibliographic information from the web"));
fetcherButton.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
fetcherPopup.show(e.getComponent(), e.getX(), e.getY());
}
});
toolBar.add(fetcherButton);
toolBar.addSeparator();
toolBar.add(deleteAction);
toolBar.add(prevEntryAction);
toolBar.add(nextEntryAction);
toolBar.addSeparator();
toolBar.add(helpAction);
Component[] comps = toolBar.getComponents();
for (Component comp : comps) {
((JComponent) comp).setOpaque(false);
}
leftPan.add(toolBar, BorderLayout.SOUTH);
add(leftPan, BorderLayout.WEST);
}
Aggregations