Author=Fu-Kwun Hwang - Dept. of Physics, National Taiwan Normal Univ.Abstract= | hwang@phy.ntnu.edu.twCaptureTools= | trueDataTools= | trueLanguageTools= | trueEmersionSupport= | falseUseInterpreter= | true
Init Page
if(dial){
x0=x2;
}else x0=x2+zero;
dx=(x4-x2-zero-size)/(nm-1);
for(int i=0;i
FixRel Page
x=xd-x2;
xt[4]=xt[5]=-x;
id=0;
if(dial && inch)sinch=0;
else sinch=1.;
for(int i=0;iy5){
if(xd>xo+w/2)enableleft=true;
else enableleft=false;
}else{
if(x>0)enableleft=true;
else enableleft=false;
}
enableright=true;
if(diameter && x>=w2)enableright=false;
else if(tail && x>=xtail-x4+td)enableright=false;
double dv;
public double dvalue (double v) {
if(v>0)dv=0.5;
else if(v<0)dv=-0.5;
else dv=0;
return (int)(v*100+dv)/100.;
}
public void dragx () {
if(xdxtail-x4+td){
//if(xd-x2+x4-tdy5 &&xdw2)xd=x2+w2;
if(xd-x2x4-14*size)xd=x4-14*size;
}
EJSVIEW: Click link to view it's content | | Control variables:(testing) double,double,double,double |
title | = | "Frame" | layout | = | border | visible | = | true | location | = | "71,-35" | size | = | "935,558" |
position | = | center | autoscaleX | = | false | autoscaleY | = | false | minimumX | = | xmin | maximumX | = | xmax | minimumY | = | ymin | maximumY | = | ymax | square | = | true | background | = | BLACK |
xData | = | xt | yData | = | yt | x | = | x4+x | y | = | y4/4 | lineColor | = | 128,192,0 | fillColor | = | 128,192,0 |
xData | = | xu | yData | = | yu | x | = | xd | y | = | 0+0 | enabledPosition | = | true | dragAction | = | dragx () | lineColor | = | 128,192,0 | fillColor | = | 192,128,64 | lineWidth | = | stroke |
xData | = | xb | yData | = | yb | sensitivity | = | 0 | lineColor | = | 128,0,128 | fillColor | = | 128,64,0 | lineWidth | = | stroke |
numberOfElements | = | ni | x | = | xin | y | = | yinm | sizeX | = | 0 | sizeY | = | yin | visible | = | !dial || inch | lineColor | = | 128,255,255 |
numberOfElements | = | nm | x | = | xcm | y | = | y4 | sizeX | = | 0 | sizeY | = | ycm | visible | = | !(dial && inch) | lineColor | = | 128,255,255 |
xData | = | xm | yData | = | ym | x | = | xd | y | = | y4+size2/2 | enabledPosition | = | true | dragAction | = | dragx () | lineColor | = | 128,192,0 | fillColor | = | 192,128,64 |
numberOfElements | = | nm2 | x | = | xcm2 | y | = | y4+size2/2 | sizeX | = | 0 | sizeY | = | ycm2 | visible | = | !dial | lineColor | = | 128,255,255 |
numberOfElements | = | ni2 | x | = | xin2 | y | = | y3 | sizeX | = | 0 | sizeY | = | yin2 | visible | = | !dial | lineColor | = | 128,255,255 |
x | = | xo | y | = | yo | sizeX | = | w | sizeY | = | h | enabledPosition | = | true | sensitivity | = | 0 | dragAction | = | if(x<w){
if(yo+h/2>y5)yo=y5-h/2;
}
if(yo+h/2>y4)yo=y4-h/2;
if(yo+h/2>y5){
if(xo<x2+w/2)xo=x2+w/2;
else if(xo+w/2>xd)xo=xd-w/2;
} | style | = | ROUND_RECTANGLE | elementposition | = | CENTERED | lineColor | = | null | fillColor | = | GRAY |
xData | = | xu2 | yData | = | yu2 | x | = | xm2 | y | = | ym2 | visible | = | diameter | fillColor | = | 128,128,0 |
numberOfElements | = | id%25 | x | = | xins | y | = | yins | pixelSize | = | true | visible | = | !dial || inch | text | = | %sins% | font | = | Monospaced,PLAIN,15 | lineColor | = | 192,255,0 | fillColor | = | 192,255,0 |
numberOfElements | = | 7 | x | = | xcms | y | = | y4+size*2.2 | pixelSize | = | true | visible | = | !(dial && inch) | text | = | %cms% | font | = | Monospaced,BOLD,16 | elementposition | = | SOUTH | lineColor | = | 192,255,0 | fillColor | = | 192,255,0 |
numberOfElements | = | 6 | x | = | xins2 | y | = | y3+2*size | pixelSize | = | true | visible | = | !dial | text | = | %ins% | lineColor | = | 192,255,0 | fillColor | = | 192,255,0 |
numberOfElements | = | 11 | x | = | xcms2 | y | = | y4-size*1.7 | pixelSize | = | true | visible | = | !dial | text | = | %cms% | font | = | Monospaced,BOLD,12 | elementposition | = | NORTH | lineColor | = | 192,255,0 | fillColor | = | 192,255,0 |
x | = | xc | y | = | 0+0 | sizeX | = | 2*R | sizeY | = | 2*R | visible | = | dial | enabledPosition | = | true | dragAction | = | xd=xc-R;
dragx(); | lineColor | = | DARKGRAY | fillColor | = | GRAY |
x | = | xc | y | = | 0+0 | sizeX | = | dialxc | sizeY | = | dialyc | visible | = | dial | lineColor | = | 255,192,0 | fillColor | = | 255,128,0 |
numberOfElements | = | 10 | x | = | dialxs | y | = | dialys | pixelSize | = | true | visible | = | dial | text | = | %dials% | font | = | Monospaced,BOLD,16 | lineColor | = | 64,64,0 | fillColor | = | 64,64,0 |
numberOfElements | = | ndial | x | = | dialx | y | = | dialy | sizeX | = | dialdx | sizeY | = | dialdy | visible | = | dial | lineColor | = | 128,0,128 |
x | = | xc | y | = | -2*size | pixelSize | = | true | visible | = | dial | text | = | %dialmsg% | lineColor | = | 64,255,64 | fillColor | = | 64,255,64 |
x | = | xc-din/2 | y | = | -size2 | sizeX | = | 0 | sizeY | = | -size | visible | = | dial | lineColor | = | 192,0,64 |
x | = | xc+din/2 | y | = | -size2 | sizeX | = | 0 | sizeY | = | -size | visible | = | dial | lineColor | = | 192,0,64 |
x | = | x2+x/4 | y | = | y5-size2 | pixelSize | = | true | text | = | %vmsg% | font | = | Monospaced,BOLD,16 | elementposition | = | WEST | lineColor | = | LIGHTGRAY | fillColor | = | LIGHTGRAY |
x | = | xcm2[v2] | y | = | y4-3*size | sizeX | = | 0 | sizeY | = | 2*size | visible | = | !dial | lineColor | = | 192,0,128 | fillColor | = | 192,0,128 |
numberOfElements | = | 4 | x | = | x2+x/2 | y | = | arrowy | sizeX | = | arrowdx | sizeY | = | 0 | lineColor | = | 64,128,0 | fillColor | = | 64,128,0 |
x | = | xin2[vin3] | y | = | y3+3*size | sizeX | = | 0 | sizeY | = | -2*size | visible | = | !dial | lineColor | = | 192,0,128 | fillColor | = | 192,0,128 |
x | = | xcms2[10]+size2 | y | = | y4-size*1.7 | pixelSize | = | true | visible | = | !dial | text | = | ".05mm" | font | = | Monospaced,BOLD,12 | elementposition | = | NORTH_WEST | lineColor | = | 128,0,128 | fillColor | = | 128,0,128 |
xData | = | ox | yData | = | oy | x | = | xtail | y | = | y4/6 | visible | = | tail | enabledPosition | = | true | dragAction | = | if(xtail-x4+td<x)xtail=x+x4-td;
if(xtail<x4)xtail=x4; | fillColor | = | 128,128,0 |
numberOfElements | = | 2 | x | = | x4+x/2 | y | = | y4/4-size2/2 | sizeX | = | arrowdx | sizeY | = | 0 | lineColor | = | 255,0,128 | fillColor | = | 255,0,128 |
x | = | xins2[5]+2*size2 | y | = | y3+2*size | pixelSize | = | true | visible | = | !dial | text | = | ".001''" | font | = | Monospaced,BOLD,12 | elementposition | = | WEST | lineColor | = | 128,0,128 | fillColor | = | 128,0,128 |
position | = | south | layout | = | HBOX | borderType | = | LOWERED_ETCHED | background | = | GRAY |
text | = | "Reset" | image | = | /org/opensourcephysics/resources/controls/images/reset.gif | action | = | _reset() | background | = | BLACK | foreground | = | 64,255,0 |
variable | = | show | text | = | "show" | foreground | = | 255,255,0 |
variable | = | diameter | text | = | "inner diameter" | action | = | dragx () | foreground | = | 255,255,0 |
variable | = | tail | text | = | "depth" | foreground | = | 255,255,0 |
variable | = | dial | selected | = | true | text | = | "dial" | action | = | _initialize() | foreground | = | 255,255,0 |
variable | = | inch | selected | = | true | text | = | "inch" | enabled | = | dial | action | = | _initialize() | foreground | = | 255,255,0 |
image | = | "/org/opensourcephysics/resources/controls/images/stepback.gif" | enabled | = | enableleft | action | = | if(dial){
if(inch)xd-=din/25.;
else xd-=dx/100.;
}else{
if(inch)xd-=din/25.;
else xd-=dx/20.;
}
dragx(); | background | = | 128,64,0 |
image | = | "/org/opensourcephysics/resources/controls/images/stepforward.gif" | enabled | = | enableright | action | = | if(dial){
if(inch)xd+=din/25.;
else xd+=dx/100.;
}else{
if(inch)xd+=din/25.;
else xd+=dx/20.;
}
dragx(); | background | = | 128,64,0 |
layout | = | HBOX | background | = | 128,64,0 |
variable | = | x | minimum | = | 0.0 | maximum | = | w2 | dragaction | = | xd=x2+x;
dragx(); | background | = | 64,64,0 |
variable | = | w | minimum | = | 0.0 | maximum | = | x2+x-xs | pressaction | = | xs=xo-w/2; | dragaction | = | xo=xs+w/2; | background | = | 255,128,0 |
variable | = | w2 | minimum | = | xd-x2 | maximum | = | xmax*1.5 | enabled | = | diameter | dragaction | = | xu2[2]=xu2[3]=w2+4*size;
xu2[4]=xu2[5]=w2+2*size; | background | = | 128,192,0 |
variable | = | td | minimum | = | tdmin | maximum | = | td2 | enabled | = | tail | dragaction | = | ox[2]=ox[3]=td; | background | = | 64,64,0 |
|