public void restored() {
//Set the size of the initial screen to something manageable:
SwingUtilities.invokeLater(new Runnable() {
public void run() {
Frame f = WindowManager.getDefault().getMainWindow();
f.addWindowListener(new Listener());
}
});
}
//Listener for setting size, because the size is reset after installation:
public class Listener extends WindowAdapter {
public void windowActivated(WindowEvent event) {
Frame f = WindowManager.getDefault().getMainWindow();
f.setSize(600, 400);
}
}
As a result, what you see above is exactly the new default size of the JFugue Music NotePad. Thanks to Stephen Kaspersen, from dev@openide.netbeans.org, for passing on this tip. (Anyone creating rich-client applications without regularly checking that list doesn't know what they're missing.)
By the way, as you might be able to see, the JFugue Music NotePad has made a lot of progress recently, which is really all thanks to Pierre Matthijs from Gent in Belgium. Now, there's a wizard for setting up a score (i.e., a music sheet). The coolest new thing is that when you reach the end of a stave, irrespective of the width of the application, a new one is immediately created below it. That's really a very cool improvement. But Pierre has generally rewritten the underlying architecture of the application so that it is a lot more robust and can be expanded with more functionality more easily from now onwards. A lot needs still to be done. The biggest issues right now are that you can't insert notes between existing notes and that the editor isn't synchronized with the new multi-document structure. But it has clearly come a long way already! Watch this space for further updates or join the project (with NetBeans IDE 5.5 Beta 2, you should just be able to check out the sources and run them without any problem at all). Check out the sources here.
a tiny, little detail; I live in Zottegem, about 20 km south of Gent ;-)
public void windowOpened(WindowEvent event) {
}
callback instead of -
public void windowActivated(WindowEvent event) {
}
callback.
Otherwise the window size will keep jumping back to the specified size even if the user resized the window to the size they prefer. This will happen every time the user clicks on some other window and then clicks back on the JFugue Music Notepad window (because the windowActivated() is called every time the window is (re)activated i.e. regains active status).
Please see tutorial at:
http://foldingreality.com/?q=node/2
Thank you Sandip Sir, for your valuable comment use of
windowOpened(WindowEvent event){}
method instead of using
windowActivated(WindowActivated event){}
It is useful if window will resize more than one time in application.