Creating of Rich Client Applications using NetBeans 6 and Java Swing Miroslav Nachev.

Slides:



Advertisements
Similar presentations
The Ribbon Standard to all Office 2007 applications Organized by feature and functionality Navigation Pane Access to all objects in the current database.
Advertisements

Microsoft Expression Web-Illustrated Unit J: Creating Forms.
Using Eclipse. Getting Started There are three ways to create a Java project: 1:Select File > New > Project, 2 Select the arrow of the button in the upper.
Chapter 18 - Data sources and datasets 1 Outline How to create a data source How to use a data source How to use Query Builder to build a simple query.
UNESCO ICTLIP Module 4. Lesson 3 Database Design, and Information Storage and Retrieval Lesson 3. Information storage and retrieval using WinISIS.
Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
Integrating Access with the Web and with Other Programs.
Creating Custom Forms. 2 Design and create a custom form You can create a custom form by modifying an existing form or creating a new form. Either way,
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
1 GUI Elements in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Create a New Application and Project Open the Create Application dialog. Enter the application name of your choice and the directory. Select No Template.
1 Lecture 18 George Koutsogiannakis/Spring 2011 CS441 CURRENT TOPICS IN PROGRAMMING LANGUAGES.
Access Tutorial 10 Automating Tasks with Macros
Chapter 9 Macros, Navigation Forms, PivotTables, and PivotCharts
WorkPad 4 Quick Start WorkPad 4 Quick Start  Business Optix brings the rigor and discipline of business modelling and design into.
Tutorial 8 Managing and Securing a Database. Objectives Filter data in a table and a form Save a filter as a query and apply the saved query as a filter.
PROGRAMMING REVIEW Lab 2 EECS 448 Dr Fengjun Li and Meenakshi Mishra.
Chapter 10 EJB Concepts of EJB Three Components in Creating an EJB Starting/Stopping J2EE Server and Deployment Tool Installation and Configuration of.
Department of Mechanical Engineering, LSUSession VII MATLAB Tutorials Session VIII Graphical User Interface using MATLAB Rajeev Madazhy
© 2008 The McGraw-Hill Companies, Inc. All rights reserved. WORD 2007 M I C R O S O F T ® THE PROFESSIONAL APPROACH S E R I E S Lesson 21 Fields and Forms.
Creating a Web Site to Gather Data and Conduct Research.
Tutorial 121 Creating a New Web Forms Page You will find that creating Web Forms is similar to creating traditional Windows applications in Visual Basic.
Introduction to GUI in Java 1. Graphical User Interface Java is equipped with many powerful,easy to use GUI component such as input and output dialog.
Java GUI CSCE 190 – Java Instructor: Joel Gompert Mon, July 26, 2004.
XP New Perspectives on Microsoft Access 2002 Tutorial 1 1 Microsoft Access 2002 Tutorial 1 – Introduction To Microsoft Access 2002.
1 CSC111H Graphical User Interfaces (GUIs) Introduction GUIs in Java Understanding Events A Simple Application The Containment Hierarchy Layout Managers.
FEN IntroJava2006 AAU1 GUI: Graphical User Interface AWT/SWING: Components Drag and Drop in NetBeans Events Listeners.
COMPREHENSIVE Access Tutorial 12 Managing and Securing a Database.
® Microsoft Access 2010 Tutorial 12 Managing and Securing a Database.
Course ILT Forms and queries Unit objectives Create forms by using AutoForm and the Form Wizard, and add or modify form headers and footers Open and enter.
1 Creating Windows GUIs with Visual Studio. 2 Creating the Project New Project Visual C++ Projects Windows Forms Application Give the Project a Name and.
Graphical Enablement In this presentation… –What is graphical enablement? –Introduction to newlook dialogs and tools used to graphical enable System i.
Java GUI. Graphical User Interface (GUI) a list a button a text field a label combo box checkbox.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 41 JavaServer Face.
Class Builder Tutorial Presented By- Amit Singh & Sylendra Prasad.
Visual Basic for Application - Microsoft Access 2003 Programming applications using Objects.
XP New Perspectives on Microsoft Office FrontPage 2003 Tutorial 7 1 Microsoft Office FrontPage 2003 Tutorial 8 – Integrating a Database with a FrontPage.
®® Microsoft Windows 7 for Power Users Tutorial 3 Managing Folders and Files.
Swinging in Your Java Playground. Background Swing is a part of the Java Foundation Classes (JFC). The JFC is made up of features intended to give a programmer.
Swing. Introduction to Swing What is Swing? “ Swing is a diverse collection of lightweight components that can be used to build sophisticated user interfaces.”
Managing File Resource Using File Server Resource Manager Chapter 9 Advance Computer Network Lecture Sorn Pisey
Java Swing One of the most important features of Java is its ability to draw graphics.
McGraw-Hill/Irwin The Interactive Computing Series © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Microsoft Access 2002 Advanced Form Design.
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 8 1 Microsoft Office Access 2003 Tutorial 8 – Integrating Access with the.
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 6 1 Microsoft Office Access 2003 Tutorial 6 – Creating Custom Forms.
CSCI 3327 Visual Basic Chapter 13: Databases and LINQ UTPA – Fall 2011.
Customizing Menus and Toolbars CHAPTER 12 Customizing Menus and Toolbars.
2 Copyright © 2004, Oracle. All rights reserved. ADF Development Process.
1 A Quick Java Swing Tutorial. 2 Introduction Swing – A set of GUI classes –Part of the Java's standard library –Much better than the previous library:
Using NetBeans IDE for Desktop Development Geertjan Wielenga
Beans Binding Framework & Swing Application Framework Geertjan Wielenga http//netbeans.dzone.com.
Swing Application Framework and Beans Binding David Botterill
A Quick Java Swing Tutorial
Microsoft Access 2016 Simplify Data Entry with Forms
Developer 2000 CSE 4504/6504 Lab.
CARA 3.10 Major New Features
A Quick Java Swing Tutorial
Important terms Black-box testing White-box testing Regression testing
Simplify Data Entry with Forms Chapter 3
Microsoft Office Access 2003
Microsoft Office Access 2003
Learning about Taxes with Intuit ProFile
Windows xp PART 1 DR.WAFAA SHRIEF.
Microsoft Office Access 2003
Microsoft Office Access 2003
Java External Libraries & Case Study
Learning about Taxes with Intuit ProFile
A Quick Java Swing Tutorial
Constructors, GUI’s(Using Swing) and ActionListner
Tutorial 12 Managing and Securing a Database
Presentation transcript:

