📄 inputpanel.java,v
字号:
head 1.5;access;symbols;locks; strict;comment @# @;1.5date 2005.05.25.14.03.18; author rirwin; state Exp;branches;next 1.4;1.4date 2005.05.24.13.55.49; author rirwin; state Exp;branches;next 1.3;1.3date 2005.03.15.19.26.33; author patil; state Exp;branches;next 1.2;1.2date 2005.03.11.05.18.57; author patil; state Exp;branches;next 1.1;1.1date 2004.12.28.00.04.32; author patil; state Exp;branches;next ;desc@@1.5log@Fixed compile error.paintComponent should have public modifier.@text@/** * file: InputPanel.java * * last edited: Ryan Irwin */// import necessary java libraries//import java.awt.*;import javax.swing.*;import javax.swing.border.*;//These imports are not needed - Phil T. 6-23-03//import java.awt.event.*;/** * class acts as a top level container that emcompasses the input plot * * hierarchy: JPanel->SubPanel->InputPanel * */class InputPanel extends SubPanel { // ********************************************************************* // // declare global variables and components // // ********************************************************************* // declare components // DataPoints data_points_d; // selection area for input display // SelectionArea selection_area_d; Font curr_font_d = getFont(); // fonts for the buttons Font new_font_d = new Font(curr_font_d.getName(), curr_font_d.getStyle(), 12); int width = 0; // width of the canvas int height = 0; // height of the canvas int zeroX = 0; // zero position on x axis int zeroY = 0; // zero position on y axis // ********************************************************************* // // declare class constructors // // ********************************************************************* /** * constructor sets the border and initializes the input plot * * @@param data_a input data samples * */ InputPanel(DataPoints data_a) { super(); // initialize components // data_points_d = data_a; // register a listener for the radio buttons. // selection_area_d = new SelectionArea(data_points_d); // set the border for the panel // String title = new String("Input Display:"); Border titleBorder = BorderFactory.createTitledBorder( BorderFactory.createLineBorder(Color.black), title, TitledBorder.LEFT, TitledBorder.ABOVE_TOP, new_font_d, Color.black); setBorder(titleBorder); } // ********************************************************************* // // declare class methods // // ********************************************************************* /** * set the value of the draw flag for the input canvas * * @@param flag input draw flag * */ public void setDrawFlag(boolean flag) { selection_area_d.drawFlag = flag; } /** * add components to the input panel * */ public void add_components() { constrain(this, selection_area_d, 0, 0, GridBagConstraints.REMAINDER, GridBagConstraints.REMAINDER, GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST, 1, 1, 2, 2, 2, 2); } /** * redraw the input panel screen. Calls repaint() * */ public void refresh() { super.repaint(); selection_area_d.repaint(); } /** * redraw the input panel screen. Calls repaint() * */ public void clear() { super.repaint(); selection_area_d.clear(); selection_area_d.repaint(); } /* /** * set the canvas dimensions, i.e., the input plot dimensions * */ /* public void setCanvasDimensions() { data.inputWidth = slection_area_d.getCanvasWidth(); data.inputHeight = slection_area_d.getCanvasHeight(); } */ /** * determine the dimensions of the selection area * */ public void DetermineDimensions() { Dimension dimen = this.getSize(); width = dimen.width; height = dimen.height; // set the coordinates of the axis origin // zeroX = width >> 1; zeroY = height >> 1; // store the dimensions of the output canvas // //setCanvasDimensions(); } /** * paing the current data points and if needed the decision regions * * @@param g graphics object to be */ public void paintComponent(Graphics g) { super.paintComponent(g); }}@1.4log@Fixed javadoc syntax@text@d178 1a178 1 void paintComponent(Graphics g) @1.3log@some errors done during the Java Documentation style formattingrectified.@text@d4 1a16 2 * class: InputPanel *d57 1a57 1 * method: InputPaneld59 1a59 5 * @@param Data d: input data samples * * @@return none * * constructor sets the border and initializes the input plotd96 1a96 3 * method: setDrawFlag * * @@param boolean flag: input draw flagd98 1a98 3 * @@return none * * set the value of the draw flag for the input canvasa106 5 * method: add_components * * @@param none * @@return none *d119 1a119 7 * method: Refresh() * * @@param none * * @@return none * * redraw the input panel screend129 1a129 7 * method: clear() * * @@param none * * @@return none * * redraw the input panel screena140 5 * method: setCanvasDimensions * * @@param none * @@return none *a151 6 * method: DetermineDimensions * * @@param none * * @@return none *a173 6 * method: paintComponent * * @@param Graphics g: graphics object * * @@return none *d176 1d178 1a178 1 public void paintComponent(Graphics g) @1.2log@comments changed to Java Documentation Style.@text@d136 1d152 1d175 5a179 4 public void setCanvasDimensions() { data.inputWidth = slection_area_d.getCanvasWidth(); data.inputHeight = slection_area_d.getCanvasHeight(); }d181 1a181 1d186 1@1.1log@Initial revision@text@d1 4a4 2// file: InputPanel.java//d15 10a24 7// class: InputPanel//// class acts as a top level container that emcompasses the input plot//// hierarchy: JPanel->SubPanel->InputPanel//class InputPanel extends SubPanel {d57 12a68 10 // method: InputPanel // // arguments: // Data d: input data samples // // returns : none // // constructor sets the border and initializes the input plot // InputPanel(DataPoints data_a) {d100 12a111 10 // method: setDrawFlag // // arguments: // boolean flag: input draw flag // // return : none // // set the value of the draw flag for the input canvas // public void setDrawFlag(boolean flag) {d115 11a125 8 // method: add_components // // arguments: none // return : none // // add components to the input panel // public void add_components() {d132 11a142 8 // method: Refresh() // // arguments: none // return : none // // redraw the input panel screen // public void refresh() {d147 11a157 8 // method: clear() // // arguments: none // return : none // // redraw the input panel screen // public void clear() {d164 9a172 7 // method: setCanvasDimensions // // arguments: none // return : none // // set the canvas dimensions, i.e., the input plot dimensions //d179 11a189 8 // method: DetermineDimensions // // arguments: none // return : none // // determine the dimensions of the selection area // public void DetermineDimensions() {d206 12a217 10 // method: paintComponent // // arguments: // Graphics g: graphics object // // return : none // // paing the current data points and if needed the decision regions // public void paintComponent(Graphics g) {a220 11//// end of file@
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -