Posts

How to draw Arrow Line in Applet Java code example

public static void drawArrowLine(Graphics g, int i, int j, int k, int l, int i1)     {         double d = Math.sqrt((k - i) * (k - i) + (l - j) * (l - j));         double d1 = (double)(-(k - i)) / (double)(l - j);         double d2 = 6D / Math.sqrt(1.0D + d1 * d1);         double d3 = 6D / Math.sqrt(1.0D + 1.0D / d1 / d1);         if(d1 < 0.0D)             d3 = -d3;         double d4 = (double)k - (double)(10 * (k - i)) / d;         double d5 = (double)l - (double)(10 * (l - j)) / d;         drawLine(g, i, j, (int)d4, (int)d5, i1);         int ai[] = {        ...

How to use Color Dialog box in java applet

public class ColorDialog extends Dialog {     public ColorDialog(Frame p)     {         super(p, "Color Dialog", true);         OK_button = new Button("OK");         Cancel_button = new Button("Cancel");         OK_Cancel = new Panel();         init();         show();     }     public ColorDialog(Frame p, Color c)     {         super(p, "Color Dialog", true);         OK_button = new Button("OK");         Cancel_button = new Button("Cancel");         OK_Cancel = new Panel();         init();         color_panel.setCurColor(c);         show();     }  ...

How to implements Comparator interface in java code examples

import java.util.Comparator; public class TagComparator implements Comparator{         public int compare(Object arg0, Object arg1) {         // TODO Auto-generated method stub         int r = 0;                 if (arg0.toString().length() > arg1.toString().length())             r = 1;         else             r=0;                 return r;     } }

How to remove html tag from string?

public String removeHTMLTag(String html) {         String finalString = "";         try {             finalString = html.replaceAll("\\<.*?>", "");                        finalString = finalString.replaceAll("\\&.*?;", "");             finalString = finalString.replace("\r\n", " ");             finalString = finalString.replace("\n", " ");             finalString = finalString.replace("\t", " ");             finalString = finalString.replaceAll("\\<.*?>", "");             finalString = finalString.replaceAll("\\s+", " ");      ...

How to Running a Java Program - Programming Tutorial

Java Programming Tutorial - 2 - Running a Java Program

What are Literals in java example

In java, literals are used for storing the constant value. Example :- “Literals” denoted String Literals, ‘P’ denoted Character Literals,  93.8 denotes floating points value Literals, 786 denotes an Integer Literals

What is primitive data type in java

Java had eight (8) primitive data type. 1) byte                  Width : 8 Range : -128 to 127 2) short                 Width : 16 Range : -32768 to 32767 3)int                       Width : 32 Range : -2147483648 to 2147483647 4) long                   Width : 64 Range : -9223372036854775808 to 9223372036854775807 Above four primitive data type belongs to Integers. 5) float                  Width : 32 Range 1.4e-045 to 3.4e+308 6) double             Width : 64 Range 4.9e-...

Recent Post

Recent Posts Widget