MouseExample - /Program to illustrate mouse events import...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
//Program to illustrate mouse events / import javax.swing.*; import java.awt.*; import java.awt.event.*; i public class MouseExample extends JFrame implements MouseListener { private static int WIDTH = 350; private static int HEIGHT = 250; //GUI components private JLabel[] labelJL; public MouseExample() { setTitle("Mouse Events"); Container pane = getContentPane(); setSize(WIDTH,HEIGHT); GridLayout gridMgr = new GridLayout(6, 1, 10, 10); pane.setLayout(gridMgr); labelJL = new JLabel[6]; labelJL[0] = new JLabel("Mouse Clicked", SwingConstants.CENTER); labelJL[1] = new JLabel("Mouse Entered", SwingConstants.CENTER); labelJL[2] = new JLabel("Mouse Exited", SwingConstants.CENTER); labelJL[3] = new JLabel("Mouse Pressed", SwingConstants.CENTER); labelJL[4] = new JLabel("Mouse Released", SwingConstants.CENTER); labelJL[5] = new JLabel("",SwingConstants.CENTER); for (int i = 0; i < labelJL.length; i++) { labelJL[i].setForeground(Color.gray); pane.add(labelJL[i]); } pane.addMouseListener(this);
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 06/17/2011 for the course COMP 2301 taught by Professor Staff during the Spring '10 term at Kennesaw.

Page1 / 3

MouseExample - /Program to illustrate mouse events import...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online