FileDocCategorySizeDatePackage
WindowBlocker.javaAPI DocExample2815Mon Jan 09 11:02:00 GMT 2006None

WindowBlocker

public class WindowBlocker extends JComponent implements MouseInputListener

Fields Summary
private Cursor
old_cursor
Constructors Summary
public WindowBlocker()

        addMouseListener(this);
        addMouseMotionListener(this);
    
Methods Summary
public voidblock()

        old_cursor = getCursor();
        setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        setVisible(true);
    
public static voidmain(java.lang.String[] args)

        JFrame frame = new JFrame("Blocking Window");
        JTextArea jta = new JTextArea(10,40);
        JScrollPane scroll = new JScrollPane(jta);
        JButton start = new JButton("Start Processing");
        JLabel status = new JLabel("status");
        
        WindowBlocker blocker = new WindowBlocker();
        frame.setGlassPane(blocker);
        start.addActionListener(new LongProcess(status,blocker));
        
        
        Container comp = frame.getContentPane();
        comp.add("North",start);
        comp.add("Center",scroll);
        comp.add("South",status);

        frame.pack();
        frame.show();
    
public voidmouseClicked(java.awt.event.MouseEvent e)

        Toolkit.getDefaultToolkit().beep();
    
public voidmouseDragged(java.awt.event.MouseEvent e)

    
public voidmouseEntered(java.awt.event.MouseEvent e)

    
public voidmouseExited(java.awt.event.MouseEvent e)

    
public voidmouseMoved(java.awt.event.MouseEvent e)

    
public voidmousePressed(java.awt.event.MouseEvent e)

    
public voidmouseReleased(java.awt.event.MouseEvent e)

    
public voidunBlock()

        setCursor(old_cursor);
        setVisible(false);