Archive for category JAVA SE

JavaFX Live View

I was playing with some of the screenshot stuffs in the JavaFX 2.2 and came up with idea of showing the image of the Operating system’s window stuffs in JavaFX ImageView and that was really easy to make via Java Robot API and JavaFX’s SwingFXUtils class. Thanks to the JavaFX teams 🙂

Ok here we go now . First we’ll look over how the algorithm goes for this task.

Flow of Screen capture in JavaFX

 

As you can see in above picture The portion of the Monitor is being screen captured by the Java Robot API . This give the BufferedImage Object of Java and then we convert them in to JavaFX Image using SwingFXUtils class. Now finally it’s  all in our hand to show that Image in appropriate way.
Read the rest of this entry »

Tags: , , , , , , ,

Making Simple JTable

The JTable is almost great component of Java Swing which is used to display records of any data.
Specially JTable are used for displaying records which are retrived from the database like MySQL, ORACLE ,Excel and other…

Simply JTable has it’s default model for displaying the records in format.
In this blog we would just demonstrate a simple JTable where all the data records are being assigned by developers.

Ok, here is a detail codes of Making simple JTable:

Read the rest of this entry »

Tags: , , , , ,

JFrame

This JFrame is a class which is located at the java package javax.swing

JFrame helps to form applet , this class is one type of Container where different Components can be

added by getContentPane() and add() method of this class.

JFrame

The JFrame is one of the static or predefined Frame where there is limitation of extending the Frame feature

All the classes of

javax.swing.*;

package are predefined applet components. It’s design is also static on all

operating system. There is platform independent design of JButton,JLabel,JTextField bar and all things. Here we use JFrame for the

independent of the application.

Where as in the context of

 java.awt.*;

The components like Button,Label all are platform indendent as well.

Tags: , , ,

GUI (Graphical User Interface)

An applet is the software components or a small application which can run the program via JAVA programming Language.

Applets are on either desktop or on the web pages too.
The applets are mostly used for the GUI end user clients. The Applets are in GUI form.

Basically GUI is being used by the help of the JFrame which is located at the javax.swing

JFrame is the first platform for the deployment of the GUI applications. The Container classes are used to add the components at JFrame.

Some essential classes for the developing GUI app are:

  • JFrame
  • JPanel
  • JLabel
  • JButton
  • JTextField
  • and other classes ..

First of all if we are going to develop a small GUI program which can display the only the text;

[source language=’java’]
//import directives
import javax.swing.*;

public class Text1 extends JFrame{

public Text1() {
//FOR LABEL
JLabel label = new JLabel(“Hello JAVA !!!”);

//ADDING CONTAINERS TO COMPONENTS
this.getContentPane().add(label);
this.setSize(200,200);
this.setVisible(true);

}

public static void main (String[] args) {
// invoking constructor
new Text1();
}

}
[/source]

Read the rest of this entry »

Tags: , , , ,

Trick of Positioning the Containers of JFrame

Many developers want their own Layout Manager with user-defined so JAVA has provided a separate method for the every container of JFrame Component and that method is setBounds(). This method helps the developers to position the container as per their need .

About SetBounds() method:

This method consists four parameter

  Syntax:
     xxx.setBounds(int x_axis, int y_axis, int width, int height);

We can arrange the containers with the help of this method easily. Read the rest of this entry »

Tags: , , , , , , , , , ,