public RoboticonManagerView( final RoboticonManagerModel roboticonManagerModel, final RoboticonManagerModel publicRoboticonManagerModel) { privateSortedRoboticonModel = new SortedRoboticonManagerModel(roboticonManagerModel, SortOrder.TYPE); privateList = new DragAndDropJList(privateSortedRoboticonModel); privateList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); privateList.setLayoutOrientation(DragAndDropJList.VERTICAL); privateList.setCellRenderer(new MyListCellRenderer()); privateList.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); privateList.setDragEnabled(true); privateList.setSelectionBackground(Color.orange); privateList.setSelectionForeground(Color.white); publicSortedRoboticonModel = new SortedRoboticonManagerModel(publicRoboticonManagerModel, SortOrder.NAME); publicList = new DragAndDropJList(publicSortedRoboticonModel); publicList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); publicList.setLayoutOrientation(DragAndDropJList.VERTICAL); publicList.setCellRenderer(new MyListCellRenderer()); publicList.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); publicList.setDragEnabled(true); publicList.setSelectionBackground(Color.orange); publicList.setSelectionForeground(Color.white); getListPanel(); }
/* * Atualiza a tabela a cada 5 minutos */ public void atualizacaoAutomaticaTabela() { this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); ActionListener acao = new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { final Progress p = new Progress(); p.setVisible(true); SwingWorker worker = new SwingWorker() { @Override protected Object doInBackground() throws Exception { atualizaTabela(); return null; } @Override protected void done() { p.setVisible(false); } }; worker.execute(); } }; timer = new Timer(5000 * 60, acao); // a cada 5 minutos executa o metodo timer.start(); this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }
protected void save(String text) { String title = "Save " + textType + " File"; TextFileFilter fileFilter = getTextFileFilter(textType); chooser.setFileFilter(fileFilter); if (chooser.showSaveDialog(editor.getFrame()) == JFileChooser.APPROVE_OPTION) { String name = chooser.getSelectedFile().toString(); if (!name.endsWith(fileFilter.getExtension())) { name = name + "." + fileFilter.getExtension(); } try { editor.getFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); FileOutputStream fos = new FileOutputStream(new File(name)); fos.write(text.getBytes()); fos.close(); JOptionPane.showMessageDialog( editor.getFrame(), textType + " saved successfully to " + name, title, JOptionPane.INFORMATION_MESSAGE); } catch (Exception ex) { Logger.getLogger(FileMenuAction.class.getName()).log(Level.SEVERE, null, ex); ExceptionHandler.handleException(ex); return; } finally { editor.getFrame().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } }
/** deletes the currently selected attribute */ public void deleteAttribute() { ArffSortedTableModel model; // no column selected? if (m_CurrentCol == -1) return; model = (ArffSortedTableModel) m_TableArff.getModel(); // really an attribute column? if (model.getAttributeAt(m_CurrentCol) == null) return; // really? if (ComponentHelper.showMessageBox( getParent(), "Confirm...", "Do you really want to delete the attribute '" + model.getAttributeAt(m_CurrentCol).name() + "'?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) != JOptionPane.YES_OPTION) return; setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); model.deleteAttributeAt(m_CurrentCol); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }
/** deletes the chosen attributes */ public void deleteAttributes() { ListSelectorDialog dialog; ArffSortedTableModel model; Object[] atts; int[] indices; int i; JList list; int result; list = new JList(getAttributes()); dialog = new ListSelectorDialog(null, list); result = dialog.showDialog(); if (result != ListSelectorDialog.APPROVE_OPTION) return; atts = list.getSelectedValues(); // really? if (ComponentHelper.showMessageBox( getParent(), "Confirm...", "Do you really want to delete these " + atts.length + " attributes?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) != JOptionPane.YES_OPTION) return; model = (ArffSortedTableModel) m_TableArff.getModel(); indices = new int[atts.length]; for (i = 0; i < atts.length; i++) indices[i] = model.getAttributeColumn(atts[i].toString()); setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); model.deleteAttributes(indices); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }
private void cargarEdicion() { try { this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); Cliente cliente = ClienteNegocio.Obtener(id); if (cliente != null) { txtNombre.setText(cliente.getNombre()); txtCalle.setText(cliente.getDireccion().getCalle()); txtCelular.setText(cliente.getCelular()); txtCiudad.setText(cliente.getDireccion().getCiudad()); txtColonia.setText(cliente.getDireccion().getColonia()); txtCorreo.setText(cliente.getCorreo()); txtNumero.setText(cliente.getDireccion().getNumero()); txtTelefono.setText(cliente.getTelefono()); } } catch (Exception e) { JOptionPane.showMessageDialog( this, ResourceBundle.getBundle("gdm/entidades/clases/resource").getString("ErrorMensaje"), ResourceBundle.getBundle("gdm/entidades/clases/resource").getString("TituloError"), JOptionPane.INFORMATION_MESSAGE); } finally { this.setCursor(Cursor.getDefaultCursor()); } }
private void readEvents() { frame .getGlassPane() .setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR)); // run event reader runEventReader(currentEventFile); // initialize map viewer if (this.jMapViewer == null) loadMapView(); // get data from eventhandler (if not null) if (eventHandler != null) { eventHandler.setColorationMode(this.colorationMode); eventHandler.setTransparency(this.cellTransparency); eventHandler.setK(k); // get data EventData data = eventHandler.getData(); // update data in both the map viewer and the graphs jMapViewer.updateEventData(data); graphPanel.updateData(data); keyPanel.updateData(data); } frame .getGlassPane() .setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR)); }
private void sendButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_sendButtonActionPerformed // TODO add your handling code here: this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); emailbodyText = bodyTextArea.getText(); System.out.println("text entered is " + emailbodyText); // ArrayList emailId = new ArrayList(); //// for(int i= 0;i<5;i++){ // emailId.add("*****@*****.**"); // //// } boolean flag = false; // flag = new SendMail().sendMail(toEmailList, ccEmailList, bccEmailList, emailText, // subjectTextField.getText(), userId); new ThreadUtil( toEmailList, ccEmailList, bccEmailList, subjectTextField.getText(), txId, emailbodyText, this) .start(); JOptionPane.showMessageDialog(null, "E-Mail sent successfully."); System.out.println("flag status is " + flag); this.dispose(); this.setCursor(Cursor.getDefaultCursor()); } // GEN-LAST:event_sendButtonActionPerformed
/** * Constructor de la clase. Inicializa todos los paneles de la pantalla y asocia los eventos para * ser tratados. Se le pasa por parametro un JFrame y la lista de expedientes a mostrar. * * @param desktop JFrame * @param exp lista de expedientes */ public BusquedaExportacionMasiva(final JFrame desktop, ArrayList exp) { this.desktop = desktop; this.expedientes = exp; this.expedienteFiltrados = exp; this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); UtilRegistroExp.menuBarSetEnabled(false, this.desktop); inicializaElementos(); addInternalFrameListener( new javax.swing.event.InternalFrameListener() { public void internalFrameOpened(javax.swing.event.InternalFrameEvent evt) {} public void internalFrameClosing(javax.swing.event.InternalFrameEvent evt) {} public void internalFrameClosed(javax.swing.event.InternalFrameEvent evt) { cierraInternalFrame(); } public void internalFrameIconified(javax.swing.event.InternalFrameEvent evt) {} public void internalFrameDeiconified(javax.swing.event.InternalFrameEvent evt) {} public void internalFrameActivated(javax.swing.event.InternalFrameEvent evt) {} public void internalFrameDeactivated(javax.swing.event.InternalFrameEvent evt) {} }); this.setTitle( I18N.get( "RegistroExpedientes", "Catastro.RegistroExpedientes.ExportacionMasiva.tituloBusqueda")); setClosable(true); this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }
protected boolean refreshFeatureSelection(String layerName, String id) { try { if (id == null || geopistaEditor == null) return false; this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); geopistaEditor.getSelectionManager().clear(); GeopistaLayer geopistaLayer = (GeopistaLayer) geopistaEditor.getLayerManager().getLayer(layerName); Collection collection = searchByAttribute(geopistaLayer, 0, id); Iterator it = collection.iterator(); if (it.hasNext()) { Feature feature = (Feature) it.next(); geopistaEditor.select(geopistaLayer, feature); } geopistaEditor.zoomToSelected(); this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); return true; } catch (Exception ex) { this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); ex.printStackTrace(pw); logger.error("Exception: " + sw.toString()); return false; } }
/** * Respond to selections within the left list. * * @throws InvocationTargetException * @throws InterruptedException */ private void respondToListClick() { this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); enableOrDisableActions(); int idx = archetypeList.getSelectedIndex(); if (idx == -1 || idx >= listData.size()) { // no selection if (archetypeControl == null) { return; } archetypeControl.removeNameChangeListener(this); rightPanel.removeAll(); archetypeControl = null; rightPanel.add(selectLeftLabel); rightPanel.repaint(); return; } if (archetypeControl == null) { archetypeControl = new ArchetypeControl(listData.get(idx)); setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); rightPanel.removeAll(); rightPanel.add(archetypeControl, BorderLayout.CENTER); rightPanel.repaint(); rightPanel.revalidate(); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); archetypeControl.addNameChangeListener(this); } else { archetypeControl.setArchetype(listData.get(idx)); archetypeControl.repaint(); } this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }
public void actionPerformed(ActionEvent evt) { if (model.names().isEmpty() || model.files().isEmpty()) { return; } BackgroundMatcher backgroundMatcher = new BackgroundMatcher(model, EpisodeMetrics.defaultSequence(true)); backgroundMatcher.execute(); Window window = getWindow(evt.getSource()); window.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); try { // wait a for little while (matcher might finish in less than a second) backgroundMatcher.get(2, TimeUnit.SECONDS); } catch (TimeoutException ex) { // matcher will probably take a while ProgressDialog dialog = createProgressDialog(window, backgroundMatcher); dialog.setLocation(getOffsetLocation(dialog.getOwner())); // display progress dialog and stop blocking EDT dialog.setVisible(true); } catch (Exception e) { Logger.getLogger(getClass().getName()).log(Level.SEVERE, e.toString(), e); } finally { window.setCursor(Cursor.getDefaultCursor()); } }
@Override public void setCursor(Cursor cursor) { super.setCursor(cursor); final java.awt.Cursor awtPredefinedCursor; if (cursor != null && (cursor.equals(CursorFactory.getCursor(SWT.CURSOR_WAIT)) || cursor.equals(CursorFactory.getCursor(SWT.CURSOR_APPSTARTING)) || cursor.equals(CursorFactory.getCursor(SWT.CURSOR_SIZENS)))) { if (cursor.equals(CursorFactory.getCursor(SWT.CURSOR_APPSTARTING))) { awtPredefinedCursor = java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR); } else if (cursor.equals(CursorFactory.getCursor(SWT.CURSOR_SIZENS))) { awtPredefinedCursor = java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.HAND_CURSOR); } else { awtPredefinedCursor = java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR); } } else { awtPredefinedCursor = java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR); } final Frame frame = SWT_AWT.getFrame(mainChartComposite); Runnable runnable = new Runnable() { public void run() { frame.setCursor(awtPredefinedCursor); if (mainChartPanel.getComponents().length > 0) { mainChartPanel.getComponent(0).setCursor(awtPredefinedCursor); } } }; EventQueue.invokeLater(runnable); }
/** Performs the update. */ private boolean doUpdate() { try { setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); Map<String, Object> properties = new HashMap<String, Object>(); for (PropertyInputPanel propertyPanel : propertyPanels) { if (propertyPanel.includeInUpdate()) { properties.put(propertyPanel.getId(), propertyPanel.getValue()); } } if (properties.isEmpty()) { return false; } ObjectId newId = object.updateProperties(properties, false); if ((newId != null) && newId.getId().equals(model.getCurrentObject().getId())) { try { model.reloadObject(); model.reloadFolder(); } catch (Exception ex) { ClientHelper.showError(null, ex); } } return true; } catch (Exception ex) { ClientHelper.showError(this, ex); return false; } finally { setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }
public void actionPerformed(ActionEvent e) { Object source = e.getSource(); setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (source == btFirst) { prot.firstStep(); } else if (source == btLast) { prot.lastStep(); } else if (source == btPrev) { prot.previousStep(); } else if (source == btNext) { prot.nextStep(); } else if (source == btPlay) { if (isPlaying) { player.stopAnimation(); } else { player = new AutomaticPlayer(playDelay); player.startAnimation(); } } if (prot.isVisible()) prot.scrollToConstructionStep(); setCursor(Cursor.getDefaultCursor()); }
private void setBussyMouse(boolean wait) { if (wait) { this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); } else { this.setCursor(Cursor.getDefaultCursor()); } }
// Audio recording\mixing private void audioEditor() { audioStudio.setLayout(null); record = new JButton("Record"); record.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); record.setToolTipText("Record Audio"); record.setBounds((width / 2) - 160, 0, 80, 25); audioStudio.add(record); audioStudio.add(audioformat); audioformat.setBounds(0, 0, 80, 25); audioformat.add("Wav"); audioformat.add("AIFC"); audioformat.add("AIFF"); audioformat.add("AU"); audioformat.add("SND"); audioStudio.add(sampleRate); sampleRate.setBounds(80, 0, 80, 25); sampleRate.add("8000"); sampleRate.add("11025"); sampleRate.add("16000"); sampleRate.add("22050"); sampleRate.add("44100"); audioStudio.add(channels); channels.setBounds(160, 0, 80, 25); channels.add("Mono"); channels.add("Stereo"); playaudio = new JButton("Play"); playaudio.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); playaudio.setToolTipText("Play recording"); playaudio.setBounds((width / 2), 0, 80, 25); audioStudio.add(playaudio); stopBtn = new JButton("Stop"); stopBtn.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); stopBtn.setToolTipText("Stop Recording"); stopBtn.setBounds((width / 2) - 80, 0, 80, 25); audioStudio.add(stopBtn); record.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { audio.captureAudio(); System.out.println(audio.getAudioFormat().getSampleRate()); System.out.println(audio.getAudioFormat().getChannels()); audio.audnum++; } }); stopBtn.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { audio.targetDataLine.stop(); audio.targetDataLine.close(); } }); }
public void mouseMoved(MouseEvent e) { EditorImpl.MyScrollBar scrollBar = myEditor.getVerticalScrollBar(); int buttonHeight = scrollBar.getDecScrollButtonHeight(); int lineCount = getDocument().getLineCount() + myEditor.getSettings().getAdditionalLinesCount(); if (lineCount == 0) { return; } if (e.getY() < buttonHeight && myErrorStripeRenderer != null) { showTrafficLightTooltip(e); return; } if (showToolTipByMouseMove(e, getWidth())) { scrollbar.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); return; } cancelMyToolTips(e, false); if (scrollbar.getCursor().equals(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR))) { scrollbar.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }
// region Private Methods private void onOK() { this.connectionDetails = new ConnectionDetails() { { setZookeeper( new ServerDetails( ConnectionDetailsDialog.this.zooKeeperServer.getText(), ConnectionDetailsDialog.this.zooKeeperPort.getValue().toString())); } }; this.contentPane.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); boolean canConnect = false; try { canConnect = this.connectionDetails.canConnect(); } finally { this.contentPane.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } if (canConnect) { dispose(); } else { JOptionPane.showMessageDialog( ConnectionDetailsDialog.this, "Failed to connect to hbase.\n\nMake sure you have access to all hadoop nodes\nIn case you don't, map the nodes in your hosts file.", "Connection failed...", JOptionPane.ERROR_MESSAGE); ConnectionManager.release(connectionDetails); connectionDetails = null; } }
void updateTabButton(int index, int selectedIndex, int buttonsCount) { if (buttonsCount == 1) { tabButton.setFocusable(false); tabButton.setCursor(Cursor.getDefaultCursor()); setBackground(BACKGROUND_COLOR_NORMAL); setBorder( TabbedCaptionBorder.get( BORDER_COLOR_NORMAL, BORDER_COLOR_NORMAL, COLOR_NONE, COLOR_NONE)); } else if (index == selectedIndex) { tabButton.setFocusable(true); tabButton.setCursor(Cursor.getDefaultCursor()); setBackground(BACKGROUND_COLOR_HIGHLIGHT); setBorder( TabbedCaptionBorder.get( BORDER_COLOR_HIGHLIGHT, BORDER_COLOR_HIGHLIGHT, COLOR_NONE, BORDER_COLOR_HIGHLIGHT)); } else { tabButton.setFocusable(true); tabButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); setBackground(BACKGROUND_COLOR_NORMAL); Color topColor = BORDER_COLOR_NORMAL; Color leftColor = index == 0 ? BORDER_COLOR_NORMAL : null; Color bottomColor = BORDER_COLOR_HIGHLIGHT; Color rightColor = index == selectedIndex - 1 ? null : index == buttonsCount - 1 ? COLOR_NONE : TABS_SEPARATOR; setBorder(TabbedCaptionBorder.get(topColor, leftColor, bottomColor, rightColor)); } }
public boolean mostrarJInternalFrame(JInternalFrame internalFrame) { try { desktopPane.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); int numInternalFrames = desktopPane.getAllFrames().length; if (numInternalFrames == 0) { ClassLoader cl = this.getClass().getClassLoader(); internalFrame.setFrameIcon(new javax.swing.ImageIcon(cl.getResource("img/geopista.gif"))); desktopPane.add(internalFrame); internalFrame.setMaximum(true); internalFrame.show(); try { iFrame = (JInternalFrame) internalFrame; } catch (Exception e) { iFrame = null; } } else { logger.info("cannot open another JInternalFrame"); } desktopPane.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } catch (Exception ex) { logger.warn("Exception: " + ex.toString()); } return true; }
/* public void printData() { getJMenuBar().repaint(); try { PrinterJob prnJob = PrinterJob.getPrinterJob(); prnJob.setPrintable(m_panel); if (!prnJob.printDialog()) return; setCursor( Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); prnJob.print(); setCursor( Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); JOptionPane.showMessageDialog(this, "Printing completed successfully", "JPEGEditor2", JOptionPane.INFORMATION_MESSAGE); } catch (PrinterException e) { e.printStackTrace(); System.err.println("Printing error: "+e.toString()); } } */ public void printData(Image im) { Printer p = new Printer(im); try { java.awt.print.PrinterJob prnJob = java.awt.print.PrinterJob.getPrinterJob(); prnJob.setPrintable(p); if (!prnJob.printDialog()) { return; } setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR)); prnJob.print(); setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR)); javax.swing.JOptionPane.showMessageDialog( this, "Printing completed successfully", "JPEGEditor2", javax.swing.JOptionPane.INFORMATION_MESSAGE); } catch (java.awt.print.PrinterException e) { e.printStackTrace(); System.err.println("Printing_error:_" + e.toString()); } }
public void displayPanel(JPanel panel) { this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); contentPane.removeAll(); contentPane.add(panel); contentPane.repaint(); contentPane.revalidate(); this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }
public void mouseMoved(MouseEvent e) { Shape pickedShape = myPanel.myDrawing.pickShapeAt(e.getPoint()); if (pickedShape != null) { myPanel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); } else { myPanel.setCursor(Cursor.getDefaultCursor()); } }
/** Brings up a preview of the image or images to save. */ void previewImage() { ImgSaverPreviewer preview = new ImgSaverPreviewer(this); setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); createImages(uiDelegate.getSavingType()); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); preview.initialize(); UIUtilities.centerAndShow(preview); }
private void enablePanel(boolean enable) { if (enable) { setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } else { setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); } getLoginButton().setEnabled(enable); }
// Draws the buttons and adds functions to them private void drawButtons() { playAnim = new JButton("Play"); playAnim.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); playAnim.setBounds((width / 2) + 30, 750, 80, 25); playAnim.setToolTipText("Play Animation"); window.add(playAnim); cap = new JButton("Capture"); cap.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); rcap = new Rectangle((width / 2) - 50, 750, 80, 25); cap.setBounds(rcap); cap.setToolTipText("Capture Frame"); window.add(cap); // Not working right playAnim.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent action) { if (canon == true) { renderCanon.setIcon(null); } else if (webcam == true) { for (int i = 0; i < framename; i++) { images = new ImageIcon(Save_Algorithm.imgdir + "\\image_" + i + ".tiff"); // renderWebcam.setIcon(null); // renderWebcam.setIcon(images); // renderWebcam.revalidate(); System.out.println(images); } } } }); cap.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { try { if (canon == true) { sound(); camera.execute(new ShootTask(filename())); System.out.println("Frame Captured from Canon SLR at... " + Save_as.pathname); framename++; } else if (canon == false) { opencv_core.IplImage img = frame.frame(); sound(); cvSaveImage(Save_Algorithm.imgdir + "\\image_" + framename + ".tiff", img); System.out.println("Frame Captured from Webcam at... " + Save_as.pathname); framename++; } } catch (RuntimeException e) { throw e; } catch (Exception e) { throw e; } } }); }
/** * Handles mouse moved events. * * @param e the mouse event */ public void mouseMoved(MouseEvent e) { TreePath path = tree.getPathForLocation(e.getX(), e.getY()); if (path == null) return; if (e.getX() > tree.getPathBounds(path).x + hotspot - 3 || e.getX() < tree.getPathBounds(path).x + 2) tree.setCursor(Cursor.getDefaultCursor()); else { tree.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); } }
public void mouseMoved(MouseEvent e) { JTable table = (JTable) e.getSource(); Object tag = getTagAt(e); if (tag == myTag) { table.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); } else { table.setCursor(Cursor.getDefaultCursor()); } }
/** * Left Mouse dragging drags end of feature if drag type right or left boundary. dragType is * figured in mousePressed */ public void mouseDragged(MouseEvent e) { if (!MouseButtonEvent.isLeftMouseClick(e)) return; // dragFeature set in mousePressed // not needed if (dragging == false && dragFeature != null) { // changer = baseEditorPanel.getAnnotationEditor().beginRangeChange(dragFeature);// ?? preDragStartBasePair = dragFeature.getStart(); preDragEndBasePair = dragFeature.getEnd(); } dragging = true; // dragType determined in MousePressed if (dragType == baseEditorPanel.START_BOUNDARY) baseEditorPanel.setCursor(Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR)); else if (dragType == baseEditorPanel.END_BOUNDARY) baseEditorPanel.setCursor(Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR)); else if (dragType == baseEditorPanel.SEQ_SELECT_DRAG) { baseEditorPanel.setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR)); } setPos(e.getX(), e.getY()); startPos = pos; // going right // substract the one because during dragging // the person operating the mouse drags it // one position beyond where they want the // drop to occur. // pos--; if (dragType == baseEditorPanel.START_BOUNDARY) { // Is this position okay to use as the new // low end or will it make the feature too short? if (baseEditorPanel.notTooSmall( pos, baseEditorPanel.basePairToPos((int) dragFeature.getEnd()))) // this actually changes the model - do we really need to do that // with every mouse drag - cant we just change it at the end of the // drag? No - the EDE relies on the feature being changed - bummer baseEditorPanel.changeStart(dragFeature, pos - dragStartPos, limit_5prime, limit_3prime); } else if (dragType == baseEditorPanel.END_BOUNDARY) { // Is this position okay to use as the new // high end or will it make the feature too short? if (baseEditorPanel.notTooSmall( baseEditorPanel.basePairToPos((int) dragFeature.getStart()), pos)) // This changes the actual exon model! EDE relies on this baseEditorPanel.changeEnd(dragFeature, pos - dragStartPos, limit_5prime, limit_3prime); } else if (dragType == baseEditorPanel.SEQ_SELECT_DRAG) { int redrawLowPos = baseEditorPanel.selectLowPos(); int redrawHighPos = baseEditorPanel.selectHighPos(); if (pos < redrawLowPos) redrawLowPos = pos; if (pos > redrawHighPos) redrawHighPos = pos; // selectCurrentPos = pos; baseEditorPanel.setSelectCurrentPos(pos); baseEditorPanel.repaint(redrawLowPos, redrawHighPos); return; } // repaint with exon seq feature ends changed baseEditorPanel.repaint(pos, dragStartPos); dragStartPos = pos; }