Notes - Part I - Say Hello from Java
- by Silviu Turuga
Sometimes we need to take small notes to remember things, one way to do this is to use stick notes and have them all around our desktop. But what happening if you have a lot of notes and a small office? You'll need a piece of software that will sort things for you and also it will provide you a quick way to retrieve the notes when need. Did I mention that this will keep your desktop clean and also will reduce paper waste? 
   
  During the next days we'll gonna create an application that will let you manage your notes, put them in different categories etc. I'll show you step by step what do you need to do and finally you'll have the application run on multiple systems, such as Mac, Windows, Linux, etc. 
   
  The only pre-requisition for this lesson is to have JDK 7 with JavaFX installed and an IDE, preferably NetBeans. 
   
   
    I'll call this application Notes….  
   
  Part I - Say Hello from Java  
   
     
      From NetBeans go to Files->New Project
        
        
        
        
        
        
        
        
        
          
       
      Chose JavaFX->JavaFX FXML Application 
       
           
       
       
        Project Name: Notes 
        FXML name: NotesUI 
        Check Create Application Class and name it Main
          
          
          
          
          
          
            
         
       
      After this the project is created and you'll see the following structure 
          
       
      As a best practice I advice you to have your code in your own package instead of the default one. 
       
        right click on Source Packages and chose New->Java Package 
        name it something like this: com.turuga.notes and click Next 
        after the package is created, select all the 3 files from step #3 and drag them over the new package 
        chose Refactor, as this will make sure all the references are correctly moved inside the new package 
        now you should have the following structure  
        if you'll try to run the project you'll get an error: Unable to find class: Main 
        right click on project name Notes and click properties 
        go to Run and you'll see Application Class set to Main, but because we have defined our own packages, this location has been change, so click on Browse and the correct one appear: com.turuga.notes.Main  
        last modification before running the project is to right click on NotesUI.fxml and chose Edit (if you'll double click it will open in JavaFX Scene Builder) 
        look around line 9 and change fx:controller="NotesUIController" to fx:controller="com.turuga.notes.NotesUIController" 
        now you are ready to run it and you should see the following  
       
     
     
   
  On the next lesson we'll continue to play with NetBeans and start working on the interface of our project