コントローラーを重ねる
2008/01/30
java
アイデアレベル
import java.awt.GridBagLayout;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JPanel;
public class TestPanel extends JPanel {
private static final long serialVersionUID = 1L;
public static void main(String[] args) {
}
public TestPanel() {
super();
initialize();
addMouseListener(new Controllers());
}
private void initialize() {
this.setSize(300, 200);
this.setLayout(new GridBagLayout());
}
class Controllers extends MouseAdapter{
List<Controller> list = new ArrayList<Controller>();
@Override
public void mousePressed(MouseEvent e) {
for (Controller controller : list) {
controller.mousePressed(e);
}
}
}
class Controller extends MouseAdapter{
}
}
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JPanel;
public class TestPanel extends JPanel {
private static final long serialVersionUID = 1L;
public static void main(String[] args) {
}
public TestPanel() {
super();
initialize();
addMouseListener(new Controllers());
}
private void initialize() {
this.setSize(300, 200);
this.setLayout(new GridBagLayout());
}
class Controllers extends MouseAdapter{
List<Controller> list = new ArrayList<Controller>();
@Override
public void mousePressed(MouseEvent e) {
for (Controller controller : list) {
controller.mousePressed(e);
}
}
}
class Controller extends MouseAdapter{
}
}
: