Posts

Showing posts from June 23, 2010

How to get file name in java code, example

 public static String getFileName(String filePath)     {         File f = new File(filePath);         return f.getName();     }

How to get file exist or not in java code example

This method is used to check that file is exist or not on your given path.  public static boolean getFileExist(String filePath)     {         File f = new File(filePath);         return f.exists();     }

How to get file size in java code, example?

 How to get file size in java code, example Now we are writing a very simple code for find the file size in java. Copy and paste this code in your java class. public static long getFileSize(String filePath)     {         File f = new File(filePath);         return f.length();     }

How to delete file in java code example?

 Delete file in java code example Here we are describing how to delete file in java code example. Very simple code method is there. public boolean setDeleteFile(String filePath)     {         File f = new File(filePath);         return f.delete();     }

Draw Image button with link in java applet code.

import java.applet.Applet; import java.awt.*; import java.net.MalformedURLException; import java.net.URL; public class ImageButton extends Canvas {     public ImageButton()     {         staticImage = null;         activeImage = null;         linkURL = null;         buttonUp = true;         mouseOver = false;     }     public ImageButton(Applet app, String toolType, int border)     {         staticImage = null;         activeImage = null;         linkURL = null;         buttonUp = true;         mouseOver = false;         this.app = app;         this.border = border;         this.toolType = toolType;         if(toolType.equalsIgnoreCase("View"))             setSize(25, 30);         else         if(toolType.equalsIgnoreCase("Draw"))             setSize(25, 30);         else         if(toolType.equalsIgnoreCase("Text"))             setSize(25, 30);     }     public void setLink(String link)     {         thisLink = link;

How to draw ruler in applet code

import java.io.PrintStream; public class Ruler extends Button {     public Ruler()     {         mid1 = 77;     }     public void init()     {         setBackground(Color.GRAY);     }     public void paint(Graphics g)     {         drawNum(g, 10, 520, 12, mid1, 1);         drawRuler(g, 10, 520, 8);     }     private void drawRuler(Graphics g, int left, int right, int level)     {         if(level < 1)         {             return;         } else         {             int mid = (left + right) / 2;             g.setColor(Color.BLUE);             g.drawLine(80, mid, 80 - level * 3, mid);             drawRuler(g, left, mid - 1, level - 1);             drawRuler(g, mid + 1, right, level - 1);             return;         }     }     private void drawNum(Graphics g, int left, int right, int level, int mid1, int i)     {         if(level < 1)             return;         char m[] = new char[10];         String c1 = (new Integer(i)).toString();   

How to convert Video to FLV for Flv Player ? : java code , Examples

How to convert Video to FLV for Flv Player public int compressVideioFLV(String inputVideo, String outputVidio) {         int returnCode = 0;         Process process;         try {             System.out.println("compressVideioFLV called");             System.out.println("inputVideo:"+inputVideo);             System.out.println("outputVidio:"+outputVidio);             String[] command = { "ffmpeg", "-i", inputVideo , "-ar", "22050", "-ab", "32","-f","flv","-s","422x252", outputVidio};             System.out.println("11:");             process = Runtime.getRuntime().exec(command);             System.out.println("after process FLV");             returnCode = process.waitFor();             System.out.println("returnCode FLV:"+returnCode);         } catch (IOException e) {             e.printStackTrace();         }

Recent Post

Recent Posts Widget