List of usage examples for java.awt.event MouseAdapter MouseAdapter
MouseAdapter
From source file:com.projity.dialog.AbstractDialog.java
protected JComponent getHelpButton() { if (help == null) { // help= new JLabel(IconManager.getIcon("menu24.help")); help = new JButton(MenuManager.getMenuString("Help.text"));//,IconManager.getIcon("menu24.help")); // help.setToolTipText(Messages.getString("Text.Help")); //$NON-NLS-1$ help.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent arg0) { AbstractDialog.this.onHelp(); }// www .j a v a2 s.c o m }); } return help; }
From source file:com.github.dougkelly88.FLIMPlateReaderGUI.SequencingClasses.GUIComponents.XYSequencing.java
private void setControlDefaults() { pmdp_ = new PlateMapDrawPanel(this); sap_ = SeqAcqProps.getInstance();// w w w . j a va2 s.c o m plateMapBasePanel.setLayout(new BorderLayout()); plateMapBasePanel.add(pmdp_, BorderLayout.CENTER); tableModel_ = new FOVTableModel(pp_); searchFOVtableModel_ = new FOVTableModel(pp_); //Not sure if this is the best way, but try it for now. tableModel_.addTableModelListener(new TableModelListener() { @Override public void tableChanged(TableModelEvent e) { } }); fovTable_ = new JTable(); fovTable_.setModel(tableModel_); fovTable_.setSurrendersFocusOnKeystroke(true); fovTable_.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE); JScrollPane scroller = new javax.swing.JScrollPane(fovTable_); fovTable_.setPreferredScrollableViewportSize(new java.awt.Dimension(190, 130)); fovTablePanel.setLayout(new BorderLayout()); fovTablePanel.add(scroller, BorderLayout.CENTER); final JPopupMenu popupMenu = new JPopupMenu(); JMenuItem deleteItem = new JMenuItem("Delete FOV"); deleteItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int r = fovTable_.getSelectedRow(); tableModel_.removeRow(r); } }); JMenuItem addItem = new JMenuItem("Add FOV"); addItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int r = fovTable_.getSelectedRow(); tableModel_.insertRow(r, new FOV("A1", pp_, 6000)); } }); JMenuItem goToFOVItem = new JMenuItem("Go to FOV"); goToFOVItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int r = fovTable_.getSelectedRow(); // FOV fov = tableModel_.getData().get(r); xyzmi_.gotoFOV(tableModel_.getData().get(r)); if (!zAsOffset_) { double zval = tableModel_.getData().get(r).getZ(); xyzmi_.moveZAbsolute(zval); } else { // obviously, this isn't quite right - we want to get // the offset of the CURRENT FOV (perhaps from parent in // later implementations?) and subtract from that of the // NEWLY SELECTED FOV. // TODO: fix for proper zAsOffset behaviour. // Wait for move completion while (xyzmi_.isStageBusy()) { System.out.println("Stage moving..."); } ; if (parent_.checkifAFenabled()) { // If we have gone to the FOV, and have AF, do AF xyzmi_.customAutofocus(parent_.getAFOffset()); } else { // If we don't have AF, go to the 'good offset position' xyzmi_.moveZAbsolute(parent_.getFixedAFDefault()); } //Now do the relative shift xyzmi_.moveZRelative(tableModel_.getData().get(r).getZ()); System.out.println("Z value" + tableModel_.getData().get(r).getZ()); } } }); popupMenu.add(addItem); popupMenu.add(deleteItem); popupMenu.add(goToFOVItem); fovTable_.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { // System.out.println("pressed"); } @Override public void mouseReleased(MouseEvent e) { if (e.isPopupTrigger()) { JTable source = (JTable) e.getSource(); int row = source.rowAtPoint(e.getPoint()); int column = source.columnAtPoint(e.getPoint()); if (!source.isRowSelected(row)) { source.changeSelection(row, column, false, false); } popupMenu.show(e.getComponent(), e.getX(), e.getY()); } } }); // fovTable_.setDefaultRenderer(FOV.class, new TableRenderer()); setupInsertComboBox(); }
From source file:de.tor.tribes.ui.windows.DSWorkbenchMainFrame.java
/** * Creates new form MapFrame//from w w w.ja va 2 s.c om */ DSWorkbenchMainFrame() { initComponents(); setAlwaysOnTop(false); if (!GlobalOptions.isMinimal()) { setTitle("DS Workbench " + Constants.VERSION + Constants.VERSION_ADDITION); } else { setTitle("DS Workbench Mini " + Constants.VERSION + Constants.VERSION_ADDITION); } jExportDialog.pack(); jAddROIDialog.pack(); JOutlookBar outlookBar = new JOutlookBar(); outlookBar.addBar("Navigation", jNavigationPanel); outlookBar.addBar("Information", jInformationPanel); outlookBar.addBar("Karte", jMapPanel); outlookBar.addBar("ROI", jROIPanel); outlookBar.setVisibleBar(1); jSettingsScrollPane.setViewportView(outlookBar); mAbout = new AboutDialog(this, true); mAbout.pack(); chooser.setDialogTitle("Speichern unter..."); chooser.addChoosableFileFilter(new javax.swing.filechooser.FileFilter() { @Override public boolean accept(File f) { return (f != null) && (f.isDirectory() || f.getName().endsWith(".png")); } @Override public String getDescription() { return "PNG Image (*.png)"; } }); chooser.addChoosableFileFilter(new javax.swing.filechooser.FileFilter() { @Override public boolean accept(File f) { return (f != null) && (f.isDirectory() || f.getName().endsWith(".jpeg")); } @Override public String getDescription() { return "JPEG Image (*.jpeg)"; } }); //Schedule Backup new Timer("BackupTimer", true).schedule(new BackupTask(), 60 * 10000, 60 * 10000); //give focus to map panel if mouse enters map jMapPanelHolder.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { jMapPanelHolder.requestFocusInWindow(); } }); getContentPane().setBackground(Constants.DS_BACK); pack(); capabilityInfoPanel1.addActionListener(MapPanel.getSingleton()); // <editor-fold defaultstate="collapsed" desc=" Add global KeyListener "> Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() { @Override public void eventDispatched(AWTEvent event) { if (event.getID() == KeyEvent.KEY_PRESSED) { KeyEvent e = (KeyEvent) event; if (DSWorkbenchMainFrame.getSingleton().isActive()) { //move shortcuts if (e.getKeyCode() == KeyEvent.VK_DOWN) { scroll(0.0, 2.0); } else if (e.getKeyCode() == KeyEvent.VK_UP) { scroll(0.0, -2.0); } else if (e.getKeyCode() == KeyEvent.VK_LEFT) { scroll(-2.0, 0.0); } else if (e.getKeyCode() == KeyEvent.VK_RIGHT) { scroll(2.0, 0.0); } else if ((e.getKeyCode() == KeyEvent.VK_1) && e.isShiftDown() && !e.isControlDown() && !e.isAltDown()) { //shot minimap tool shortcut MapPanel.getSingleton().setCurrentCursor(ImageManager.CURSOR_ATTACK_AXE); } else if ((e.getKeyCode() == KeyEvent.VK_2) && e.isShiftDown() && !e.isControlDown() && !e.isAltDown()) { //attack axe tool shortcut MapPanel.getSingleton().setCurrentCursor(ImageManager.CURSOR_ATTACK_RAM); } else if ((e.getKeyCode() == KeyEvent.VK_3) && e.isShiftDown() && !e.isControlDown() && !e.isAltDown()) { //attack ram tool shortcut MapPanel.getSingleton().setCurrentCursor(ImageManager.CURSOR_ATTACK_SNOB); } else if ((e.getKeyCode() == KeyEvent.VK_4) && e.isShiftDown() && !e.isControlDown() && !e.isAltDown()) { //attack snob tool shortcut MapPanel.getSingleton().setCurrentCursor(ImageManager.CURSOR_ATTACK_SPY); } else if ((e.getKeyCode() == KeyEvent.VK_5) && e.isShiftDown() && !e.isControlDown() && !e.isAltDown()) { //attack sword tool shortcut MapPanel.getSingleton().setCurrentCursor(ImageManager.CURSOR_ATTACK_LIGHT); } else if ((e.getKeyCode() == KeyEvent.VK_6) && e.isShiftDown() && !e.isControlDown() && !e.isAltDown()) { //attack light tool shortcut MapPanel.getSingleton().setCurrentCursor(ImageManager.CURSOR_ATTACK_HEAVY); } else if ((e.getKeyCode() == KeyEvent.VK_7) && e.isShiftDown() && !e.isControlDown() && !e.isAltDown()) { //attack heavy tool shortcut MapPanel.getSingleton().setCurrentCursor(ImageManager.CURSOR_ATTACK_SWORD); } else if ((e.getKeyCode() == KeyEvent.VK_S) && e.isControlDown() && !e.isAltDown()) { //search frame shortcut DSWorkbenchSearchFrame.getSingleton() .setVisible(!DSWorkbenchSearchFrame.getSingleton().isVisible()); } } //misc shortcuts if ((e.getKeyCode() == KeyEvent.VK_0) && e.isAltDown()) { //no tool shortcut MapPanel.getSingleton().setCurrentCursor(ImageManager.CURSOR_DEFAULT); } else if ((e.getKeyCode() == KeyEvent.VK_1) && e.isAltDown() && !e.isShiftDown() && !e.isControlDown()) { //measure tool shortcut MapPanel.getSingleton().setCurrentCursor(ImageManager.CURSOR_MEASURE); } else if ((e.getKeyCode() == KeyEvent.VK_2) && e.isAltDown() && !e.isShiftDown() && !e.isControlDown()) { //mark tool shortcut MapPanel.getSingleton().setCurrentCursor(ImageManager.CURSOR_MARK); } else if ((e.getKeyCode() == KeyEvent.VK_3) && e.isAltDown() && !e.isShiftDown() && !e.isControlDown()) { //tag tool shortcut MapPanel.getSingleton().setCurrentCursor(ImageManager.CURSOR_TAG); } else if ((e.getKeyCode() == KeyEvent.VK_4) && e.isAltDown() && !e.isShiftDown() && !e.isControlDown()) { //attack ingame tool shortcut MapPanel.getSingleton().setCurrentCursor(ImageManager.CURSOR_SUPPORT); } else if ((e.getKeyCode() == KeyEvent.VK_5) && e.isAltDown() && !e.isShiftDown() && !e.isControlDown()) { //attack ingame tool shortcut MapPanel.getSingleton().setCurrentCursor(ImageManager.CURSOR_SELECTION); } else if ((e.getKeyCode() == KeyEvent.VK_6) && e.isAltDown() && !e.isShiftDown() && !e.isControlDown()) { //attack ingame tool shortcut MapPanel.getSingleton().setCurrentCursor(ImageManager.CURSOR_RADAR); } else if ((e.getKeyCode() == KeyEvent.VK_7) && e.isAltDown() && !e.isShiftDown() && !e.isControlDown()) { //attack ingame tool shortcut MapPanel.getSingleton().setCurrentCursor(ImageManager.CURSOR_ATTACK_INGAME); } else if ((e.getKeyCode() == KeyEvent.VK_8) && e.isAltDown() && !e.isShiftDown() && !e.isControlDown()) { //res ingame tool shortcut MapPanel.getSingleton().setCurrentCursor(ImageManager.CURSOR_SEND_RES_INGAME); } else if ((e.getKeyCode() == KeyEvent.VK_1) && e.isControlDown() && !e.isShiftDown() && !e.isAltDown()) { //move minimap tool shortcut MinimapPanel.getSingleton().setCurrentCursor(ImageManager.CURSOR_MOVE); } else if ((e.getKeyCode() == KeyEvent.VK_2) && e.isControlDown() && !e.isShiftDown() && !e.isAltDown()) { //zoom minimap tool shortcut MinimapPanel.getSingleton().setCurrentCursor(ImageManager.CURSOR_ZOOM); } else if ((e.getKeyCode() == KeyEvent.VK_3) && e.isControlDown() && !e.isShiftDown() && !e.isAltDown()) { //shot minimap tool shortcut MinimapPanel.getSingleton().setCurrentCursor(ImageManager.CURSOR_SHOT); } else if ((e.getKeyCode() == KeyEvent.VK_T) && e.isControlDown() && !e.isShiftDown() && !e.isAltDown()) { //search time shortcut ClockFrame.getSingleton().setVisible(!ClockFrame.getSingleton().isVisible()); } else if ((e.getKeyCode() == KeyEvent.VK_S) && e.isAltDown() && !e.isShiftDown() && !e.isControlDown()) { planMapshot(); } else if (e.getKeyCode() == KeyEvent.VK_F2) { DSWorkbenchAttackFrame.getSingleton() .setVisible(!DSWorkbenchAttackFrame.getSingleton().isVisible()); } else if (e.getKeyCode() == KeyEvent.VK_F3) { DSWorkbenchMarkerFrame.getSingleton() .setVisible(!DSWorkbenchMarkerFrame.getSingleton().isVisible()); } else if (e.getKeyCode() == KeyEvent.VK_F4) { DSWorkbenchTroopsFrame.getSingleton() .setVisible(!DSWorkbenchTroopsFrame.getSingleton().isVisible()); } else if (e.getKeyCode() == KeyEvent.VK_F5) { DSWorkbenchRankFrame.getSingleton() .setVisible(!DSWorkbenchRankFrame.getSingleton().isVisible()); } else if (e.getKeyCode() == KeyEvent.VK_F6) { DSWorkbenchFormFrame.getSingleton() .setVisible(!DSWorkbenchFormFrame.getSingleton().isVisible()); } else if (e.getKeyCode() == KeyEvent.VK_F7) { if (ServerSettings.getSingleton().isChurch()) { DSWorkbenchChurchFrame.getSingleton() .setVisible(!DSWorkbenchChurchFrame.getSingleton().isVisible()); } } else if (e.getKeyCode() == KeyEvent.VK_F8) { DSWorkbenchConquersFrame.getSingleton() .setVisible(!DSWorkbenchConquersFrame.getSingleton().isVisible()); } else if (e.getKeyCode() == KeyEvent.VK_F9) { DSWorkbenchNotepad.getSingleton() .setVisible(!DSWorkbenchNotepad.getSingleton().isVisible()); } else if (e.getKeyCode() == KeyEvent.VK_F10) { DSWorkbenchTagFrame.getSingleton() .setVisible(!DSWorkbenchTagFrame.getSingleton().isVisible()); } else if (e.getKeyCode() == KeyEvent.VK_F11) { DSWorkbenchStatsFrame.getSingleton() .setVisible(!DSWorkbenchStatsFrame.getSingleton().isVisible()); } else if (e.getKeyCode() == KeyEvent.VK_F12) { DSWorkbenchSettingsDialog.getSingleton().setVisible(true); } else if ((e.getKeyCode() == KeyEvent.VK_1) && e.isControlDown() && e.isAltDown() && !e.isShiftDown()) { //ROI 1 centerROI(0); } else if ((e.getKeyCode() == KeyEvent.VK_2) && e.isControlDown() && e.isAltDown() && !e.isShiftDown()) { //ROI 2 centerROI(1); } else if ((e.getKeyCode() == KeyEvent.VK_3) && e.isControlDown() && e.isAltDown() && !e.isShiftDown()) { //ROI 3 centerROI(2); } else if ((e.getKeyCode() == KeyEvent.VK_4) && e.isControlDown() && e.isAltDown() && !e.isShiftDown()) { //ROI 4 centerROI(3); } else if ((e.getKeyCode() == KeyEvent.VK_5) && e.isControlDown() && e.isAltDown() && !e.isShiftDown()) { //ROI 5 centerROI(4); } else if ((e.getKeyCode() == KeyEvent.VK_6) && e.isControlDown() && e.isAltDown() && !e.isShiftDown()) { //ROI 6 centerROI(5); } else if ((e.getKeyCode() == KeyEvent.VK_7) && e.isControlDown() && e.isAltDown() && !e.isShiftDown()) { //ROI 7 centerROI(6); } else if ((e.getKeyCode() == KeyEvent.VK_8) && e.isControlDown() && e.isAltDown() && !e.isShiftDown()) { //ROI 8 centerROI(7); } else if ((e.getKeyCode() == KeyEvent.VK_9) && e.isControlDown() && e.isAltDown() && !e.isShiftDown()) { //ROI 9 centerROI(8); } else if ((e.getKeyCode() == KeyEvent.VK_0) && e.isControlDown() && e.isAltDown() && !e.isShiftDown()) { //ROI 10 centerROI(9); } else if (e.getKeyCode() == KeyEvent.VK_SPACE) { jMapPanelHolder.requestFocusInWindow(); MapPanel.getSingleton().setSpaceDown(true); } else if (e.getKeyCode() == KeyEvent.VK_SHIFT) { jMapPanelHolder.requestFocusInWindow(); MapPanel.getSingleton().setShiftDown(true); } } else if (event.getID() == KeyEvent.KEY_RELEASED) { KeyEvent e = (KeyEvent) event; if (e.getKeyCode() == KeyEvent.VK_SPACE) { MapPanel.getSingleton().setSpaceDown(false); } else if (e.getKeyCode() == KeyEvent.VK_SHIFT) { MapPanel.getSingleton().setShiftDown(false); } } } }, AWTEvent.KEY_EVENT_MASK); // </editor-fold> // <editor-fold defaultstate="collapsed" desc=" Load UI Icons "> try { jOnlineLabel.setIcon(new ImageIcon("./graphics/icons/online.png")); jEnableClipboardWatchButton.setIcon(new ImageIcon("./graphics/icons/watch_clipboard.png")); jCenterIngameButton .setIcon(new ImageIcon(DSWorkbenchMainFrame.class.getResource("/res/ui/center_ingame.png"))); jRefreshButton.setIcon(new ImageIcon("./graphics/icons/refresh.png")); jCenterCoordinateIngame.setIcon(new ImageIcon("./graphics/icons/center.png")); } catch (Exception e) { logger.error("Failed to load status icon(s)", e); } // </editor-fold> // <editor-fold defaultstate="collapsed" desc=" Check for desktop support "> if (!Desktop.isDesktopSupported()) { jCenterIngameButton.setEnabled(false); jCenterCoordinateIngame.setEnabled(false); } // </editor-fold> // <editor-fold defaultstate="collapsed" desc=" Restore last map position "> try { String x = GlobalOptions.getSelectedProfile().getProperty("last.x"); String y = GlobalOptions.getSelectedProfile().getProperty("last.y"); centerPosition(Double.parseDouble(x), Double.parseDouble(y)); } catch (Exception e) { centerPosition(ServerSettings.getSingleton().getMapDimension().getCenterX(), ServerSettings.getSingleton().getMapDimension().getCenterY()); } // </editor-fold> // <editor-fold defaultstate="collapsed" desc=" Restore other settings "> jShowMapPopup.setSelected(GlobalOptions.getProperties().getBoolean("show.map.popup")); jShowMouseOverInfo.setSelected(GlobalOptions.getProperties().getBoolean("show.mouseover.info")); jIncludeSupport.setSelected(GlobalOptions.getProperties().getBoolean("include.support")); jHighlightTribeVillages.setSelected(GlobalOptions.getProperties().getBoolean("highlight.tribes.villages")); jShowRuler.setSelected(GlobalOptions.getProperties().getBoolean("show.ruler")); jDisplayChurch.setSelected(GlobalOptions.getProperties().getBoolean("show.church")); jDisplayWatchtower.setSelected(GlobalOptions.getProperties().getBoolean("show.watchtower")); jDisplayChurch.setEnabled(ServerSettings.getSingleton().isChurch()); jDisplayWatchtower.setEnabled(ServerSettings.getSingleton().isWatchtower()); ServerSettings.getSingleton().addListener(new ServerSettingsListener() { @Override public void fireServerSettingsChanged() { jDisplayChurch.setEnabled(ServerSettings.getSingleton().isChurch()); jDisplayWatchtower.setEnabled(ServerSettings.getSingleton().isWatchtower()); } }); int r = GlobalOptions.getProperties().getInt("radar.size"); int hour = r / 60; jHourField.setText(Integer.toString(hour)); jMinuteField.setText(Integer.toString(r - hour * 60)); // </editor-fold> // <editor-fold defaultstate="collapsed" desc="Skin Setup"> DefaultComboBoxModel gpModel = new DefaultComboBoxModel(GlobalOptions.getAvailableSkins()); jGraphicPacks.setModel(gpModel); String skin = GlobalOptions.getProperty("default.skin"); if (gpModel.getIndexOf(skin) != -1) { jGraphicPacks.setSelectedItem(skin); } else { jGraphicPacks.setSelectedItem("default"); } //</editor-fold> minZoom = GlobalOptions.getProperties().getDouble("map.zoom.min"); maxZoom = GlobalOptions.getProperties().getDouble("map.zoom.max"); dZoomInOutFactor = GlobalOptions.getProperties().getDouble("map.zoom.in.out.factor"); mNotificationHideThread = new NotificationHideThread(); mNotificationHideThread.start(); SystrayHelper.installSystrayIcon(); //update online state onlineStateChanged(); restoreProperties(); }
From source file:edu.pdi2.visual.PDI.java
private void initGUI() { try {/* ww w. j a v a2 s . c om*/ setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); getContentPane().setLayout(null); this.setTitle("Procesamiento Digital de Imagenes"); //$NON-NLS-1$ getContentPane().setBackground(new java.awt.Color(212, 208, 200)); this.setResizable(false); this.addFocusListener(new FocusAdapter() { public void focusGained(FocusEvent evt) { thisFocusGained(evt); } }); { jMenuBar1 = new JMenuBar(); setJMenuBar(jMenuBar1); { jMenu1 = new JMenu(); jMenuBar1.add(jMenu1); jMenu1.setText("File"); //$NON-NLS-1$ { jMenuItem1 = new JMenuItem(); // jMenu1.add(jMenuItem1); jMenu1.add(getJMenuOpenImage()); jMenu1.add(getJSeparator1()); jMenu1.add(getJMenuItemExit()); jMenuItem1.setText("Open Image"); //$NON-NLS-1$ jMenuItem1.addMouseListener(new MouseAdapter() { public void mouseReleased(MouseEvent evt) { jMenuItem1MouseReleased(evt); } }); } } { jMenu3 = new JMenu(); jMenuBar1.add(jMenu3); jMenuBar1.add(getJMenuView()); jMenu3.setText("Options"); //$NON-NLS-1$ jMenu3.setEnabled(false); { jMenuItem3 = new JMenuItem(); jMenu3.add(getJMenuItem2()); jMenu3.add(jMenuItem3); jMenuItem3.setText("False Color Image"); //$NON-NLS-1$ jMenuItem3.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { menuFalseColorActionPerformed(evt); } }); } { jMenuItem4 = new JMenuItem(); jMenu3.add(jMenuItem4); jMenuItem4.setText("Mesh"); //$NON-NLS-1$ jMenuItem4.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jMenuItem4ActionPerformed(evt); } }); } { jMenu4 = new JMenu(); jMenu3.add(jMenu4); jMenu3.add(getJMenuItem5()); jMenu3.add(getJGenerarSignature()); jMenu4.setText("Image"); //$NON-NLS-1$ { jmiCorrectedReflectance = new JMenuItem(); jMenu4.add(jmiCorrectedReflectance); jmiCorrectedReflectance.setText("Corrected Reflectance"); //$NON-NLS-1$ jmiCorrectedReflectance.setAccelerator(KeyStroke.getKeyStroke("ctrl pressed 1")); //$NON-NLS-1$ jmiCorrectedReflectance.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jmiCorrectedRadianceActionPerformed(evt); } }); } { jmiCorrectedRadiance = new JMenuItem(); jMenu4.add(jmiCorrectedRadiance); jmiCorrectedRadiance.setText("Corrected Radiance"); //$NON-NLS-1$ jmiCorrectedRadiance.setAccelerator(KeyStroke.getKeyStroke("ctrl pressed 2")); jmiCorrectedRadiance.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jmiCorrectedReflectanceActionPerformed(evt); } }); } } } } // First we create the instance of DisplayThumbnail with a 0.1 // scale. // dt.setBorder(BorderFactory.createTitledBorder("")); // We must register mouse motion listeners to it ! // Now we create the instance of DisplayJAI to show the region // corresponding to the viewport. // Set it size. { image = new JPanel(); getContentPane().add(image); image.setBounds(1, 10, 590, dHeight + 10); { dj = new DisplayJAIWithAnnotations(); image.add(dj); dj.setBounds(0, 0, dWidth, dHeight); dj.setPreferredSize(new Dimension(dWidth, dHeight)); dj.setMinimumSize(new Dimension(dWidth, dHeight)); dj.setMaximumSize(new Dimension(dWidth, dHeight)); dj.setBorder(BorderFactory.createTitledBorder("")); dj.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent evt) { djMousePressed(evt); } }); dj.addMouseMotionListener(new MouseMotionAdapter() { public void mouseMoved(MouseEvent evt) { djMouseMoved(evt); } public void mouseDragged(MouseEvent evt) { djMouseDragged(evt); } }); } getContentPane().add(getLatLon()); } pack(); this.setSize(604, 579); } catch (Exception e) { e.printStackTrace(); } }
From source file:de.tor.tribes.ui.views.DSWorkbenchSOSRequestAnalyzer.java
private void buildMenu() { JXTaskPane viewPane = new JXTaskPane(); viewPane.setTitle("Ansicht"); JXButton toSosView = new JXButton( new ImageIcon(DSWorkbenchTagFrame.class.getResource("/res/ui/axe24.png"))); toSosView.setToolTipText("Eingelesene SOS-Anfragen anzeigen"); toSosView.addMouseListener(new MouseAdapter() { @Override/*from w ww . j a v a 2 s . c om*/ public void mouseReleased(MouseEvent e) { jScrollPane6.setViewportView(jAttacksTable); } }); viewPane.getContentPane().add(toSosView); JXButton toSupportView = new JXButton( new ImageIcon(DSWorkbenchTagFrame.class.getResource("/res/ui/sword24.png"))); toSupportView.setToolTipText("Errechnete Untersttzungen anzeigen"); toSupportView.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { jScrollPane6.setViewportView(jSupportsTable); } }); viewPane.getContentPane().add(toSupportView); JXTaskPane transferPane = new JXTaskPane(); transferPane.setTitle("bertragen"); JXButton toSupport = new JXButton( new ImageIcon(DSWorkbenchTagFrame.class.getResource("/res/ui/support_tool.png"))); toSupport.setToolTipText( "bertrgt den ersten Angriff der gewhlten SOS-Anfrage in das Untersttzungswerkzeug"); toSupport.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { transferToSupportTool(); } }); transferPane.getContentPane().add(toSupport); JXButton toRetime = new JXButton( new ImageIcon(DSWorkbenchTagFrame.class.getResource("/res/ui/re-time.png"))); toRetime.setToolTipText( "bertrgt den gewhlten Angriff in den ReTimer. Anschlieend muss dort noch die vermutete Einheit gewhlt werden!"); toRetime.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { transferToRetimeTool(); } }); transferPane.getContentPane().add(toRetime); JXButton toBrowser = new JXButton( new ImageIcon(DSWorkbenchTagFrame.class.getResource("/res/ui/att_browser.png"))); toBrowser.setToolTipText("bertrgt die gewhlten Untersttzungen in den Browser"); toBrowser.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { transferToBrowser(); } }); transferPane.getContentPane().add(toBrowser); transferPane.getContentPane().add(new JXButton(new AbstractAction(null, new ImageIcon(DSWorkbenchTagFrame.class.getResource("/res/ui/sos_clipboard.png"))) { @Override public Object getValue(String key) { if (key.equals(Action.SHORT_DESCRIPTION)) { return "Untersttzungsanfragen fr die gewhlten, unvollstndigen Verteidigungen erstellen" + " und in die Zwischenablage kopieren"; } return super.getValue(key); } @Override public void actionPerformed(ActionEvent e) { copyDefRequests(); } })); JXTaskPane miscPane = new JXTaskPane(); miscPane.setTitle("Sonstiges"); JXButton reAnalyzeButton = new JXButton( new ImageIcon(DSWorkbenchTagFrame.class.getResource("/res/ui/reanalyze.png"))); reAnalyzeButton.setToolTipText( "Analysiert die eingelesenen Angriffe erneut, z.B. wenn man die Truppenzahlen in den Einstellungen gendert hat."); reAnalyzeButton.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { analyzeData(true); } }); miscPane.getContentPane().add(reAnalyzeButton); JXButton setSelectionSecured = new JXButton( new ImageIcon(DSWorkbenchTagFrame.class.getResource("/res/ui/save.png"))); setSelectionSecured.setToolTipText( "Die gewhlten Eintrge manuell auf 'Sicher' setzen, z.B. weil man sie ignorieren mchte oder bereits gengend Untersttzungen laufen."); setSelectionSecured.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { setSelectionSecured(); } }); miscPane.getContentPane().add(setSelectionSecured); clickAccount = new ClickAccountPanel(); profileQuickchangePanel = new ProfileQuickChangePanel(); centerPanel.setupTaskPane(clickAccount, profileQuickchangePanel, viewPane, transferPane, miscPane); }
From source file:net.sf.jabref.gui.openoffice.StyleSelectDialog.java
private void setupTable() { styles = new BasicEventList<>(); EventList<OOBibStyle> sortedStyles = new SortedList<>(styles); tableModel = (DefaultEventTableModel<OOBibStyle>) GlazedListsSwing .eventTableModelWithThreadProxyList(sortedStyles, new StyleTableFormat()); table = new JTable(tableModel); TableColumnModel cm = table.getColumnModel(); cm.getColumn(0).setPreferredWidth(100); cm.getColumn(1).setPreferredWidth(200); cm.getColumn(2).setPreferredWidth(80); selectionModel = (DefaultEventSelectionModel<OOBibStyle>) GlazedListsSwing .eventSelectionModelWithThreadProxyList(sortedStyles); table.setSelectionModel(selectionModel); table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.addMouseListener(new MouseAdapter() { @Override/*from w w w . j a va 2 s .co m*/ public void mousePressed(MouseEvent mouseEvent) { if (mouseEvent.isPopupTrigger()) { tablePopup(mouseEvent); } } @Override public void mouseReleased(MouseEvent mouseEvent) { if (mouseEvent.isPopupTrigger()) { tablePopup(mouseEvent); } } }); selectionModel.getSelected().addListEventListener(new EntrySelectionListener()); }
From source file:edu.ku.brc.af.ui.forms.IconViewObj.java
/** * //from w w w . jav a 2 s . co m */ protected void initMainComp() { if (isEditing) { String delTTStr = ResultSetController.createTooltip("DeleteRecordTT", view.getObjTitle()); String edtTTStr = ResultSetController.createTooltip("EditRecordTT", view.getObjTitle()); String newTTStr = ResultSetController.createTooltip("NewRecordTT", view.getObjTitle()); editBtn = UIHelper.createIconBtnTT("EditForm", IconManager.IconSize.Std16, edtTTStr, false, null); newBtn = UIHelper.createIconBtnTT("CreateObj", IconManager.IconSize.Std16, newTTStr, false, null); delBtn = UIHelper.createIconBtnTT("DeleteRecord", IconManager.IconSize.Std16, delTTStr, false, null); validationInfoBtn = FormViewObj.createValidationIndicator(mainComp, getValidator()); editBtn.setEnabled(false); delBtn.setEnabled(false); newBtn.setEnabled(true); } else { String srchTTStr = ResultSetController.createTooltip("ShowRecordInfoTT", view.getObjTitle()); viewBtn = UIHelper.createIconBtnTT("InfoIcon", IconManager.IconSize.Std16, srchTTStr, false, null); viewBtn.setEnabled(false); } altViewsList = new Vector<AltViewIFace>(); switcherUI = FormViewObj.createMenuSwitcherPanel(mvParent, view, altView, altViewsList, mainComp, cellName, dataClass); Dimension maxSize = Thumbnailer.getInstance().getMaxSize(); iconTray = new OrderedIconTray(IconTray.SINGLE_ROW, maxSize.width, maxSize.height); iconTray.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equalsIgnoreCase("item order")) { rootHasChanged(); } } }); iconTray.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 1) { updateEnableUI(); } else if (e.getClickCount() > 1) { doDoubleClick(); } } @Override public void mousePressed(MouseEvent e) { if (e.isPopupTrigger()) { showContextMenu(e); } } }); iconTray.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { updateEnableUI(); } } }); if (isEditing) { addActionListenerToEditButton(); addActionListenerToNewButton(); addActionListenerToDeleteButton(); IconViewTransferHandler ivth = new IconViewTransferHandler(this); iconTray.setTransferHandler(ivth); } else { addActionListenerToViewButton(); } mainComp = new RestrictablePanel(); mainComp.setLayout(new BorderLayout()); if (mvParent == null) { mainComp.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); } boolean isAbove = mvParent.getSeparator() != null; int defCnt = (isEditing ? 3 : 1) + (switcherUI != null ? 1 : 0) + (validationInfoBtn != null ? 1 : 0); String colDef = (isAbove ? "1px," : "f:1px:g,") + UIHelper.createDuplicateJGoodiesDef("p", "1px", defCnt); PanelBuilder builder = new PanelBuilder(new FormLayout(colDef, "p")); CellConstraints cc = new CellConstraints(); int x = 2; if (isEditing) { builder.add(editBtn, cc.xy(x, 1)); x += 2; builder.add(newBtn, cc.xy(x, 1)); x += 2; builder.add(delBtn, cc.xy(x, 1)); x += 2; if (validationInfoBtn != null) // is null when genrating form images { builder.add(validationInfoBtn, cc.xy(x, 1)); x += 2; } } else { builder.add(viewBtn, cc.xy(x, 1)); x += 2; } if (switcherUI != null) { builder.add(switcherUI, cc.xy(x, 1)); x += 2; } if (isAbove) { sepController = builder.getPanel(); } else { southPanel = builder.getPanel(); mainComp.add(southPanel, BorderLayout.SOUTH); } mainComp.add(iconTray, BorderLayout.CENTER); }
From source file:com.univocity.app.swing.DataAnalysisWindow.java
private void addPopupMenuToTable(DaoTable daoTable, boolean isSourceTable) { String engineName = isSourceTable ? config.getSourceEngineName() : config.getDestinationEngineName(); if (engineName == null) { return;/*from w w w.jav a 2s. c o m*/ } final JTable table = daoTable.getDataTable(); final JPopupMenu menu = new JPopupMenu(); menu.add(newJMenuItem("Disable updates", daoTable, engineName, false, false)); menu.add(newJMenuItem("Enable updates", daoTable, engineName, true, false)); menu.add(new JSeparator()); menu.add(newJMenuItem("Disable updates on all rows", daoTable, engineName, false, true)); menu.add(newJMenuItem("Enable updates on all rows", daoTable, engineName, true, true)); table.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON3) { int rowNumber = table.rowAtPoint(e.getPoint()); if (rowNumber != -1) { table.getSelectionModel().setSelectionInterval(rowNumber, rowNumber); menu.show(table, e.getX(), e.getY()); } } }; }); }
From source file:gg.pistol.sweeper.gui.component.DecoratedPanel.java
/** * Helper factory method for creating clickable links. * * @param linkText// w w w.j av a 2s .co m * a string that will be displayed as a link * @param action * the action performed at click * @return the link component */ protected JComponent createLink(String linkText, final Runnable action) { Preconditions.checkNotNull(linkText); Preconditions.checkNotNull(action); JLabel link = new JLabel("<html><a href=''>" + linkText + "</a></html>"); link.setComponentOrientation(ComponentOrientation.getOrientation(i18n.getLocale())); link.setCursor(new Cursor(Cursor.HAND_CURSOR)); link.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { action.run(); } }); return link; }
From source file:gtu._work.ui.DirectoryCompareUI.java
private void initGUI() { try {/*from ww w . ja v a 2 s .c o m*/ BorderLayout thisLayout = new BorderLayout(); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); getContentPane().setLayout(thisLayout); { jTabbedPane1 = new JTabbedPane(); getContentPane().add(jTabbedPane1, BorderLayout.CENTER); { jPanel1 = new JPanel(); BorderLayout jPanel1Layout = new BorderLayout(); jPanel1.setLayout(jPanel1Layout); jTabbedPane1.addTab("jPanel1", null, jPanel1, null); { jPanel2 = new JPanel(); BoxLayout jPanel2Layout = new BoxLayout(jPanel2, javax.swing.BoxLayout.X_AXIS); jPanel2.setLayout(jPanel2Layout); jPanel1.add(jPanel2, BorderLayout.NORTH); jPanel2.setPreferredSize(new java.awt.Dimension(660, 36)); { leftDirText = new JTextArea(); leftDirText.setPreferredSize(leftDirText.getPreferredSize()); leftDirText.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false)); JCommonUtil.jTextFieldSetFilePathMouseEvent(leftDirText, true); leftDirText.getDocument() .addDocumentListener(JCommonUtil.getDocumentListener(new HandleDocumentEvent() { @Override public void process(DocumentEvent event) { } })); jPanel2.add(leftDirText); JTextFieldUtil.setupDragDropFilePath(leftDirText, null); } { rightDirText = new JTextArea(); rightDirText.setPreferredSize(rightDirText.getPreferredSize()); rightDirText.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false)); JCommonUtil.jTextFieldSetFilePathMouseEvent(rightDirText, true); rightDirText.getDocument() .addDocumentListener(JCommonUtil.getDocumentListener(new HandleDocumentEvent() { @Override public void process(DocumentEvent event) { } })); jPanel2.add(rightDirText); JTextFieldUtil.setupDragDropFilePath(rightDirText, null); } { executeBtn = new JButton(); jPanel2.add(executeBtn); jPanel2.add(getResetBtn()); executeBtn.setText("\u958b\u59cb\u6bd4\u5c0d"); executeBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { compareStart(); } }); } } { jScrollPane1 = new JScrollPane(); jPanel1.add(jScrollPane1, BorderLayout.CENTER); jScrollPane1.setPreferredSize(new java.awt.Dimension(660, 362)); { dirCompareTable = new JTable(); // JTableUtil.defaultSetting(dirCompareTable); JTableUtil.defaultSetting_AutoResize(dirCompareTable); jScrollPane1.setViewportView(dirCompareTable); dirCompareTable.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { dirCompareTableMouseClicked(evt); } }); dirCompareTable.setModel(getDefaultTableModel()); } } { jPanel3 = new JPanel(); FlowLayout jPanel3Layout = new FlowLayout(); jPanel3Layout.setAlignOnBaseline(true); jPanel1.add(jPanel3, BorderLayout.SOUTH); jPanel3.setLayout(jPanel3Layout); jPanel3.setPreferredSize(new java.awt.Dimension(843, 62)); { jLabel1 = new JLabel(); jPanel3.add(jLabel1); jLabel1.setText("\u526f\u6a94\u540d"); } { DefaultComboBoxModel extensionNameComboBoxModel = new DefaultComboBoxModel(); extensionNameComboBox = new JComboBox(); jPanel3.add(extensionNameComboBox); jPanel3.add(getDiffToolComboBox()); jPanel3.add(getJLabel2()); jPanel3.add(getSearchText()); jPanel3.add(getCompareStyleComboBox()); jPanel3.add(getResetQueryBtn()); addDiffMergeChkBox(); extensionNameComboBox.setModel(extensionNameComboBoxModel); { panel = new JPanel(); jTabbedPane1.addTab("New tab", null, panel, null); panel.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), }, new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, })); { lblCustomCommand = new JLabel("custom command"); panel.add(lblCustomCommand, "2, 2, right, default"); } { customCompareText = new JTextField(); customCompareText.setText( "\"C:\\Program Files\\TortoiseGit\\bin\\TortoiseGitMerge.exe\" /base:\"%s\" /theirs:\"%s\""); panel.add(customCompareText, "4, 2, fill, default"); customCompareText.setColumns(10); } { configSaveBtn = new JButton(""); configSaveBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { boolean configChange = false; String customCompareUrl = customCompareText.getText(); if (StringUtils.isNotBlank(customCompareUrl)) { configBean.getConfigProp().setProperty(CUSTOM_COMPARE_URL_KEY, customCompareUrl); configChange = true; } if (configChange) { configBean.store(); JCommonUtil._jOptionPane_showMessageDialog_info( "?!"); } } catch (Exception ex) { JCommonUtil.handleException(ex); } } }); panel.add(configSaveBtn, "2, 36"); } } extensionNameComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { totalScanFiles(null); } }); } } } } pack(); this.setSize(864, 563); JCommonUtil.setJFrameIcon(getOwner(), "images/ico/file_merge.ico"); initConfigBean(); } catch (Exception e) { e.printStackTrace(); } }