Posts

Showing posts from June 25, 2010

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

Recent Post

Recent Posts Widget