CS411X - Lecture 3

homeContentsIndexPrevNext

Lecture Topics:


 
 Outline of your Progress Reports :

    Date

Report #

version

02/20/97

1

Beta 1

03/07/97

2

Beta 2

03/21/97

3

Beta 3

04/10/97

4

Beta 4

04/21/97

5

final version 1.0

05/08/97

6

code with report

A Progress report should contain

A File Filter :

FileFilter.java


import java.io.*;
import java.util.*;
 
public class FileFilter implements FilenameFilter {
    public boolean accept(File dir, String name) {
        return new File(dir, name).isFile();
        }
}
 

DirFilter.java


import java.io.*;
import java.util.*;
 
public class DirFilter implements FilenameFilter {
    public boolean accept(File dir, String name) {
        return new File(dir, name).isDirectory();
    }
}
 
To Filter .java files ( The Java Filter )

JavaFilter.java

import java.io.*;
import java.util.*;
 
class JavaFilter implements FilenameFilter {
    public boolean accept(File dir, String name) {
        String match = ".java";
        int ml = match.length();
        int nl = name.length();
        if (nl > ml) {
            String post_fix = name.substring(nl - ml, nl);
            return post_fix.equals(match);
        }
        return false;
    }
}
 

Images in Java

Pixel plane
Image frame
Edge Detection - kind of image segmentation

Computer Vision

various kind of images

Rendering in Java :

AWT

    AWT Architecture
public void paint( Graphics g );

call asynchronously on initializing or if damage occurs

Who calls repaint( )?

You or the Window system
repaint( ) requests a component to be repainted.

Component calls back : update( )

usually donot call update yourself !

public void update( Graphics g );

callback paint( )

public void paint( Graphics g );

asynchronously called when

  1. component first becomes visible
  2. damage occurs

background will already be cleared
clip area is set to the damaged area (never call paint( ) yourself)

paint( ) and update( ) methods are called from the AWT callback thread.

public abstract class Graphics{
// you cannot make a graphics instance as a result
Graphics g = myPanel.getGraphics( );
g.dispose( );
 

Sample Quiz

1. An instance of Graphics class can be obtained


 
homeContentsIndexPrevNext



UBLOGOLast Update: 04/09/97
Copyright © 1997- Douglas Lyon
Lyon@cse.bridgeport.edu