Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2005

Tip: Looking for answers? Try searching our database.

Java - Bailey & Bailey Elements Help

Thread view: 
smokymcpot_00@yahoo.com - 12 Nov 2005 20:43 GMT
Hi

I'm doing a computer games development degree which includes a java
programming class. In this they use an Elements package (by 'Bailey &
Bailey') which is used for drawing objects in a bitmap drawing window.
When creating a new drawing window I use the following code:

DrawingWindow d = new DrawingWindow();

This creates a new drawing window with the name "d" which I would use
to draw an object (e.g d.draw(Rect);)

However this seems to be only local to the method I include it in,
which is'nt very helpful. I was wondering if anyone has had any
experience with the Elements package and if they could help me make "d"
public to all other methods in the class.

Thanks in advance,
dev_wannabe
smokymcpot_00@yahoo.com - 12 Nov 2005 21:30 GMT
Just found the answer to my own question lol so thought I'd post it
here in case there happens to be someone else out there in pooter-land
with the same problem as me :o)

example code
==========

import element.*;

public class simpleDrawingExample
{
   static DrawingWindow d;

   public static void draw_head(int x, int y, int width, int height)
   {
       Oval oval_head = new Oval(x,y,width,height);

       d.draw(oval_head);
   }

   public static void main(String[] args)
   {
       d = new DrawingWindow();
       draw_head(100,100,20,30);
   }
}

============

all that had to be done was put "static DrawingWindow d" outside of a
method and use "d = new DrawingWindow();" when I wanted to open up the
drawing window for the first time

Ahhhh us n00bs with out silly little puzzles :p

Thanks,
dev_wannabe


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.