|
Hello Cedric
I am sorry If my questions are too much vague for you but I try my best to explain from myside.I guess you might be some senior member here so I respect you.Is that reason that some of mine last questions were not answered by anyone?
Actually,I got the answer to my question .but Anyway I will Explain you more in details.vector3d is from java3d Library.And I am getting float values some obj file format.Ans setScale is function of Transform3d.And SetScale are of types, one accepts float and other accepts vector3d.I was getting flaot values so my question was how to create a vector3d from flaot values.
But It solved After more googling.
AnyWay,I appreciate for your valuable time in my thread and even for answering to me .
Thanks Once Again
Regards
Yogesh Sikri
|
|
|
|
|
yogeshs wrote: But It solved After more googling
Maybe, just maybe, you should try google BEFORE cp.
Panic, Chaos, Destruction.
My work here is done.
or "Drink. Get drunk. Fall over." - P O'H
|
|
|
|
|
It seems like you are trying to use a Java library for 3D programming. If that is the case, then there would most definitely be a class called FastMath in a package called math somewhere. You can use the FastMath.round(...) method within that class to convert the float values to an int without much overhead. This will enable you to then pass those values to the Vector3D class.
Hope this helps. I would have been of further help if I only knew what libraries you were using. The beginning of knowledge is the fear of God
|
|
|
|
|
Hi Everybody,
I am trying to search for a free source Java project or application which is currently sequential and could be converted to multithreaded code.Any suggestion on which application could be converted to concurrent Java code.
Thanks in advance for your help
Deed
|
|
|
|
|
Write a program that does something ten times.
Convert said program to do it once on each of ten threads.
Panic, Chaos, Destruction.
My work here is done.
or "Drink. Get drunk. Fall over." - P O'H
|
|
|
|
|
Thank you Nagy for the quick response.
I was actually looking for a bigger implementation which I could convert to concurrent code for Masters project.I am right now looking into sourceforge to see if there are any projects there..Any suggestions would be appreciated.
Thanks a lot
Deed
|
|
|
|
|
Hello guys.......im newbie in java. How can we conver a string to integer if it contains more than one numbers like this.......
String str = "12 23 4 35 56 ";
Do you see it has 5 numbers in one string var. How can we do this??
|
|
|
|
|
Do you need five integers or one. You could split your string, or you could remove spacesLet there arise out of you a band of people inviting to all that is good, enjoining what is right, and forbidding what is wrong: They are the ones to attain felicity.
Āli-'Imrān (The Family of Imran), 104.
|
|
|
|
|
thanx ..........i can use split methd.
|
|
|
|
|
Hello Friends
I am deleting a file after loading it but some time if any exception occur or some other crash then that file is not deleting bcoz application crashes first.Is there any way to know when application terminates so that i can delete that file or is there any way that will delete my file inspite of any crashes or any other problem?
Any Ideas?
Thanks In Advance.
Regards
Yogesh
|
|
|
|
|
If I understand you correctly, the file should be deleletd by the app when it has finished using it but if the app prematurely exits due to an exception then the file does not get deleted.
0. If an exception is being thrown then it should be caught and managed.
1. There should be a single, safe exit point from the application.
2. At start up, can you check for already processed files and delete them? This may be the best solution.
Panic, Chaos, Destruction.
My work here is done.
or "Drink. Get drunk. Fall over." - P O'H
|
|
|
|
|
Hello Nagy
U understand my problem absolutely right.And i tried ur first way by putting it in finally and It is fine.
Thanks A Lot for your valuable reply.
Regards
Yogesh
|
|
|
|
|
Hello guys...im new to java envirnoement. How can we set the path variable permanently so that we dont have to do it again and again ??
|
|
|
|
|
Which path variable, and where do you want to set it? Windows, Linux, Solaris? Please clarify your question. txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
thanx for ur time....i have already done it.
|
|
|
|
|
Muzammil Saeed wrote: .i have already done it.
Well, maybe you could post your answer so others may benefit?txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
Richard MacCutchan wrote: Well, maybe you could post your answer so others may benefit?
well guys...i did not check this post so i did not know that you wanted my Anser.....OK
Here...if you installed jdk on default location then most probably path for java compiler javac is C:\Program Files\Java\jdk1.6.0_18\bin.This is my path, you use your own.
1....right click the My Computer icon on desktop
2....click the Advanced tab
3....At left bottom, click Envirnoment Variables.
4....Down there, you will find System Variables.....click New.
5....Type variable name Path and variable value ....path mentioned above.click OK.
Thats all.....
what is this all about??.
when you use the command promt then you compile the program using javac...you must set the path first using set path command...now if there, you exit from command prompt, then each time you have to set this path if you use command prompt to compile you program. This method sets that path permanently.
Hope made you clear.
|
|
|
|
|
Hi,
I'm guessing you're referring to the JAVA_HOME environment variable, if you're running Windows XP you can set this permanently using the System Properties (right-click This Computer and select properties), then on the Advanced tab click the Environment Variables button.
Hope this helps,
Fredrik Bornander
|
|
|
|
|
|
You may need something like this[^]. txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
Hello Friends
I am creating a view in which I am creating a shape3d object with the help of geometryInfo Class(using verts,faces).After that I am adding each shape object to BranchGroup and that branchgroup to sceneBase.
Now the Problem is that If I am having Single object in my file then it is showing up in viewer but if file contains two object then only one object is showing up in viewer but all other info of second object is getting stored.
Give some IDeas.
Thanks
Yogesh Sikri
|
|
|
|
|
You need to check the way that you are reading the file. Either your code ignores all subsequent data after reading the first item or only keeps the last item read.
Panic, Chaos, Destruction.
My work here is done.
or "Drink. Get drunk. Fall over." - P O'H
|
|
|
|
|
The relationSpaceShips between the classes in this project is as follows:
(1) SpacePort has-many SpaceShip
(2) SpaceShip has-a Captain
(3) SpaceShip has-a Engine
(4) SpaceShip has-a RegistrationDate
(5) Impulse is-a Engine
(6) Warp is-a Engine
(7) SpaceShip has-many Crewman
(6) Person has-a pid (int)
(9) Person has-a DateOfBirth
(10) Captain is-a Officer
(11) Officer is-a Person
(12) DateOfBirth is-a StarDate
(13) RegistrationDate is-a StarDate
(14) StarDate has-a day (int)
(15) StarDate has-a month (int)
(16) StarDate has-a year (int)
(17) Enterprise is-a SpaceShip
(18) WarBird is-a SpaceShip
(19) RedShirt is-a Crewman
(20) Crewman is-a Person
NOTE:every object has:
private String objName, and
public String getName() {return objName;}
Create a test program that creates an SpacePort object, and prompts for
the user to enter the path of a data file. The program then reads the data from the data
file for the SpacePort.
Then, print:
1. all SpaceShip objects belonging to the SpacePort, sorted by getName(), and
2. all Person objects belonging to the SpacePort, sorted by getName()
Test your program by creating a data file and filling it in
with the data that answers the questions. Include the
data file and run.bat in the project folder.
Rules:
1. Each class above includes, in addition to the constructors:
public String toString(){
//return a string of the classname, the name, and toString() of all
parts.
}
public void readFromFile(){
//read the data from the user, including objName
}//readIn
2. The data members of each class MUST be declared "private" and you may not create
a public function that returns the value of any private data object, other than
getName() above.
3. All classes, except MainClass, should be in a package. Your project should have
at least 3 packages.
4. if you are reading in an element of class "C", where "C" is a superclass
of some other classes, then you must ask the user which of the subclasses
they want.
For example, suppose we have these relationSpaceShips:
Dealer has-many Car
Ford is-a Car
Honda is-a Car
then the readFromFile() function for Dealer might look like this:
Code:
public void readFromFile(FileIO fio) thows Exception{
if(fio.hasNextInt()==false){
throw new Exception("Dealer.readFromFile:missing ncars");
}
int ncars = fio.getNextInt();
carArray = new Car[ncars];
for(int i=0;i<carArray.length;i++){
if(fio.getNextLine()==false){
throw new Exception("Dealer.readFromFile:missing ncars");
}
String cartype=fio.getNextLine();
if(cartype.equals("f")){
carArray[i]= new Ford();
}else{
carArray[i]= new Honda();
}
carArray[i].readFromFile(fio);
}
}
You may assume that class fileioPkg.FileIO is part of your project:
package fileioPkg;
import java.util.*;
import java.io.*;
public class FileIO {
private FileReader freader;
private Scanner scan=null;
public FileIO(){
freader=null;
scan=null;
}
public FileIO(String filename) throws FileNotFoundException{
File infile;
FileReader reader;
infile = new File(filename);
reader = new FileReader(infile);
scan = new Scanner(reader);
}
public boolean hasNextInt() throws Exception{
if(scan==null){
throw new Exception("FileIO.getNextInt:file not opened");
}else{
return scan.hasNextInt();
}
}
public int getNextInt() throws Exception{
if(scan==null){
throw new Exception("FileIO.getNextInt:file not opened");
}else{
int iv=scan.nextInt();
System.out.println("FileIO.getNextInt:"+iv);
return iv;
}
}
public boolean hasNextLine() throws Exception{
if(scan==null){
throw new Exception("FileIO.getNextInt:file not opened");
}else{
return scan.hasNextLine();
}
}
public String getNextLine() throws Exception{
if(scan==null){
throw new Exception("FileIO.getNextInt:file not opened");
}else{
String result=scan.nextLine().trim();
System.out.println("FileIO.getNextLine:"+result);
return result;
}
}
public boolean hasNextDouble() throws Exception{
if(scan==null){
throw new Exception("FileIO.getNextInt:file not opened");
}else{
return scan.hasNextDouble();
}
}
public double getNextDouble() throws Exception{
if(scan==null){
throw new Exception("FileIO.getNextInt:file not opened");
}else{
double dv=scan.nextDouble();
System.out.println("FileIO.getNextDouble:"+dv);
return dv;
}
}
public void close(){
try {
freader.close();
} catch (IOException e) {
}
}
}
So far I created all the classes such as SpacePort, Crewman etc. I created the super classes for example SpaceShip extends SpacePort. I created a mainclass which asks the user to enter a txt file. But fromt his spot I am stuck on what I am so post to do. I have no idea how the txt file is supposed to look like and what the program is to do. Can someone please exaplin this to me in idiot proof terms. Sorry I am still new to java.
|
|
|
|
|
This seems like a rather advanced test program for someone who is new to Java. I suggest you take a look at The Java Tutorials[^] for help on reading and writing files. As to the format of your data file, you will need to decide that yourself, and will depend on what fields you need. For example suppose you need to get the name and age of a crewman, the line in the textfile could be:
CREW, Mr Spock, 750
Your program then needs to read this line and split the content into the correct fields so that you can create a Crewman object.txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
JLayerPane - three problems
1 - I need fix row and column in layer pane and when mouse click it return my coordinates, not actual?
2 - I want to draw in this Layer, But could't?
3 - When i try AffineTransform, my coordinate origin does not moved?
If anybody have solution please reply........
class LayerPane extends JComponent
{
void LayerPane(int x1,int y1,int x2,int y2,int x3,int y3,int x4,int y4,int recW,int recH)
{
JLayeredPane lp = new JLayeredPane();
f.setLayeredPane(lp);
GridLayout grid = new GridLayout(1600, 1440,recW,recH);
lp.setLayout(grid);
lp.setBounds(x1-5, y1-30, recW, recH);
lp.setLocation(x1-5,y1-30);
lp.setOpaque(true);
Color color = new Color(0, 0, 0, 0.4F);
lp.setBackground(color);
MyListenerLP myListener2 = new MyListenerLP();
lp.addMouseListener(myListener2);
lp.setVisible(true);
}
public void paintComponent(Graphics g)
{
g.setColor(Color.blue);
g.drawLine(x,y,x+50,y+50);
System.out.print("\nx,y is = "+x);
System.out.print(", "+y);
}
class MyListenerLP extends MouseInputAdapter
{
public void mouseClicked(MouseEvent e)
{
int x = e.getX();
int y = e.getY();
System.out.print("\nX,Y = "+x);
System.out.print(", "+y);
repaint(x,y,x,y);
}
}
}
|
|
|
|
|