Return-Path: Delivered-To: apmail-jakarta-log4j-dev-archive@www.apache.org Received: (qmail 41697 invoked from network); 1 Oct 2003 04:10:52 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 1 Oct 2003 04:10:52 -0000 Received: (qmail 67704 invoked by uid 500); 1 Oct 2003 04:10:30 -0000 Delivered-To: apmail-jakarta-log4j-dev-archive@jakarta.apache.org Received: (qmail 67678 invoked by uid 500); 1 Oct 2003 04:10:30 -0000 Mailing-List: contact log4j-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Log4J Developers List" Reply-To: "Log4J Developers List" Delivered-To: mailing list log4j-dev@jakarta.apache.org Received: (qmail 67665 invoked by uid 500); 1 Oct 2003 04:10:30 -0000 Received: (qmail 67661 invoked from network); 1 Oct 2003 04:10:30 -0000 Received: from unknown (HELO minotaur.apache.org) (209.237.227.194) by daedalus.apache.org with SMTP; 1 Oct 2003 04:10:30 -0000 Received: (qmail 41686 invoked by uid 1665); 1 Oct 2003 04:10:49 -0000 Date: 1 Oct 2003 04:10:49 -0000 Message-ID: <20031001041049.41685.qmail@minotaur.apache.org> From: psmith@apache.org To: jakarta-log4j-cvs@apache.org Subject: cvs commit: jakarta-log4j/src/java/org/apache/log4j/chainsaw LogPanelPreferencePanel.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N psmith 2003/09/30 21:10:49 Added: src/java/org/apache/log4j/chainsaw LogPanelPreferencePanel.java Log: Beginnings of the Log Panels new preference dialog. Revision Changes Path 1.1 jakarta-log4j/src/java/org/apache/log4j/chainsaw/LogPanelPreferencePanel.java Index: LogPanelPreferencePanel.java =================================================================== /* * ============================================================================ * The Apache Software License, Version 1.1 * ============================================================================ * * Copyright (C) 1999 The Apache Software Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without modifica- * tion, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The end-user documentation included with the redistribution, if any, must * include the following acknowledgment: "This product includes software * developed by the Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, if * and wherever such third-party acknowledgments normally appear. * * 4. The names "log4j" and "Apache Software Foundation" must not be used to * endorse or promote products derived from this software without prior * written permission. For written permission, please contact * apache@apache.org. * * 5. Products derived from this software may not be called "Apache", nor may * "Apache" appear in their name, without prior written permission of the * Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals * on behalf of the Apache Software Foundation. For more information on the * Apache Software Foundation, please see . * */ package org.apache.log4j.chainsaw; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import javax.swing.BorderFactory; import javax.swing.Box; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTree; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.TreeModel; /** * GUI panel used to manipulate the PreferenceModel for a Log Panel * * @author Paul Smith */ public class LogPanelPreferencePanel extends JPanel { private final LogPanelPreferenceModel model; final JLabel titleLabel = new JLabel("Selected Pref Panel"); public LogPanelPreferencePanel(LogPanelPreferenceModel model) { this.model = model; initComponents(); } /** * Setsup and layouts the components */ private void initComponents() { // setBorder(BorderFactory.createLineBorder(Color.red)); setLayout(new BorderLayout(5, 5)); setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15)); final JTree prefTree = new JTree(createTreeModel()); DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer(); renderer.setLeafIcon(null); prefTree.setCellRenderer(renderer); final JScrollPane treeScroll = new JScrollPane(prefTree); treeScroll.setPreferredSize(new Dimension(200, 240)); JPanel mainPanel = new JPanel(new BorderLayout(10, 10)); JPanel selectedPrefPanel = new JPanel(new BorderLayout(0, 3)); titleLabel.setFont(titleLabel.getFont().deriveFont(16.0f)); titleLabel.setBorder(BorderFactory.createEtchedBorder()); titleLabel.setBackground(Color.white); titleLabel.setOpaque(true); selectedPrefPanel.add(titleLabel, BorderLayout.NORTH); mainPanel.add(treeScroll, BorderLayout.WEST); mainPanel.add(selectedPrefPanel, BorderLayout.CENTER); add(mainPanel, BorderLayout.CENTER); JButton okButton = new JButton("OK"); JButton cancelButton = new JButton("Cancel"); Box buttonBox = Box.createHorizontalBox(); buttonBox.add(Box.createHorizontalGlue()); buttonBox.add(okButton); buttonBox.add(Box.createHorizontalStrut(5)); buttonBox.add(cancelButton); add(buttonBox, BorderLayout.SOUTH); } private TreeModel createTreeModel() { final DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("Preferences"); DefaultTreeModel model = new DefaultTreeModel(rootNode); DefaultMutableTreeNode formatting = new DefaultMutableTreeNode("Formatting"); rootNode.add(formatting); return model; } public static void main(String[] args) { JFrame f = new JFrame("Preferences Panel Test Bed"); LogPanelPreferenceModel model = new LogPanelPreferenceModel(); f.getContentPane().add(new LogPanelPreferencePanel(model)); f.setSize(640, 480); f.show(); } } --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: log4j-dev-help@jakarta.apache.org