List of usage examples for java.awt.event MouseEvent getButton
public int getButton()
From source file:GUI.MainWindow.java
private void handleAffectedHosts(MouseEvent evt) { Object obj = this.VulnTree.getLastSelectedPathComponent(); if (obj == null) { return;/*from w ww. j a va 2 s. c o m*/ } int row = VulnAffectedHostsTable.getSelectedRow(); if (row == -1) // No vulns selected { // Setup the context menu as required EditHostname.setEnabled(false); DeleteHost.setEnabled(false); } else { // A vuln is selected // Setup the context menu as required EditHostname.setEnabled(true); DeleteHost.setEnabled(true); } if (evt.getButton() == MouseEvent.BUTTON1 && evt.getClickCount() == 2) { // this was a double click on the try showNotesForSpecificHost(); } else if (evt.getButton() == MouseEvent.BUTTON3) { VulnAffectedHostsContextMenu.show(VulnAffectedHostsTable, evt.getX(), evt.getY()); } }
From source file:net.ytbolg.mcxa.MCLaucherXA.java
private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened // GameInfo.uuid = UUID.randomUUID().toString().toUpperCase().replace("-", ""); // GameInfo.rb.getBundle(tpf) // jMenu3.setVisible(false); setTitle(MainTitle);/* w w w. j a v a 2 s . c o m*/ jLabel2.setText(Lang.getLang("Main_Label_Username")); jCheckBox1.setText(Lang.getLang("Main_CheckBox_zhangben")); jLabel4.setText(Lang.getLang("Main_Label_Memory")); jLabel1.setText(Lang.getLang("Main_Label_Type")); jLabel3.setText(Lang.getLang("Main_Label_Time")); jLabel6.setText(Lang.getLang("Main_Label_BMCLVAPI")); jButton1.setText(Lang.getLang("Main_Button_Lauch")); // jButton2.setText(Lang.getLang("Main_Button_GetAss")); jMenu1.setText(Lang.getLang("Main_Menu_File")); jMenu2.setText(Lang.getLang("Main_Menu_Help")); jMenuItem1.setText(Lang.getLang("Main_Menu_DownVersion")); jMenuItem3.setText(Lang.getLang("Main_Menu_DownForge")); jMenuItem2.setText(Lang.getLang("Main_Menu_Config")); jMenuItem4.setText(Lang.getLang("Main_Menu_Update")); // jMenuItem4.setText(Lang.getLang("Main_Menu_Delete")); jLabel7.setText(Lang.getLang("Main_Label_Update")); jLabel9.setText(Lang.getLang("Main_Label_AppArgs")); jLabel7.setVisible(Updater.NeedUpdate()); JMenuItem ji = jPopupMenu1.add(Lang.getLang("Main_Menu_Delete")); JMenuItem j2 = jPopupMenu1.add(Lang.getLang("Main_Menu_Brush")); JMenuItem j3 = jPopupMenu1.add(Lang.getLang("Main_Button_GetAss")); JMenuItem j4 = jPopupMenu1.add(Lang.getLang("Main_Menu_RedownloadLib")); j2.addMouseListener(new MouseListener() { @Override public void mouseClicked(MouseEvent e) { // throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void mousePressed(MouseEvent e) { jList1.setListData(GameInfoGet.getGameVersions()); // throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void mouseReleased(MouseEvent e) { // throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void mouseEntered(MouseEvent e) { // throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void mouseExited(MouseEvent e) { // throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } }); ji.addMouseListener(new MouseListener() { @Override public void mouseClicked(MouseEvent e) { //if(e.getComponent().) // throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void mousePressed(MouseEvent e) { // System.out.println("Right click"); if (e.getButton() == MouseEvent.BUTTON1) { System.out.println( GameInfo.GameDir + tpf + "versions" + tpf + jList1.getSelectedValue().toString()); deleteDir(new File( GameInfo.GameDir + tpf + "versions" + tpf + jList1.getSelectedValue().toString())); jList1.setListData(GameInfoGet.getGameVersions()); } // System.out.println("Right click"); // throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void mouseReleased(MouseEvent e) { //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void mouseEntered(MouseEvent e) { //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void mouseExited(MouseEvent e) { // throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } public void mouseDragged(MouseEvent e) { } }); j3.addMouseListener(new MouseListener() { @Override public void mouseClicked(MouseEvent e) { // throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void mousePressed(MouseEvent e) { GameInfo.assVersion = jList1.getSelectedValue().toString(); try { GetAss(); // throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } catch (ParserConfigurationException ex) { Logger.getLogger(MCLaucherXA.class.getName()).log(Level.SEVERE, null, ex); } } @Override public void mouseReleased(MouseEvent e) { // throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void mouseEntered(MouseEvent e) { ///// throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void mouseExited(MouseEvent e) { // throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } }); j4.addMouseListener(new MouseListener() { @Override public void mouseClicked(MouseEvent e) { // throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void mousePressed(MouseEvent e) { try { Downloader d = new Downloader(); d.setUnzip(false); String al = GameInfoGet .libstotruedir(GameInfoGet.getLibs(jList1.getSelectedValue().toString())); String libs[] = al.split(";"); for (int a = 0; a < libs.length; a++) { libs[a] = libs[a].substring(1, libs[a].length() - 1); } for (String lib : libs) { File f = new File(lib); if (f.exists()) { f.delete(); } d.add(DownLoadURL.getURL(DownLoadURL.LIBRARIES, Integer.valueOf(Config.getConfig("DownSou"))) + lib.replaceFirst(Matcher.quoteReplacement(GameInfo.GameDir + tpf + "libraries"), ""), lib); } d.setVisible(true); d.start(); // throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } catch (IOException | JSONException ex) { Logger.getLogger(MCLaucherXA.class.getName()).log(Level.SEVERE, null, ex); } } @Override public void mouseReleased(MouseEvent e) { // throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void mouseEntered(MouseEvent e) { // throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void mouseExited(MouseEvent e) { // throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } }); // this.setIconImage(this.getToolkit().getImage(getClass().getResource("/icon_16x16.icon"))); // System.out.println(p.getProperty("zhengbanmima")); jCheckBox1.setSelected(Config.getConfig("iszhengban").equals("true")); jCheckBox1ActionPerformed(null); setLocationRelativeTo(getOwner()); if (!System.getProperty("os.name").contains("Windows")) { jLabel8.setText(Lang.getLang("Main_NotWindows")); // jLabel9.setText(); } this.setResizable(false); jList1.setListData(GameInfoGet.getGameVersions());// TODO add your handling code here: GameInfo.downUrl = Config.getConfig("downUrl"); try { int m = GameInfoGet.getGameVersions().length; vs = new JSONObject[m]; // System.out.println(m); for (int i = 0; i < m; i++) { vs[i] = new JSONObject(ReadFile(GameInfo.GameDir + tpf + "versions" + tpf + GameInfoGet.getGameVersions()[i] + tpf + GameInfoGet.getGameVersions()[i] + ".json")); } jPasswordField1.setText(Config.getConfig("zhengbanmima")); if (Config.getConfig("zhengbanmima").equals("")) { jCheckBox1.setSelected(false); jPasswordField1.setEnabled(false); } jTextField1.setText(Config.getConfig("username")); jTextField2.setText(Config.getConfig("lastmemory")); int i = 0; // System.out.println(p.getProperty("lastgameversion")); i = Integer.parseInt(Config.getConfig("lastgameversion")); if (i < 0) { i = 0; } jList1.setSelectedIndex(i); if (jList1.getModel().getSize() != 0) { BrushLabels(jList1.getSelectedIndex()); } // OutputStream in = new FileOutputStream(GameInfo.Rundir + tpf + "MCXA.cfg"); Config.Save(); // p.store(in, "= ="); if (MakeCmd.isChanged( new ZipFile(GameInfo.GameDir + tpf + "versions" + tpf + jList1.getSelectedValue().toString() + tpf + jList1.getSelectedValue().toString() + ".jar"))) { jComboBox1.setSelectedIndex(0); } } catch (IOException | JSONException e) { } catch (Exception ex) { Logger.getLogger(MCLaucherXA.class.getName()).log(Level.SEVERE, null, ex); } // TODO add your handling code here: }
From source file:ca.phon.app.project.ProjectWindow.java
private void init() { /* Layout *//* ww w . jav a 2s.c o m*/ setLayout(new BorderLayout()); final ProjectDataTransferHandler transferHandler = new ProjectDataTransferHandler(this); /* Create components */ newCorpusButton = createNewCorpusButton(); createCorpusButton = createCorpusButton(); corpusList = new JList<String>(); corpusModel = new CorpusListModel(getProject()); corpusList.setModel(corpusModel); corpusList.setCellRenderer(new CorpusListCellRenderer()); corpusList.setVisibleRowCount(20); corpusList.addListSelectionListener(e -> { if (getSelectedCorpus() != null) { String corpus = getSelectedCorpus(); sessionModel.setCorpus(corpus); sessionList.clearSelection(); corpusDetails.setCorpus(corpus); if (getProject().getCorpusSessions(corpus).size() == 0) { onSwapNewAndCreateSession(newSessionButton); } else { onSwapNewAndCreateSession(createSessionButton); } } }); corpusList.addMouseListener(new MouseInputAdapter() { @Override public void mousePressed(MouseEvent e) { doPopup(e); } @Override public void mouseReleased(MouseEvent e) { doPopup(e); } public void doPopup(MouseEvent e) { if (e.isPopupTrigger()) { int clickedIdx = corpusList.locationToIndex(e.getPoint()); if (clickedIdx >= 0 && Arrays.binarySearch(corpusList.getSelectedIndices(), clickedIdx) < 0) { corpusList.setSelectedIndex(clickedIdx); } showCorpusListContextMenu(e.getPoint()); } } }); final DragSource corpusDragSource = new DragSource(); corpusDragSource.createDefaultDragGestureRecognizer(corpusList, DnDConstants.ACTION_COPY, (event) -> { final List<ProjectPath> paths = new ArrayList<>(); for (String corpus : getSelectedCorpora()) { final ProjectPath corpusPath = new ProjectPath(getProject(), corpus, null); paths.add(corpusPath); } final ProjectPathTransferable transferable = new ProjectPathTransferable(paths); event.startDrag(DragSource.DefaultCopyDrop, transferable); }); corpusList.setDragEnabled(true); corpusList.setTransferHandler(transferHandler); corpusDetails = new CorpusDetailsPane(getProject()); corpusDetails.setWrapStyleWord(true); corpusDetails.setRows(6); corpusDetails.setLineWrap(true); corpusDetails.setBackground(Color.white); corpusDetails.setOpaque(true); JScrollPane corpusDetailsScroller = new JScrollPane(corpusDetails); sessionList = new JList<String>(); newSessionButton = createNewSessionButton(); createSessionButton = createSessionButton(); sessionModel = new SessionListModel(getProject()); sessionList.setModel(sessionModel); sessionList.setCellRenderer(new SessionListCellRenderer()); sessionList.setVisibleRowCount(20); sessionList.addListSelectionListener(e -> { if (sessionList.getSelectedValue() != null && !e.getValueIsAdjusting()) { String corpus = getSelectedCorpus(); String session = getSelectedSessionName(); sessionDetails.setSession(corpus, session); } }); sessionList.addMouseListener(new MouseInputAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2 && e.getButton() == 1) { // get the clicked item int clickedItem = sessionList.locationToIndex(e.getPoint()); if (sessionList.getModel().getElementAt(clickedItem) == null) return; final String session = sessionList.getModel().getElementAt(clickedItem).toString(); final String corpus = ((SessionListModel) sessionList.getModel()).getCorpus(); msgPanel.reset(); msgPanel.setMessageLabel("Opening '" + corpus + "." + session + "'"); msgPanel.setIndeterminate(true); msgPanel.repaint(); SwingUtilities.invokeLater(() -> { final ActionEvent ae = new ActionEvent(sessionList, -1, "openSession"); (new OpenSessionAction(ProjectWindow.this, corpus, session)).actionPerformed(ae); msgPanel.setIndeterminate(false); }); } } @Override public void mousePressed(MouseEvent e) { doPopup(e); } @Override public void mouseReleased(MouseEvent e) { doPopup(e); } public void doPopup(MouseEvent e) { if (e.isPopupTrigger()) { int clickedIdx = sessionList.locationToIndex(e.getPoint()); if (clickedIdx >= 0 && Arrays.binarySearch(sessionList.getSelectedIndices(), clickedIdx) < 0) { sessionList.setSelectedIndex(clickedIdx); } showSessionListContextMenu(e.getPoint()); } } }); sessionList.setDragEnabled(true); sessionList.setTransferHandler(transferHandler); final DragSource sessionDragSource = new DragSource(); sessionDragSource.createDefaultDragGestureRecognizer(sessionList, DnDConstants.ACTION_COPY, (event) -> { final List<ProjectPath> paths = new ArrayList<>(); final String corpus = getSelectedCorpus(); if (corpus == null) return; for (String session : getSelectedSessionNames()) { final ProjectPath sessionPath = new ProjectPath(getProject(), corpus, session); paths.add(sessionPath); } final ProjectPathTransferable transferable = new ProjectPathTransferable(paths); event.startDrag(DragSource.DefaultCopyDrop, transferable); }); sessionDetails = new SessionDetailsPane(getProject()); sessionDetails.setLineWrap(true); sessionDetails.setRows(6); sessionDetails.setWrapStyleWord(true); sessionDetails.setBackground(Color.white); sessionDetails.setOpaque(true); JScrollPane sessionDetailsScroller = new JScrollPane(sessionDetails); JScrollPane corpusScroller = new JScrollPane(corpusList); JScrollPane sessionScroller = new JScrollPane(sessionList); blindModeBox = new JCheckBox("Blind transcription"); blindModeBox.setSelected(false); msgPanel = new StatusPanel(); corpusPanel = new JPanel(new BorderLayout()); corpusPanel.add(newCorpusButton, BorderLayout.NORTH); corpusPanel.add(corpusScroller, BorderLayout.CENTER); corpusPanel.add(corpusDetailsScroller, BorderLayout.SOUTH); sessionPanel = new JPanel(new BorderLayout()); sessionPanel.add(newSessionButton, BorderLayout.NORTH); sessionPanel.add(sessionScroller, BorderLayout.CENTER); sessionPanel.add(sessionDetailsScroller, BorderLayout.SOUTH); final JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); splitPane.setLeftComponent(corpusPanel); splitPane.setRightComponent(sessionPanel); splitPane.setResizeWeight(0.5); // invoke later SwingUtilities.invokeLater(() -> { splitPane.setDividerLocation(0.5); }); // the frame layout String projectName = null; projectName = getProject().getName(); DialogHeader header = new DialogHeader(projectName, StringUtils.abbreviate(projectLoadPath, 80)); add(header, BorderLayout.NORTH); CellConstraints cc = new CellConstraints(); final JPanel topPanel = new JPanel(new FormLayout("pref, fill:pref:grow, right:pref", "pref")); topPanel.add(msgPanel, cc.xy(1, 1)); topPanel.add(blindModeBox, cc.xy(3, 1)); add(splitPane, BorderLayout.CENTER); add(topPanel, BorderLayout.SOUTH); // if no corpora are currently available, 'prompt' the user to create a new one if (getProject().getCorpora().size() == 0) { SwingUtilities.invokeLater(() -> { onSwapNewAndCreateCorpus(newCorpusButton); }); } else { SwingUtilities.invokeLater(() -> { corpusList.setSelectedIndex(0); }); } }
From source file:gda.plots.SimplePlot.java
/** * Part of the implementation of MouseListener - overrides the super class (ChartPanel) implementation so that the * mouse can be used to select a rectangle as well as for zooming. * //w ww.j av a 2 s . com * @param e * the mouse event which caused the call */ @Override public void mousePressed(MouseEvent e) { // Unless a rectangle is being dragged we just // want to call the super class method (which // deals with zooming) if (rd == null) { super.mousePressed(e); if (magnifyingImage || magnifyingData) { if (e.getButton() == MouseEvent.BUTTON1) { magnifyRectangle = null; magnifyXPoint = e.getX(); magnifyYPoint = e.getY(); } if (!e.isPopupTrigger()) { Graphics2D g2 = (Graphics2D) getGraphics(); g2.setXORMode(dragColour); if (magnifyRectangle != null) { g2.fill(magnifyRectangle); } g2.dispose(); } } } else { rd.mousePressed(e); } }
From source file:gda.plots.SimplePlot.java
/** * Part of the implementation of MouseListener. Overrides the super class (ChartPanel) implementation so that the * mouse can be used to select a rectangle as well as for zooming. * /* ww w . j a v a 2 s . c om*/ * @see #mousePressed(java.awt.event.MouseEvent) * @see #mouseDragged(java.awt.event.MouseEvent) * @param e * the mouse event which caused the call */ @Override public void mouseReleased(MouseEvent e) { // Unless a rectangle is being dragged we just // want to call the super class method (which // deals with zooming) if (rd == null) { super.mouseReleased(e); if (magnifyingImage || magnifyingData) { // If the button released is BUTTON1 then the rectangle for // magnification will have been resized. if (e.getButton() == MouseEvent.BUTTON1) { magnifyWidth = e.getX() - magnifyXPoint; magnifyHeight = e.getY() - magnifyYPoint; magnifyRectangleIsNew = true; } // If the button released is BUTTON2 then the rectangle will // have been being dragged around. Need to redraw in XOR mode // one // last time to remove rectangle from plot. else if (e.getButton() == MouseEvent.BUTTON2) { Graphics2D g2 = (Graphics2D) getGraphics(); g2.setXORMode(dragColour); if (magnifyRectangle != null) { g2.fill(magnifyRectangle); } g2.dispose(); } recalculateMagnifyRectangle(e); magnifier.update(magnifyRectangle); } } else { rd.mouseReleased(e); } }
From source file:org.yccheok.jstock.gui.MainFrame.java
private void createSystemTrayIcon() { if (SystemTray.isSupported()) { SystemTray tray = SystemTray.getSystemTray(); final Image image; if (Utils.isWindows7() || Utils.isWindows8()) { image = new javax.swing.ImageIcon(getClass().getResource("/images/128x128/chart.png")).getImage(); } else {//from ww w . j av a2s.com image = new javax.swing.ImageIcon(getClass().getResource("/images/16x16/chart.png")).getImage(); } MouseListener mouseListener = new MouseListener() { @Override public void mouseClicked(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1) { MainFrame.this.setVisible(true); MainFrame.this.setState(Frame.NORMAL); } } @Override public void mouseEntered(MouseEvent e) { } @Override public void mouseExited(MouseEvent e) { } @Override public void mousePressed(MouseEvent e) { } @Override public void mouseReleased(MouseEvent e) { } }; ActionListener exitListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { MainFrame.this.setVisible(false); MainFrame.this.dispose(); } }; PopupMenu popup = new PopupMenu(); MenuItem defaultItem = new MenuItem( java.util.ResourceBundle.getBundle("org/yccheok/jstock/data/gui").getString("MainFrame_Exit")); defaultItem.addActionListener(exitListener); popup.add(defaultItem); trayIcon = new TrayIcon(image, GUIBundle.getString("MainFrame_Application_Title"), popup); ActionListener actionListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { } }; trayIcon.setImageAutoSize(true); trayIcon.addActionListener(actionListener); trayIcon.addMouseListener(mouseListener); try { tray.add(trayIcon); } catch (AWTException e) { trayIcon = null; JOptionPane.showMessageDialog(MainFrame.this, java.util.ResourceBundle.getBundle("org/yccheok/jstock/data/messages") .getString("warning_message_trayicon_could_not_be_added"), java.util.ResourceBundle.getBundle("org/yccheok/jstock/data/messages").getString( "warning_title_trayicon_could_not_be_added"), JOptionPane.WARNING_MESSAGE); } } else { // System Tray is not supported trayIcon = null; JOptionPane.showMessageDialog(MainFrame.this, java.util.ResourceBundle.getBundle("org/yccheok/jstock/data/messages") .getString("warning_message_system_tray_is_not_supported"), java.util.ResourceBundle.getBundle("org/yccheok/jstock/data/messages") .getString("warning_title_system_tray_is_not_supported"), JOptionPane.WARNING_MESSAGE); } }
From source file:org.yccheok.jstock.gui.JStock.java
private void createSystemTrayIcon() { if (SystemTray.isSupported()) { SystemTray tray = SystemTray.getSystemTray(); final Image image = new javax.swing.ImageIcon(getClass().getResource("/images/128x128/chart.png")) .getImage();/*from ww w .java 2 s.c om*/ MouseListener mouseListener = new MouseListener() { @Override public void mouseClicked(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1) { JStock.this.setVisible(true); JStock.this.setState(Frame.NORMAL); } } @Override public void mouseEntered(MouseEvent e) { } @Override public void mouseExited(MouseEvent e) { } @Override public void mousePressed(MouseEvent e) { } @Override public void mouseReleased(MouseEvent e) { } }; ActionListener exitListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JStock.this.setVisible(false); JStock.this.dispose(); } }; PopupMenu popup = new PopupMenu(); MenuItem defaultItem = new MenuItem( java.util.ResourceBundle.getBundle("org/yccheok/jstock/data/gui").getString("MainFrame_Exit")); defaultItem.addActionListener(exitListener); popup.add(defaultItem); trayIcon = new TrayIcon(image, GUIBundle.getString("MainFrame_Application_Title"), popup); ActionListener actionListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { } }; trayIcon.setImageAutoSize(true); trayIcon.addActionListener(actionListener); trayIcon.addMouseListener(mouseListener); try { tray.add(trayIcon); } catch (AWTException e) { trayIcon = null; JOptionPane.showMessageDialog(JStock.this, java.util.ResourceBundle.getBundle("org/yccheok/jstock/data/messages") .getString("warning_message_trayicon_could_not_be_added"), java.util.ResourceBundle.getBundle("org/yccheok/jstock/data/messages").getString( "warning_title_trayicon_could_not_be_added"), JOptionPane.WARNING_MESSAGE); } } else { // System Tray is not supported trayIcon = null; JOptionPane.showMessageDialog(JStock.this, java.util.ResourceBundle.getBundle("org/yccheok/jstock/data/messages") .getString("warning_message_system_tray_is_not_supported"), java.util.ResourceBundle.getBundle("org/yccheok/jstock/data/messages") .getString("warning_title_system_tray_is_not_supported"), JOptionPane.WARNING_MESSAGE); } }
From source file:org.pmedv.blackboard.components.BoardEditor.java
private void handleMouseReleased(MouseEvent e) { ArrayList<UndoableEdit> edits = new ArrayList<UndoableEdit>(); for (Item item : selectedItems) { Line currentLine = null;/*from ww w. j a v a 2 s . c o m*/ if (item instanceof Line) { currentLine = (Line) item; } // just add edit if item or line has been moved if (item.getOldXLoc() > 0 || (currentLine != null && !currentLine.getOldstart().equals(currentLine.getStart()))) { if (item instanceof Line) { Line l = (Line) item; MoveLineEdit ml = new MoveLineEdit(l, l.getOldstart().x, l.getOldstart().y, l.getStart().x, l.getStart().y, l.getOldEnd().x, l.getOldEnd().y, l.getEnd().x, l.getEnd().y, true); edits.add(ml); for (WireConnection wc : l.getWireConnections()) { Line l1 = wc.getLine(); ml = new MoveLineEdit(l1, l1.getOldstart().x, l1.getOldstart().y, l1.getStart().x, l1.getStart().y, l1.getOldEnd().x, l1.getOldEnd().y, l1.getEnd().x, l1.getEnd().y, true); edits.add(ml); l1.setOldstart(new Point(l1.getStart())); l1.setOldEnd(new Point(l1.getEnd())); } } else { MoveItemEdit me = new MoveItemEdit(item, item.getOldXLoc(), item.getOldYLoc(), item.getXLoc(), item.getYLoc(), true); if (item instanceof Part) { Part part = (Part) item; for (WireConnection wc : part.getWireConnections()) { Line l1 = wc.getLine(); MoveLineEdit m = new MoveLineEdit(l1, l1.getOldstart().x, l1.getOldstart().y, l1.getStart().x, l1.getStart().y, l1.getOldEnd().x, l1.getOldEnd().y, l1.getEnd().x, l1.getEnd().y, true); edits.add(m); l1.setOldstart(new Point(l1.getStart())); l1.setOldEnd(new Point(l1.getEnd())); } edits.add(me); } } setFileState(FileState.DIRTY); } } if (edits.size() > 0) { MoveMultipleItemsEdit mme = new MoveMultipleItemsEdit(edits); if (!undoManager.addEdit(mme)) { log.error("could not add edit to undo manager"); } else { log.info("added edit : " + this.getClass()); } } if (editorMode.equals(EditorMode.SELECT)) { if (selectedItem != null) state = SelectionState.SINGLE_ITEM_SELECTED; else state = SelectionState.NOTHING_SELECTED; } if (e.isPopupTrigger()) { handleContextClick(e); } if (e.getButton() == 1) { button1Pressed = false; if (editorMode.equals(EditorMode.SELECT)) { // handleClickSelectionEvent(e); handleReleaseSelectionEvent(e, edits); } } else if (e.getButton() == 2) { button2Pressed = false; } else if (e.getButton() == 3) { button3Pressed = false; } refresh(); }
From source file:v800_trainer.JCicloTronic.java
private void DatentabelleMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_DatentabelleMouseClicked // Add your handling code here: if (evt.getButton() == MouseEvent.BUTTON3 && evt.getButton() != MouseEvent.BUTTON1) { int dummy = Datentabelle.rowAtPoint(evt.getPoint()); int selection[] = Datentabelle.getSelectedRows(); boolean isselected = false; for (int i = 0; i < selection.length; i++) { if (dummy == selection[i]) { isselected = true;/*from w w w .j av a 2s .co m*/ } } ; Datentabelle.clearSelection(); if (!isselected) { Datentabelle.addRowSelectionInterval(dummy, dummy); } for (int i = 0; i < selection.length; i++) { if (dummy != selection[i]) { Datentabelle.addRowSelectionInterval(selection[i], selection[i]); } } } SelectionChanged = true; Update = false; Datenliste_Monat.setEnabled(false); Datenliste_Monat.setSelectedIndex(0); Datenliste_Jahr.setSelectedIndex(0); Datenliste_Zeitabschnitt.setSelectedIndex(0); Datenliste_TourTyp.setSelectedIndex(0); Update = true; jLabel69_Selektiert.setText(Datentabelle.getSelectedRowCount() + " / " + Datentabelle.getRowCount()); if (evt.getClickCount() == 2) { Hauptfenster.setSelectedIndex(1); } }
From source file:lu.fisch.unimozer.Diagram.java
@Override public void mouseReleased(MouseEvent e) { if (isEnabled() && e.getButton() == MouseEvent.BUTTON1) { if (mode == MODE_EXTENDS) { extendsTo = getMouseClass(e.getPoint()); if ((extendsFrom != null) && (extendsTo != null) && (extendsFrom != extendsTo)) { // %TODO% extendsFrom.addExtends(extendsTo.getShortName()); repaint();//from w w w .j a va 2s . c o m } // change the mode back to SELECT setMode(MODE_SELECT); // update the bouttons in the mainform frame.updateMode(); // free pointers extendsDragPoint = null; extendsFrom = null; extendsTo = null; deselectAll(); } else { // load the clickled class (if clicked!) if (mousePressed == true) loadClickedClass(e); mousePressed = false; } } }