Posts Tagged ‘which java’

How to Create Translucent and Shaped Windows in java.

September 4, 2011

Hi all,

I am back after a long time. This time I want to tell you all how I set a window as translucent in java. It was a very cumbersome thing to do before recently. From JDK 6 update 10, java has this facility to set the window as translucent  and its very easy.

Recently I did this in one of my projects and wanted to share it with you all.

As of the Java Platform, Standard Edition 6 (Java SE 6) Update 10 release, we can add translucent and shaped windows to our Swing applications.

The translucent and shaped window API was first added to the Java SE 6 Update 10 release as a private API. This functionality was moved to the public AWT package in the JDK 7 release.

Here is an example :

import java.awt.*;
import javax.swing.*;
import static java.awt.GraphicsDevice.WindowTranslucency.*;

public class MyWindow extends JFrame {
    public MyWindow() {
        setLayout(new GridBagLayout());


        add(new JButton("Just a Button"));

    public static void main(String[] args) {
        // Determine if the GraphicsDevice supports translucency.
        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
 GraphicsDevice gd = ge.getDefaultScreenDevice();

        //If translucent windows aren't supported, exit.
        if (!gd.isWindowTranslucencySupported(TRANSLUCENT)) { 
 System.err.println( "Translucency is not supported"); 

        SwingUtilities.invokeLater(new Runnable() {

            public void run() {
                MyWindow tw = new MyWindow();

		// Set the window to 55% opaque (45% translucent).

		// Display the window.

To learn more please check this link.


Here is how you can select which methods to use according to your JDK version.


Manohar Bhattarai (मनोहर भट्टराई)
Twitter :- :-


Java SE 7 is officially here.

July 28, 2011

Hi all,

Java SE 7 is officially released today i.e. July 28, 2011(07.28.2011)! After nearly five years of collaboration within the worldwide Java community, Java Platform, Standard Edition is ready for download! It’s an important step in Java’s evolution.

The major features of Java SE 7 are:
•    Project Coin- many small language changes that add up to a big boost in productivity for developers
•    The Fork/Join Framework –  facilitates parallelism for mulit-core processors
•    The New File System API (NIO.2) – provides the ability to perform many basic file system operations natively
•    InvokeDynamic – makes it easier to run other languages on the JVM

To learn more about these features, you can view the technical presentations from Oracle’s global event on July 7.

Download Java Platform, Standard Edition (Java SE) 7 

Here is my previous blog :

Manohar Bhattarai (मनोहर भट्टराई)
Twitter :- :-

Install java manually in UBUNTU Linux

March 23, 2010

Hi everyone,

I have moved this post to my new blog site. Click here to get to the post.

Thank you.

Manohar Bhattarai (मनोहर भट्टराई)

%d bloggers like this: