List of usage examples for java.beans PropertyChangeEvent getPropertyName
public String getPropertyName()
From source file:com.croer.javaorange.diviner.SimpleOrangeDiviner.java
public SimpleOrangeDiviner(Mediator mediator) { super((Frame) null, true); initComponents();//from ww w.j av a 2 s . c o m setUndecorated(true); Util.activateFunctionKey(SimpleOrangeDiviner.this, new FormAction("ENTER")); //Efectua la seleccin Util.activateFunctionKey(SimpleOrangeDiviner.this, new FormAction("control CONTROL")); //Cancela la consulta y oculta el dilogo Util.activateFunctionKey(SimpleOrangeDiviner.this, new FormAction("alt SPACE")); //Reinicia la seleccin de toda la tabla Util.activateFunctionKey(SimpleOrangeDiviner.this, new FormAction(configuration.getString("Plus"))); //Incrementa en uno la cantidad Util.activateFunctionKey(SimpleOrangeDiviner.this, new FormAction("alt DOWN")); //Decrementa en uno la cantidad Util.activateFunctionKey(SimpleOrangeDiviner.this, new FormAction("UP")); //Recorrido hacia arriba Util.activateFunctionKey(SimpleOrangeDiviner.this, new FormAction("DOWN")); //Recorrido hacia abajo Util.activateFunctionKey(SimpleOrangeDiviner.this, new FormAction("PAGE_UP")); //Retrocede una pgina Util.activateFunctionKey(SimpleOrangeDiviner.this, new FormAction("PAGE_DOWN")); //Avanza una pgina Util.activateFunctionKey(SimpleOrangeDiviner.this, new FormAction("F5")); // // getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke("pressed UP"), "go"); // getRootPane().getActionMap().put("go", new AbstractAction() { // // @Override // public void actionPerformed(ActionEvent e) { // System.out.println("Yepa " + System.currentTimeMillis()); // } // }); // getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_CONTROL, InputEvent.CTRL_MASK), "collapse"); // getRootPane().getActionMap().put("collapse", new AbstractAction() { // // @Override // public void actionPerformed(ActionEvent e) { // SimpleOrangeDiviner.this.setVisible(false); // } // }); jPanel1.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { System.out.println("Evento: " + evt.getPropertyName() + "-" + evt.getNewValue()); } }); }
From source file:org.oyrm.kobo.postproc.KoboBatchTranscriber.java
@Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getSource().equals(srd)) { if (evt.getPropertyName() == Constants.CHANGEPROP_NAME_NCOMPLETED) { this.setnTranscribed((Integer) evt.getNewValue()); } else if (evt.getPropertyName() == Constants.CHANGEPROP_NAME_PROGRESS) { this.setSubProgress((Integer) evt.getNewValue()); } else if (evt.getPropertyName() == Constants.CHANGEPROP_NAME_STATE) { this.getPropertyChangeSupport().firePropertyChange(evt); }/* w w w. j av a2s . c om*/ } }
From source file:hermes.browser.components.ClasspathGroupTable.java
private void init() { final JPopupMenu popupMenu = new JPopupMenu(); final JMenuItem addItem = new JMenuItem("Add Group"); final JMenuItem removeItem = new JMenuItem("Remove Group"); final JMenuItem renameItem = new JMenuItem("Rename"); popupMenu.add(addItem);/* www . ja va 2 s. com*/ popupMenu.add(removeItem); popupMenu.add(renameItem); addItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { try { doAddGroup(); dialog.setDirty(); } catch (Exception ex) { log.error(ex.getMessage(), ex); } } }); removeItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { if (getSelectedRowCount() > 0) { for (int row : getSelectedRows()) { getClasspathGroupTableModel().removeRow(row); } dialog.setDirty(); } } }); renameItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (getSelectedRow() != -1) { doRename(); } } }); mouseAdapter = new MouseAdapter() { public void mousePressed(MouseEvent e) { if (SwingUtilities.isRightMouseButton(e)) { removeItem.setEnabled(getClasspathGroupTableModel().getRowCount() != 0); renameItem.setEnabled(getClasspathGroupTableModel().getRowCount() != 0); popupMenu.show(e.getComponent(), e.getX(), e.getY()); } } }; addMouseListener(mouseAdapter); getTableHeader().addMouseListener(mouseAdapter); if (dialog != null) { addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { // // Think this is ok, seems 2 do the job. if (evt.getPropertyName().equals("tableCellEditor")) { dialog.setDirty(); } } }); } }
From source file:ec.ui.view.AutoCorrelationsView.java
private void enableProperties() { addPropertyChangeListener(new PropertyChangeListener() { @Override/*from ww w .j ava 2 s . c om*/ public void propertyChange(PropertyChangeEvent evt) { switch (evt.getPropertyName()) { case LENGTH_PROPERTY: onDataChange(); break; case KIND_PROPERTY: onDataChange(); break; case MEAN_CORRECTION_PROPERTY: onDataChange(); break; case AUTO_CORRELATIONS_PROPERTY: onDataChange(); break; case "componentPopupMenu": onComponentPopupMenuChange(); break; } } }); }
From source file:InternalFrameTest.java
/** * Creates an internal frame on the desktop. * @param c the component to display in the internal frame * @param t the title of the internal frame. *///from www .ja v a 2 s. com public void createInternalFrame(Component c, String t) { final JInternalFrame iframe = new JInternalFrame(t, true, // resizable true, // closable true, // maximizable true); // iconifiable iframe.add(c, BorderLayout.CENTER); desktop.add(iframe); iframe.setFrameIcon(new ImageIcon("document.gif")); // add listener to confirm frame closing iframe.addVetoableChangeListener(new VetoableChangeListener() { public void vetoableChange(PropertyChangeEvent event) throws PropertyVetoException { String name = event.getPropertyName(); Object value = event.getNewValue(); // we only want to check attempts to close a frame if (name.equals("closed") && value.equals(true)) { // ask user if it is ok to close int result = JOptionPane.showInternalConfirmDialog(iframe, "OK to close?", "Select an Option", JOptionPane.YES_NO_OPTION); // if the user doesn't agree, veto the close if (result != JOptionPane.YES_OPTION) throw new PropertyVetoException("User canceled close", event); } } }); // position frame int width = desktop.getWidth() / 2; int height = desktop.getHeight() / 2; iframe.reshape(nextFrameX, nextFrameY, width, height); iframe.show(); // select the frame--might be vetoed try { iframe.setSelected(true); } catch (PropertyVetoException e) { } frameDistance = iframe.getHeight() - iframe.getContentPane().getHeight(); // compute placement for next frame nextFrameX += frameDistance; nextFrameY += frameDistance; if (nextFrameX + width > desktop.getWidth()) nextFrameX = 0; if (nextFrameY + height > desktop.getHeight()) nextFrameY = 0; }
From source file:dev.agustin.serializer.MainWindow.java
/** * This method initializes jTextArea/*from w ww. j a v a 2 s. c o m*/ * * @return javax.swing.JTextArea */ private javax.swing.JTextArea getJTextArea() { if (jTextArea == null) { jTextArea = new javax.swing.JTextArea(); jTextArea.setEditable(false); jTextArea.addPropertyChangeListener(new java.beans.PropertyChangeListener() { public void propertyChange(java.beans.PropertyChangeEvent e) { if ((e.getPropertyName().equals("text"))) { System.out.println("propertyChange(text)"); // TODO Auto-generated property Event stub "text" } } }); } return jTextArea; }
From source file:org.ut.biolab.medsavant.client.util.VisibleMedSavantWorker.java
@Override public final void propertyChange(PropertyChangeEvent evt) { if (!progressBar.isIndeterminate() && "progress" == evt.getPropertyName()) { int progress = (Integer) evt.getNewValue(); progressBar.setValue(progress);/*www .ja v a 2s.com*/ } }
From source file:edu.harvard.mcz.imagecapture.BulkMediaFrame.java
@Override public void propertyChange(PropertyChangeEvent evt) { log.debug(evt.getPropertyName()); if (evt.getPropertyName() == "progress") { int progress = (Integer) evt.getNewValue(); progressBar.setValue(progress);//from w w w . j av a 2 s .c om progressBar.setStringPainted(true); log.debug(progress); } }
From source file:com.emr.mappings.MappingsForm.java
/** * Creates new form MappingsForm/*from w w w . java 2 s .c o m*/ * SQliteDataLoadWorker is a SwingWorker that fetches the saved mappings from the sqlite database, * and populates this to the mappings table * */ public MappingsForm() { //model=new DefaultTableModel(new Object[]{"Source Value","Map To"}, 25); final SQliteDataLoadWorker dl = new SQliteDataLoadWorker(tblMappings, "select sourceValue,dataMapping from mappings"); dl.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { switch (event.getPropertyName()) { case "progress": System.out.println("Fetching data from db"); break; case "state": switch ((SwingWorker.StateValue) event.getNewValue()) { case DONE: try { model = dl.get(); tblMappings.setModel(model); } catch (final CancellationException ex) { Logger.getLogger(SourceDataPreview.class.getName()).log(Level.SEVERE, null, ex); } catch (InterruptedException ex) { Logger.getLogger(SourceDataPreview.class.getName()).log(Level.SEVERE, null, ex); } catch (ExecutionException ex) { Logger.getLogger(SourceDataPreview.class.getName()).log(Level.SEVERE, null, ex); } break; } break; } } }); dl.execute(); initComponents(); //todo: get already added mappings and use their count to initilize model this.setClosable(true); /*TextBoxTableCellEditor sourceValEditor=new TextBoxTableCellEditor(new JTextField()); tblMappings.getColumnModel().getColumn(0).setCellEditor(sourceValEditor); TextBoxTableCellEditor mappingValEditor=new TextBoxTableCellEditor(new JTextField()); tblMappings.getColumnModel().getColumn(1).setCellEditor(mappingValEditor);*/ }
From source file:org.jboss.tools.openshift.internal.ui.wizard.newapp.fromtemplate.ApplicationSourceFromTemplateModel.java
@SuppressWarnings("unchecked") @Override//from www.ja va2 s . c o m public void propertyChange(PropertyChangeEvent evt) { switch (evt.getPropertyName()) { case IResourceLabelsPageModel.PROPERTY_LABELS: setLabels((List<Label>) evt.getNewValue()); break; case IApplicationSourceListPageModel.PROPERTY_PROJECT: this.project = (IProject) evt.getNewValue(); break; case IApplicationSourceListPageModel.PROPERTY_SELECTED_APP_SOURCE: handleSelectedAppSource(evt); break; case IApplicationSourceListPageModel.PROPERTY_ECLIPSE_PROJECT: handleEclipseProject(evt); break; } }