Creating of Rich Client Applications using NetBeans 6 and Java Swing Miroslav Nachev

Contents SwingX SwingX Simple Database Application Simple Database Application Another simple Database Application with MasterTable and DetailTable Another simple Database Application with MasterTable and DetailTable Rich Client Application example Rich Client Application example Swing Application Framework Swing Application Framework Q & A Q & A

SwingX Contains extensions to the Swing GUI toolkit, including new and enhanced components that provide functionality commonly required by rich client applications. SwingX Demo SwingX Demo

SwingX highlights include: Sorting, filtering, highlighting for tables, trees, and lists Sorting, filtering, highlighting for tables, trees, and lists Date picker component Date picker component Find/search Find/search Auto-completion Auto-completion Login/authentication framework Login/authentication framework TreeTable component TreeTable component Collapsible panel component Collapsible panel component Tip-of-the-Day component Tip-of-the-Day component

SwingX links Links: Links: ngLabsSwingX ngLabsSwingX ngLabsSwingX ngLabsSwingX

Simple Database Application Creating a Database “car_db” Creating a Database “car_db” Creating the Application “CarsApp” Creating the Application “CarsApp” Transaction type: JTA in a JavaEE and RESOURCE_LOCAL in a JavaSE Transaction type: JTA in a JavaEE and RESOURCE_LOCAL in a JavaSE Transaction model: persists all and commit to save or rollback to cancel Transaction model: persists all and commit to save or rollback to cancel.properties files containing the labels in the user interface.properties files containing the labels in the user interface

Features that are already built into the application Car.java entity bean Car.java entity bean Bean to Table relation using annotations Bean to Table relation using annotations Property Change notification Property Change notification Persistence unit: META-INF/persistence.xml, defines a connection between the database and the entity class. Persistence unit: META-INF/persistence.xml, defines a connection between the database and the entity class. Using beans binding (JSR 295) to connect the properties of the entity class with the properties of the JTable component. Using beans binding (JSR 295) to connect the properties of the entity class with the properties of the JTable component. The entityManager, query, and list objects, which are defined in the CarsView class The entityManager, query, and list objects, which are defined in the CarsView class

Adding More Controls “Tire Size” slider “Tire Size” slider “Modernness” slider “Modernness” slider “Spoiler” checkbox “Spoiler” checkbox “Roof” checkbox “Roof” checkbox

Binding Controls to Values in the Table In the form, right-click the first slider and choose Bind > value. In the form, right-click the first slider and choose Bind > value. In the Binding Source drop-down list of the Binding dialog box, select masterTable. In the Binding Source drop-down list of the Binding dialog box, select masterTable. In the Binding Expression drop-down list, select selectedElement > tiresize. In the Binding Expression drop-down list, select selectedElement > tiresize. Click the Advanced tab. Click the Advanced tab. Select the Unreadable Source Value checkbox. Select the Unreadable Source Value checkbox. Click the ellipsis (...)button that is next to the Unreadable Source Value checkbox. Click the ellipsis (...)button that is next to the Unreadable Source Value checkbox.

