2014-12-08 1 views
0

저는 3 차원 공간에서 2 점 사이의 거리를 계산하는 프로그램을 만들고 있습니다. 이제 JFreeChart가 XYZ 축에서이 두 점에 의해 형성된 선을 그려야합니다. 또한이 프로그램은 BlueJ가있는 다른 컴퓨터에서 실행해야하므로 패키지 형식으로 JFreeChart 라이브러리를 가져 오려고합니다. 하지만 Tools \ Preferences \ Libraries에서 external .jars로 추가 할 수조차 못했습니다 (, BlueJ를 다시 시작했습니다). 그러니이 방법, 구체적으로 패키지로 알려주십시오. 미리 감사드립니다. 내 코드의 일부는 다음과 같습니다.BlueJ에 JFreeChart 파일의 External .jar를 추가하는 방법은 무엇입니까?

String Sx1,Sx2,Sy1,Sy2,Sz1,Sz2; 
       Sx1=tAX.getText(); 
       Sy1=tAY.getText(); 
       Sz1=tAZ.getText(); 
       Sx2=tBX.getText(); 
       Sy2=tBY.getText(); 
       Sz2=tBZ.getText(); 
       double mx,xi,yi,zi,x1,y1,z1,x2,y2,z2,px,py,pz,dXY,dist,c,mz,cmain,c2; 
       double re1; 
       boolean v1=false,v2=false,v3=false,v4=false; 
       x1=Integer.parseInt(Sx1); 
       y1=Integer.parseInt(Sy1); 
       z1=Integer.parseInt(Sz1); 
       x2=Integer.parseInt(Sx2); 
       y2=Integer.parseInt(Sy2); 
       z2=Integer.parseInt(Sz2); 
       px=Math.abs(x2-x1); 
       py=Math.abs(y2-y1); 
       pz=Math.abs(z2-z1); 
       dXY=Math.sqrt((px*px)+(py*py)); 
       dist=Math.sqrt((dXY*dXY)+(pz*pz)); 

       mx=py/px; 
       mz=py/pz; 

       c=y1-(mx*x1); 
       c2=y1-(mz*z1); 

       JFrame f2=new JFrame("Answers"); 
       f2.setSize(600,600); 
       f2.setVisible(true); 
       f2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 
       Dimension dim=Toolkit.getDefaultToolkit().getScreenSize(); 
       f2.setLocation(dim.width/2-f2.getSize().width/2,dim.height/2-f2.getSize().height/2); 

       JPanel p2=new JPanel(new GridBagLayout()); 

       JLabel L1=new JLabel("The distance between the two points is "+dist); 
       gbc.insets=new Insets(5,5,5,5); 
       gbc.gridx=0; 
       gbc.gridy=1; 
       p2.add(L1,gbc); 

       JLabel L2=new JLabel("The slope of the line on the x axis is "+mx); 
       gbc.insets=new Insets(5,5,5,5); 
       gbc.gridx=0; 
       gbc.gridy=2; 
       p2.add(L2,gbc); 

       if(c!=0) 
       { 
        JLabel L3=new JLabel("The equation of the line on the XY plane is: y="+mx+"x+"+c); 
        gbc.insets=new Insets(5,5,5,5); 
        gbc.gridx=0; 
        gbc.gridy=3; 
        p2.add(L3,gbc); 
       } 
       else 
       { 
        JLabel L3=new JLabel("The equation of the line on the XY plane is: y="+mx+"x"); 
        gbc.insets=new Insets(5,5,5,5); 
        gbc.gridx=0; 
        gbc.gridy=3; 
        p2.add(L3,gbc); 
       } 

       if(c2!=0) 
       { 
        JLabel L4=new JLabel("The equation of the line on the YZ plane is: y="+mz+"z+"+c2); 
        gbc.insets=new Insets(5,5,5,5); 
        gbc.gridx=0; 
        gbc.gridy=4; 
        p2.add(L4,gbc); 
       } 
       else 
       { 
        JLabel L4=new JLabel("The equation of the line on the YZ plane is: y="+mz+"z"); 
        gbc.insets=new Insets(5,5,5,5); 
        gbc.gridx=0; 
        gbc.gridy=4; 
        p2.add(L4,gbc); 
       } 



       f2.add(p2); 

여기에서 2 방정식에 따라 선을 그려야합니다. 그것에 관한 어떤 조언도 좋을 것입니다! 시작 스크립트 (여기 예제는 Windows 환경에서의)와

답변

0

명령 프롬프트/터미널 창에서 첫째로 당신은 항상 실행할 수있는 프로그램과 지정 외부 JAR-파일 : 두 번째 옵션으로

C:> java -classpath C:\java\MyClasses\myclasses.jar utility.myapp.Cool 

나는 확실하지 않다 BlueJ가 해당 카탈로그 Tools \ Preferences \ Libraries에서 라이브러리를 사용할 수있는 프로그램을 시작할 수 있습니다. BlueJ는 프로그램 시작시 Java 클래스 패스에 외부 라이브러리 (JAR 파일에 패키지되어 있음)를 추가하기 위해 IDE 자체에서 어떤 방법이 있다고 가정합니다.

+0

감사합니다. 그러나 C :>는 무엇을 의미합니까? – SwingStar123

+0

Windows 운영 체제에서 하드 디스크의 C 드라이브 또는 기본 이름입니다. 명령 자체는 입력해야하는 'java ...'로 시작합니다. 어떤 운영 체제로 작업하고 있습니까? Unix 기반 환경에서는 대개 C :> 및/또는 달러 기호와 현재 카탈로그 조합 대신 사용자 이름이 표시됩니다. –