From now on we will use the ready-made library Open Source Physics Core Library.
You should download this library using the next link
https://easy-english-study.com/osp.jar
and include it in NetBeans everytime before compiling projects
Open NetBeans and right-click on the project name in the Projects tab.
Select Properties.
Select Libraries.
Click the Add Jar/Folder button.
Navigate to the directory where the downloaded osp.jar file is.
Lesson4
Re: Lesson4
- package plotframeapp;
- import org.opensourcephysics.frames.PlotFrame;
- public class PlotFrameApp{
- public static void main (String[] args){
- PlotFrame frame=new PlotFrame ("x","sin(x)/x","Plot example");
- for (int i=1; i<=100; i++){
- double x=i*0.2;
- frame.append (0,x,Math.sin(x)/x) ;
- }
- frame.setVisible(true) ;
- frame.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);
- }
- }
Re: Lesson4
Code: Select all
package plotframeapp;
import org.opensourcephysics.frames.PlotFrame;
public class PlotFrameApp{
public static void main (String[] args){
PlotFrame frame=new PlotFrame ("x","sin(x)/x","Plot example");
for (int i=1; i<=100; i++){
double x=i*0.2;
frame.append (0,x,Math.sin(x)/x) ;
}
frame.setVisible(true) ;
frame.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);
}
}
Re: Lesson4
The screenshot of PlotFrameApp program.
- Attachments
-
- PlotFrameApp.png (8.79 KiB) Viewed 2874 times