⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 errorgraph.java

📁 JaNet: Java Neural Network Toolkit resume: A well documented toolkit for designing and training, a
💻 JAVA
字号:
////////////////////////////////////////////////////////////////////////////////////  //  //  Copyright (C) 1996 L.  Patocchi & W.Gander////  This program is free  software;  you can  redistribute  it and/or  modify it//  under the terms of the GNU General  Public  License as published by the Free//  Software  Foundation;  either  version 2 of the License, or (at your option)//  any later version.////  This program is  distributed in the hope that it will be useful, but WITHOUT//  ANY  WARRANTY;  without  even the implied  warranty  of  MERCHANTABILITY  or//  FITNESS FOR A PARTICULAR  PURPOSE.  See the GNU General  Public  License for//  more details.////  You should have received a copy of the GNU General Public License along with//  this program; if not, write to the Free Software  Foundation, Inc., 675 Mass//  Ave, Cambridge, MA 02139, USA.////  Contacts://  //    Project Supervisor//      W.Hett       hew@info.isbiel.ch//  //    Authors//      W.Gander     gandw@info.isbiel.ch//      L.Patocchi   patol@info.isbiel.ch////  Documentation can be found at:////      http://www.isbiel.ch/Projects/janet/index.html////////////////////////////////////////////////////////////////////////////////////////// File : errorGraph.java//package jaNet.backprop.gui;

import java.awt.*;

public class errorGraph extends Frame {

	private boolean 		imVisible;
	public errorGraphDraw	graphCanvas;
	public Button 			buttonClear;
	public Button 			buttonClose;

    public errorGraph() {
        super("Error Graph");
		Separator separator;

        this.setBackground(Color.lightGray);

		// main panel
		GridBagLayout grid = new GridBagLayout();
		int rowHeights[] = {0,5,113,5,25,5};
		int columnWidths[] = {0,5,30,75,100,75,30,5};
		double rowWeights[] = {0.0,0.0,1.0,0.0,0.0,0.0};
		double columnWeights[] = {0.0,0.0,1.0,0.0,1.0,0.0,1.0,0.0};
		grid.rowHeights = rowHeights;
		grid.columnWidths = columnWidths;
		grid.rowWeights = rowWeights;
		grid.columnWeights = columnWeights;

		graphCanvas = new errorGraphDraw();
		this.add(graphCanvas);

		separator = new Separator(Separator.HORIZONTAL);
    	separator.perSide = 0;
    	separator.rise = Separator.IN;
		this.add(separator);

		buttonClear = new Button();
		buttonClear.setLabel("Clear");
		this.add(buttonClear);

		buttonClose = new Button();
		buttonClose.setLabel("Close");
		this.add(buttonClose);

		// Geometry management
		GridBagConstraints con = new GridBagConstraints();
		reset(con);
		con.gridx = 2;
		con.gridy = 2;
		con.gridwidth = 5;
		con.anchor = GridBagConstraints.CENTER;
		con.fill = GridBagConstraints.BOTH;
		grid.setConstraints(graphCanvas, con);

		reset(con);
		con.gridx = 2;
		con.gridy = 3;
		con.gridwidth = 5;
		con.anchor = GridBagConstraints.CENTER;
		con.fill = GridBagConstraints.BOTH;
		grid.setConstraints(separator, con);

		reset(con);
		con.gridx = 3;
		con.gridy = 4;
		con.anchor = GridBagConstraints.CENTER;
		con.fill = GridBagConstraints.HORIZONTAL;
		grid.setConstraints(buttonClear, con);

		reset(con);
		con.gridx = 5;
		con.gridy = 4;
		con.anchor = GridBagConstraints.CENTER;
		con.fill = GridBagConstraints.HORIZONTAL;
		grid.setConstraints(buttonClose, con);


		// Resize behavior management and parent heirarchy
		setLayout(grid);


        addNotify();
		pack();		
    }

	public void setMinLimit(double val){
		graphCanvas.setMinLimit(val);
		paint(getGraphics());
	}
	public void putElement(double err){
		graphCanvas.putElement(err);
	}
	public void showElements(){
		graphCanvas.updateDraw();
	}
	
    public synchronized void show(double minLim) {
    	graphCanvas.setMinLimit(minLim);
		imVisible = true;
    	super.show();
    	paint(getGraphics());
    }
    
    public synchronized void hide() {
		imVisible = false;
    	super.hide();
    }

	public boolean isVisible(){
		return imVisible;
	}
    public boolean handleEvent(Event event) {

    	if (event.id == Event.ACTION_EVENT && event.target == buttonClear) {
    	    	clickedButtonClear();
    	    	return true;
    	}
    	else
    	if (event.id == Event.ACTION_EVENT && event.target == buttonClose) {
    	    	clickedButtonClose();
    	    	return true;
    	}
    	else
    	if (event.id == Event.WINDOW_DESTROY) {
    	    hide();
			return true;
    	}
    	return super.handleEvent(event);
    }
    
	public void clickedButtonClear() {
		graphCanvas.clearElements();
    	graphCanvas.updateDraw();
    }
    
	public void clickedButtonClose() {
        this.hide();
    }
			
	private void reset(GridBagConstraints con) {
		con.gridx = GridBagConstraints.RELATIVE;
		con.gridy = GridBagConstraints.RELATIVE;
		con.gridwidth = 1;
		con.gridheight = 1;

		con.weightx = 0;
		con.weighty = 0;
		con.anchor = GridBagConstraints.CENTER;
		con.fill = GridBagConstraints.NONE;

		con.insets = new Insets(0, 0, 0, 0);
		con.ipadx = 0;
		con.ipady = 0;
	}

}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -