Sharing With Passion

September 10, 2012

Posted by Sabar Santoso in , | September 10, 2012 No comments
JavaFX is a software technology that lets you create and deliver Rich Internet Applications (RIAs) with media and content across a wide variety of platforms and devices.

The language was originally called F3 (Form Follows Function) and was developed primarily by Chris Oliver, now at Sun Microsystems. The name was changed to JavaFX in 2007.

On Java platforms, JavaFX is a compiled, statically typed, declarative scripting language. The language offers automatic data binding, triggers, animation, and an expression syntax where code blocks yield values. Sequences, function types, and inferred types make JavaFX a concise scripting language. Developers can use objectoriented JavaFX features to simplify complexity and handle errors with Java-like exceptions. JavaFX also lets you easily access the complete Java API, which includes an enormous number of third-party Java libraries.

Figure 1.1 is the big picture for JavaFX. This block diagram shows the various pieces you can leverage when creating JavaFX applications. As the diagram shows, there are extensions for three environments: Desktop, Mobile and TV. All three environments support the common API (labeled Common Elements in Figure 1.1). As of this writing, the runtime for the JavaFX TV environment does not yet exist. There is a runtime for the JavaFX mobile environment, which supports the common API only.


On the desktop, JavaFX runs on Windows XP, Vista, and Mac OS. Linux support is forthcoming (as of this writing). JavaFX is also capable of running on Android, Windows Mobile, and other mobile operating systems.

The JavaFX platform release currently includes three major components : JavaFX SDK, NetBeans IDE and JavaFX Production Suite.

JavaFX SDK
The JavaFX SDK (Software Development Kit) includes the JavaFX compiler, runtime tools, graphics, media, and web services. It also includes libraries that let you create RIAs (Rich Internet Applications) for desktop, browser, and mobile platforms.

NetBeans IDE
NetBeans is a sophisticated IDE (Integrated Development Environment) that lets you build, preview, and debug JavaFX applications. The code editor supports JavaFX syntax checking, code completion, hyperlinked documentation, and other developerfriendly features. To decrease development time, the editor offers drag-and-drop from palettes of GUI controls, event handlers, transformations, effects, and animation. For Mobile applications, NetBeans also supports a Mobile emulator to simulate applications running on mobile devices.

Currently, JavaFX is a plug-in component for NetBeans. A community-supported plug-in for Eclipse IDE users is also available.

JavaFX Production Suite
The JavaFX Production Suite is a set of tools and plug-ins to help designers export JavaFX graphics from third-party applications (Adobe Illustrator and Photoshop).

Using the JavaFX Graphics Viewer, you can preview how graphics will render when you deploy to desktop and mobile environments. An SVG (Scalable Vector Graphics) conversion tool lets you convert SVG files to JavaFX format.

To access the JavaFX downloads, go to
http://java.sun.com/javafx/downloads. You will see downloads for the following components.
• JavaFX SDK
• NetBeans for JavaFX
• JavaFX Production Suite
Follow the instructions on the web site to download and install the component you want. You can download and install NetBeans with JavaFX together or you can install the JavaFX plug-in separately if you already have NetBeans installed.

Here are some other valuable links for JavaFX.
• http://java.sun.com/javafx—Main site for JavaFX
• http://javafx.com—Samples and demos for JavaFX
• http://java.sun.com/javafx/num/docs/api—JavaFX documentation (version num)
• http://www.netbeans.org—NetBeans site
• https://openjfx-compiler.dev.java.net—OpenJFX Compiler Project

Once you have NetBeans and JavaFX installed, you are ready to try out JavaFX.

September 08, 2012

Posted by Sabar Santoso in , , , , | September 08, 2012 No comments

As you may have realized, the PHP language revolves around the central theme of practicality. PHP is about providing the programmer with the necessary tools to get the job done in a quick and efficient fashion. Five important characteristics make PHP’s practical nature possible:
• Familiarity
• Simplicity
• Efficiency
• Security
• Flexibility
One final characteristic makes PHP particularly interesting: it’s free!

Familiarity
Programmers from many backgrounds will find themselves already accustomed to the PHP language. Many of the language’s constructs are borrowed from C and Perl, and in many cases PHP code is almost indistinguishable from that found in the typical C or Pascal program. This minimizes the learning curve considerably.

Simplicity
A PHP script can consist of 10,000 lines or one line: whatever you need to get the job done. There is no need to include libraries, special compilation directives, or anything of the sort. The PHP engine simply begins executing the code after the first escape sequence (). If the code is syntactically correct, it will be executed exactly as it is displayed.

Efficiency
Efficiency is an extremely important consideration for working in a multiuser environment such as the WWW. PHP 4.0 introduced resource allocation mechanisms and more pronounced support for object-oriented programming, in addition to session management features. Reference counting has also been introduced in the latest version, eliminating unnecessary memory allocation.

Security
PHP provides developers and administrators with a flexible and efficient set of security safeguards. These safeguards can be divided into two frames of reference: system level and application level.

