Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Problem in <Shape> List

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 03-03-2010
Member
 
Join Date: Dec 2009
Posts: 211
Problem in <Shape> List
  

Hello,
I have a class that derives from JPanel where we draw the curve Graph, I have inserted a private attribute
Code:
Public Class Gra{ ....
private List <Shape> shapes;
...}
And
Code:
sh = new ArrayList <Shape>(); / / Collection form used to break
But this is not working for me, If you have any solution for this then please do post back. Thanks in advance.

Reply With Quote
  #2  
Old 03-03-2010
Member
 
Join Date: Apr 2008
Posts: 264
Re: Problem in <Shape> List

Hello,
I am new to java, but I have done a program, keeping your needs in mind. Just check out the code and see if this works with you.
Code:
Public View Point(){ .....
if(ok){
g.drawLine(num-1+ x, tab_coor[indiceTab -(int)not][i][0], num + x, tab_coor[indiceTab][i][0]);
shapes.add(new Line2D.Double(num-1+ x, tab_coor[indiceTab -(int)not][i][0], num + x, tab_coor[indiceTab][i][0]));
}
....
if(ok){
{g.drawLine(num-1+ x, tab_coor[indiceTab -(int)not][i][c], num + x, tab_coor[indiceTab][i][c]);
shapes.add(new Line2D.Double(num-1+ x, tab_coor[indiceTab -(int)not][i][c], num + x, tab_coor[indiceTab][i][c]));
}
}
Reply With Quote
  #3  
Old 03-03-2010
Member
 
Join Date: Nov 2009
Posts: 335
Re: Problem in <Shape> List

Hello,
I think if you need you can use the following methods in your code.
Code:
a.getfenfraph ()
a.getfenfraph (). getGraphePh ()
Simply add System.out to determine which is the standard output you want in your code. If you have any more problem regarding this topic then please do post back and we will try to solve it.
Reply With Quote
  #4  
Old 03-03-2010
Member
 
Join Date: Nov 2009
Posts: 446
Re: Problem in <Shape> List

Hello,
Yes, I agree with the above posted, you can do it.
Here is an sample example
Code:
System.out.System.out.println( a);
System.out.System.out.println( a.getfenfraph());
System.out.System.out.println( a.getfenfraph().getGraphePh());
sh = a.getfenfraph().getGraphePh().getmesShapes();
It does not fix the bug But it will know which element is null. Hope this method will help you in your code.
Reply With Quote
  #5  
Old 03-03-2010
Member
 
Join Date: Nov 2009
Posts: 347
Re: Problem in <Shape> List

Hello,
Uncomment this line to your constructor, you have done a mistake there, this may cause a problem when you are trying to compile the program or you can get an undesired the results
Code:
/ / List <Shape>sh <Shape> = new ArrayList ();
In fact your list is initialized at any time, hence the NullPointerException that you get. I guess you will correct is soon.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Problem in <Shape> List"
Thread Thread Starter Forum Replies Last Post
Cursor Shape And Size hatred Windows XP Support 3 26-09-2011 07:20 PM
Shape interface of java Gajananvihari Software Development 4 09-03-2010 04:08 PM
Changing the Cursor shape in Java rashmi_ay Software Development 4 30-11-2009 09:58 AM
How to draw outline of a shape in photoshop? sizzla Windows Software 2 17-06-2009 12:23 PM
Multi Shape Cobra Stand for PSP Alexxx Portable Devices 3 26-03-2009 11:10 PM


All times are GMT +5.5. The time now is 12:51 AM.