All pastes #577110 Raw Edit

LayeredPane

public java v1 · immutable
·published 2007-06-19 19:48 UTC
rendered paste body
// <Honk> how the hell is the option in line 12 supposed to be the same as the one you add in line 36?import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.border.*;import javax.accessibility.*;public class LayeredPane extends JPanel{    private Performance perf;    private Option option;    private TextField field;    private View view;    private stringView sview;    private JLayeredPane layer;        // Construcor: takes in all classes    public LayeredPane(Performance perf, Option option, TextField field, View view, stringView sview){        this.perf = perf;        this.option = option;        this.field = field;        this.view = view;        this.sview = sview;                layer = new JLayeredPane();        layer.setPreferredSize(new Dimension(600,500));        // Sets the "settings" to the panels before adding to the JLayeredPane        // TextField is hidden behind the other layers        TextField panel1 = TextFieldSettings();        layer.add(panel1, new Integer(0));        // View put in the middle layer        View panel2 = ViewSettings();        layer.add(panel2, new Integer(1));        // stringView is put on the top        stringView panel3 = stringViewSettings();        layer.add(panel3, new Integer(2));        // Option is put on the top        Option panel4 = OptionSettings();        layer.add(panel4, new Integer(2));                add(layer);    }    // The settings for the View layer/JPanel    private View ViewSettings() {        View v = new View(perf,option);        v.setOpaque(true);        v.setBorder(BorderFactory.createLineBorder(Color.black));        v.setBounds(0, 0, 600, 500);        return v;    }        // The settings for the Option layer/JPanel    private Option OptionSettings(){        Option o = new Option(perf);        o.setOpaque(true);        o.setBorder(BorderFactory.createLineBorder(Color.black));        o.setBounds(100, 400, 400, 40);        return o;    }        // The settings for the stringView layer/JPanel    private stringView stringViewSettings() {        stringView s = new stringView(perf, option);        s.setOpaque(true);        s.setBounds(300, 150, 200, 250);        return s;    }        // The settings for the TextField layer/JPanel    private TextField TextFieldSettings() {        TextField f = new TextField(view, perf, sview);        f.setOpaque(true);        f.setBounds(200, 400, 300, 50);        f.requestFocus();        return f;    }}