- System-Level Security Safeguards :
PHP furnishes a number of security mechanisms that administrators can manipulate, providing for the maximum amount of freedom and security when PHP is properly configured. PHP can be run in what is known as safe mode, which can limit users’ attempts to exploit the PHP implementation in many important ways.
Limits can also be placed on maximum execution time and memory usage, which if not controlled can have adverse affects on server performance. Much as with a cgi-bin folder, administrators can also place restrictions on the locations in which users can view and execute PHP scripts and use PHP scripts to view guarded server information, such as the passwd file.

- Application-Level Security Safeguards :
Several trusted data encryption options are supported in PHP’s predefined function set. PHP is also compatible with many third-party applications, allowing for easy-integration with secure ecommerce technologies. Another advantage is that the PHP source code is not viewable through the browser because the script is completely parsed before it is sent back to the requesting user. This benefit of PHP’s server-side architecture prevents the loss of creative scripts to users at least knowledgeable enough to execute a ‘View Source’. Security is such an important issue that this book contains an entire chapter on the subject.

Flexibility
Because PHP is an embedded language, it is extremely flexible towards meeting the needs of the developer. Although PHP is generally touted as being used in conjunction solely with HTML, it can also be integrated alongside languages like JavaScript, WML, XML, and many others. Additionally, as with most other mainstream languages, isely planned PHP applications can be easily expanded as needed.
Browser dependency is not an issue because PHP scripts are compiled entirely on the server side before being sent to the user. In fact, PHP scripts can be sent to just about any kind of device containing a browser, including cell phones, personal digital assistant (PDA) devices, pagers, laptops, not to mention the traditional PC. People who want to develop shell-based applications can also execute PHP from the command line.

Since PHP contains no server-specific code, users are not limited to a specific and perhaps unfamiliar Web server. Apache, Microsoft IIs, Netscape Enterprise Server, Stronghold, and Zeus are all fair game for PHP’s server integration. Because of the various platforms that these servers operate on, PHP is largely platform independent, available for such platforms as UNIX, Solaris, FreeBSD, and Windows 95/98/NT.
Finally, PHP offers access to external components, such as Enterprise Java Beans and Win32 COM objects. These newly added features put PHP in the big league, truly enabling developers to scale PHP projects upward and outward as need be. An Introduction to PHP 7

Free
The open source development strategy has gained considerable notoriety in the software industry. The prospect of releasing source code to the masses has resulted in undeniably positive outcomes for many projects, perhaps most notably Linux, although the success of the Apache project has certainly been a major contributor in proving the validity of the open source ideal. The same holds true for the developmental history of PHP, as users worldwide have been a huge factor in the advancement of the PHP project.

PHP’s embracing of this open source strategy result in great performance gains for users, and the code is available free of charge. Additionally, an extremely receptive user community numbering in the thousands acts as “customer support,” providing answers to even the most arcane questions in popular online discussion groups.

Posted by Sabar Santoso in | September 08, 2012 No comments
















When you talk about viewing a PHP page, you are referring to a Web page. When you go to a Web page a series of events occur. These events start at the client with the request, go to a server to get the page, and end back at the client for viewing. Take a look at these events as listed below,

  1. The client computer connects to the Internet.
  2. The client opens a Web browser.
  3. The client requests a page from a Web site. When you do this, a message is sent over the Internet to a name server, and the name server then directs you to the server that hosts the Web page.
  4. The server that hosts the Web page receives your request and retrieves the requested page.
  5. If the page is a scripted page, such as a PHP page, the server compiles the page through a just-in-time compiler that generates HTML.
  6. The server then transmits the completed HTML back to the client (the browser).
  7. The Web browser receives the HTML and displays an interpretation of the page.
All of that is fairly straightforward; it’s almost like magic. There is only one catch—from browser to browser, your Web pages are not displayed identically. That is why we say the browser interprets the page. For instance, when Internet Explorer receives a page that includes nested tables, both with heights of 100%, Internet Explorer interprets the height
of the inner table relative to the height of the outer table. However, in Netscape Navigator, the browser will make both the inner and the outer table the height of the browser window. This poses a problem if you want a page to look the same in multiple browsers.

It gets worse when you switch between OS platforms. Let’s say you have a page of text, and for some reason the text determines the layout of the page, and you get it looking perfect on a Windows platform. When you then view the page on a Macintosh, the font is rendered very differently. The kerning (the space between characters) and the leading (the space between lines) is totally different. In fact, the font itself might be changed to a different font altogether. Style sheets can mitigate some of these problems, but you’ll still run into layout issues. The point is that what the browser displays is not a photograph, so if you want your games to work on several different browsers you have to be careful about the types of elements (text and graphics) you use.


The Web Server

