Language - Java Windows NetBeans: Difference between revisions

From Phidgets Support
No edit summary
(Redirected page to Language - Java)
 
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{NoTitle}}
#REDIRECT [[Language - Java]]
{{Language_-_Java_Dev_Environment_Table}}
{|
|style="vertical-align:middle; width: 60%;"|
<font size=6>'''Language - Java'''
 
'''Windows with NetBeans'''</font>
 
Welcome to using Phidgets with Java! By using Java, you will have access to the complete Phidget22 API, including events.
 
NetBeans is an IDE used to write, compile, and run Java applications.
|{{TOC limit|2}}
|}
 
{{Language_-_Java_Intro|Windows|NetBeans}}
 
==Use Our Examples==
One of the best ways to start programming with Phidgets is to use our example code as a guide. In order to run the examples, you will need to download and install [https://netbeans.org/ NetBeans].
 
 
Now that you have NetBeans installed, select an example that will work with your Phidget:
*{{SampleCode|Java|Java Examples}}
 
 
Next, open NetBeans and create a new project. Select ''Java Application'' then click ''Next >'':
[[Image:Java_netbeans_newproject.PNG|link=|center]]
 
 
Give your project a name and finish creating the project:
[[Image:Java_netbeans_nameproject.PNG|link= |center]]
 
 
Delete the java file that was generated with the project:
[[Image:Java_netbeans_deletefile.png|link= |center]]
 
 
Replace the deleted file with the example files that you downloaded. Next, add a reference to phidget22.jar by right-clicking on the libraries folder:
[[Image:Java_netbeans_addjar.png|link= |center]]
 
 
 
You can find phidget22.jar at the following location:
*C:\Program Files\Phidgets\Phidget22\phidget22.jar
 
 
[[Image:Java_netbeans_jarpath.png|link=|center]]
 
 
Finally, you can run the example by clicking the Run Project button.
 
[[Image:Java_netbeans_run.png|link=|center]]
 
 
{{Edit_the_Examples}}
 
==Editing the Examples==
{{Language_-_Java_Editing_the_Examples}}
 
==Write Code==
{{Language_-_Java_Write_Code}}
 
==Setting up a New Project==
When you are building a project from scratch, or adding Phidget functionality to an existing project, you'll need to configure your development environment to properly link the Phidget Java library.
 
To start, open NetBeans and create a new project. Select ''Java Application'' then click ''Next >'':
[[Image:Java_netbeans_newproject.PNG|link=|center]]
 
 
Give your project a name and finish creating the project:
[[Image:Java_netbeans_nameproject.PNG|link= |center]]
 
 
Next, add a reference to phidget22.jar by right-clicking on the libraries folder:
[[Image:Java_netbeans_addjar_v3.png|link= |center]]
 
 
You can find phidget22.jar at the following location:
*C:\Program Files\Phidgets\Phidget22\phidget22.jar
 
 
[[Image:Java_netbeans_jarpath.png|link=|center]]
 
 
Finally, to use the Phidget Java library, add the following import to your code:
<syntaxhighlight lang="java">
import com.phidget22.*;
</syntaxhighlight>
 
 
Your project now has access to Phidgets.
 
==Further Reading==
{{Language_-_Java_Further_Reading}}

Latest revision as of 16:37, 15 March 2021

Redirect to: