Java Reference
In-Depth Information
L ISTING 13.3 Continued
getContentPane().add(toolbar, BorderLayout.NORTH);
jScrollPane1.getViewport().add(textPane, null);
loadActionTable();
populate();
setJMenuBar(menubar);
setSize(400,300);
setVisible(true);
}
/**
* fill up menus and actions
*/
private void populate() {
// ...
}
/**
* fill up action table
*/
private void loadActionTable() {
Action[] actions = textPane.getActions();
for(int i=0; i < actions.length; ++i) {
actionTable.put(actions[i].getValue(Action.NAME), actions[i]);
13
}
}
/**
* quits the application
*/
private void close() {
System.exit(0);
}
/**
* return an action
*/
private Action getAction(String name) {
return (Action)actionTable.get(name);
}
/**
* shows up the about dialog
Search WWH ::




Custom Search