Multiview (Visual Layout)



NOTE: This is the first version of the applet. In this version all we have are the three views and a very primitive ability to respond to user input. The HELP view and the FUNCTIONS view are both fully functional. There is really no parser to speak of in this implementation.

The code which allows the switching of views is contained in the mousePressed method and the doClick method. The code follows:

addMouseListener(new MouseAdapter(){ public void mousePressed(MouseEvent m){ doClick(m.getX(), m.getY()); if(condition==2) FTA.setVisible(true); else FTA.setVisible(false); repaint(); } }); public void doClick(int x, int y){ //always save any changes to active function FN[actFn]=FTA.getText(); if(condition==2){ //add 10 to x and y to account for image offset if(y>270 && y<300){ if(x>120 && x<180){ actFn=0; } else if(x>190 && x<250){ actFn=1; } else if(x>260 && x<320){ actFn=2; } else if(x>330 && x<390){ actFn=3; } FTA.setText(FN[actFn]); } } if(x>440 && x<520){ if(y>50 && y<70){ condition=0; } else if(y>80 && y<100){ condition=1; } else if(y>110 && y<130){ condition=2; } } }