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]
Basic Code Required
This topic has been viewed 7878 times and has 7 replies
-
rohanbhanu
- Posts: 5
- Joined: Fri May 31, 2013 10:50 am
Re: Basic Code Required
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.
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.
Re: Basic Code Required
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
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.
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
hello Emmanuel Puybaret,
I am waiting for your reply.
I am waiting for your reply.
Re: Basic Code Required
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.
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
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.
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.
Who is online
Users browsing this forum: No registered users and 2 guests