Oct 9, 2012

Simple JMF Media Player

JMF Media PlayerThis is simple Java Media Player using JMF library. It opens a MPEG file file from directory and plays it. JMF comes with visual component and media controls that can be embedded into into the AWT or Swing components. we need to implement the ControllerListener interface for handling asynchronous events generated by the media Controllers. The controllerUpdate(ControllerEvent event) method is called when an event is generated by a Controller that the listener to it registered.

Oct 5, 2012

Data Encryption in Java Part 2

DES Cryptography
This is another Data Encryption example in Java, but it featured DES encryption algorithm which is academically popular and has been in use for quite some time. DES uses 56-bits key size and also uses a key to customize the transformation, so that decryption can only be performed by those who know the particular key used for the encryption. Every 8th bit of the selected key is discarded, that is, positions 8, 16, 24, 32, 40, 48, 56, 64 are removed from the 64 bit key leaving behind only the 56 bit key.

Oct 3, 2012

How to Create System Tray Icon in Java

System Tray Icon
In this tutorial, I will show you how to create a System Tray Icon in Java. Operating Systems normally provides a  place(program) for icons display, either for the programs that runs in background, such as services, or programs that continue to run while the window is closed. For example, if your computer supports advanced power management (APM), a Battery Meter icon may be displayed on the taskbar. In Windows its called a Status Area, others called it System Tray. 

Sep 29, 2012

Data Encryption in Java Part 1

Blowfish Cipher Cryptography
In this example, I will show you how to encrypt data in Java using Blowfish Cipher algorithm. Blowfish is a keyed, symmetric block cipher, with 64-bit block sized encryption algorithm, with a variable key length from 32 bits up to 448 bits. Blowfish provides a good encryption rate in software. It is meant to be an alternative to DES(Data Encryption Standard) which is the predominantly used algorithm for the data encryption developed at IBM in the early 1970s.

Sep 27, 2012

How to Create your own Splash Screen in Java

Splash Screen
In this program, I will show you how to create your own Non-SDK Splash Screen. If you found the Java Splash Screen APIs hard to implement, this is a good choice for you.
Splash Screen is the short lived window that pops out in the middle of the computer or mobile device before the main program is fully loaded and lunched to the user. It mostly contains the progress of the loading components built in the program or just a logo of the software.

Sep 24, 2012

Auto-Scrolling Texts with Image Background in Java

ImageIO
This is an example of how to program an animated texts, that automatically scrolls up slowly with an image as its background. In this Java program I used threading, the IO and math APIs to bring everything together. First, the texts are loaded into the stream, pull every line of it and then draw it on to the screen. A top and bottom offset is used to nicely cut the starting as well as the ending points of the texts, as they scrolls in a given time interval.

Sep 15, 2012

How To Load And Display Image From File In Java

Java IO
In this Java tutorial, we set to graphically display image from a directory. We first set a file reference to our image directory, in this case we gonna use BufferedImage object to get the decoded buffered image, automatically invoking ImageReader. You can see no ImageInputStream is physically used, this is because the file is wraped in an image input stream as soon as it register the file to the ImageReader object. Null is returned if the registration failed.

Sep 13, 2012

How To Make a Copy of File in Java

In this simple example, a file is loaded into a stream, copy it into a temporary storage called "temp", from which it was emptied bit by bit to a new directory.

Sep 4, 2012

Smart Calculator

Java Math
Calculator is one of the applications that every programmer want to create, it is fun to see how a simple code can make such an awesome arithmetic operations. People write calculator code in different ways, depending on the kind of language you are familiar with, and how easy or otherwise that language can avail you that, as well as how complex the operation would be. Java has a great library for UX and maths, which is great for developing calculator or other educational business/ applications.

Sep 2, 2012

Camera Application Using JMF

Java camera JMF
This a simple Java program that opens the system Webcam and presents the visual data of the camera. It used Java Media Framework library, though has not been updated for a very long, but developers still found it very useful for capture, playback, stream, and transcoding multiple media formats. You need to integrate the JMF plugin into your project in order to use the JMF APIs. You can download the JMF library here at Softpedia. 

May 18, 2012

Accessing Private Member From Other Class In Java

Core Java
Many people wonder if a private field can be accessed from other completely strange class. The words that first come out from the mouth many, if asked whether access to such private members is possible, is: 'impossible!' or say the least: 'you can't do that!'. We are not talking about using accessors here, the usual getter/setter methods are completely excluded. The truth about that is, gaining access to private members from an alien class is not only possible, but real.

May 15, 2012

How To Shutdown PC With Java Code

Java Runtime
In this tutorial I create a program that shuts the computer down after 10 seconds, which gives you chance to abort the shutdown sequence. I used Java Runtime to execute the command line switch, and the second parameter for aborting the first command sequence. Java Runtime is key to making that possible. You can also pass other commands as parameter to start other Windows programs.

Jul 26, 2011

Dealing With Files In PHP

In php and of course othe languages files are the directories or paths to a given data. file() —> Reads entire file into an array. for example:
array file(string $filename[,int $flags = 0 [,resource $context ]] );
$domain = file('http://www.example.com/');
You can iterate through a given directory read and store an array of data into a variable.

Jun 6, 2011

A Simple Time-Left PHP Code

PHP time left
function time_left($integer)
{ 

/*Returns a string of the amount of time the integer in seconds.

 $timeleft=time_left(86400); 

 $timeleft='1 day';

Will not return anything higher than weeks. False if $integer=0 or fails.