Now that you have a general understanding of how a client/server relationship works you can take a closer look at the heart of the beast: the Web server itself. A Web server runs what is called an HTTP daemon. This daemon handles all of the requests received on a particular port. The HTTP daemon will listen to two ports—port 80 and port 443. Port 80 is the general Web port (http://). Port 443 is the standard for secure socket (https://). A Web server is also said to be stateless. That is to say, no permanent connection is maintained between the client and the server. This is extremely important to understand. It will make debugging or solving certain problems much easier, and, more important, this concept will completely change the way you design your games. It won’t be as easy as making a library of functions or a simple engine and calling functions. You will need to develop a way to keep state.

Think about that for a minute. What does that really mean? Well, it means that every time a particular event happens in your PHP game—e.g., the user enters coordinates and clicks the fire button—the Web browser will reopen the connection to the server, resend the request to the server, and the server will then process the page and send it back. Now you need to reload all of your variables/states and update the page appropriately. Otherwise the whole game would start over, and that would be no fun. Don’t get me wrong—there are some client-side scripting languages, such as JavaScript, that you can use for clientside event processing. However, that is beyond the scope of this book, which focuses on how to make games with PHP. So how exactly do you do this?
Posted by Sabar Santoso in | September 08, 2012 No comments

The iPhone is one of the most distinctive game platforms currently available. The touch screen, integration with iTunes, programming in Objective-C, low development cost, and ease of publishing all make for a very strange but promising new development opportunity. As the newest kid on the block, the iPhone instantly captured a noticeable portion of the mobile phone market and inspired a wave of copycat devices by makers such as Motorola, Samsung, and LG.
As a programmer, you might not be impressed with sales figures and market shares, but you should be interested in the viability of the iPhone as a whole. If no one owns an iPhone, no one will buy the games you make for it. The good news is that even in the face of the 2009 economic downturn, iPhones continued to sell. To get started with the iPhone, you’ll need to get a free Apple developer account. Next you’ll download the iPhone SDK on your Mac, which also contains the Xcode IDE and Interface Builder tool for laying out screens. (Apple doesn’t provide a toolkit for Windows or any other non-Mac platform.) And because the iPhone API requires you to write in Objective-C, you will need to read a primer on the language if you do not already understand it. This chapter takes you step by step through all of these tasks.

Apple Developer Account and Downloading the SDK

The first step in setting up your iPhone development environment is to register an Apple developer account. Signing up for an account is free and gives you access to Apple’s online documentation, tutorial videos, and the SDK download:
1. Go to http://developer.apple.com/iphone/.
2. Click the Register link, and then click Start Now. Choose the option to create a new Apple ID, or to log in using an Apple ID from an iTunes or App Store account.
3. Once you have registered, you can log in to the iPhone Dev Center.
4. Apple may already have emailed you a link to download the free SDK, or you may choose to download the SDK using the link from the website. Note that you should not download Xcode separately because it is included within the SDK download package (and the version of Xcode that comes with the SDK may be newer than what is otherwise available).
5. Once downloaded, install the SDK, which will make Xcode and Interface Builder accessible to you in the /Developer/Applications folder on your hard drive (you can also activate Spotlight and search for Xcode and Interface Builder to launch either application quickly).

The free developer account will allow you to build applications and run them in a simulator on your Mac. However, to load your application onto a phone, you will also need to sign up for the paid developer program. This requires a small annual fee, so even if you are a private developer, it won’t hurt your wallet too much:
1. Go to http://developer.apple.com/iphone/program/apply.html.
2. You will have two options: Standard Program and Enterprise Program. If you are writing games for the general public, you probably do not want the Enterprise Program. If you read closely, you will notice the Enterprise Program is actually for creating applications that only you and your company will use internally. If you plan to create games that will be sold via the App Store, rest assured that the Standard Program is the correct choice for you.
3. Select Enroll Now and log in if necessary.
4. You now have another choice: enroll as an individual or as a company. If you choose Individual, you will not be able to add other programmers or quality assurance members to your account, which is necessary to distribute your application to others during the development and testing process. However, if you select Company, you will be required to provide detailed information about your company.
5. Continue through the website, selecting the appropriate information, until you arrive at a screen that says “Thank you for submitting your enrollment.” Now you must wait for an email from Apple (which may take on the order of a month to arrive).
It is good to get your paid developer account enrollment going as soon as possible so that it will be available when you actually need it.

July 14, 2012

Posted by Sabar Santoso in , , | July 14, 2012 No comments


C is a high-level imperative programming language, which characteristically provides a very close correspondence between high-level language statements and machine-language instructions. It was initially developed in the 1970s, being primarily used for systems programming, most notably for the implementation of the Unix operating system. In the 1980s its popularity broadened massively, coming into use in some form on almost all computing platforms, and it remained popular throughout the 1990s.

Two versions of C have been standardized, in 1989 and 1999. It has also spawned a profusion of dialects and descendant languages, most notably C++. Because of C's enormous popularity, parts of its syntax have also been adopted for inter-human communication among programmers.

More detailed information follows, organized into sections thus:

  • History: origins of the language, and mainline development through standardization
  • Dialects: relationship to other languages in the C language family
  • Technical aspects: notable technical aspects of C
  • References: further sources of information

History

The initial developments towards C occurred on the nascent Unix operating system in 1969. When the need was felt for a system programming language, Unix co-inventor Ken Thompson designed and implemented the language B, derived from BCPL, which is the descendent of CPL, and ultimately of Algol 60. The name "B" was chosen as the first letter of "BCPL". Like BCPL, B is a typeless word-oriented language, and B inherits BCPL's block structure. However, B had to be stripped down to fit into the DEC PDP-7 on which Unix was being developed. Its syntax is therefore largely novel, and very terse.

In 1970, the Unix project moved to the DEC PDP-11, a byte-oriented machine. Although B was ported to the PDP-11, its architectural assumptions made it an inconvenient language to use. Starting in 1971, Unix co-inventor Dennis Ritchie extended the B language to support bytes as well as words. The later addition of structures, more conventional array semantics, and later generalizations of the type system, yielded the earliest incarnation of C. Ritchie deliberately left unanswered the question of whether the name "C" was chosen as the next letter of the alphabet after "B" or as the next letter of "BCPL".

The remainder of C's most formative development occurred in 1972-1973, and in 1973 Unix itself was finally rewritten in C. Further development, primarily in the type system, occurred up to 1980. During this period, an intermediate version of the language was described in the book "The C Programming Language". This version of the language became a de facto standard, named "K&R C" after the authors of the book, Brian Kernighan and Dennis Ritchie.

During the 1980s, C compilers spread widely, and C became an extremely popular language. The previously largely unaddressed issues of portability that this raised, and the deficiencies of the K&R standard (which was already out of date), led to an observed need for more formal standardization. An ANSI standardization effort, from 1983 to 1989, led to a formal standard, ANSI X3.159-1989, which was subsequently adopted by ISO as ISO/IEC 9899:1990.

The 1989 standard went slightly beyond codifying the language already in use, by continuing the language development a little, in particular making the type system more complete. The resulting "ANSI C" or "C89" dialect was progressively adopted during the early 1990s, so that by around 1995 K&R C was viewed as a historical artifact, rather than as a current language.

A second round of standardization, starting in 1995, developed the language further, principally by adding syntactic features for the convenience of programmers. This resulted in the "C99" standard, ISO/IEC 9899:1999, which to date (2001) has yet to make any significant impact.


Dialects

The mainline C dialects (K&R C, ANSI C and C99) are discussed in the history section. Although most C compilers have always made a handful of changes to the C language that they implement, few such dialects have gained significance in their own right. One of the few, and probably the most significant current non-standard C dialect, is GNU C, which is the C implemented by the GCC C compiler. Although, like other compiler-specific dialects, many of its features are tied to the internals of the compiler, it has anticipated or even originated some of the features of C99, such as variable length arrays and the long long type.

There is also a large group of languages derived from C. Because of C's familiarity and the ease of access to compilers, it has been used as the basis for many experimental and some non-experimental projects in adding specialized features to an existing general purpose language. A few such projects have grown to the status of being independent languages. There are also some true descendant languages, that do not maintain compatibility with C. In approximate chronological order, here are the most significant of both types of descendant:

  • C++ is an object-oriented programming language directly descended from C. Its initial development by Bjarne Stroustrup occurred in the early 1980s, and consisted of some simple additions to the C language to make the handling of basic class structures with member functions and polymorphism easier. Parts of C++'s cleaning up of C syntax influenced C's 1989 standardization, and the developments made in the C standard were in turn adopted into C++. C++ was itself standardized in 1998, and developments continue to pass in both directions between the two languages. The C and C++ standardization committees now actively cooperate to maintain as much compatibility as possible between the languages.
  • Objective C is an object-oriented descendant of C that uses a Smalltalk-derived message-passing paradigm. It was developed by Brad J. Cox starting in the early 1980s. Since then, Objective C has adopted changes made to mainstream C, and has had some independent developments in its object oriented features. There is also a variant, Objective C++, which incorporates C++'s features. Objective C remains a distinct branch of the C family tree, not quite independent of C, implemented in environments that also handle C.
  • Concurrent C, developed by Narain Gehani and William Roome starting in the mid-1980s, is an extension of C that builds multiprocessing into the language. Much like Objective C, its essence is a set of additions to the C language, rather than being a completely separate language, such that Concurrent C++ has been formed by merging Concurrent C with C++.
  • Alef is a distinct language from C, but in origin is a direct descendant. It is intended for much the same type of use as C; it is the system programming language for Plan 9, a derivative of Unix. Alef replaces C's type system, and adds some concurrency features.
  • Java is an object-oriented language descended from C; it has been described as having Objective C's semantics with C++'s syntax. It is not a traditional compiled language like the more closely related C variants, but rather is a fully safe language, with automatic memory management. It was developed by James Gosling starting in 1991, and after its public release in 1995 it rapidly became very popular for certain types of programming. Current development is still led by Sun Microsystems Inc., Gosling's employer.

Technical Aspects

C is a high-level imperative programming language, designed to be statically compiled into machine code for byte-oriented architectures. Many of its basic features are typical of languages in this class. For example, expressions and variables are strongly and statically typed; there is strictly lexical scoping with no function closures; dynamic storage allocation is entirely manual; and there are many details of the language semantics that vary with the target architecture, for efficiency.
There is also much about C that is atypical. The following paragraphs discuss C's unusual or original features.


C is, at its core, a fairly small language, due to its origin in very small computers. Because of its closeness to the machine, it is easily implemented, with C code naturally compiling into a very similar amount of machine code. There are no I/O primitives in the language itself; all interaction with the environment is relegated to a library of separately compiled functions. All of these aspects make it well suited to embedded computing, where it is indeed very popular.


Because so little is built into the language itself, those operators that are part of the language are reused for many purposes. The composition of complex data types from a handful of basic data types that are native to the target architecture is very transparent. The language gives a number of partial guarantees about the representation of certain data types, and the relationships between them, allowing the programmer to implement many operations by direct manipulation of bits in memory, essentially using the C language as a portable machine language. The language imposes few restrictions to impede the programmer in doing such things, and there is a history of lax enforcement by compilers of the official restrictions.


A particularly notable area in which C promotes direct manipulation of data structures is arrays. C guarantees that arrays are laid out contiguously, and so has remarkably flexible array handling, due to the flexibility of its pointer handling and direct memory manipulation. In fact, for historical reasons, even very basic array operations require the use of pointers; array indexing, for example, is made up of pointer arithmetic, with only a little syntactic sugar.


C has flow control primitives mostly typical of languages in its class, with the block structuring derived from BCPL. It includes the goto of imperative languages; it is not strictly necessary, due to the code structuring capabilities, but its use is not as controversial among C programmers as it is among, for example, programmers of Pascal-derived languages. Unusually for its class, though, C has no for loop in the conventional sense; it instead has some syntactic sugar for a while loop, leaving loop counter advancement for the programmer to specify.


Another unusual flow control feature of C is the relatively unstructured nature of its switch statement (its version of what is usually referred to as a case statement). Instead of selecting between alternative code sequences to execute, it selects between a set of labels to jump to; while in syntax it looks much like a conventional case statement, its semantics are more akin to the `computed goto' of FORTRAN. Full use of this facility is controversial, as particularly noted in the case of the infamous `Duff's device', which uses the freedom in label placement to interleave the structures of a switch statement and a while loop.


Another noted feature of C's syntax is its declarations, which avoid requiring additional keywords to describe pointers, arrays, and functions, by reusing the syntax for dereferencing pointers, indexing arrays, and calling functions. A C declaration consists of a base type and a `declarator', which gives the name of the object being declared and the means of deriving its type from the base type, in the approximate form of an expression involving the named object and having the type of the declared base type. This feature originated early in C's development, when multiply-derived types were added to the language, and is one of the features consistently copied in languages derived from C.

References

  • Brad J. Cox and Andrew J. Novobilski, "Object Oriented Programming: An Evolutionary Approach (second edition)", Addison-Wesley, 1991
  • N. H. Gehani and W. D. Roome, "The Concurrent C Programming Language", Silicon Press, 1989
  • B. W. Kernighan and D. M. Ritchie, "The C Programming Language", Prentice-Hall, 1978
  • B. W. Kernighan and D. M. Ritchie, "The C Programming Language (second edition)", Prentice-Hall, 1988
  • D. M. Ritchie, "The Development of the C Language", ACM, 1993
  • Bjarne Stroustrup, "The C++ Programming Language (second edition)", Addison-Wesley, 1991
  • Bjarne Stroustrup, "The Design and Evolution of C++", Addison-Wesley, 1995

July 09, 2012

Posted by Sabar Santoso in , , , | July 09, 2012 No comments

The Java Swing provides the multiple platform independent APIs interfaces for interacting between the users and GUIs components. All Java Swing classes imports form the import javax.swing.*; package. Java provides an interactive features for design the GUIs toolkit or components like: labels, buttons, text boxes, checkboxes, combo boxes, panels and sliders etc. All AWT flexible components can be handled by the Java Swing. The Java Swing supports the plugging between the look and feel features. The look and feel that means the dramatically changing in the component like JFrame, JWindow, JDialog etc. for viewing it into the several types of window.
Here the following APIs interfaces and classes are available:
The following interfaces and it's descriptions to be used by the Java swing.
Interfaces
Descriptions
ActionThis interface performed the action with the ActionListenerwhere the multiple controls are used for same purposes.
BoundedRangeModelThis interface defines the data model of components like: sliders and progressBars.
ButtonModelIt defines the state model for the buttons like: radio buttons, check boxes etc.
CellEditorThis interface used by the developer for creating the new editor and it has the new components implement interfaces. TheCellEditor implements the wrapper based approach.
ComboBoxEditorIn this interface, the editor component used to JComboBoxcomponents.
ComboBoxModelThis interface represents the data model in a list model with the selected items.
DesktopManagerThis interface has JDesktopPane object. The JInternalFrameimplements in the JDesktopPane with the help of DesktopManager.
IconThis interface used to graphical representation of the components. It has fixed size picture.
JComboBox.KeySelectionManagerThis interface has KeySelectionManager and used for the combo box data model.
ListCellRendererThis interface used for paint the cell in the list with the help of "rubber stamps" .
ListModelThis interface used for JList components method. It gets the value of each cell of list.
ListSelectionModelThis interface indicates the components, which are stable or not.
MenuElementThis interface used where the any components are implements in the menu.
MutableComboBoxModelThis interface extends from the ComboBoxModel. It is a mutable version of ComboBoxModel.
RendererIt defines the requirements of an object for displaying the values.
RootPaneContainerThis interface uses the RootPane properties and it has the components like: JFrame, JInternalFrame and JWindow etc.
ScrollableThis interface provides the scrolling to show the large amount of data with the help of JScrollPane.
ScrollPaneConstantsThis interface used for JScrollPane components.
SingleSelectionModelThis interface used to select the one index in a model.
SwingConstantsYou can set the components on the screen to own requirements.
UIDefaults.ActiveValueIt constructs the DefaultListCellRenderer.
UIDefaults.LazyValueThis enables one to store an entry in the default table. The entered value is not constructed until first time is a real value is created through it using LazyValue.createValue() method.
WindowConstantsThis interface has two methods setDefaultCloseOperation and getDefaultCloseOperation and provides the window close opration.
The following classes and it's descriptions to be used by the Java swing.
Classes
Descriptions
AbstractActionThis class handles the any types of action and provides JFC Action interface.
AbstractButtonThis class defines the nature of buttons and menu items.
AbstractCellEditorIt provides a list and contents of the data model.
AbstractListModelThis class defines the data model which provides the list with its contents.
ActionMapThis class works with InputMap and performs any action when the key is pressed.
BorderFactoryThis class extends from Object and creates the Border instance in the factory.
BoxIt provides the fixed spaces between two components and uses the BoxLayout object of the layout manager.
Box.FillerThis class participates in the Layout and uses the lightweight components.
BoxLayoutThis class uses the arranging the multiple components either horizontally or vertically. The Box container uses this class.
ButtonGroupThis class used to create the multiple buttons in aButtonGroup object.
CellRandererPaneThis class used to insert the components like: JList, JTable and JTree.
ComponentInputMapThis class has ComponentInputMap constructor and creates the components with the help of InpuMap.
DebugGraphicsIt extends from the Graphics and used to debug the graphics
DefaultBoundedRangeModelThis class provides the implementation of default BoundedRangeModel.
DefaultButtonModelThis class implements the generic ButtonModel.
DefaultCellEditorIt implements the TableCellEditor and TreeCellEditor for the table and tree cells.
DefaultComboBoxModelIt provides the default model for combo boxes.
DefaultDesktopManagerIt implements the DesktopManager. The DesktopManager has the JInternalFrame for creating the internal fame in a frame.
DefaultFocusManagerIt provides the implementing the FocusManager.
DefaultListCellRandererIt implements the default ListCellRanderer.
DefaultListCellRanderer.UIResourceThis extends the DefaultListCellRanderer and implementing in the UIResource.
DefaultListModelIt extends the AbstractListModel and implementing thejava.util.Vector.
DefaultListSelectionModelThis class used for select the list in a data model.
DefaultSingleSelectionModelThis class provides the default SingleSelectionModel.
FocusManagerIt handles all focus like: gainedFocus and lostFocus.
GrayFilterIt extends the RGBImageFilter and used for disabling the image through the button.
ImageIconThis class implements the Icon and paints the icons from the images.
InputMapThis class uses the ActionMap to performed the action when you press any key of keyboard. It bounds data between the input event and an object.
InputVerifierThis class helps you when you works with the text fields through the focus.
JAppletThis class extends the Applet and implements the Accessibleand RootPaneContainer.
JButtonThis class extends the AbstractButton and you can create the new button.
JCheckBoxThis class extends the JToggleButton and implements the check box in which buttons are selected or deselected.
JCheckBoxMenuItemIt extends the JMenuItem and determines the items which is selected or deselected.
JColorChooserIt extends the JComponent and implementing the Accessable. Here, you choose and manipulate the colors.
JComboBoxThis class extends the JComboBox. It provides the drop-down list where user select only one item or value at a time. But combo box is a combination of multiple text or buttons etc.
JComponentIn java swing, All components are used the JComponent except the top-level containers like: JFrame, JDialog etc.
JDesktopPaneThis class extends the JLayeredPane and when you create the object of JInternalFrame to be maintained in the JDesktopPane. The JDesktopPane has DesktopManager.
JDialogIt extends the Dialog. This class used to create the dialog window and when you want to create the custom dialog window with the help of JOptionPane method.
JEditorPaneThis class extends the JTextComponent. It edits the component by the EditorKit.
JFileChooserThis class provides the facility to choosing the file.
JFrameIt extends the Frame and supports the swing components architecture.
JInternalFrameThis class extends from the JComponent and provides the facility to dragging, closing, resizing and menu bar of the internal frame. The JInternalFrame added into the JDesktopPane.
JInternalFrame.JDesktopIconIt displays the desktop icon and create the instance of JInternalFrame and iconify.
JLabelThis class used to show the small text and image.
JLayeredPaneIt has JFC/Swing container that can be used to overlap the components to each other.
JListThis class used to create a list where you select the one or more than objects.
JMenuThis class used to create a new menu where you add the JMenuItems. When you select the item then shows the popup menu items in the JMenuBar.
JMenuBarIt used to create a new menu bar where the JMenu objects are added.
JMenuItemThis class used to create new menu items in the mebus.
JOptionPaneIt used to create some different types of dialog box like: message dialog box, error dialog box etc.
JPanelIt extends the JComponent and used to create a new panel.
JPassworkFieldIt provides the single line text editing. Here, don't available the original characters but view type indication characters are available.
JPopupMenuThis class used to create a popup menu. It provides small window where the various types of choices are available.
JPopupMenu.SeparatorHere the popup menu and the separator are available.
JProgressBarIt shows the integer types values in percent within a bounded range to determine the working process.
JRadioButtonIt implements the radio button and shows the state of an item selected or deselected.
JRadioButtonMenuItemIt extends the JMenuItem and implements the radio button menu item
JRootPaneThis class provides the component behind the scenes by JFrame, JWindow, JDialog etc. for providing the task-orientation and functionality.
JScrollBarThis class used to create a scroll bar. It provides the view content area where you show the content to scroll this.
JScrollPaneIt provides the scrollable view components.
JSeparatorThis class use the separator among the components.
JSliderThis class provides a control to represent a numeric value by dragging the slider.
JSplitPaneThis class used to divides the two components graphically like: top and button, left and right.
JTabbedPaneThis class provides the tab component through which you can switch from one component to another component regarding to the specific tab button by clicking on that.
JTableIt provides the user interface component and represents the two dimensional data.
JTextAreaIt provides the multi line plain text area.
JTextFieldIt provides the facility to editing the text in a single line.
JTextPaneThis class provides the component like JTexArea for multiple lines text with more capabalities.
JToggleButtonIt implements two state button that means selected or deselected.
JToggleButton.ToggleButtonModelIt extends the DefaultButtonModel and provides theToggleButton model.
JToolBarIt provides set of command buttons icons that performs the different actions or controls.
JToolBar.SeparatorIt provides the tool bar separator.
JToolTipIt shows the tool tips related to it's components.
JTreeIt shows the data in a hierarchical way.
JTree.DynamicUtilTreeNodeThis extends the DefaultMutableTreeNode and create children nodes.
JTree.EmptySelectionModelIt does not allows the any selection.
JViewPortIt gives you about the underlying information.
JWindowIt extends window and shows the any location or area on the desktop. It couldn't any title bar and window management buttons.
KeyStrokeThis class controls the key events on the keyboard for the equivalent device.
LayoutFocusTraversalPolicyThis class conducts the sorting objects according to their size, type, position or orientation.
LookAndFeelIt provides the dramatically changes in the component like frame related to the graphics for the application. Through this the application can be done very efficient and easier.
MenuSelectionManagerIt has menu selection hierarchy.
OverlayLayoutThe layout manager arrange the components.
ProgressMonitorThis class is used to monitoring the progress of any operation to be done.
ProgressMonitorInputStreamThis class creates a progress monitor to monitor the progress of reading input from the input stream. It cleanups all the rights when the stream is closed.
RepaintManagerThis class manage and override the repaint requests.
ScrollPaneLayoutIt implements the LayoutManager and manage the components like: scroll bar, row header, column header etc.
ScrollPaneLayout.UIResourceIt extends the ScrollPaneLayout and implements theUIResource.
SizeRequirementsIt calculates the size and positions of components.
SizeSequenceIt represents the order list of size and it's positions.
SwingUtilitiesThis class has utilities methods for swing.
TimerActions perform the predefined rate.
ToolTipManagerIt manages the all tool tips.
UIDefaultsIt extends the Hashtable and you set/get the value with the help of UIManager.
UIDefaults.LazyInputMapThis class creates a Input Map through it's createValue() method. The array of key after binding is passed to the constructor of this. Example of binding of key is array of pressing key information (e.g. ctrl + c or alt + f).
UIDefaults.ProxyLazyValueThis class is used to create a lazy value which is used to delay loading of the class to create instance for that.
UIManagerThis class has track of the current look and feel details.
UIManager.LookAndFeelInfoThis is the nested class of UIManager class i.e. used for getting information about all the look and feels installed with the software development kit.
ViewportLayoutIt implements the LayoutManager and defines the policy for the layout.


July 08, 2012

Posted by Sabar Santoso in , | July 08, 2012 No comments
Forms are a very common method of interactions in web sites. JSP makes forms processing specially easy.
The standard way of handling forms in JSP is to define a "bean". This is not a full Java bean. You just need to define a class that has a field corresponding to each field in the form. The class fields must have "setters" that match the names of the form fields. For instance, let us modify our GetName.html to also collect email address and age.
The new version of GetName.html is
  
What's your name?
What's your e-mail address?
What's your age?
To collect this data, we define a Java class with fields "username", "email" and "age" and we provide setter methods "setUsername", "setEmail" and "setAge", as shown. A "setter" method is just a method that starts with "set" followed by the name of the field. The first character of the field name is upper-cased. So if the field is "email", its "setter" method will be "setEmail". Getter methods are defined similarly, with "get" instead of "set". Note that the setters (and getters) must be public.
 package user;  public class UserData {
 String username;     
 String email;     
 int age;      
     public void setUsername( String value )     
     {         username = value;     }      
     public void setEmail( String value )     
     {         email = value;     }      
     public void setAge( int value )     
     {         age = value;     }      
     public String getUsername() 
     { return username; }      
     public String getEmail() 
     { return email; }      
     public int getAge() 
     { return age; }
}
The method names must be exactly as shown. Once you have defined the class, compile it and make sure it is available in the web-server's classpath. The server may also define special folders where you can place bean classes, e.g. with Blazix you can place them in the "classes" folder. If you have to change the classpath, the web-server would need to be stopped and restarted if it is already running.
Note that we are using the package name user, therefore the file UserData.class must be placed in a folder named user under the classpath entry.
Now let us change "SaveName.jsp" to use a bean to collect the data.
All we need to do now is to add the jsp:useBean tag and the jsp:setProperty tag!  The useBean tag will look for an instance of the "user.UserData" in the session.  If the instance is already there, it will update the old instance.  Otherwise, it will create a new instance of user.UserData (the instance of the user.UserData is called a bean), and put it in the session.
The setProperty tag will automatically collect the input data, match names against the bean method names, and place the data in the bean!
Let us modify NextPage.jsp to retrieve the data from bean..
    You entered
Name: <%= user.getUsername() %>
Email: <%= user.getEmail() %>
Age: <%= user.getAge() %>
 
Notice that the same useBean tag is repeated. The bean is available as the variable named "user" of class "user.UserData". The data entered by the user is all collected in the bean.
We do not actually need the "SaveName.jsp", the target of GetName.html could have been NextPage.jsp, and the data would still be available the same way as long as we added a jsp:setProperty tag. But in the next tutorial, we will actually use SaveName.jsp as an error handler that automatically forwards the request to NextPage.jsp, or asks the user to correct the erroneous data.
Exercise:
1) Write a JSP/HTML set that allows a user to enter the name of a system property, and then displays the value returned by System.getProperty for that property name (handle errors appripriately.)
2) Go back to the exercises where you manually modified boolean variables. Instead of a boolean variable, make these come from a HIDDEN form field that can be set to true or false.

