001package jmri.jmrit.throttle.implementation; 002 003import java.awt.Color; 004import java.awt.Graphics; 005 006import javax.swing.JPanel; 007 008/** 009 * A translucent JPanel (grey semitransparent background) 010 * 011 * <hr> 012 * This file is part of JMRI. 013 * <p> 014 * JMRI is free software; you can redistribute it and/or modify it under the 015 * terms of version 2 of the GNU General Public License as published by the Free 016 * Software Foundation. See the "COPYING" file for a copy of this license. 017 * <p> 018 * JMRI is distributed in the hope that it will be useful, but WITHOUT ANY 019 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 020 * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 021 * 022 * @author Lionel Jeanson 2007-2026 023 * 024 */ 025 026public class TranslucentJPanel extends JPanel { 027 028 private final Color TRANS_COL = new Color(100, 100, 100, 100); 029 030 public TranslucentJPanel() { 031 super(); 032 setOpaque(false); 033 } 034 035 @Override 036 public void paintComponent(Graphics g) { 037 g.setColor(TRANS_COL); 038 g.fillRoundRect(0, 0, getSize().width, getSize().height, 10, 10); 039 super.paintComponent(g); 040 } 041}