001 /* 002 * Copyright 2002-2007 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package org.springframework.richclient.command.config; 017 018 import java.awt.Color; 019 020 import javax.swing.AbstractButton; 021 import javax.swing.SwingConstants; 022 023 import org.springframework.richclient.command.AbstractCommand; 024 import org.springframework.richclient.image.ArrowIcon; 025 026 /** 027 * <code>CommandButtonConfigurer</code> for pulldown menu buttons. 028 * <p> 029 * Sets a custom icon (arrow down), and the text is shown before the icon. 030 * 031 * @author Keith Donald 032 */ 033 public final class PullDownMenuButtonConfigurer extends DefaultCommandButtonConfigurer { 034 private static final ArrowIcon PULL_DOWN_ICON = new ArrowIcon(ArrowIcon.Direction.DOWN, 3, Color.BLACK); 035 036 public void configure(AbstractButton button, AbstractCommand command, CommandFaceDescriptor faceDescriptor) { 037 super.configure(button, command, faceDescriptor); 038 button.setIcon(PULL_DOWN_ICON); 039 button.setHorizontalTextPosition(SwingConstants.LEADING); 040 } 041 }