it.tidalwave.swing.WaitingComponent Maven / Gradle / Ivy
/***********************************************************************************************************************
*
* OpenBlueSky - NetBeans Platform Enhancements
* Copyright (C) 2006-2011 by Tidalwave s.a.s. (http://www.tidalwave.it)
*
***********************************************************************************************************************
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
***********************************************************************************************************************
*
* WWW: http://openbluesky.java.net
* SCM: https://bitbucket.org/tidalwave/openbluesky-src
*
**********************************************************************************************************************/
package it.tidalwave.swing;
import java.awt.Color;
import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.SwingConstants;
import javax.swing.border.Border;
import org.jdesktop.swingx.VerticalLayout;
/*******************************************************************************
*
* @author Fabrizio Giudici
* @version $Id$
*
******************************************************************************/
public class WaitingComponent extends RoundedPanel
{
private static final int RADIUS = 20;
private static final Border BORDER = BorderFactory.createEmptyBorder(10, 10, 10, 10);
private static final Color BACKGROUND_COLOR = new Color(0, 0, 0, 64);
private final JLabel label = new JLabel("Please wait...", SwingConstants.CENTER);
public WaitingComponent()
{
super(RADIUS);
// final JXBusyLabel busyLabel = new JXBusyLabel();
//// setDoubleBuffered(true);
// busyLabel.setBusy(true);
// busyLabel.setOpaque(false);
// busyLabel.setHorizontalAlignment(SwingConstants.CENTER);
// busyLabel.setBackground(new Color(0,0,0,0));
label.setFont(getFont().deriveFont(getFont().getSize() * 0.9f));
label.setForeground(Color.WHITE);
label.setOpaque(false);
setLayout(new VerticalLayout());
// add(busyLabel);
add(label);
setBackground(BACKGROUND_COLOR);
setOpaque(true);
setBorder(BORDER);
}
public void setText (final String message)
{
label.setText(message);
}
}