List of usage examples for java.awt.event MouseListener MouseListener
MouseListener
From source file:com.atlassian.theplugin.idea.config.serverconfig.defaultCredentials.TestDefaultCredentialsDialog.java
private MouseListener getMouseListener(final ServerDataExt serverFinal) { return new MouseListener() { public void mouseClicked(final MouseEvent e) { DialogWithDetails.showExceptionDialog(rootPanel, "Connection Details", serverFinal.getErrorMessage()); }/* w w w . ja v a 2s .c o m*/ public void mousePressed(final MouseEvent e) { } public void mouseReleased(final MouseEvent e) { } public void mouseEntered(final MouseEvent e) { } public void mouseExited(final MouseEvent e) { } }; }
From source file:org.duracloud.syncui.SyncUIDriver.java
private static void createSysTray(final String url, final Server srv) { final TrayIcon trayIcon; try {//from w w w .ja v a 2 s. c om if (SystemTray.isSupported()) { SystemTray tray = SystemTray.getSystemTray(); InputStream is = org.duracloud.syncui.SyncUIDriver.class.getClassLoader() .getResourceAsStream("tray.png"); Image image = ImageIO.read(is); MouseListener mouseListener = new MouseListener() { public void mouseClicked(MouseEvent e) { log.debug("Tray Icon - Mouse clicked!"); } public void mouseEntered(MouseEvent e) { log.debug("Tray Icon - Mouse entered!"); } public void mouseExited(MouseEvent e) { log.debug("Tray Icon - Mouse exited!"); } public void mousePressed(MouseEvent e) { log.debug("Tray Icon - Mouse pressed!"); } public void mouseReleased(MouseEvent e) { log.debug("Tray Icon - Mouse released!"); } }; ActionListener exitListener = new ActionListener() { public void actionPerformed(ActionEvent e) { log.info("Exiting..."); try { srv.stop(); while (!srv.isStopped()) { WaitUtil.wait(1); } } catch (Exception e1) { e1.printStackTrace(); } System.exit(0); } }; PopupMenu popup = new PopupMenu(); MenuItem view = new MenuItem("View Status"); view.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { launchBrowser(url); } }); popup.add(view); MenuItem exit = new MenuItem("Exit"); exit.addActionListener(exitListener); popup.add(exit); trayIcon = new TrayIcon(image, "DuraCloud Sync Tool", popup); ActionListener actionListener = new ActionListener() { public void actionPerformed(ActionEvent e) { trayIcon.displayMessage("Action Event", "An Action Event Has Been Performed!", TrayIcon.MessageType.INFO); } }; trayIcon.setImageAutoSize(true); trayIcon.addActionListener(actionListener); trayIcon.addMouseListener(mouseListener); try { tray.add(trayIcon); } catch (AWTException e) { log.error("TrayIcon could not be added."); } } else { log.warn("System Tray is not supported."); } } catch (Exception ex) { log.error(ex.getMessage(), ex); } }
From source file:org.zaproxy.zap.extension.multiFuzz.impl.http.HttpFuzzResultDialog.java
@Override public JXTreeTable getTable() { if (table == null) { if (model == null) { model = new HttpFuzzTableModel(); }//from www. j ava 2s. com table = new JXTreeTable(model); table.setDoubleBuffered(true); table.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_INTERVAL_SELECTION); table.setName("HttpFuzzResultTable"); table.setFont(new java.awt.Font("Default", java.awt.Font.PLAIN, 12)); table.setDefaultRenderer(Pair.class, new IconTableCellRenderer()); int[] widths = { 10, 25, 550, 30, 85, 55, 40, 70 }; for (int i = 0, count = widths.length; i < count; i++) { TableColumn column = table.getColumnModel().getColumn(i); column.setPreferredWidth(widths[i]); } table.addMouseListener(new java.awt.event.MouseAdapter() { @Override public void mousePressed(java.awt.event.MouseEvent e) { showPopupMenuIfTriggered(e); } @Override public void mouseReleased(java.awt.event.MouseEvent e) { showPopupMenuIfTriggered(e); } private void showPopupMenuIfTriggered(java.awt.event.MouseEvent e) { if (e.isPopupTrigger()) { if (e.isPopupTrigger()) { // Select list item on right click JTable table = (JTable) e.getSource(); int row = table.rowAtPoint(e.getPoint()); if (!table.isRowSelected(row)) { table.changeSelection(row, 0, false, false); } View.getSingleton().getPopupMenu().show(e.getComponent(), e.getX(), e.getY()); } } } }); table.getSelectionModel().addListSelectionListener(new javax.swing.event.ListSelectionListener() { @Override public void valueChanged(javax.swing.event.ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { if (table.getSelectedRowCount() == 0) { return; } final int row = table.getSelectedRow(); if (getEntry(row) instanceof HttpFuzzRequestRecord) { final HistoryReference historyReference = ((HttpFuzzRequestRecord) getEntry(row)) .getHistory(); try { getMessageInspection().setMessage(historyReference.getHttpMessage()); } catch (HttpMalformedHeaderException | SQLException ex) { logger.error(ex.getMessage(), ex); } } updateValues(); redrawDiagrams(); } } }); } table.getTableHeader().addMouseListener(new MouseListener() { int sortedOn = -1; @Override public void mouseReleased(MouseEvent arg0) { } @Override public void mousePressed(MouseEvent arg0) { } @Override public void mouseExited(MouseEvent arg0) { } @Override public void mouseEntered(MouseEvent arg0) { } @Override public void mouseClicked(MouseEvent e) { int index = table.columnAtPoint(e.getPoint()); List<HttpFuzzRecord> list = model.getEntries(); if (list.size() == 0) { return; } HttpFuzzRecordComparator comp = new HttpFuzzRecordComparator(); comp.setFeature(index); if (index == sortedOn) { Collections.sort(list, comp); Collections.reverse(list); sortedOn = -1; } else { Collections.sort(list, comp); sortedOn = index; } table.updateUI(); } }); table.setRootVisible(false); table.setVisible(true); return table; }
From source file:org.nuclos.client.layout.wysiwyg.editor.ui.panels.WYSIWYGMetaInformationPicker.java
/** * /*from w ww. j ava 2s .c o m*/ * @param values * @param parent */ private WYSIWYGMetaInformationPicker(Window owner, List<String> values, TableLayoutPanel parent) { super(owner); this.setIconImage(NuclosIcons.getInstance().getScaledDialogIcon(48).getImage()); Container contentPane = this.getContentPane(); contentPane.setLayout(new TableLayout(layoutDefinition)); originalValues = values; filter = new JTextField(); /** the keybinding*/ filter.addKeyListener(new KeyListener() { @Override public void keyPressed(KeyEvent e) { } @Override public void keyReleased(KeyEvent e) { /** up and down cursor for selecting the next or previous entry */ if (e.getKeyCode() == KeyEvent.VK_DOWN || e.getKeyCode() == KeyEvent.VK_UP) { int selectedItem = itemList.getSelectedIndex(); if (e.getKeyCode() == KeyEvent.VK_UP) selectedItem--; else if (e.getKeyCode() == KeyEvent.VK_DOWN) selectedItem++; if (selectedItem < 0) { selectedItem = listModel.getSize() - 1; } else if (selectedItem == listModel.getSize()) { selectedItem = 0; } itemList.setSelectedIndex(selectedItem); itemList.ensureIndexIsVisible(selectedItem); } else if (e.getKeyCode() == KeyEvent.VK_ENTER || e.getKeyCode() == KeyEvent.VK_ESCAPE) { /** enter for saving, esc for cancel */ if (e.getKeyCode() == KeyEvent.VK_ESCAPE) selectedEntity = null; dispose(); } else { /** every other key is used for filtering the entries */ filterItems(WYSIWYGMetaInformationPicker.this.filter.getText()); } } @Override public void keyTyped(KeyEvent e) { } }); /** request focus in the filter window */ filter.requestFocusInWindow(); this.add(filter, new TableLayoutConstraints(1, 1, 3, 1)); itemList = new JList(listModel); itemList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); itemList.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (itemList.getSelectedValue() != null) selectedEntity = (String) itemList.getSelectedValue(); } }); freeExpr = new JCheckBox(SpringLocaleDelegate.getInstance() .getMessageFromResource("wysiwg.metainformation.picker.freeexpr")); this.add(freeExpr, new TableLayoutConstraints(1, 2, 3, 2)); freeExpr.setVisible(true); // double click on item to select itemList.addMouseListener(new MouseListener() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON1) { performSaveAction(); } } @Override public void mouseEntered(MouseEvent e) { } @Override public void mouseExited(MouseEvent e) { } @Override public void mousePressed(MouseEvent e) { } @Override public void mouseReleased(MouseEvent e) { } }); filterItems(null); JScrollPane scrollpane = new JScrollPane(itemList); this.add(scrollpane, new TableLayoutConstraints(1, 4, 3, 4)); JButton apply = new JButton(BUTTON_LABELS.LABEL_APPLY); apply.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { performSaveAction(); } }); this.add(apply, new TableLayoutConstraints(1, 6)); JButton cancel = new JButton(BUTTON_LABELS.LABEL_CANCEL); cancel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { performCancelAction(); } }); setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { performCancelAction(); } }); this.add(cancel, new TableLayoutConstraints(3, 6)); this.setBounds(this.getBounds().x, this.getBounds().y, 300, 400); this.setTitle(TABLELAYOUT_PANEL.SELECT_FIELD_FOR_METAINFORMATION); this.setModal(true); }
From source file:de.tor.tribes.ui.panels.MinimapPanel.java
/** * Creates new form MinimapPanel// ww w .j a va2 s. c o m */ MinimapPanel() { initComponents(); setSize(300, 300); mMinimapListeners = new LinkedList<>(); mToolChangeListeners = new LinkedList<>(); setCursor(ImageManager.getCursor(iCurrentCursor)); mScreenshotPanel = new ScreenshotPanel(); minimapButtons.put(ID_MINIMAP, new Rectangle(2, 2, 26, 26)); minimapButtons.put(ID_ALLY_CHART, new Rectangle(30, 2, 26, 26)); minimapButtons.put(ID_TRIBE_CHART, new Rectangle(60, 2, 26, 26)); try { minimapIcons.put(ID_MINIMAP, ImageIO.read(new File("./graphics/icons/minimap.png"))); minimapIcons.put(ID_ALLY_CHART, ImageIO.read(new File("./graphics/icons/ally_chart.png"))); minimapIcons.put(ID_TRIBE_CHART, ImageIO.read(new File("./graphics/icons/tribe_chart.png"))); } catch (Exception ignored) { } jPanel1.add(mScreenshotPanel); rVisiblePart = new Rectangle(ServerSettings.getSingleton().getMapDimension()); zoomed = false; MarkerManager.getSingleton().addManagerListener(this); TagManager.getSingleton().addManagerListener(this); MinimapRepaintThread.getSingleton().setVisiblePart(rVisiblePart); if (!GlobalOptions.isMinimal()) { MinimapRepaintThread.getSingleton().start(); } addMouseListener(new MouseListener() { @Override public void mouseClicked(MouseEvent e) { if (!showControls && e.getButton() != MouseEvent.BUTTON1) { //show controls Point p = e.getPoint(); p.translate(-5, -5); showControls(p); return; } if (!showControls && iCurrentView == ID_MINIMAP) { Point p = mousePosToMapPosition(e.getX(), e.getY()); DSWorkbenchMainFrame.getSingleton().centerPosition(p.getX(), p.getY()); MapPanel.getSingleton().getMapRenderer().initiateRedraw(MapRenderer.ALL_LAYERS); if (MinimapZoomFrame.getSingleton().isVisible()) { MinimapZoomFrame.getSingleton().toFront(); } } else { if (minimapButtons.get(ID_MINIMAP).contains(e.getPoint())) { iCurrentView = ID_MINIMAP; mBuffer = null; showControls = false; MinimapRepaintThread.getSingleton().update(); } else if (minimapButtons.get(ID_ALLY_CHART).contains(e.getPoint())) { iCurrentView = ID_ALLY_CHART; lastHash = 0; showControls = false; updateComplete(); } else if (minimapButtons.get(ID_TRIBE_CHART).contains(e.getPoint())) { iCurrentView = ID_TRIBE_CHART; lastHash = 0; showControls = false; updateComplete(); } } } @Override public void mousePressed(MouseEvent e) { if (iCurrentView != ID_MINIMAP) { return; } if (iCurrentCursor == ImageManager.CURSOR_SHOT || iCurrentCursor == ImageManager.CURSOR_ZOOM) { iXDown = e.getX(); iYDown = e.getY(); } } @Override public void mouseReleased(MouseEvent e) { if (iCurrentView != ID_MINIMAP) { return; } if (rDrag == null) { return; } if (iCurrentCursor == ImageManager.CURSOR_SHOT) { try { BufferedImage i = MinimapRepaintThread.getSingleton().getImage(); double widthFactor = ((double) ServerSettings.getSingleton().getMapDimension().width) / getWidth(); double heightFactor = ((double) ServerSettings.getSingleton().getMapDimension().height) / getHeight(); int x = (int) Math.rint(widthFactor * rDrag.getX()); int y = (int) Math.rint(heightFactor * rDrag.getY()); int w = (int) Math.rint(widthFactor * (rDrag.getWidth() - rDrag.getX())); int h = (int) Math.rint(heightFactor * (rDrag.getHeight() - rDrag.getY())); BufferedImage sub = i.getSubimage(x, y, w, h); mScreenshotPanel.setBuffer(sub); jPanel1.setSize(mScreenshotPanel.getSize()); jPanel1.setPreferredSize(mScreenshotPanel.getSize()); jPanel1.setMinimumSize(mScreenshotPanel.getSize()); jPanel1.setMaximumSize(mScreenshotPanel.getSize()); jScreenshotPreview.pack(); jScreenshotControl.pack(); jScreenshotPreview.setVisible(true); jScreenshotControl.setVisible(true); } catch (Exception ie) { logger.error("Failed to initialize mapshot", ie); } } else if (iCurrentCursor == ImageManager.CURSOR_ZOOM) { if (!zoomed) { Rectangle mapDim = ServerSettings.getSingleton().getMapDimension(); double widthFactor = ((double) mapDim.width) / getWidth(); double heightFactor = ((double) mapDim.height) / getHeight(); int x = (int) Math.rint(widthFactor * rDrag.getX() + mapDim.getMinX()); int y = (int) Math.rint(heightFactor * rDrag.getY() + mapDim.getMinY()); int w = (int) Math.rint(widthFactor * (rDrag.getWidth() - rDrag.getX())); if (w >= 10) { rVisiblePart = new Rectangle(x, y, w, w); MinimapRepaintThread.getSingleton().setVisiblePart(rVisiblePart); redraw(); zoomed = true; } } else { rVisiblePart = new Rectangle(ServerSettings.getSingleton().getMapDimension()); MinimapRepaintThread.getSingleton().setVisiblePart(rVisiblePart); redraw(); zoomed = false; } MinimapZoomFrame.getSingleton().setVisible(false); } iXDown = 0; iYDown = 0; rDrag = null; } @Override public void mouseEntered(MouseEvent e) { if (iCurrentView != ID_MINIMAP) { return; } switch (iCurrentCursor) { case ImageManager.CURSOR_ZOOM: { MinimapZoomFrame.getSingleton().setVisible(true); } } } @Override public void mouseExited(MouseEvent e) { if (MinimapZoomFrame.getSingleton().isVisible()) { MinimapZoomFrame.getSingleton().setVisible(false); } iXDown = 0; iYDown = 0; rDrag = null; } }); addMouseMotionListener(new MouseMotionListener() { @Override public void mouseDragged(MouseEvent e) { if (iCurrentView != ID_MINIMAP) { return; } switch (iCurrentCursor) { case ImageManager.CURSOR_MOVE: { Point p = mousePosToMapPosition(e.getX(), e.getY()); DSWorkbenchMainFrame.getSingleton().centerPosition(p.x, p.y); rDrag = null; break; } case ImageManager.CURSOR_SHOT: { rDrag = new Rectangle2D.Double(iXDown, iYDown, e.getX(), e.getY()); break; } case ImageManager.CURSOR_ZOOM: { rDrag = new Rectangle2D.Double(iXDown, iYDown, e.getX(), e.getY()); break; } } } @Override public void mouseMoved(MouseEvent e) { if (iCurrentView == ID_MINIMAP) { switch (iCurrentCursor) { case ImageManager.CURSOR_ZOOM: { if (!MinimapZoomFrame.getSingleton().isVisible()) { MinimapZoomFrame.getSingleton().setVisible(true); } int mapWidth = (int) ServerSettings.getSingleton().getMapDimension().getWidth(); int mapHeight = (int) ServerSettings.getSingleton().getMapDimension().getHeight(); int x = (int) Math.rint((double) mapWidth / (double) getWidth() * (double) e.getX()); int y = (int) Math.rint((double) mapHeight / (double) getHeight() * (double) e.getY()); MinimapZoomFrame.getSingleton().updatePosition(x, y); break; } default: { if (MinimapZoomFrame.getSingleton().isVisible()) { MinimapZoomFrame.getSingleton().setVisible(false); } } } } Point location = minimapButtons.get(ID_MINIMAP).getLocation(); location.translate(-2, -2); if (!new Rectangle(location.x, location.y, 88, 30).contains(e.getPoint())) { //hide controls showControls = false; repaint(); } } }); addMouseWheelListener(new MouseWheelListener() { @Override public void mouseWheelMoved(MouseWheelEvent e) { if (iCurrentView != ID_MINIMAP) { return; } iCurrentCursor += e.getWheelRotation(); if (iCurrentCursor == ImageManager.CURSOR_DEFAULT + e.getWheelRotation()) { if (e.getWheelRotation() < 0) { iCurrentCursor = ImageManager.CURSOR_SHOT; } else { iCurrentCursor = ImageManager.CURSOR_MOVE; } } else if (iCurrentCursor < ImageManager.CURSOR_MOVE) { iCurrentCursor = ImageManager.CURSOR_DEFAULT; } else if (iCurrentCursor > ImageManager.CURSOR_SHOT) { iCurrentCursor = ImageManager.CURSOR_DEFAULT; } if (iCurrentCursor != ImageManager.CURSOR_ZOOM) { if (MinimapZoomFrame.getSingleton().isVisible()) { MinimapZoomFrame.getSingleton().setVisible(false); } } else { MinimapZoomFrame.getSingleton().setVisible(true); } setCurrentCursor(iCurrentCursor); } }); }
From source file:it.iit.genomics.cru.igb.bundles.mi.view.MITable.java
public MITable(MITableModel model, IgbService service, final MIQuery query) { super(model); this.query = query; igbLogger = IGBLogger.getInstance(query.getLabel()); this.igbService = service; this.SymSelectionListener = new MouseListener() { @SuppressWarnings("unchecked") @Override//from w w w . j a v a 2 s.c o m public void mouseClicked(MouseEvent e) { if (e.getComponent().isEnabled() && e.getButton() == MouseEvent.BUTTON1) { if (getSelectedRow() >= 0) { int modelRow = convertRowIndexToModel(getSelectedRow()); MIResult interaction = ((MITableModel) getModel()).getResult(modelRow); structuresPanel.setCurrentInteraction(interaction); } MITable table = (MITable) e.getComponent(); int modelRow = convertRowIndexToModel(table.getSelectedRow()); int column = table.getSelectedColumn(); if (e.getClickCount() == 1) { if (column == MITableModel.TRACK_COLUMN) { Object value = table.getValueAt(table.getSelectedRow(), column); if (value instanceof JButton) { MIResult result = ((MITableModel) table.getModel()).getResult(modelRow); TypeContainerAnnot interactorTrack = result.createTrack(); igbService.addTrack(interactorTrack, interactorTrack.getID()); igbService.getSeqMapView().updatePanel(); for (TierGlyph t : igbService.getAllTierGlyphs()) { if (TierGlyph.TierType.ANNOTATION.equals(t.getTierType()) && (t.getAnnotStyle().getTrackName().equals(interactorTrack.getID()))) { SimpleTrackStyle style = new SimpleTrackStyle(interactorTrack.getID(), false) { @Override public boolean drawCollapseControl() { return false; } }; t.getAnnotStyle().copyPropertiesFrom(style); t.getAnnotStyle().setColorProvider(new RGB()); interactorTrack.setProperty(TrackLineParser.ITEM_RGB, "on"); } } igbService.getSeqMapView().updatePanel(); ((JButton) value).setText(interactorTrack.getID()); ((JButton) value).setEnabled(false); updateUI(); } } } else { // symmetry: zoom-in if (column == MITableModel.SYMS1_COLUMN) { MoleculeEntry entry = ((MITableModel) table.getModel()).getResult(modelRow) .getInteractor1(); if (query.getTaxid().equals(entry.getTaxid())) { Collection<SeqSymmetry> syms = ((MITableModel) table.getModel()).getResult(modelRow) .getSymmetries1(); zoomToSym(syms); } } else if (column == MITableModel.SYMS2_COLUMN) { MoleculeEntry entry = ((MITableModel) table.getModel()).getResult(modelRow) .getInteractor2(); if (query.getTaxid().equals(entry.getTaxid())) { Collection<SeqSymmetry> syms = ((MITableModel) table.getModel()).getResult(modelRow) .getSymmetries2(); zoomToSym(syms); } } // Protein: link to uniprot if (column == MITableModel.INTERACTOR1_COLUMN || column == MITableModel.INTERACTOR2_COLUMN) { MIResult miResult = ((MITableModel) table.getModel()).getResult(modelRow); String id; String taxid; MoleculeEntry interactor; if (column == MITableModel.INTERACTOR1_COLUMN) { interactor = miResult.getInteractor1(); } else { interactor = miResult.getInteractor2(); } taxid = interactor.getTaxid(); String query; String anchor = ""; switch (taxid) { case MoleculeEntry.TAXID_DNA: case MoleculeEntry.TAXID_RNA: if (miResult.getInteractionStructures().isEmpty()) { return; } query = "http://www.pdb.org/pdb/explore/explore.do?structureId=" + miResult.getInteractionStructures().iterator().next().getStructureID(); break; case MoleculeEntry.TAXID_LIGAND: if (miResult.getInteractionStructures().isEmpty()) { return; } query = DrugBankMapper.getInstance().isDrug(interactor.getGeneName()) ? DrugBankMapper.getInstance().getDrugBankLink(interactor.getGeneName()) : "http://www.ebi.ac.uk/pdbe-srv/pdbechem/chemicalCompound/show/" + interactor.getGeneName(); break; case MoleculeEntry.TAXID_MODIFICATION: query = "http://www.uniprot.org/uniprot/" + miResult.getInteractor1().getUniprotAc(); anchor = "#ptm_processing"; break; default: id = interactor.getUniprotAc(); query = "http://www.uniprot.org/uniprot/" + id; break; } try { URI uri = new URI(URIUtil.encodeQuery(query) + anchor); Desktop desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null; if (desktop != null && desktop.isSupported(Desktop.Action.BROWSE)) { desktop.browse(uri); } } catch (IOException ioe) { JOptionPane.showMessageDialog(null, "Cannot reach Uniprot website."); return; } catch (URISyntaxException ue) { JOptionPane.showMessageDialog(null, "Cannot reach Uniprot website: " + query); } } // interaction type: link to psicquic if (column == MITableModel.INTERACTION_TYPE_COLUMN) { MIResult miResult = ((MITableModel) table.getModel()).getResult(modelRow); String queryURL; String idA = miResult.getInteractor1().getUniprotAc(); String idB = miResult.getInteractor2().getUniprotAc(); if (null == miResult.getPsicquicUrl()) { // from the structure database if (query.searchDSysMap()) { queryURL = "http://http://dsysmap.irbbarcelona.org/results.php?type=proteins&neigh=2&value=" + idA + "," + idB; } else if (query.searchInteractome3D()) { try { queryURL = "http://interactome3d.irbbarcelona.org/interaction.php?ids=" + idA + ";" + idB + "&dataset=" + it.iit.genomics.cru.bridges.interactome3d.ws.Utils .getDataset(query.getTaxid()); } catch (Interactome3DException e3d) { // it will never happend: if the taxid was not known by // I3D, we wouldn't have an interaction return; } } else { return; } } else { if (false == idA.equals(idB)) { queryURL = miResult.getPsicquicUrl() + "query/id:" + miResult.getInteractor1().getUniprotAc() + "* AND id:" + miResult.getInteractor2().getUniprotAc() + "*"; } else { queryURL = miResult.getPsicquicUrl() + "query/idA:" + miResult.getInteractor1().getUniprotAc() + "* AND idB:" + miResult.getInteractor2().getUniprotAc() + "*"; } } try { URI uri = new URI(URIUtil.encodeQuery(queryURL)); Desktop desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null; if (desktop != null && desktop.isSupported(Desktop.Action.BROWSE)) { desktop.browse(uri); } } catch (IOException ioe) { JOptionPane.showMessageDialog(null, "Cannot reach psicquic server."); } catch (URISyntaxException ue) { JOptionPane.showMessageDialog(null, "Cannot reach psicquic server: " + queryURL); } } } } } @Override public void mousePressed(MouseEvent me) { } @Override public void mouseReleased(MouseEvent me) { } @Override public void mouseEntered(MouseEvent me) { } @Override public void mouseExited(MouseEvent me) { } }; TableRowSorter<MITableModel> sorter = new MITableRowSorter(model); setRowSorter(sorter); sorter.setRowFilter(evidenceRowFilter()); model.fireTableDataChanged(); this.getTableHeader().setReorderingAllowed(false); TableCellRenderer rend = getTableHeader().getDefaultRenderer(); TableColumnModel tcm = getColumnModel(); for (int j = 0; j < tcm.getColumnCount(); j += 1) { TableColumn tc = tcm.getColumn(j); TableCellRenderer rendCol = tc.getHeaderRenderer(); // likely null if (rendCol == null) { rendCol = rend; } Component c = rendCol.getTableCellRendererComponent(this, tc.getHeaderValue(), false, false, 0, j); tc.setPreferredWidth(c.getPreferredSize().width); } TableCellRenderer buttonRenderer = new JTableButtonRenderer(); getColumn(model.getColumnName(MITableModel.TRACK_COLUMN)).setCellRenderer(buttonRenderer); getColumn(model.getColumnName(MITableModel.SYMS1_COLUMN)).setCellRenderer(new GeneRenderer()); getColumn(model.getColumnName(MITableModel.SYMS2_COLUMN)).setCellRenderer(new GeneRenderer()); getColumn(model.getColumnName(MITableModel.INTERACTOR1_COLUMN)).setCellRenderer(new MoleculeRenderer()); getColumn(model.getColumnName(MITableModel.INTERACTOR2_COLUMN)).setCellRenderer(new MoleculeRenderer()); getColumn(model.getColumnName(MITableModel.INTERACTION_TYPE_COLUMN)) .setCellRenderer(new EvidenceRenderer()); getColumn(model.getColumnName(MITableModel.STRUCTURES_COLUMN)).setCellRenderer(new StructuresRenderer()); setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS); int smallWidth = 75; int mediumWidth = 120; int largeWidth = 200; getColumnModel().getColumn(MITableModel.TRACK_COLUMN).setMinWidth(smallWidth); getColumnModel().getColumn(MITableModel.STRUCTURES_COLUMN).setMinWidth(smallWidth); getColumnModel().getColumn(MITableModel.STRUCTURES_COLUMN).setMaxWidth(smallWidth); getColumnModel().getColumn(MITableModel.STRUCTURES_COLUMN).setPreferredWidth(smallWidth); addMouseListener(SymSelectionListener); getSelectionModel().addListSelectionListener(new RowSelectionListener()); }
From source file:org.echocat.velma.dialogs.AboutDialog.java
protected void createIntroduction(@Nonnull Resources resources) { final URL iconUrl = resources.getIconUrl(48); final StringBuilder body = new StringBuilder(); body.append("<html>"); body.append("<head><style>" + "td { margin-right: 10px; }" + "</style></head>"); body.append("<body style='font-family: sans; font-size: 1em'><table><tr>"); body.append("<td valign='top'><img src='").append(iconUrl).append("' /></td>"); body.append("<td valign='top'>"); body.append("<h2>").append(escapeHtml4(resources.getApplicationName())); final String version = resources.getVersion(); if (!isEmpty(version)) { body.append("<br/><span style='font-size: 0.6em'>") .append(resources.formatEscaped("versionText", version)).append("</span>"); }//from w ww. j av a2s . co m body.append("</h2>"); body.append("<p>Copyright 2011-2012 <a href='https://echocat.org'>echocat</a></p>"); body.append("<p><a href='http://mozilla.org/MPL/2.0/'>") .append(resources.formatEscaped("licensedUnder", "MPL 2.0")).append("</a></p>"); body.append("<p><table cellpadding='0' cellspacing='0'>"); body.append("<tr><td>").append(resources.formatEscaped("xHomepage", "echocat")) .append(":</td><td><a href='https://echocat.org'>echocat.org</a></td></tr>"); body.append("<tr><td>").append(resources.formatEscaped("xHomepage", "Velma")) .append(":</td><td><a href='https://velma.echocat.org'>velma.echocat.org</a></td></tr>"); body.append("</table></p>"); body.append("<h4>").append(resources.formatEscaped("developers")) .append("</h4><table cellpadding='0' cellspacing='0'>"); body.append( "<tr><td>Gregor Noczinski</td><td><a href='mailto:gregor@noczinski.eu'>gregor@noczinski.eu</a></td><td><a href='https://github.com/blaubaer'>github.com/blaubaer</a></td></tr>"); body.append("</table>"); body.append("</td>"); body.append("</tr></table></body></html>"); final JTextPane text = new JTextPane(); text.setMargin(new Insets(0, 0, 0, 0)); text.setContentType("text/html"); text.setText(body.toString()); text.setFont(new Font(DIALOG, PLAIN, 12)); text.setBackground(new Color(255, 255, 255, 0)); text.setEditable(false); text.addHyperlinkListener(new HyperlinkListener() { @Override public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() == ACTIVATED && isDesktopSupported()) { final Desktop desktop = getDesktop(); if (desktop.isSupported(BROWSE)) { try { desktop.browse(e.getURL().toURI()); } catch (IOException | URISyntaxException exception) { LOG.error("Could not open " + e.getURL() + " because of an exception.", exception); } } else { LOG.error("Could not open " + e.getURL() + " because browse is not supported by desktop."); } } repaint(); } }); text.addMouseListener(new MouseListener() { @Override public void mouseClicked(MouseEvent e) { repaint(); } @Override public void mousePressed(MouseEvent e) { repaint(); } @Override public void mouseReleased(MouseEvent e) { repaint(); } @Override public void mouseEntered(MouseEvent e) { repaint(); } @Override public void mouseExited(MouseEvent e) { repaint(); } }); add(text, new CC().spanX(2).growX().minWidth("10px")); }
From source file:Provider.GoogleMapsStatic.TestUI.SampleApp.java
private void _displayImgInFrame() { final JFrame frame = new JFrame("Google Static Map"); GUIUtils.setAppIcon(frame, "71.png"); frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE); JLabel imgLbl = new JLabel(new ImageIcon(_img)); imgLbl.setToolTipText(MessageFormat.format("<html>Image downloaded from URI<br>size: w={0}, h={1}</html>", _img.getWidth(), _img.getHeight())); imgLbl.addMouseListener(new MouseListener() { public void mouseClicked(MouseEvent e) { }// w w w . j a va2s . c o m public void mousePressed(MouseEvent e) { frame.dispose(); } public void mouseReleased(MouseEvent e) { } public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } }); frame.setContentPane(imgLbl); frame.pack(); GUIUtils.centerOnScreen(frame); frame.setVisible(true); }
From source file:org.zaproxy.zap.extension.customFire.TechnologyTreePanel.java
public TechnologyTreePanel addTechTreeListener(final TechnologyTreePanel ttp, final boolean s) { ttp.techTree.addMouseListener(new MouseListener() { @Override/*w w w . j a v a2s. c o m*/ public void mouseReleased(MouseEvent e) { } @Override public void mousePressed(MouseEvent e) { } @Override public void mouseExited(MouseEvent e) { } @Override public void mouseEntered(MouseEvent e) { } @Override public void mouseClicked(MouseEvent e) { TreePath tp = techTree.getPathForLocation(e.getX(), e.getY()); techTree.check1(tp, s); techTree.repaint(); } }); return ttp; }
From source file:Provider.GoogleMapsStatic.TestUI.SampleApp.java
private void _displayRespStrInFrame() { final JFrame frame = new JFrame("Google Static Map - Error"); GUIUtils.setAppIcon(frame, "69.png"); frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE); JTextArea response = new JTextArea(_respStr, 25, 80); response.addMouseListener(new MouseListener() { public void mouseClicked(MouseEvent e) { }//from w ww . ja v a 2s . c o m public void mousePressed(MouseEvent e) { frame.dispose(); } public void mouseReleased(MouseEvent e) { } public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } }); frame.setContentPane(new JScrollPane(response)); frame.pack(); GUIUtils.centerOnScreen(frame); frame.setVisible(true); }