confused Basic Code Required

This topic has been viewed 7880 times and has 7 replies
Thread status: Active
Questions about Sweet Home 3D installation [img]http://www.sweethome3d.com/images/flags/en_small.gif[/img]
Post Reply New Topic
rohanbhanu
Posts: 5
Joined: Fri May 31, 2013 10:50 am

Basic Code Required

Post by rohanbhanu »

Dear All,

I am using SweetHome3d in servlet.
I am new in Java and dont understand how to use this api for my application.
I request you to give me some sample codes.
I am using Eclipse as development tool.

Thank you in advance,
Rohan bhanu

[url=mailto:[email protected]][email protected][/url]
User avatar
Puybaret
Posts: 9440
Joined: Mon Nov 07, 2005 12:00 pm
Country: Paris, France
Contact:

Re: Basic Code Required

Post by Puybaret »

In servlet!?! What for?
Emmanuel Puybaret, Sweet Home 3D creator
rohanbhanu
Posts: 5
Joined: Fri May 31, 2013 10:50 am

Re: Basic Code Required

Post by rohanbhanu »

I am attaching code for reference.

try {
Class c=Class.forName("com.eteks.sweethome3d.model.Home");
Home hm=(Home)c.newInstance();
hm=new Home();
hm.setName("rohan");
hm.addLabel(new Label("MyHome", 1, 11));
Level arg0 = new Level("rohan",20,1,3);
out.print("asdasdasd");
hm.addLevel(arg0);
hm.getPrint();
hm.setModified(true);
Room rom;
Room room=new Room({{},{}});
hm.addRoom(room);

}catch(Exception e){out.print(e.getMessage());}


Using this code I can initialize the home class.
But what is method to display the home preview after adding walls and furniture.
User avatar
Puybaret
Posts: 9440
Joined: Mon Nov 07, 2005 12:00 pm
Country: Paris, France
Contact:

Re: Basic Code Required

Post by Puybaret »

Sorry but I still understand why you speak about servlets? What is your goal?
Emmanuel Puybaret, Sweet Home 3D creator
rohanbhanu
Posts: 5
Joined: Fri May 31, 2013 10:50 am

Re: Basic Code Required

Post by rohanbhanu »

OK let me know you.
My goal is to develop website in which user can create his/her own view for their own house.
They will upload image and draw walls,may add furniture as per their requirement.
I want to build the web application as same as sweet home 3d has developed online application.


For this reason I have downloaded the jar file.
Imported in my eclipse IDE and start using classes developed by SweetHome3d.
rohanbhanu
Posts: 5
Joined: Fri May 31, 2013 10:50 am

Re: Basic Code Required

Post by rohanbhanu »

hello Emmanuel Puybaret,
I am waiting for your reply.
User avatar
Puybaret
Posts: 9440
Joined: Mon Nov 07, 2005 12:00 pm
Country: Paris, France
Contact:

Re: Basic Code Required

Post by Puybaret »

I think you are on the wrong path. Servlets won't help you (at least in a first step) and you'd rather study applets and how it works in Sweet Home 3D Online case.
I'm ok to give you a few hints but sorry I can't spend time on teaching you the basics of Java technology itself.
Emmanuel Puybaret, Sweet Home 3D creator
rohanbhanu
Posts: 5
Joined: Fri May 31, 2013 10:50 am

Re: Basic Code Required

Post by rohanbhanu »

Dear,
As you have mentioned I have tried using applet but it is showing me error:
Code of Applet init method:

public void init(){
Container c=getContentPane();
c.setLayout(new FlowLayout());
JLabel jtemp=new JLabel("Demo Label");
c.add(jtemp);
Class c=Class.forName("com.eteks.sweethome3d.model.Home");
Home hm=(Home)c.newInstance();
Class l=Class.forName("com.eteks.sweethome3d.model.Wall");
Wall w=(Wall)l.newInstance();
w.setThickness(10);
w.setLeftSideColor(20);
w.setRightSideColor(200);
w.setXStart(WIDTH);
hm.addWall(w);
c.add(hm);
}


It is showing error in c.add(hm); statement.
Post Reply New Topic

Who is online

Users browsing this forum: No registered users and 1 guest