001    /*
002     * Copyright 2007 - 2008 JEuclid, http://jeuclid.sf.net
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    
017    /* $Id: MathComponentUI16.java,v 439a683a20f9 2008/02/18 19:45:38 maxberger $ */
018    
019    package net.sourceforge.jeuclid.swing;
020    
021    import java.awt.Component;
022    import java.awt.Component.BaselineResizeBehavior;
023    
024    import javax.swing.JComponent;
025    import javax.swing.SwingConstants;
026    
027    /*
028     * Copyright 2002 - 2007 JEuclid, http://jeuclid.sf.net
029     * 
030     * Licensed under the Apache License, Version 2.0 (the "License"); you may not
031     * use this file except in compliance with the License. You may obtain a copy
032     * of the License at
033     * 
034     * http://www.apache.org/licenses/LICENSE-2.0
035     * 
036     * Unless required by applicable law or agreed to in writing, software
037     * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
038     * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
039     * License for the specific language governing permissions and limitations
040     * under the License.
041     */
042    
043    /* $Id: MathComponentUI16.java,v 439a683a20f9 2008/02/18 19:45:38 maxberger $ */
044    
045    /**
046     * @version $Revision: 439a683a20f9 $
047     */
048    public class MathComponentUI16 extends MathComponentUI {
049        /**
050         * Default Constructor.
051         */
052        public MathComponentUI16() {
053            super();
054        }
055    
056        /** {@inheritDoc} */
057        @Override
058        public BaselineResizeBehavior getBaselineResizeBehavior(final JComponent c) {
059            final BaselineResizeBehavior retVal;
060            switch (((JMathComponent) c).getVerticalAlignment()) {
061            case SwingConstants.TOP:
062                retVal = Component.BaselineResizeBehavior.CONSTANT_ASCENT;
063                break;
064            case SwingConstants.BOTTOM:
065                retVal = Component.BaselineResizeBehavior.CONSTANT_DESCENT;
066                break;
067            case SwingConstants.CENTER:
068                retVal = Component.BaselineResizeBehavior.CENTER_OFFSET;
069                break;
070            default:
071                retVal = Component.BaselineResizeBehavior.OTHER;
072            }
073            return retVal;
074        }
075    }