Let me explain about static and instance blocks. You might already have heard of static blocks and also have used it. But what are instan...
Read More
Home » Archive for October 2013
Different Way To Declare Method Return Type
Here is a different way that I have encountered from the stackoverflow answer (thanks to Chandra Patni). I am happy to share it here. Th...
Read More
How To Break Outer Loop From Inner Loop In Java?
Have you ever got a situation to break outer loop when in a inner loop? I got this many times. But what could I do, the simple break stat...
Read More
How To Set Custom Image Cursor In Java?
Since time, it was my tiny dream to set my own custom image cursor for a swing component and now I am able to do that in a single line! W...
Read More
Understanding Switch Statement In Java
Switch is a conditional statement that checks if a given value matches any of the given values. The value which is to be matched is passe...
Read More
Find Maximum And Minimum Of Numbers
For days I had been stumped to find maximum and minimum of 3 numbers which is nothing more than a simple logic. I felt laughed at myself....
Read More
2 Ways To Concat A String In Java
Concatenating a string in Java is the most easiest thing that you'll learn. You might already be familiar with one way using the simp...
Read More
Using Startswith() And Endswith() In String
Here is a dead simple tutorial on startsWith() and endsWith() . The startsWith() method is used to check if a string starts with a give...
Read More
Using Cyclicbarrier In Java With Example
Here are general life and real time examples on Cyclic barrier. These examples help you understand Cyclic barrier in the easy way. Somet...
Read More
2 Ways To Match A Number In Regex
Here are 2 simple ways, how you can match any number or a number with given no.of digits in Java using the regular expression. This is de...
Read More
How To Convert An Array To List?
Here is how you can convert an array to a list using the simple Arrays.asList() method. This is a simple generic method that takes in an...
Read More
How To Use Static Import In Java
static import is one of the fantastic feature of the Java programming language. It enables you to import the static members of a class, ...
Read More
How To Use Assert Statement In Java?
assert is a simple keyword in Java that allows you to specify a condition, which when failed throw an AssertionException . Assertion sta...
Read More
How To Resize An Image In Java?
Here is a simple method to re-size an image in Java. Here, you can also save the resized image in a file. The Image class contains the ge...
Read More
3 Ways To Set Icon Image For Jframe
Here are 3 ways to set an icon image in JFrame . Doing this is dead simple, and each way doesn't take more than one statement. An ico...
Read More
How To Set Default System Icons In Jfilechooser?
Here is how to set default system icon for files and directories in JFileChooser using the simple FileView . It's nothing more than...
Read More
How To Add Changelistener To Jtogglebutton?
Here is how to add ChangeListener to JToggleButton . In this example, we are going to make the JPanel semi transparent when the JToggleB...
Read More
How To Set Look And Feel Via Command Line?
Image Credit: lookandfeelcast.com Here is how you can set the look and feel of a GUI application via the command prompt. The command li...
Read More
How To Use Filefilter In Jfilechooser?
The javax.swing.filechooser.FileFilter class is used to set custom file type option in JFileChooser . You might already have noticed th...
Read More
Subscribe to:
Posts (Atom)