/**
* Init GUI like setting layout, adding panels
* and components.
*/
public void initGui() {
UserConfiguration uc=UserConfiguration.getInstance();
String lf=uc.getProperty(LOOK_AND_FEEL, null);
if (lf!=null) {
try {
UIManager.setLookAndFeel(lf);
SwingUtilities.updateComponentTreeUI(this);
} catch (Exception ex) {
log.error(ResourceFactory.getString(ERROR_LOOK_AND_FEEL), ex);
ErrorHandler.handleError(ERROR_LOOK_AND_FEEL, lf);
}
}
Rectangle bounds=uc.getRectProperty(WINDOW_BOUNDS,
Constants.DEFAULT_BOUNDS);
setBounds(bounds);
setJMenuBar(initMenu());
notationPanel=new NotationPanel();
JPanel mainPanel=new JPanel();
mainPanel.setLayout(new GridLayout(3,1));
mainPanel.add(notationPanel);
messagePanel=new JTextArea();
messagePanel.setText("Initiated\n"+
"Lesson Mode, both hands, Beginner\n"+
"MIDI active, Input/Output recognized\n"+
"Start with key press on your keyboard");
messagePanel.setEditable(false);
mainPanel.add(new JScrollPane(messagePanel));
keyboardPanel=new JKeyBoard(Constants.KEYBOARD_OCTAVE_RANGE);
ApplicationContext.getInstance().addListener(keyboardPanel);
Dimension d=new Dimension(getSize());
d.height=d.height/3;
keyboardPanel.setPreferredSize(d);
mainPanel.add(keyboardPanel);
InfoPanel helpPanel=new InfoPanel();
splitPanel=new JSplitPane(JSplitPane.VERTICAL_SPLIT,
mainPanel,
new JScrollPane(helpPanel));
splitPanel.setOneTouchExpandable(true);
if (uc.getIntProperty(INFO_PANEL_LOCATION, -1)!=-1) {
log.debug("re-minimizing info panel");
splitPanel.setDividerLocation(uc.getIntProperty(INFO_PANEL_LOCATION,0));
splitPanel.setLastDividerLocation(uc.getIntProperty(INFO_PANEL_LAST_LOCATION, 0));
}
Container contentPane=getContentPane();
contentPane.setLayout(new BorderLayout());
contentPane.add(splitPanel, BorderLayout.CENTER);