Friday, 25 July 2014


A small prototype for a switch-lights problem (four or more consecutive lights will be turned off) By Henry Chen https://henry416.wordpress.com



Wednesday, 23 July 2014

Exception : Numbers of source Raster bands and source color space components do not match when read image

JavaFX: Zoom all Pane Content/Children on Stage resize

Wednesday, 16 July 2014

JavaFx Group

@DefaultProperty(value="children")
public class Group
extends Parent
  • A Group node contains an ObservableList of children that are rendered in order whenever this node is rendered. A Group will take on the collective bounds of its children and is not directly resizable.
  • Any transform, effect, or state applied to a Group will be applied to all children of that group. Such transforms and effects will NOT be included in this Group's layout bounds, however if transforms and effects are set directly on children of this Group, those will be included in this Group's layout bounds.
  • By default, a Group will "auto-size" its managed resizable children to their preferred sizes during the layout pass to ensure that Regions and Controls are sized properly as their state changes. If an application needs to disable this auto-sizing behavior, then it should set autoSizeChildren to false and understand that if the preferred size of the children change, they will not automatically resize (so buyer beware!).
  • Group Example:
    import javafx.scene.*;
    import javafx.scene.paint.*;
    import javafx.scene.shape.*;
    import java.lang.Math;

    Group g = new Group();
    for (int i = 0; i < 5; i++) {
       Rectangle r = new Rectangle();
        r.setY(i * 20);
        r.setWidth(100);
        r.setHeight(10);
        r.setFill(Color.RED);
        g.getChildren().add(r);
    }

Wednesday, 9 July 2014

How to get IP address in Java using InetAddress

An Internet Protocol address (IP address) is a numerical label assigned to each device (e.g., computer, printer) participating in a computer network that uses the Internet Protocol for communication. The designers of the Internet Protocol defined an IPv4 address as a 32-bit number.
In this tutorial we are going to see how can you get the IP Address that is assigned to your own machine inside your local network and the IP Addresses assigned to specific Domain Names(e.g. www.google.com…).
To do that we are going to use InetAddress.To be more specific we are going to use:
  • getLocalHost().getHostAddress() method of InetAddress to get the IP Address of our machine in our local network
  • getByName() method of InetAddress to get the IP Address of a specific Domain Name
  • getAllByName() method of InetAddress to get all the IP Address of a specific Domain Name.