July 07, 2012

Posted by Sabar Santoso in , , | July 07, 2012 No comments
What Is RSS?
RSS is a format used by content providers to publish content. Originally, RSS stood for Rich Site Summary, but with the release of the RSS 2.0 spec in 2002, the name was changed to Really Simple Syndication.
RSS simplifies publishing by providing a standardized, no-frills approach to releasing content. No formatting is included with an RSS entry; only the content is sent. This allows for RSS aggregators,commonly referred to as feed readers, to accept and display RSS feeds from any number of sites in a uniform, easy-to-read manner.
The RSS format is built in XML, which learn more about in the next section. For a history of RSS, visit this article: http://en.wikipedia.org/wiki/RSS.


What Is XML?
XML stands for Extensible Markup Language. In the context of programming, extensible means that the developer can define the markup elements. This might sound odd, but it’s actually incredibly useful.
XML is, on a basic level, extremely simple. In a parallel with HTML, XML information is enclosed in tags; however, you can name the tags anything you want, and these tags are basically labels for the enclosed information.
For example, assume you want to send personal information about someone via XML. The markup might read as follows:

Jason
24
male

The benefit of XML is that it’s easy to read. Take another look at the information in the preceding example—you don’t need to be an XML expert to understand what the markup means. In the next section, you’ll learn how RSS uses XML to syndicate content.

