NTNUJAVA Virtual Physics Laboratory
Enjoy the fun of physics with simulations!
Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/
December 12, 2017, 09:12:51 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
The most important medicine is tender love and care. ..."Mother Teresa(1910-1997, Roman Catholic Missionary, 1979 Nobel Peace Prize)"
Google Bookmarks Yahoo My Web MSN Live Netscape Del.icio.us FURL Stumble Upon Delirious Ask FaceBook

Pages: [1]   Go Down
  Print  
Author Topic: Can draw points directly on the "drawing panel" component?  (Read 4584 times)
0 Members and 1 Guest are viewing this topic. Click to toggle author information(expand message area).
akunkeji
Newbie
*
Offline Offline

Posts: 13


«
Embed this message
on: March 06, 2011, 02:51:25 pm » posted from:Jinan,Shandong,China

Can draw points directly on the  "drawing panel" component?(or on the other component)
Do not use "Points" component.

thanks

Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #1 on: March 06, 2011, 08:51:24 pm » posted from:Taipei,T\'ai-pei,Taiwan

Define two double variables: e.g. mx,my
And assigned "Pos X" property(of drawingPanel) to mx, and "Pos Y" properties to my.
Then the mouse position will be assigned to mx,my when you click into the drawingPanel.

If you want to show trace of mouse movement, you can add Trace element and assign "Input X,Input Y" to "mx,my".
Logged
akunkeji
Newbie
*
Offline Offline

Posts: 13


«
Embed this message
Reply #2 on: March 06, 2011, 10:32:14 pm » posted from:Jinan,Shandong,China

Can not draw a point from the specified position?
Like this(java Syntax):
java.awt.graphics g=new java.awt.graphics();
g.drawLine(0,0,x,y);//Draw a line or point.
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #3 on: March 07, 2011, 08:52:37 am » posted from:Taipei,T\'ai-pei,Taiwan

If you just want to draw a segment, use GUI element "segment":
assign PosX,PosY to 0,0 and Size x, Size y to x,y will do it. (it should be x-xi,y-yi if the starting point is (xi,yi) instead of origin)

You can use Arrow to draw an arrow. (If you change style property of arrow, it can be turned into a segment).

There are many examples in this forum. I suggest find one you like, run it locally and open it with EJS(Right click "open EJS model") to view how it was done.
Logged
akunkeji
Newbie
*
Offline Offline

Posts: 13


«
Embed this message
Reply #4 on: March 07, 2011, 10:00:34 am » posted from:Jinan,Shandong,China

thank you!
Logged
Pages: [1]   Go Up
  Print  
The most important medicine is tender love and care. ..."Mother Teresa(1910-1997, Roman Catholic Missionary, 1979 Nobel Peace Prize)"
 
Jump to:  


Related Topics
Subject Started by Replies Views Last post
When you step on the accelerator, the car "noses up"?
Kinematics
Fu-Kwun Hwang 0 15000 Last post April 08, 2005, 12:55:37 pm
by Fu-Kwun Hwang
how to make the symbol "alpha" appear as α in the java applet
Questions related to EJS
lookang 2 13017 Last post August 13, 2007, 07:48:56 am
by lookang
Free Fall 3D "Modeling Physics with Easy Java Simulations" by Wolfgang/Francisco
Collaborative Community of EJS
lookang 1 14206 Last post August 03, 2009, 10:18:08 am
by lookang
problem with Ejs 4.2 new text objects cannot display "^o" as subscript string.
Questions related to EJS
lookang 3 5999 Last post October 04, 2009, 06:00:32 am
by fem@um.es
Help with simulation "Feynman QED" in EJS/board:26-101-
Request for physics Simulations
jirischamberger 15 18302 Last post April 26, 2011, 01:48:37 am
by transportation
Powered by MySQL Powered by PHP Powered by SMF 1.1.13 | SMF © 2006-2011, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.055 seconds with 23 queries.since 2011/06/15