NTNUJAVA Virtual Physics Laboratory
Enjoy the fun of physics with simulations!
Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/
December 15, 2017, 03:32:56 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  
"Choose a job you love, and you will not have to work for a day in your life." ...Confucius (551-479 BC)
Google Bookmarks Yahoo My Web MSN Live Netscape Del.icio.us FURL Stumble Upon Delirious Ask FaceBook

Pages: [1]   Go Down
  Print  
Author Topic: How to change color to the cube_old?  (Read 10135 times)
0 Members and 1 Guest are viewing this topic. Click to toggle author information(expand message area).
yliu
Newbie
*
Offline Offline

Posts: 3

«
Embed this message
on: November 21, 2008, 01:23:04 pm » posted from:Adelaide,South Australia,Australia

Hi,

I am building a simple physics model, it will be much easier to see if I can change the color of the cube_old icon under 2D-Drawables section. Any help will be appreciated.

Regards,
Yang
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #1 on: November 21, 2008, 09:10:31 pm »

There is a "color" property for all the drawable element.
You should be able to change the color for the element from the popupped "color selection" panel.

You can define a variable with type "Object" if you want color change dynamically during run time:
For example: define variables with name "red,green,blue,color..." , type "Object"
and set
color=new java.awt.Color(r,g,b,t);
where r,g,b,t are value from 0-255 , corresponds to value for RED/GREEN/BLUE and transparent.
or set
 red=new java.awt.Color(255,0,0);
 green=new java.awt.Color(0,255,0);
 blue=new java.awt.Color(0,0,255);
and set color=red;  or color=green ...etc.
Logged
yliu
Newbie
*
Offline Offline

Posts: 3

«
Embed this message
Reply #2 on: November 24, 2008, 12:07:25 pm » posted from:Adelaide,South Australia,Australia

I thank you very much for your kind help. The color works very well.
Logged
yliu
Newbie
*
Offline Offline

Posts: 3

«
Embed this message
Reply #3 on: November 24, 2008, 12:16:42 pm » posted from:Adelaide,South Australia,Australia

I have another question, how to impose the position of buttons in a panel? I mean how to put the buttons where I want to, rather than following default rules (left, center or right). Thank you in advance  Cheesy
Logged
lookang
Hero Member
*****
Offline Offline

Posts: 1784


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #4 on: November 24, 2008, 04:32:01 pm » posted from:Singapore,,Singapore

Post:
http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=758.0

Example of my xml:
http://www.phy.ntnu.edu.tw/ntnujava/index.php?action=dlattach;topic=758.0;attach=375

you can check out my xml file, i normally explore the VBOX , HBOX, BORDERS, GRID and put panels inside them to get the desired look and feel for the applet.

as you can see in my example, i have menu at the top, display fields at the left, applet on the right, control buttons on the bottom.

i do agree it take time to get used to the interface, i normally copy and paste from another instant of a another applet to transfer "assets" to a new applet i am building/modifying etc.

welcome to applet making !


BTW you may want to start new threads for new questions for google bots to tag the links correctly for others to find help on EJS  Grin
« Last Edit: November 24, 2008, 04:34:36 pm by lookang » Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #5 on: November 24, 2008, 07:47:20 pm »

There is a property: "layout" for "Frame" or "Panel".
The default value is border so you can add element into left/right/center...etc.
You can change layout to horizontal box, vertical box, FlowLayout or GridLayout (Rows/Columns).

Try to change the "Layout" and find out what happened to the element added into the partent element.
Logged
Pages: [1]   Go Up
  Print  
"Choose a job you love, and you will not have to work for a day in your life." ...Confucius (551-479 BC)
 
Jump to:  


Related Topics
Subject Started by Replies Views Last post
The Wavelenght can change in a refraction?
Wave
PrinceDhampir 1 13558 Last post July 14, 2006, 01:14:59 pm
by Fu-Kwun Hwang
What is the largest adiabatic expansion of steam without a phase change?
Question related to Physics or physics related simulation
spinverted 5 20872 Last post August 16, 2010, 06:02:07 pm
by icetreat
Doubt in Easy Java Simulation/board:11-100-
Questions related to EJS
dhasthagheer 1 2964 Last post August 20, 2011, 07:01:50 pm
by Fu-Kwun Hwang
Change orientation of center panel
Question related to Physics or physics related simulation
andresgo 5 8108 Last post February 01, 2012, 07:41:22 am
by andresgo
Example for color change and action
Examples for beginner who want to learn EJS
Fu-Kwun Hwang 2 11660 Last post September 23, 2015, 04:49:29 pm
by boyer1982
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.058 seconds with 23 queries.since 2011/06/15