Do Anna Blog

13th April 2006

Swing Hall of Shame – 3

Filed under: Uncategorized — Tags: — Lokesh Shah @ 10:31:17

[java]
public void actionPerformed(ActionEvent e) {
Thread thread = new Thread(new Runnable() {
public void run() {
try {
doExpensiveOperation();
}
catch(SomeException e) {
JOptionPane.showMessageDialog(….);
}
}
});
thread.start();
}
[/java]

5th April 2006

Swing Hall of Shame – 2

Filed under: Uncategorized — Tags: — Lokesh Shah @ 09:44:43

This needs no explanation.
[java]
public void actionPerformed(ActionEvent e) {
Thread thread = new Thread(new Runnable() {
public void run() {
doExpensiveOperation();
completed = true;
}
});
completed = false;
thread.start();

//Wait for expensive thread to complete.
while (!completed) {
try {
Thread.sleep(100);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
}
}
[/java]

2nd April 2006

Swing Hall of Shame

Filed under: Uncategorized — Tags: — Lokesh Shah @ 22:52:12

Came across this blog UI Hall of Shame. Here’s a good one: UnClearCase Error.

In the few years I have been writing swing UIs, I myself have come across a few good Swing Hall of Shame candidates.

Once I came across a swing application, with a JTree, a few comboboxes, a couple of radio buttons and 2-3 textareas in the main window. The developer was persisting the state of all components to disk everytime a key pressed event happened. And to add to it, some guys were running the application through the profiler to figure out the performance bottlenecks.

Older Posts »

Blog at WordPress.com.