-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathToolBar.java
More file actions
54 lines (47 loc) · 1.21 KB
/
ToolBar.java
File metadata and controls
54 lines (47 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package aoop;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JPanel;
/**
* Toolbar menu
* @author Daniel and Erik
*/
public class ToolBar extends JPanel{
/**
* Constructor
* @param m model of mvc
* @param c controller of mvc
*/
public ToolBar(Model m, Controller c)
{
this.m = m;
this.c = c;
setLayout(new FlowLayout());
this.setPreferredSize(new Dimension(50,50));
}
/**
* Adds a filter to the menu
* @param f filter to add
* @param l Actionlistener to handle buttonpress
*/
public void addFilter(Filter f, ActionListener l)
{
JButton newButton = new JButton();
newButton.setText(f.getName());
newButton.setPreferredSize(new Dimension(110,40));
newButton.addActionListener(l);
add(newButton);
}
/**
* Adds a acalable filter to the menu
* @param f scalable filter to add
*/
public void addFilter(ScalableFilter f)
{
this.addFilter(f, c.getScalableFilterMenuListener(f));
}
private final Model m;
private final Controller c;
}