lookang
|
 |
«
Embed this message
on: April 29, 2008, 01:45:51 pm » posted from:Singapore,,Singapore |
|
 hihi prof, how do i make the text strings intelligently display in the applet on the next line. I previously used a method by spacing but when the display screen auto scale, my spacing is not shown with optimum spacing. is there a code like or next line to make the string automatically go to next line on the applet screen . attached is my xml well i relooked at some of the conversation we had, i will play with the You can set those string to the same (x,y) and set different alignment property for those strings (lower right, upper right,lower left, upper left; 4 strings maximum) .
http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=533.msg1802#msg1802I will be using the method you explained in quotes until i find a better way !! thanks!!
|
|
« Last Edit: May 05, 2008, 09:35:16 am by lookang »
|
Logged
|
|
|
|
lookang
|
 |
«
Embed this message
Reply #1 on: April 29, 2008, 02:31:28 pm » posted from:Singapore,,Singapore |
|
 completed 
|
|
|
Logged
|
|
|
|
lookang
|
 |
«
Embed this message
Reply #2 on: April 29, 2008, 02:37:35 pm » posted from:Singapore,,Singapore |
|
 refined completed 
|
|
|
Logged
|
|
|
|
Fu-Kwun Hwang
|
 |
«
Embed this message
Reply #3 on: April 30, 2008, 07:36:59 am » posted from:Taipei,T\'ai-pei,Taiwan |
|
 I modified some of the parameter in the EJS and post your beautiful applet -*- Embed a running copy of this simulation Embed a running copy link(show simulation in a popuped window) Full screen applet or Problem viewing java?Add http://www.phy.ntnu.edu.tw/ to exception site listPress the Alt key and the left mouse button to drag the applet off the browser and onto the desktop. This work is licensed under a Creative Commons Attribution 2.5 Taiwan License
- Please feel free to post your ideas about how to use the simulation for better teaching and learning.
- Post questions to be asked to help students to think, to explore.
- Upload worksheets as attached files to share with more users.
Let's work together. We can help more users understand physics conceptually and enjoy the fun of learning physics!
 
|
|
|
Logged
|
|
|
|
lookang
|
 |
«
Embed this message
Reply #4 on: April 30, 2008, 05:03:41 pm » posted from:SINGAPORE,SINGAPORE,SINGAPORE |
|
 Hi prof i want to make the applet always show equal size for x and y axes for the reason that circle will look like circle instead of an eclipse. any tips how to do it?? i try changing the PlottingFrame Size to a variable name "size", i try making a checkbox to action a function say called showsum() {actually i instead to equalaxes}  and i added a custom function but it didn't work. chance to tip me on the easiest way to mqke a checkbox that when checked will make the PlottingFrame Size equal ? thanks!
|
|
|
Logged
|
|
|
|
Fu-Kwun Hwang
|
 |
«
Embed this message
Reply #5 on: April 30, 2008, 08:30:18 pm » |
|
 The x/y axes was determined from properties of DrawingPanel. The default setting was auto-scale in both dimension. You can adjust xmin,xmax,ymin,ymax values to achieve whatever you want. As long as the x/y dimension of DrawingPanel and ratio of (xmax-xmin)/(ymax-ymin) is the same , you will get equal size for x and y axes.
|
|
|
Logged
|
|
|
|
lookang
|
 |
«
Embed this message
Reply #6 on: May 02, 2008, 09:59:32 am » posted from:Singapore,,Singapore |
|
 thanks for your tip and guidance. managed to do something already. problem statement on http://forum.java.sun.com/thread.jspa?threadID=5211941&messageID=9855498trying to write next line. i tried the method "\n" to go to the next line but it didn't work. any idea why ? quote 1: result in /n in the text s_vxformula = "{A_x}= "+"A*cos("+thetasymbol+"{^o})"+"/n"+" = "+double2String(A,100.)+"*cos("+double2String(alpha,10.)+"{^o})"; thanks!
|
|
|
Logged
|
|
|
|
Fu-Kwun Hwang
|
 |
«
Embed this message
Reply #7 on: May 02, 2008, 10:25:09 am » posted from:Taipei,T\'ai-pei,Taiwan |
|
 The method you found: write is display text string in a textarea. However, in the drawingPanel, what you want to do is DRAW a STRING on the drawing Panel. To draw, you can draw at any position. For textarea, it was first divided as line, and text can only displayed on those line. So next line make sense. However, there is no next line in the drawing Panel. That is the reason why it was not working for your case.
|
|
|
Logged
|
|
|
|
lookang
|
 |
«
Embed this message
Reply #8 on: May 02, 2008, 10:36:30 am » posted from:Singapore,,Singapore |
|
 ok thanks seems like have to use the +h method to display the next line ...... it is the update the xml file again cheers prof  New title Represent a vector (A) as horizontal (A_{x}) and vertical A_{y} components
|
|
« Last Edit: May 02, 2008, 10:55:27 am by lookang »
|
Logged
|
|
|
|
lookang
|
 |
«
Embed this message
Reply #9 on: May 05, 2008, 09:32:43 am » posted from:Singapore,,Singapore |
|
 hi prof, i have been trying to make the angle drawn as a dynamic pie for the angle instead of a hollow one, how do i filled the inside with a color ? i read the reference but still i cant understand the logic of the polygon. luckily i found http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=634.0will study ur codes  but it seems a bit harder than i thought, but i did it !!! under constraints: what does 2 lines do ? i completely cannot follow " c=cta2-(i-1)*dc; // c = end of angle segment - (i-1)*a small segment ? if(c<-pi)c+=2*pi; // if c less than - Math.PI then c add one until 2*PI ? "
|
|
« Last Edit: May 05, 2008, 10:52:04 am by lookang »
|
Logged
|
|
|
|
Fu-Kwun Hwang
|
 |
«
Embed this message
Reply #10 on: May 05, 2008, 10:47:48 am » |
|
 For 2-D polygon element in the EJS, you need to provide x[n],y[n] arrays to represent the X,Y coordinate for n points. If the polygon is not closed (you can change the property), then ejs will draw all the points and draw lines between i and i+1 points except the last one. If the polygon is closed, then it will draw another line connect the last point to the first one. When it is a closed polygon, you can set color to fill the inside of the polygon.
|
|
|
Logged
|
|
|
|
lookang
|
 |
«
Embed this message
Reply #11 on: May 05, 2008, 10:54:21 am » posted from:SINGAPORE,SINGAPORE,SINGAPORE |
|
 i managed to make ur codes work in my applet  check the post above  BTW: what does 2 lines do ? i completely cannot follow " c=cta2-(i-1)*dc; // c = end of angle segment - (i-1)*a small segment ? if(c<-pi)c+=2*pi; // if c less than - Math.PI then c add one until 2*PI ? "
|
|
« Last Edit: May 05, 2008, 01:37:17 pm by lookang »
|
Logged
|
|
|
|
lookang
|
 |
«
Embed this message
Reply #12 on: May 05, 2008, 01:34:31 pm » posted from:Singapore,,Singapore |
|
 final version, i hope  Represent a vector as two perpendicular components ( x and y direction )
|
|
« Last Edit: May 05, 2008, 02:05:23 pm by lookang »
|
Logged
|
|
|
|
Fu-Kwun Hwang
|
 |
«
Embed this message
Reply #13 on: May 05, 2008, 06:57:30 pm » |
|
 i managed to make ur codes work in my applet  check the post above  BTW: what does 2 lines do ? i completely cannot follow " c=cta2-(i-1)*dc; // c = end of angle segment - (i-1)*a small segment ? if(c<-pi)c+=2*pi; // if c less than - Math.PI then c add one until 2*PI ? " The purpose of the above code is to make sure angle c would not be less than -pi; If it is less than -pi, add the angle with 2*pi. I think the purpose is to have correct calculated components.
|
|
|
Logged
|
|
|
|
|
|