001package jmri.jmrit.throttle.buttons; 002 003import javax.annotation.CheckForNull; 004 005import jmri.PowerManager; 006import jmri.jmrit.catalog.NamedIcon; 007 008/** 009 * 010 * A small button handling layout power 011 * 012 * <hr> 013 * This file is part of JMRI. 014 * <p> 015 * JMRI is free software; you can redistribute it and/or modify it under the 016 * terms of version 2 of the GNU General Public License as published by the Free 017 * Software Foundation. See the "COPYING" file for a copy of this license. 018 * <p> 019 * JMRI is distributed in the hope that it will be useful, but WITHOUT ANY 020 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 021 * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 022 * 023 */ 024 025public class SmallPowerManagerButton extends PowerManagerButton { 026 027 /** 028 * Create a SmallPowerManagerButton for a given Power Manager. 029 * @param fullText true if displaying text and graphic, false for graphic only. 030 * @param powerMgr The PowerManager to monitor and control. 031 */ 032 public SmallPowerManagerButton(boolean fullText, @CheckForNull PowerManager powerMgr) { 033 super(fullText, powerMgr); 034 } 035 036 /** 037 * Create a Small Power Manager Button for the default Power Manager. 038 * @param fullText true if displaying text and graphic, false for graphic only. 039 */ 040 public SmallPowerManagerButton(Boolean fullText) { 041 super(fullText); 042 } 043 044 /** 045 * Create a Small Power Manager Button for the default Power Manager, 046 * displaying text and graphic. 047 */ 048 public SmallPowerManagerButton() { 049 super(); 050 } 051 052 @Override 053 protected void initComponents() { 054 setBorderPainted(false); 055 } 056 057 @Override 058 protected void loadIcons() { 059 setPowerOnIcon(new NamedIcon("resources/icons/throttles/GreenPowerLED.gif", "resources/icons/throttles/GreenPowerLED.gif")); 060 setPowerOffIcon(new NamedIcon("resources/icons/throttles/RedPowerLED.gif", "resources/icons/throttles/RedPowerLED.gif")); 061 setPowerIdleIcon(new NamedIcon("resources/icons/throttles/YellowPowerLED.gif", "resources/icons/throttles/YellowPowerLED.gif")); 062 setPowerUnknownIcon(new NamedIcon("resources/icons/throttles/YellowPowerLED.gif", "resources/icons/throttles/YellowPowerLED.gif")); 063 } 064 065}