List of usage examples for java.beans PropertyChangeEvent getNewValue
public Object getNewValue()
From source file:cz.lbenda.coursing.client.gui.LoginForm.java
public static void showLoginDialog() { final LoginForm form = new LoginForm(); JButton login = new JButton(); login.setText("Login"); // FIXME localizable JButton cancel = new JButton(); cancel.setText("Cancel"); // FIXME localizable cancel.addActionListener(new ActionListener() { @Override// w w w. j a v a2 s . c om public void actionPerformed(ActionEvent e) { exit(); } }); login.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { SecurityService ss = (SecurityService) ClientServiceLocator.getInstance() .getBean(SecurityService.SERVICE_NAME); ss.login(form.getUsername(), form.getPassword()); } catch (AuthenticationException ex) { NotifyDescriptor info = new NotifyDescriptor.Message(ex.getLocalizedMessage(), NotifyDescriptor.INFORMATION_MESSAGE); DialogDisplayer.getDefault().notify(info); LoginForm.showLoginDialog(); } } }); NotifyDescriptor nd = new NotifyDescriptor.Confirmation(form, Bundle.CTL_LoginForm()); nd.setOptions(new Object[] { login, cancel }); nd.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if (NotifyDescriptor.CLOSED_OPTION.equals(evt.getNewValue())) { exit(); } } }); DialogDisplayer.getDefault().notifyLater(nd); }
From source file:edu.ku.brc.specify.config.SpecifyGUIDGeneratorFactory.java
/** * @param pcl//from www. jav a 2s. c o m * @param classes */ public static void buildAllGUIDsAynch(final PropertyChangeListener pcl, final ArrayList<Class<?>> classes) { final String COUNT = "COUNT"; final GhostGlassPane glassPane = UIRegistry.writeGlassPaneMsg(getResourceString("SETTING_GUIDS"), UIRegistry.STD_FONT_SIZE); glassPane.setProgress(0); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { if (SubPaneMgr.getInstance().aboutToShutdown()) { Taskable task = TaskMgr.getTask("Startup"); if (task != null) { SubPaneIFace splash = edu.ku.brc.specify.tasks.StartUpTask .createFullImageSplashPanel(task.getTitle(), task); SubPaneMgr.getInstance().addPane(splash); SubPaneMgr.getInstance().showPane(splash); } final GUIDWorker worker = new GUIDWorker() { protected Integer doInBackground() throws Exception { if (getInstance() instanceof SpecifyGUIDGeneratorFactory) { SpecifyGUIDGeneratorFactory guidGen = (SpecifyGUIDGeneratorFactory) getInstance(); guidGen.buildGUIDs(this); } return null; } @Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals("COUNT")) { firePropertyChange("COUNT", 0, evt.getNewValue()); } } @Override protected void done() { glassPane.setProgress(100); UIRegistry.clearGlassPaneMsg(); if (pcl != null) { pcl.propertyChange(new PropertyChangeEvent(this, "complete", "true", "true")); } } }; worker.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(final PropertyChangeEvent evt) { if (COUNT.equals(evt.getPropertyName())) { glassPane.setProgress((int) (((Integer) evt.getNewValue() * 100.0) / (double) CATEGORY_TYPE.values().length)); } } }); worker.execute(); } } }); }
From source file:Main.java
PrintHelloAction() { super("Print"); putValue(Action.SHORT_DESCRIPTION, "Hello, World"); super.addPropertyChangeListener(new PropertyChangeListener() { @Override// w w w . j a v a 2 s. co m public void propertyChange(PropertyChangeEvent e) { System.out.println(e.getNewValue()); } }); }
From source file:Main.java
public void propertyChange(PropertyChangeEvent evt) { Object oldValue = evt.getOldValue(); Object newValue = evt.getNewValue(); }
From source file:Main.java
public void propertyChange(PropertyChangeEvent evt) { Component oldComp = (Component) evt.getOldValue(); Component newComp = (Component) evt.getNewValue(); if ("focusOwner".equals(evt.getPropertyName())) { if (oldComp == null) { System.out.println(newComp.getName()); } else {/*w w w .jav a 2 s. c o m*/ System.out.println(oldComp.getName()); } } else if ("focusedWindow".equals(evt.getPropertyName())) { if (oldComp == null) { System.out.println(newComp.getName()); } else { System.out.println(oldComp.getName()); } } }
From source file:Main.java
public void vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException { Object oldValue = evt.getOldValue(); Object newValue = evt.getNewValue(); boolean veto = false; if (veto) {//from w w w .ja v a 2s .c om throw new PropertyVetoException("the reason for the veto", evt); } }
From source file:hr.fer.zemris.vhdllab.platform.ui.wizard.testbench.TestbenchFileForm.java
private void installSuggestionTestbenchName() { getFormModel().getValueModel("targetFile").addValueChangeListener(new PropertyChangeListener() { @Override//www . ja v a 2s .c om public void propertyChange(PropertyChangeEvent evt) { File selectedFile = (File) evt.getNewValue(); String testbenchName = null; if (selectedFile != null) { testbenchName = selectedFile.getName() + "_tb"; } getFormModel().getValueModel("testbenchName").setValue(testbenchName); } }); }
From source file:hr.fer.zemris.vhdllab.platform.ui.wizard.simulator.SimulationFileForm.java
private void installSuggestionSimulationName() { getFormModel().getValueModel("targetFile").addValueChangeListener(new PropertyChangeListener() { @Override//from ww w .j av a 2s .c o m public void propertyChange(PropertyChangeEvent evt) { File selectedFile = (File) evt.getNewValue(); String testbenchName = null; if (selectedFile != null) { testbenchName = selectedFile.getName() + "_sim"; } getFormModel().getValueModel("simulationName").setValue(testbenchName); } }); }
From source file:VetoableChangeListenerDemo.java
public void vetoableChange(PropertyChangeEvent ev) throws PropertyVetoException { String name = ev.getPropertyName(); if (name.equals(JInternalFrame.IS_ICON_PROPERTY) && (ev.getNewValue() == Boolean.TRUE)) { System.out.println("JInternalFrame.IS_ICON_PROPERTY"); }//from ww w . j a v a 2 s .c om }
From source file:Main.java
public void vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException { Component oldComp = (Component) evt.getOldValue(); Component newComp = (Component) evt.getNewValue(); if ("focusOwner".equals(evt.getPropertyName())) { if (oldComp == null) { System.out.println(newComp.getName()); } else {/*from ww w . ja v a2 s .co m*/ System.out.println(oldComp.getName()); } } else if ("focusedWindow".equals(evt.getPropertyName())) { if (oldComp == null) { System.out.println(newComp.getName()); } else { System.out.println(oldComp.getName()); } } boolean vetoFocusChange = false; if (vetoFocusChange) { throw new PropertyVetoException("message", evt); } }