/****************************************************************************** * * * Copyright 2016 Subterranean Security * * * * 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. * * * *****************************************************************************/ package com.subterranean_security.crimson.viewer.ui.screen.files.ep; import java.awt.BorderLayout; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.SwingConstants; import javax.swing.border.EtchedBorder; import com.subterranean_security.crimson.viewer.ui.common.panels.sl.epanel.EPanel; public class Error extends JPanel { private static final long serialVersionUID = 1L; public Error(EPanel ep, String string) { setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null)); setLayout(new BorderLayout(0, 0)); JPanel panel = new JPanel(); add(panel, BorderLayout.SOUTH); JButton btnClose = new JButton("Close"); btnClose.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ep.drop(); } }); btnClose.setFont(new Font("Dialog", Font.BOLD, 10)); panel.add(btnClose); JPanel panel_1 = new JPanel(); add(panel_1, BorderLayout.CENTER); JPanel panel_2 = new JPanel(); panel_2.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null)); panel_1.add(panel_2); panel_2.setLayout(new BorderLayout(0, 0)); JLabel lblNewLabel = new JLabel("Error: " + string); panel_2.add(lblNewLabel, BorderLayout.NORTH); lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER); } }