Creating an Applet in Netbeans

Report
Creating an application in
Netbeans
Goal of this tutorial
• Project 1 requires you to develop and test a
graphical user interface (GUI)
• Netbeans allows you to quickly create a GUI
using Java
– Programs can be run on any operating system
• Today’s lecture will show you how to do this
Goal of this tutorial
• Not required to use Netbeans, but:
– Sample code will only be provided in Java
– You need to make sure that your program can run
on both Windows and Mac OSX
– The TA may not be able to help you if you chose to
develop in another language
Setup
• Download Netbeans
– https://netbeans.org/
• Download Java JRE/JDK 8 v25
– Note: You must install at least the JRE 8v25 to
make sure that you can run other student’s
programs who have developed them in Java, even
if you decide to develop your program in a
different language
Develop a desktop application
• Past years have required you to host your
application on a website
– This is not required this year
• Recommend you create a standard Java
Application, not a Java Applet
Creating a new Project
•
•
•
•
File > New Project
Select Java Application (in the Java folder)
Name it whatever you would like
Uncheck Create Main Class
Creating the GUI
• Right-click on your new project and click New
• Select Other
• Select the Swing Gui Forms folder and create a
JDialog Form
– You can ignore the warning about using the
default package
Source and Design Panes
• Select your new JDialog Form
• You should see three buttons/tabs labeled
Source, Design, and History.
– Source shows the source code for your form
– Design shows the GUI designer
– History shows your change history
• Source and Design are the important ones
Using the Design Pane
• Working with the Swing designer:
https://netbeans.org/kb/docs/java/quickstartgui.html
Building an Executable JAR
•
•
•
•
•
Open your project’s Properties and select Packaging
Check all three checkboxes and hit OK
Run > Build Project
Open the project directory
The executable .jar is in the dist folder
– There may be a lib folder as well, if your project needs any
additional libraries
• Zip the .jar file and the lib folder (if it exists)
• People can unzip the file and run your program by
double-clicking on the jar file
Hosting on the CISE Servers
• Install WinSCP (other FTP programs are fine)
• Connect to storm.cise.ufl.edu (other servers are fine)
• Place the zip file in your public_html directory
– Create the directory if it doesn’t exist
– Set the folder permissions to rwxr-xr-x (i.e. 0755)
– Permissions can be set in WinSCP in the folder’s properties
• Set your zip file’s permissions to rw-r--r– (i.e. 0644)
• Applying for an account:
https://www.cise.ufl.edu/help/account
• Download at
http://cise.ufl.edu/~<username>/<filename>
Advice for Project 1
• Building a translation program to help people
ask for directions
– Translation will be done using Google’s APIs
• Make sure your application supports other
character sets (English + Chinese characters)
• Make sure you test your input to ensure that
other character sets can be entered
Google Translate API
• Class TA will provide more information
– Demo project contains two important classes:
TranslateService.java and Language.java
• TranslateService.java
– Call the method translate to get a translation
• Language.java
– Defines constants for all of the languages
supported by Google Translate

similar documents