import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

class MyFrame extends JFrame {
    class MyMouseAdapter extends MouseAdapter {
        public void mouseEntered(MouseEvent e) {
            label.setForeground(Color.red);
        }
        public void mouseExited(MouseEvent e) {
            label.setForeground(Color.white);
        }
    }
    public MyFrame(String s) {
        super(s);
        label = new JLabel("Welkom bij van C++ naar Java.");
        label.setFont(new Font("Arial", Font.BOLD, 24));
        getContentPane().setBackground(new Color(0x00BdBd));
        add(label);
        Double x=new Double(Math.random()*400);
        Double y=new Double(Math.random()*400);
        setLocation(x.intValue(), y.intValue());
        pack();
        setVisible(true);
        addMouseListener(new MyMouseAdapter());
    }
    private JLabel label;
}
        
public class Welkom2c {
    public static void main(String[] args) {
        //see: http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html
	    javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                JFrame frame1 = new MyFrame("Welkom!");
                frame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                JFrame frame2 = new MyFrame("Ook welkom!");
            }
        });
    }
}
