Created
November 1, 2014 16:50
-
-
Save hendrikebbers/d0282b33b5d78df79ebe to your computer and use it in GitHub Desktop.
JWrap Swing Controller
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SwingDemoController { | |
@ViewNode | |
@ActionTrigger("copy-action") | |
private JButton myButton; | |
@ViewNode | |
private JTextField myTextField; | |
@ViewNode | |
private JLabel myLabel; | |
@ActionMethod("copy-action") | |
private void copy() { | |
ProcessChain.create(). | |
addSupplierInPlatformThread(() -> myTextField.getText()). | |
addFunctionInExecutor((t) -> WeatherService.getWeather(t)). | |
addConsumerInPlatformThread((t) -> myLabel.setText(t)).onException((e) -> { | |
myLabel.setText("Error"); | |
e.printStackTrace(); | |
}).run(); | |
} | |
@PostConstruct | |
private void init() { | |
System.out.println("TADA"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment