X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsonitus%2Fgui%2FControlledPane.java;fp=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsonitus%2Fgui%2FControlledPane.java;h=5ec27359b0045cb02c00a04b531c889d8d19ba44;hb=9178ad72e324d92a1857073740a4c57bbe243028;hp=0000000000000000000000000000000000000000;hpb=a9a06d4db662b4d5a28628d6caabf39b5849c2d5;p=sonitus.git diff --git a/src/main/java/net/pterodactylus/sonitus/gui/ControlledPane.java b/src/main/java/net/pterodactylus/sonitus/gui/ControlledPane.java new file mode 100644 index 0000000..5ec2735 --- /dev/null +++ b/src/main/java/net/pterodactylus/sonitus/gui/ControlledPane.java @@ -0,0 +1,52 @@ +/* + * Sonitus - ControlledTab.java - Copyright © 2013 David Roden + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.pterodactylus.sonitus.gui; + +import javax.swing.Box; +import javax.swing.BoxLayout; +import javax.swing.JPanel; + +import net.pterodactylus.sonitus.data.Controlled; +import net.pterodactylus.sonitus.data.Controller; +import net.pterodactylus.sonitus.data.controller.Fader; + +/** + * Panel that displays all {@link Controller}s of a {@link Controlled} + * component. + * + * @author David ‘Bombe’ Roden + */ +public class ControlledPane extends JPanel { + + /** + * Creates a new controlled pane. + * + * @param controlled + * The controlled whose controllers to display + */ + public ControlledPane(Controlled controlled) { + setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); + for (Controller controller : controlled.controllers()) { + if (controller instanceof Fader) { + add(new FaderPanel((Fader) controller)); + } + } + add(Box.createGlue()); + } + +}