Java Code Examples for java.awt.Container#addMouseListener()
The following examples show how to use
java.awt.Container#addMouseListener() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SlowPanelIteration.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private static void showUI() { frame = new JFrame(); frame.setSize(new Dimension(400, 400)); frame.setLocationRelativeTo(null); final Container content = frame.getContentPane(); content.setLayout(new BorderLayout(0, 0)); Container lastPanel = content; for (int i = 0; i < 500; i++) { final JPanel p = new JPanel(); p.setLayout(new BorderLayout(0, 0)); lastPanel.add(p); lastPanel.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { System.out.println("click"); go.countDown(); } }); lastPanel = p; } lastPanel.setBackground(Color.GREEN); frame.setVisible(true); Point loc = frame.getLocationOnScreen(); center.x = loc.x + frame.getWidth() / 2; center.y = loc.y + frame.getHeight() / 2; }
Example 2
Source File: SlowPanelIteration.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static void showUI() { frame = new JFrame(); frame.setSize(new Dimension(400, 400)); frame.setLocationRelativeTo(null); final Container content = frame.getContentPane(); content.setLayout(new BorderLayout(0, 0)); Container lastPanel = content; for (int i = 0; i < 500; i++) { final JPanel p = new JPanel(); p.setLayout(new BorderLayout(0, 0)); lastPanel.add(p); lastPanel.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { System.out.println("click"); go.countDown(); } }); lastPanel = p; } lastPanel.setBackground(Color.GREEN); frame.setVisible(true); Point loc = frame.getLocationOnScreen(); center.x = loc.x + frame.getWidth() / 2; center.y = loc.y + frame.getHeight() / 2; }
Example 3
Source File: SlowPanelIteration.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private static void showUI() { frame = new JFrame(); frame.setSize(new Dimension(400, 400)); frame.setLocationRelativeTo(null); final Container content = frame.getContentPane(); content.setLayout(new BorderLayout(0, 0)); Container lastPanel = content; for (int i = 0; i < 500; i++) { final JPanel p = new JPanel(); p.setLayout(new BorderLayout(0, 0)); lastPanel.add(p); lastPanel.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { System.out.println("click"); go.countDown(); } }); lastPanel = p; } lastPanel.setBackground(Color.GREEN); frame.setVisible(true); Point loc = frame.getLocationOnScreen(); center.x = loc.x + frame.getWidth() / 2; center.y = loc.y + frame.getHeight() / 2; }
Example 4
Source File: BalloonManager.java From netbeans with Apache License 2.0 | 5 votes |
private void handleMouseOver( Container c, MouseListener ml ) { c.addMouseListener(ml); for( Component child : c.getComponents() ) { child.addMouseListener(ml); if( child instanceof Container ) handleMouseOver((Container)child, ml); } }
Example 5
Source File: BalloonManager.java From netbeans with Apache License 2.0 | 5 votes |
private void handleMouseOver( Container c, MouseListener ml ) { c.addMouseListener(ml); for( Component child : c.getComponents() ) { child.addMouseListener(ml); if( child instanceof Container ) handleMouseOver((Container)child, ml); } }
Example 6
Source File: SlowPanelIteration.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
private static void showUI() { frame = new JFrame(); frame.setSize(new Dimension(400, 400)); frame.setLocationRelativeTo(null); final Container content = frame.getContentPane(); content.setLayout(new BorderLayout(0, 0)); Container lastPanel = content; for (int i = 0; i < 500; i++) { final JPanel p = new JPanel(); p.setLayout(new BorderLayout(0, 0)); lastPanel.add(p); lastPanel.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { System.out.println("click"); go.countDown(); } }); lastPanel = p; } lastPanel.setBackground(Color.GREEN); frame.setVisible(true); Point loc = frame.getLocationOnScreen(); center.x = loc.x + frame.getWidth() / 2; center.y = loc.y + frame.getHeight() / 2; }