Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-01-2008, 01:51 AM
Member
 
Join Date: Jul 2008
Posts: 6
rstepler is on a distinguished road
Using Piccolo for Drawing
I am using piccolo to create a drawing. I want to place the canvas (DrawCanvas) into a JPanel (SimulationPanel). The canvas's drawings are not appearing. I have posted my code below. Are there any suggestions? Thanks for your help.
Code:
public class CohortGui extends JFrame { public CohortGui () { super("Simulation"); setSize(1400,850); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Thread runner; // GUI menu JMenu fileMenu = new JMenu("File"); JMenu simulationMenu = new JMenu("Simulation"); JMenu optionMenu = new JMenu("Option"); JMenu aboutMenu = new JMenu("About"); JMenuBar menuBar = new JMenuBar(); menuBar.add(fileMenu); menuBar.add(simulationMenu); menuBar.add(optionMenu); menuBar.add(aboutMenu); setJMenuBar(menuBar); // Create DrawCanvas DrawCanvas drawArea = new DrawCanvas(); //Create simulationPanel SimulationPanel sp = new SimulationPanel(); sp.setBackground(Color.white); sp.add(drawArea); add(sp); .......... class DrawCanvas extends PCanvas { public DrawCanvas(){ PLayer layer = new PLayer(); PCamera camera = new PCamera(); layer.addCamera(camera); //Create Lines LineOne one = new LineOne(); LineTwo two = new LineTwo(); LineThree three = new LineThree(); PLine test = new PLine(); test.setBounds(100,200,200,400); PImage ngo = new PImage("C:/Users/Renee/Desktop/toolbarButtonGraphics/INET_Earth_Clear.png"); ngo.setBounds(390, 75, getAlignmentX(), getAlignmentY()); layer.addChild(ngo); PImage ngo2 = new PImage("C:/Users/Renee/Desktop/toolbarButtonGraphics/INET_Earth_Clear.png"); ngo2.setBounds(110,300,getAlignmentX(), getAlignmentY()); layer.addChild(ngo2); PImage ngo3 = new PImage("C:/Users/Renee/Desktop/toolbarButtonGraphics/INET_Earth_Clear.png"); ngo3.setBounds(730,300, getAlignmentX(), getAlignmentY()); layer.addChild(ngo3); layer.setPaint(Color.BLACK); layer.addChild(one); layer.addChild(two); layer.addChild(three); layer.addChild(test); } } class SimulationPanel extends JPanel { public SimulationPanel () { setLayout(null); JLabel testLabel= new JLabel("Test Label"); add(testLabel); } }
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Demonstration of drawing an Arc in SWT Java Tip SWT 0 06-28-2008 10:24 PM
Help with 2-D Drawing Deathmonger New To Java 4 06-18-2008 03:23 AM
Drawing on aJPanel Djangolo AWT / Swing 1 02-17-2008 02:01 AM
New: Want to understand Drawing... diRisig New To Java 1 02-05-2008 09:13 AM
Help with drawing strings! JavaInLove AWT / Swing 1 02-05-2008 04:39 AM


All times are GMT +3. The time now is 03:46 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org