Binding Controls to Values in the Table In the Incomplete Path Value dialog box, select Custom Code from the drop-down list. Then type the integer 0. In the Incomplete Path Value dialog box, select Custom Code from the drop-down list. Then type the integer 0. Right-click the checkbox and choose Customize Code. Right-click the checkbox and choose Customize Code. In white line under the bindingGroup.addBinding(binding) line, type: In white line under the bindingGroup.addBinding(binding) line, type: binding.setSourceUnreadableValue(false); binding.setSourceUnreadableValue(false); Run application and verify into Databse Run application and verify into Databse

Setting up a Custom Component Adding Car Preview package Adding Car Preview package Drag the CarPreview.java class (JavaBeans component) to the form Drag the CarPreview.java class (JavaBeans component) to the form Bind all the binding properties of the CarPreview component to the corresponding selectedElement attributes of the masterTable Bind all the binding properties of the CarPreview component to the corresponding selectedElement attributes of the masterTable

Another simple Database Application with MasterTable and DetailTable Creating a new Database Connection to Swing_Demo Creating a new Database Connection to Swing_Demo Creating the Application “MasterDetailDemo” Creating the Application “MasterDetailDemo” Adding to Entity beans Adding to Entity beans

Changes in detailTable Switch to Binding category in Properties window Switch to Binding category in Properties window Select elements property Select elements property Invoke property customizer (Press... button) Invoke property customizer (Press... button) Switch to Advanced tab. Switch to Advanced tab. Check 'Unreadable Source Value' ( should be selected in combo next to this check- a1box). Check 'Unreadable Source Value' ( should be selected in combo next to this check- a1box).

Starting of the application with OpenJPA agent Select root node of your project in Projects window. Select root node of your project in Projects window. Invoke Properties action from contextual menu of this node. Invoke Properties action from contextual menu of this node. Select Run node (in the tree on the left). Select Run node (in the tree on the left). Enter: Enter: -javaagent: /openjpa jar into VM Options field.

Rich Client Application example Creating the Application “RichClientApp” Creating the Application “RichClientApp” Creating a Swing Application Creating a Swing Application Separating Business Logic Interfaces from EJB Implementation (Module) Separating Business Logic Interfaces from EJB Implementation (Module)

Swing Application Framework Framework Architecture. Two classes help you manage your application (one-to-one relationship): Framework Architecture. Two classes help you manage your application (one-to-one relationship): ApplicationContext ApplicationContext Application Application ApplicationContext services: ApplicationContext services: Localizable resource management Localizable resource management Task services and monitoring Task services and monitoring Event-action management Event-action management Session-state storage Session-state storage

From where to start All Swing Application Framework applications must subclass either the Application class or its SingleFrameApplication subclass. The SingleFrameApplication adds a default main GUI frame, retrieves and injects default resources, and uses the ApplicationContext to save and restore simple session state. Session state includes UI component location, size, and configuration.

Application Life Cycle launch -- You must call this framework method. launch -- You must call this framework method. initialize -- The framework will invoke this optional overridden method. initialize -- The framework will invoke this optional overridden method. startup -- The framework will invoke this overridden method. startup -- The framework will invoke this overridden method. ready -- The framework will invoke this optional overridden method. ready -- The framework will invoke this optional overridden method. exit -- You must call this framework method. exit -- You must call this framework method. shutdown -- The framework will invoke this optional overridden method. shutdown -- The framework will invoke this optional overridden method.

Example subclasses the Application class public class BasicFrameworkApp extends Application { private JFrame mainFrame; private JLabel label; protected void startup() { mainFrame = new JFrame("BasicFrameworkApp"); mainFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); mainFrame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { mainframe.setVisible(false); exit();}}); label = new JLabel("Hello, world!"); mainFrame.add(label);mainFrame.pack();mainFrame.setVisible(true);} public static void main(String[] args) { Application.launch(BasicFrameworkApp.class, args); } }

Example subclasses the SingleFrameApplication class public class BasicSingleFrameApp extends SingleFrameApplication { JLabel label; protected void startup() { getMainFrame().setTitle("BasicSingleFrameApp"); label = new JLabel("Hello, world!"); label.setFont(new Font("SansSerif", Font.PLAIN, 22)); show(label);} public static void main(String[] args) { Application.launch(BasicSingleFrameApp.class, args); }}

ExitListener interface The ExitListener interface has two methods: The ExitListener interface has two methods: public boolean canExit(EventObject e) public boolean canExit(EventObject e) public void willExit(EventObject e) public void willExit(EventObject e)