Can anyone point me to or help me with writing an application window that will allow me to open texts, insert, search etc. If I could find some basic code for writting an application window at least. This is for a class project and everything I find uses applets, which we were told not to use. I would appreciate any help. I think I can handle placing the buttons on etc. but where can I find the basics to make this work without using applets?
posted 14 years ago
Just make your public top-most class extend JPanel. In the constructor, create and add all components (buttons, menus, etc.), then in the main() method of the class, instantiate a new JFrame, and set it's content pane to be a new object of your class, set it visible, etc. Here is some sample code from which you can build upon:
Of course, this code is quite bare-bones...and you would have to make your class also implement Actionlistener, etc. to have the buttons/menu items function. This is one method to setup an application window, there are others (like making your class extend JFrame instead of JPanel). This is the one I prefer though. Hope this helps you get started, ------------------