List of usage examples for java.beans PropertyChangeEvent getPropertyName
public String getPropertyName()
From source file:InternalFramePropertyChangeHandler.java
public void propertyChange(PropertyChangeEvent propertyChangeEvent) { String propertyName = propertyChangeEvent.getPropertyName(); System.out.println(propertyName); if (propertyName.equals(JInternalFrame.IS_ICON_PROPERTY)) { System.out.println("Icon property changed. React."); }/* w w w . j a v a2 s . c om*/ }
From source file:Main.java
public void propertyChange(PropertyChangeEvent evt) { if (JFileChooser.SELECTED_FILE_CHANGED_PROPERTY.equals(evt.getPropertyName())) { JFileChooser chooser = (JFileChooser) evt.getSource(); // Get the new selected file File newFile = (File) evt.getNewValue(); repaint();/* w w w . j a va2 s . com*/ } }
From source file:Main.java
public void vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException { String eventName = evt.getPropertyName(); if (eventName.equalsIgnoreCase("interest")) { double interest = ((Double) evt.getNewValue()).doubleValue(); if (interest > 20.00) { throw new PropertyVetoException("Interest must be below 20.00", evt); }/* ww w . j a v a2s.co m*/ System.out.println("Interest applied = " + interest); } }
From source file:Main.java
public TwoRoot() { setLayout(new GridLayout(0, 1)); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); add(progressBar);/*www .j a v a 2 s . c o m*/ add(label); setSize(300, 100); setVisible(true); progressBar.setIndeterminate(true); TwoWorker task = new TwoWorker(); task.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent e) { if ("progress".equals(e.getPropertyName())) { progressBar.setIndeterminate(false); progressBar.setValue((Integer) e.getNewValue()); } } }); task.execute(); }
From source file:Main.java
public BackgroundWorker(JTextArea ta, JProgressBar pb) { this.pb = pb; this.ta = ta; addPropertyChangeListener(new PropertyChangeListener() { @Override/*from w ww .ja va 2s . c o m*/ public void propertyChange(PropertyChangeEvent evt) { if ("progress".equalsIgnoreCase(evt.getPropertyName())) { BackgroundWorker.this.pb.setValue(getProgress()); } } }); }
From source file:com.diversityarrays.util.SwingWorkerCompletionWaiter.java
@Override public void propertyChange(PropertyChangeEvent event) { if ("state".equals(event.getPropertyName()) //$NON-NLS-1$ && SwingWorker.StateValue.DONE == event.getNewValue()) { onComplete.execute(dialog);/* w w w. j a v a 2 s. co m*/ } }
From source file:Main.java
private Box getEditPaneBox() { editorPane.setEditable(false);/*w w w .j av a 2s . co m*/ Box editorBox = Box.createHorizontalBox(); editorBox.add(new JScrollPane(editorPane)); editorPane.addHyperlinkListener((HyperlinkEvent event) -> { if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { go(event.getURL()); } else if (event.getEventType() == HyperlinkEvent.EventType.ENTERED) { System.out.println("click this link"); } else if (event.getEventType() == HyperlinkEvent.EventType.EXITED) { System.out.println("Ready"); } }); editorPane.addPropertyChangeListener((PropertyChangeEvent e) -> { String propertyName = e.getPropertyName(); if (propertyName.equalsIgnoreCase("page")) { URL url = editorPane.getPage(); System.out.println(url.toExternalForm()); } }); return editorBox; }
From source file:Main.java
public TestPane() { add(pbProgress);/*from w ww . java 2s . c o m*/ start = new JButton("Start"); add(start); start.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { start.setEnabled(false); ProgressWorker pw = new ProgressWorker(); pw.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { String name = evt.getPropertyName(); if (name.equals("progress")) { int progress = (int) evt.getNewValue(); pbProgress.setValue(progress); repaint(); } else if (name.equals("state")) { SwingWorker.StateValue state = (SwingWorker.StateValue) evt.getNewValue(); switch (state) { case DONE: start.setEnabled(true); break; } } } }); pw.execute(); } }); }
From source file:Main.java
@Override public void propertyChange(PropertyChangeEvent evt) { String strPropertyName = evt.getPropertyName(); if ("progress".equals(strPropertyName)) { progressBar.setIndeterminate(false); int progress = (Integer) evt.getNewValue(); progressBar.setValue(progress);/* www .j ava2 s . c om*/ } }
From source file:com.webcrawler.manager.impl.ProcessManagerImpl.java
@Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals("progress")) { this.parentComponent.setProgressBarValue((Integer) evt.getNewValue()); }// w ww . j a va 2s. com }