123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- import java.io.*;
- import java.util.*;
- import java.awt.*;
- import javax.swing.*;
- public class Sidepane extends JPanel implements Observer
- {
- private Model model;
- private Colours colours;
- private JPanel thiccness;
- // Bob the Builder this shit
- public Sidepane(Model model)
- {
- // Hook up this observer so that it will be notified when the model
- // changes.
- this.model = model;
- this.setPreferredSize(new Dimension(100, 300));
- colours = new Colours();
- this.add(colours);
- model.addObserver(this);
- }
- /**
- * Update with data from the model.
- */
- public void update(Object observable)
- {
- this.setBackground(model.sideColour);
- revalidate();
- repaint();
- }
- }
- private class Colours extends JPanel
- {
- private jButton red;
- private jButton green;
- private jButton blue;
- private jButton yellow;
- private jButton purple;
- private jButton orange;
- private jButton cyan;
- private jButton custom;
-
- public colours()
- {
- this.setLayout(new GridLayout(0, 2));
- red = new jButton("Red");
- green = new jButton("Green");
- blue = new jButton("Blue");
- yellow = new jButton("Yellow");
- purple = new jButton("Purple");
- orange = new jButton("Orange");
- cyan = new jButton("Cyan");
- custom = new jButton("Custom");
- this.add(red);
- this.add(green);
- this.add(blue);
- this.add(yellow);
- this.add(purple);
- this.add(orange);
- this.add(cyan);
- this.add(custom);
- }
- }
|