📄 separator.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 : Separator.java//package jaNet.backprop.gui;
import java.awt.*;
public class Separator extends Canvas{
public static final int VERTICAL = 0;
public static final int HORIZONTAL = 1;
public static final int LOOK3D = 0;
public static final int LOOK1D = 1;
public static final int IN = 0;
public static final int OUT = 1;
private int sense;
public int perSide;
public int look;
public int rise;
public Separator(int dir){
super();
sense = dir;
perSide = 5;
look = LOOK3D;
rise = IN;
}
public void paint(Graphics g){
Dimension d = this.size();
int w = d.width;
int h = d.height;
Color c1,c2;
if(look == LOOK3D){
if(rise == OUT){
c1 = Color.white;
c2 = Color.gray;
}else{
c2 = Color.white;
c1 = Color.gray;
}
if(sense == HORIZONTAL){
g.setColor(c1);
g.fillRect(perSide,h/2-1,w-perSide*2,3);
g.setColor(c2);
g.fillRect(perSide+1,h/2,w-perSide*2-1,2);
g.setColor(Color.lightGray);
g.fillRect(perSide+1,h/2,w-perSide*2-2,1);
}else{
g.setColor(c1);
g.fillRect(w/2-1,perSide-1,3,h-perSide*2);
g.setColor(c2);
g.fillRect(w/2,perSide,2,h-perSide*2);
g.setColor(Color.lightGray);
g.fillRect(w/2,perSide,1,h-perSide*2-1);
}
}else{
if(sense == HORIZONTAL){
g.setColor(Color.black);
g.fillRect(perSide,h/2,w-perSide*2-1,1);
}else{
g.setColor(Color.black);
g.fillRect(w/2,perSide,1,h-perSide*2-1);
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -