Tag Archives: java

Using Scanner to determine EOL in Java

The java.util.Scanner is widely used for scanning inputs from the System.in object. We can easily detect an EOL with the hasNext() method of this object. When we type in the EOL, the method return false. Here is an example: public … Continue reading

Posted in Blog Post | Tagged | Leave a comment

Java GUI Demo – 001

Here’s a Java GUI program I wrote a while ago… It uses the Graphics, JPanel and JFrame classes to build a windowed application that draws a cross on the canvas using the drawLine() method of the java.awt.Graphics object. import java.awt.Graphics; … Continue reading

Posted in Blog Post | Tagged | 1 Comment

JOptionPane – Swing with Java

I just love the Swing library of Java for desktop GUI development. Here’s a very simple example of JOptionPane that prompts for the user’s name and then displays it inside another dialog box. import javax.swing.JOptionPane;   public class masnun { … Continue reading

Posted in Blog Post | Tagged | 2 Comments