Skip to main content

Posts

Showing posts from March, 2014

LeapYear

The simple program which check a year either leap year or normal year. public class LeapYear { public static void main ( String [] args ) { int year = Integer . parseInt ( args [ 0 ]); boolean isLeapYear ; // divisible by 4 isLeapYear = ( year % 4 == 0 ); // divisible by 4 and not 100 isLeapYear = isLeapYear && ( year % 100 != 0 ); // divisible by 4 and not 100 unless divisible by 400 isLeapYear = isLeapYear || ( year % 400 == 0 ); System . out . println ( isLeapYear ); } }

MIG LAYOUT TUTORIAL

In this entry I would like to introduce some basic usage of mig layout. This is image I take in eclipse, we can use window builder plug-in for drag-draw UI. Code Detail Description Contructor of MigLayout: new  MigLayout( "insets 50 50 0 50" ,  "[74.00]20[165.00][grow]" ,  "[][][]" ) -      "insets 50 50 0 50" -      Decribe margin. insets  top left bottom right -      "[74.00]20[165.00][grow]" -      Number of columns +  [74.00]: size of column 1 is 74px. + [74.00]20[165.00]: gap between 1 st  colum and 2 nd  is 20px. [grow]: 3 rd  column is grow -      "[][][]" -      Number of rows. JLabel lblNewLabel =  new  JLabel( "Label 1" );          ...