|
I want to show my own component(s) in the main window - where do I start? |
|
|
Create a subclass of TopComponent. Design it just as you would a JPanel (hint: in NetBeans, use the JPanel template to create a new JPanel with the form editor, and change the parent class to org.openide.windows.TopComponent.
Create a simple subclass of javax.swing.AbstractAction and add it to the main menu. Implement it to open your component:
public class MyAction extends AbstractAction {
public MyAction() {
putValue (Action.NAME, "Open My Component");
}
public void actionPerformed(ActionEvent ae) {
new MyComponent().open();
}
}
|
Eventually, you will probably want to have your module use the declarative XML API to install your components; the above advice is good for testing.
TopComponents are part of the Windows API.
Related Tips
|
Page 1 of 0 ( 0 comments )
You can share your information about this topic using the form below!
Please do not post your questions with this form! Thanks.