001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.log4j.lf5.viewer; 018 019import java.awt.BorderLayout; 020import java.awt.FlowLayout; 021import java.awt.GridBagLayout; 022import java.awt.event.ActionEvent; 023import java.awt.event.ActionListener; 024 025import javax.swing.JButton; 026import javax.swing.JFrame; 027import javax.swing.JPanel; 028 029/** 030 * LogFactor5ErrorDialog 031 * 032 * @author Richard Hurst 033 * @author Brad Marlborough 034 */ 035 036// Contributed by ThoughtWorks Inc. 037 038public class LogFactor5ErrorDialog extends LogFactor5Dialog { 039 //-------------------------------------------------------------------------- 040 // Constants: 041 //-------------------------------------------------------------------------- 042 043 //-------------------------------------------------------------------------- 044 // Protected Variables: 045 //-------------------------------------------------------------------------- 046 047 //-------------------------------------------------------------------------- 048 // Private Variables: 049 //-------------------------------------------------------------------------- 050 051 //-------------------------------------------------------------------------- 052 // Constructors: 053 //-------------------------------------------------------------------------- 054 public LogFactor5ErrorDialog(JFrame jframe, String message) { 055 super(jframe, "Error", true); 056 057 JButton ok = new JButton("Ok"); 058 ok.addActionListener(new ActionListener() { 059 public void actionPerformed(ActionEvent e) { 060 hide(); 061 } 062 }); 063 064 JPanel bottom = new JPanel(); 065 bottom.setLayout(new FlowLayout()); 066 bottom.add(ok); 067 068 JPanel main = new JPanel(); 069 main.setLayout(new GridBagLayout()); 070 wrapStringOnPanel(message, main); 071 072 getContentPane().add(main, BorderLayout.CENTER); 073 getContentPane().add(bottom, BorderLayout.SOUTH); 074 show(); 075 076 } 077 //-------------------------------------------------------------------------- 078 // Public Methods: 079 //-------------------------------------------------------------------------- 080 081 //-------------------------------------------------------------------------- 082 // Protected Methods: 083 //-------------------------------------------------------------------------- 084 085 //-------------------------------------------------------------------------- 086 // Private Methods: 087 //-------------------------------------------------------------------------- 088 089 //-------------------------------------------------------------------------- 090 // Nested Top-Level Classes or Interfaces 091 //-------------------------------------------------------------------------- 092}