Posts

Showing posts from August, 2017

Registration of internet package sales

Image
It's a simple, MVC, JavaFX, single scene app. Actually it's a form for registering the sale of an internet package with a ListView of previous purchases. The internet package consists of few parameters : speed, flow, duration of the contract, id, name and surname of the user and user address. The functionalities are: review all sales , adding new sales and deletion of existing sales. jfxas1.Main.java 1: /* 2: * JavaFX - Registrovanje prodaje internet-paketa 3: */ 4: package jfxas1; 5: 6: import java.net.URL; 7: import javafx.application.Application; 8: import javafx.fxml.FXMLLoader; 9: import javafx.scene.Scene; 10: import javafx.scene.layout.BorderPane; 11: import javafx.stage.Stage; 12: 13: /** 14: * 15: * @author djordje gavrilovic 16: */ 17: public class Main extends Application{ 18: 19: public static void main(String[] args) { 20: launch(args); 21: } 22: 23: @Override

Web service for translating between two languages

Jersey REST service for translating between two languages. It's just a basic concept but it's working. web.xml 1: <?xml version="1.0" encoding="UTF-8"?> 2: 3: <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" 4: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 5: xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" 6: version="3.1"> 7: <display-name>TranslateWS</display-name> 8: <servlet> 9: <servlet-name>Jersey REST Service</servlet-name> 10: <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class> 11: <!-- Register resources and providers under com.vogella.jersey.first package. --> 12: <init-param> 13: <param-name>jersey.config.server.provider.packages</param-name> 14: <param-va

XML parsing with XPath

Parsing and extracting data from XML file with XPath. The output displays detailed information on all books whose price is higher than 10, which were published after 2005. bookCatalog.xml 1: <?xml version="1.0" encoding="UTF-8"?> 2: <!DOCTYPE root SYSTEM "bookCatalogDTD.dtd"> 3: 4: <catalog> 5: <book id="bk101"> 6: <author>Gambardella, Matthew</author> 7: <title>XML Developer's Guide</title> 8: <genre>Computer</genre> 9: <price>44.95</price> 10: <publish_date>2000-10-01</publish_date> 11: <description>An in-depth look at creating applications 12: with XML.</description> 13: </book> 14: <book id="bk102"> 15: <author>Ralls, Kim</author> 16: <title>Midnight Rain</title> 17: <genre>Fantasy</genre> 18:

Employee management system 2

Image
This is a bit enhanced version of employee management system project that I've done before. The GUI is generally the same, except that the data is now displayed inside tables and some colors are changed. Important thing is that ORM is done with Hibernate and HQL.  The code is shown for just two frames (PrikazFrame and IzmenaFrame) out of 5. hibernate.cfg.xml 1: <?xml version="1.0" encoding="UTF-8"?> 2: <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> 3: 4: <hibernate-configuration> 5: <session-factory> 6: <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property> 7: <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property> 8: <property name="hibernate.connection.url"&

Employee management system

Image
But it's a very simple system. And with a nicer Swing GUI, which is mostly created using NetBeans design tool. It's just a simple Swing/SQL/Persistence... exercise. It stores and manges data (name, age, address, income) about employees. Application functionalities are: display of all employees, showing only certain employees according to one of the criteria, change of employee data based on criteria, deleting an employee based on the criteria and entry of new employees. Only a few classes are shown, because logic is mostly the same...  And there is a bit enhanced Hibernate/HQL version. Main.java 1: package zaposlenisistem; 2: 3: import java.awt.Color; 4: import javax.swing.UIManager; 5: 6: /** 7: * 8: * @author djordje 9: */ 10: public class Main { 11: public static void main(String[] args) { 12: try { 13: UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); 14: } catch