📄 displayarea.java,v
字号:
public DisplayScale getDisplayScale() { return new DisplayScale(xmax, xmin, ymax, ymin); } /** * get the x value * * @@return integer form of x value */ public int getXPrecision() { return (int)((xmax-xmin)/((xmax-xmin)/precision)); } /** * get the y value * * @@return integer form of y value */ public int getYPrecision() { return (int)((ymax-ymin)/((ymax-ymin)/precision)); } /** * sets the DisplayScale * * @@param scale DisplayScale object to set * */ public void setDisplayScale(DisplayScale scale) { xmax = scale.xmax; xmin = scale.xmin; ymax = scale.ymax; ymin = scale.ymin; repaint(); }}@1.5log@errors done during Java Style documentation rectified.@text@d2 1d5 2a19 2 * class: DisplayArea *a80 6 * method: DisplayArea * * @@param none * * @@return none *a124 1 * class: MyListenerd135 1a135 5 * method: mouseClicked * * @@param MouseEvent e: event that was fired * * @@return noned137 1a137 1 * listen and act on actions fired by components attached to the moused201 1a201 7 * method: mousePressed * * @@param MouseEvent e: event that was fired * * @@return none * * listen and act on actions fired by components attached to the moused203 2d212 1a212 1 * method: mousePressedd214 1a214 5 * @@param MouseEvent e: event that was fired * * @@return none * * listen and act on actions fired by components attached to the moused224 1a224 3 * method: mouseDragged * * @@param MouseEvent e: event that was firedd226 1a226 3 * @@return none * * listen and act on actions fired by components attached to the moused235 1a235 3 * method: mouseMoved * * @@param MouseEvent e: event that was firedd237 1a237 3 * @@return none * * listen and act on actions fired by components attached to the moused245 1d247 1a247 3 * method: mouseExited * * @@param MouseEvent e: event that was firedd249 1a249 3 * @@return none * * listen and act on actions fired by components attached to the moused252 1a252 1 public void mouseExited(MouseEvent e) d258 1a258 1 * method: mouseEnteredd260 1a260 5 * @@param MouseEvent e: event that was fired * * @@return none * * listen and act on actions fired by components attached to the moused276 1a276 3 * method: getWidth * * @@param nonea279 2 * returns the width on the output canvas *d294 1a294 3 * method: getHeight * * @@param nonea297 2 * returns the height on the output canvas *d312 1a312 7 * method: setPointsTable * * @@param none * * @@return none * * returns the height on the output canvasa372 6 * method: DetermineDimensions * * @@param none * * @@return none *d389 1a389 3 * method: DrawGrid * * @@param Graphics g: graphics paint objectd391 1a391 3 * @@return none * * draw the selection area grid linesd462 1a462 1 * method: paintComponenta465 4 * @@return none * * method paints the selection area *a495 6 * method: clear * * @@param Graphics g: graphics paint object * * @@return none *d508 1a508 3 * method: DisplayScale * * @@param noned510 1a510 1 * @@return DisplayScaled518 5a522 1d527 6a532 1d538 6@1.4log@some errors done during Java Documentation Style are rectified.@text@d417 1a417 1 */@1.3log@comments style changed to Java Documentation Style.@text@d83 1d145 1a145 1 * @@return noned302 5a306 5 * ********************************************************************* * * declare class methods * * *********************************************************************d311 3a313 2 * @@param none * return : width of the output plotd333 3a335 2 * @@param none * @@return height of the output plotd355 3a357 2 * @@param none * @@return noned423 1d521 1a521 1 * @@param Graphics g: graphics paint object@1.2log@Algorithm Complete and debug statements commented@text@d1 4a4 2// file: DisplayArea.java//d16 11a26 8// class: DisplayArea//// class implements the graph plot that displays the output points // and the comouted decision region based on the algorithm used//// hierarchy: JPanel->DisplayArea//class DisplayArea extends JPanel {d78 12a89 9 // method: DisplayArea // // arguments: none // returns : none // // constructor initializes the samples to be plotted in the signal panel // public DisplayArea() {d128 7a134 5 // class: MyListener // // class implements a mouse listener, mouse motion listener for the // output display canvas //d139 10a148 9 // method: mouseClicked // // arguments: // MouseEvent e: event that was fired // // return : none // // listen and act on actions fired by components attached to the mouse //d209 12a220 10 // method: mousePressed // // arguments: // MouseEvent e: event that was fired // // return : none // // listen and act on actions fired by components attached to the mouse // public void mousePressed(MouseEvent e) {d224 12a235 10 // method: mousePressed // // arguments: // MouseEvent e: event that was fired // // return : none // // listen and act on actions fired by components attached to the mouse // public void mouseReleased(MouseEvent e) {d239 13a251 10 // method: mouseDragged // // arguments: // MouseEvent e: event that was fired // // return : none // // listen and act on actions fired by components attached to the mouse // public void mouseDragged(MouseEvent e) {d255 12a266 10 // method: mouseMoved // // arguments: // MouseEvent e: event that was fired // // return : none // // listen and act on actions fired by components attached to the mouse // public void mouseMoved(MouseEvent e) {d270 12a281 10 // method: mouseExited // // arguments: // MouseEvent e: event that was fired // // return : none // // listen and act on actions fired by components attached to the mouse // public void mouseExited(MouseEvent e) {d285 12a296 10 // method: mouseEntered // // arguments: // MouseEvent e: event that was fired // // return : none // // listen and act on actions fired by components attached to the mouse // public void mouseEntered(MouseEvent e) {d301 18a318 15 // ********************************************************************* // // declare class methods // // ********************************************************************* // method: getWidth // // arguments: none // return : width of the output plot // // returns the width on the output canvas // public int getWidth() {d322 1a322 1d328 11a338 8 // method: getHeight // // arguments: none // return : height of the output plot // // returns the height on the output canvas // public int getHeight() {d349 9a357 8 /* // method: setPointsTable // // arguments: none // return : none // // returns the height on the output canvas //d415 9a423 7 // method: DetermineDimensions // // arguments: none // return : none // // determine the dimensions of the selection area //d436 12a447 10 // method: DrawGrid // // arguments: // Graphics g: graphics paint object // // return : none // // draw the selection area grid lines // public void DrawGrid(Graphics g) {d467 2a468 1 for(int i=zeroY+yGridDiv; i<height; i+=yGridDiv) {d471 3a473 1 for(int i=zeroY-yGridDiv; i>=0; i-=yGridDiv) {d476 3a478 1 for(int i=zeroX+xGridDiv; i<width; i+=xGridDiv) {d481 3a483 1 for(int i=zeroX-xGridDiv; i>=0; i-=xGridDiv) {d513 12a524 10 // method: paintComponent // // arguments: // Graphics g: graphics paint object // // return : none // // method paints the selection area // public void paintComponent(Graphics g) {d535 2a536 1 for ( int i=0; i < output_points_d.size(); i++ ){d540 7a546 3 Classify.drawPoints(g, Classify.input_points_d.convertMyPoints(points, getWidth(), getHeight(), getDisplayScale()), type, color);d551 12a562 10 // method: clear // // arguments: // Graphics g: graphics paint object // // return : none // // method clears the output points // public void clear() {d569 8a576 7 // method: DisplayScale // // arguments: // none // // return: DisplayScale //a603 9//// end of file@1.1log@Initial revision@text@a139 3 System.out.println("///////////////////////////////"); d151 1a151 1 System.out.println(center);@
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -