Friday, March 12, 2010

Garbage First prsentation - G1

My last year presentation on G1 aka Garbage First in Sun tech days.

http://developers.sun.com/events/techdays/presentations/locations-2009/hyderabad/td_hyd_garbagcollector_aroskar_choudhary.pdf

This time also we are talking on G1. Join us at tech days at Hyderabad.

If you are interested in knowing more about Garbage First or any Garbage collector algorithms, please let me know here.

JDK6u12 - Mixing heavy and lightweight component

So, if you are a Swing Developer, you have heard many stories where someone messed up Lightweight component with Heavyweight component. In one line " A heavyweight component
is one that is associated with its own native screen resource (commonly
known as a peer). A lightweight component is one that "borrows" the
screen resource of an ancestor (which means it has no native resource
of its own -- so it's "lighter")." AWT is all heavyweight, Swing is all lightweight except top level ones like JFrame, JWindow...


Now many times you have heard "Don't mix lightweight and heavyweight". What will happen ? Alright, here is a small code :


 

import javax.swing.*;
import java.awt.*;

public class Test extends JPanel {

public Test() {
JComboBox jc = new JComboBox();
JButton btn1 = new JButton("Button1");
Button btn2 = new Button("Button2");
Button btn3 = new Button("Button3");
jc.addItem("France");
jc.addItem("Germany");
jc.addItem("Italy");
jc.addItem("Japan");

add(jc);
add(btn1);
add(btn2);
add(btn3);
}

public static void main(String[] args) {
JFrame frame = new JFrame();
frame.getContentPane().add(new Test());
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(200, 200);
frame.setVisible(true);
}
}



Here what you see the output:




Now, this is what it happen what you mix lightweight and heavyweight. No way, you can bring the drop down items on top of Button2 !!


All Past :) , JDK6 update 12 and JDK7 build 19, the output will be like this:



New JDK release fixed all these problem of mixing lightweight component and heavyweight component. So, don't worry, keep messing :).

For more detail, please see this : http://java.sun.com/developer/technicalArticles/GUI/mixing_components/index.html


For more: Please join us at Tech Days at Hyderabad on 24-25th of March.

LiveConnect Docs for JDK6

JDK6 has done lot of changes in LiveConnect. LiveConnect is a feature in the browser for communication between Java Applet and JavaScript. With the new Plugin2, most of the work has been left on browser to do. Initially it was Java which do a good amount of work. So, now the Java Plug-in will operate like any other scriptable Plug-in.

This is one of the great document written : http://java.sun.com/javase/6/webnotes/6u10/plugin2/liveconnect/

If you want to see some code help, visit: http://java2s.com/Code/Java/JDK-6/Script-Engines.htm

Have Fun !!