\ru\ifmo\alarm\gui\RemoteControlPanel.java

package ru.ifmo.alarm.gui; 
 
import java.awt.Cursor; 
import java.awt.Rectangle; 
 
import javax.swing.ImageIcon; 
import javax.swing.JLabel; 
import javax.swing.JPanel; 
 
public class RemoteControlPanel extends JPanel { 
    static final long serialVersionUID = 0;     //eclipse wants me to write this :( 
     
    private static final String IMG_PATH = "/ru/ifmo/alarm/img/"; 
    private static final String remoteIconFileName            = "remoteIcon.jpg"; 
    private static final String remoteIconButton1FileName     = "remoteIconButton1.jpg"; 
    private static final String remoteRolloverButton1FileName = "remoteRolloverButton1.jpg"; 
    private static final String remotePressedButton1FileName  = "remotePressedButton1.jpg"; 
    private static final String remoteIconButton2FileName     = "remoteIconButton2.jpg"; 
    private static final String remoteRolloverButton2FileName = "remoteRolloverButton2.jpg"; 
    private static final String remotePressedButton2FileName  = "remotePressedButton2.jpg"; 
    private static final String remoteIconButton3FileName     = "remoteIconButton3.jpg"; 
    private static final String remoteRolloverButton3FileName = "remoteRolloverButton3.jpg"; 
    private static final String remotePressedButton3FileName  = "remotePressedButton3.jpg"; 
     
    private static final String button1MaskFileName  = "button1Mask.bmp"; 
    private static final String button2MaskFileName  = "button2Mask.bmp"; 
    private static final String button3MaskFileName  = "button3Mask.bmp"; 
     
    protected ShapedButton button1; 
    protected ShapedButton button2; 
    protected ShapedButton button3; 
    protected Rectangle button1Rect; 
    protected Rectangle button2Rect; 
    protected Rectangle button3Rect; 
    protected ImageIcon imgIcon; 
    protected JLabel background; 
     
    public RemoteControlPanel() { 
        this.setLayout(null); 
        imgIcon = new ImageIcon( 
                RemoteControlPanel.class.getResource(IMG_PATH + remoteIconFileName)); 
         
        button1 = new ShapedButton( 
                RemoteControlPanel.class.getResource(IMG_PATH + button1MaskFileName)); 
        button2 = new ShapedButton( 
                RemoteControlPanel.class.getResource(IMG_PATH + button2MaskFileName)); 
        button3 = new ShapedButton( 
                RemoteControlPanel.class.getResource(IMG_PATH + button3MaskFileName)); 
        button1Rect = new Rectangle(40, 36, 42, 31); 
        button2Rect = new Rectangle(40, 74, 46, 31); 
        button3Rect = new Rectangle(41, 111, 36, 29); 
        button1.setBounds(button1Rect); 
        button2.setBounds(button2Rect); 
        button3.setBounds(button3Rect); 
         
        background = new JLabel(imgIcon); 
            this.add(background); 
            background.setBounds(0, 0, imgIcon.getIconWidth(), imgIcon.getIconHeight()); 
            background.setLayout(null); 
            background.add(button1); 
            background.add(button2); 
            background.add(button3); 
         
        button1.setIcon(new ImageIcon( 
                RemoteControlPanel.class.getResource(IMG_PATH + remoteIconButton1FileName))); 
        button1.setRolloverIcon(new ImageIcon( 
                RemoteControlPanel.class.getResource(IMG_PATH + remoteRolloverButton1FileName))); 
        button1.setPressedIcon(new ImageIcon( 
                RemoteControlPanel.class.getResource(IMG_PATH + remotePressedButton1FileName))); 
        button1.setBorderPainted(false); 
        //button1.setToolTipText("Включить"); 
        button1.setCursor(new Cursor(Cursor.HAND_CURSOR)); 
         
        button2.setIcon(new ImageIcon( 
                RemoteControlPanel.class.getResource(IMG_PATH + remoteIconButton2FileName))); 
        button2.setRolloverIcon(new ImageIcon( 
                RemoteControlPanel.class.getResource(IMG_PATH + remoteRolloverButton2FileName))); 
        button2.setPressedIcon(new ImageIcon( 
                RemoteControlPanel.class.getResource(IMG_PATH + remotePressedButton2FileName))); 
        button2.setBorderPainted(false); 
        //button2.setToolTipText("Выключить"); 
        button2.setCursor(new Cursor(Cursor.HAND_CURSOR)); 
         
        button3.setIcon(new ImageIcon( 
                RemoteControlPanel.class.getResource(IMG_PATH + remoteIconButton3FileName))); 
        button3.setRolloverIcon(new ImageIcon( 
                RemoteControlPanel.class.getResource(IMG_PATH + remoteRolloverButton3FileName))); 
        button3.setPressedIcon(new ImageIcon( 
                RemoteControlPanel.class.getResource(IMG_PATH + remotePressedButton3FileName))); 
        button3.setBorderPainted(false); 
        //button3.setToolTipText("Тихий режим"); 
        button3.setCursor(new Cursor(Cursor.HAND_CURSOR)); 
         
        this.setSize(imgIcon.getIconWidth(), imgIcon.getIconHeight()); 
    } 
     
    public ShapedButton getButton1() { 
        return button1; 
    } 
     
    public ShapedButton getButton2() { 
        return button2; 
    } 
     
    public ShapedButton getButton3() { 
        return button3; 
    } 
 
}