github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

jacek99 / javabuilders

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 10
    • 3
  • Source
  • Commits
  • Network (3)
  • Issues (0)
  • Downloads (1)
  • Wiki (1)
  • Graphs
  • Tree: 44cb39d

click here to add a description

click here to add a homepage

  • Branches (2)
    • dev
    • master
  • Tags (0)
Sending Request…
Click here to lend your support to: javabuilders and make a donation at www.pledgie.com ! Edit Pledgie Setup

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

JavaBuilders - Max productivity with minimum code for Java UI development — Read more

  cancel

http://javabuilders.org

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Initial git commit 
jacek99 (author)
Wed Mar 25 19:13:37 -0700 2009
commit  44cb39db6ec0a80c0cf060716082816dbbb2e963
tree    1c70988c8c88a1db634060792314d7cb1df840f4
javabuilders / PersonApp / src / person / app / PersonApp.java PersonApp/src/person/app/PersonApp.java
100644 82 lines (67 sloc) 2.019 kb
edit raw blame history
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
package person.app;
 
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
 
import org.javabuilders.BuildResult;
import org.javabuilders.annotations.DoInBackground;
import org.javabuilders.event.BackgroundEvent;
import org.javabuilders.event.CancelStatus;
import org.javabuilders.swing.SwingJavaBuilder;
 
public class PersonApp extends JFrame {
 
private Person person;
 
private BuildResult result;
 
public PersonApp() {
person = new Person();
person.setFirstName("John");
person.setLastName("Smith");
result = SwingJavaBuilder.build(this);
}
 
public Person getPerson() {
return person;
}
 
private void cancel() {
setVisible(false);
}
 
@DoInBackground(cancelable=true, indeterminateProgress=false, progressStart=1, progressEnd=100)
private void save(BackgroundEvent evt) {
//simulate a long running save to a database
for(int i = 0; i < 100; i++) {
//progress indicator
evt.setProgressValue(i + 1);
evt.setProgressMessage("" + i + "% done...");
 
//check if cancel was requested
if (evt.getCancelStatus() != CancelStatus.REQUESTED) {
 
//sleep
try {
Thread.sleep(100);
} catch (InterruptedException e) {}
 
} else {
//cancel requested, let's abort
evt.setCancelStatus(CancelStatus.COMPLETED);
break;
}
}
}
 
//runs after successful save
private void done() {
JOptionPane.showMessageDialog(this, "Person data: " + person.toString());
}
 
/**
* @param args
*/
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
//activate internationalization
SwingJavaBuilder.getConfig().addResourceBundle("PersonApp");
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
new PersonApp().setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
}
 
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server