Creating an RSS Feed
RSS feeds follow a general format that allows for large-scale, easy compatibility with any feed reader in use right now. The basic format for an RSS consists of a channel that includes a title, description, link, and language setting. Within the channel, you declare each entry as an item. Each item contains a title, description, link, the date it was published, and a unique identifier.

To create your feed, you need to create a new folder and file in the simple_blog project. Next, add a new folder called feeds, and then create a new file called rss.php and in that folder (the full path: http://localhost/simple_blog/feeds/rss.php).

Before you can run your file, you need to modify .htaccess. This is as simple as adding an additional file extension to the first RewriteRule that prevents any rewrite from occurring if a file ending in .php is accessed. To accomplish this, add the following line in bold to your .htaccess file:

RewriteEngine on
RewriteBase /simple_blog/

RewriteRule \.(gif|jpg|png|css|ico|swf|js|inc\.php|php)$ - [L]
RewriteRule ^admin/?$ admin.php [NC,L]
RewriteRule ^admin/(\w+)/?$ admin.php?page=$1 [NC,L]
RewriteRule ^admin/(\w+)/([\w-]+) admin.php?page=$1&url=$2 [NC,L]
RewriteRule ^(\w+)/?$ index.php?page=$1
RewriteRule ^(\w+)/([\w-]+) index.php?page=$1&url=$2


Describing Your Feed
Now that your file is created and being handled properly, you can start to mark up your feed.
Begin by adding a Content-Type header to the document (using the aptly named header() function). This header tells the browser to serve the file as XML.

Next, you need to output an XML declaration. However, this causes issues because XML declarations conflict with PHP short tags. You can get around this by using the echo command to output the declaration in double quotes, which eliminates the conflict.

Now you need to state what you are doing, which you accomplish by adding an tag with a version attribute. This tells any feed reader what it’s receiving and ensures the information received is handled properly.

Next, you add the channel declaration and your feed’s basic information. As mentioned previously, the basic information consists of the title, description, link, and language of your feed. Add the following code to rss.php to create your feed:

// Add a content type header to ensure proper execution header('Content-Type: application/rss+xml');
// Output the XML declaration echo "\n";
?>
My Simple Blog
http://localhost/simple_blog/
This blog is awesome.
en-us

At this point, you can load your RSS feed in a browser to see what it looks like without any items; you can load the information at http://localhost/simple_blog/feeds/rss.php


Note : You don’t want to do anything further with the feed as it appears in your browser. The blog is not available publicly, so subscribing to the feed won’t work in a feed reader at this time.

Search

Bookmark Us

Delicious Digg Facebook Favorites More Stumbleupon Twitter