View Javadoc

1   /*
2    * Copyright 2007 - 2008 JEuclid, http://jeuclid.sf.net
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  /* $Id: MathComponentUI16.java,v 439a683a20f9 2008/02/18 19:45:38 maxberger $ */
18  
19  package net.sourceforge.jeuclid.swing;
20  
21  import java.awt.Component;
22  import java.awt.Component.BaselineResizeBehavior;
23  
24  import javax.swing.JComponent;
25  import javax.swing.SwingConstants;
26  
27  /*
28   * Copyright 2002 - 2007 JEuclid, http://jeuclid.sf.net
29   * 
30   * Licensed under the Apache License, Version 2.0 (the "License"); you may not
31   * use this file except in compliance with the License. You may obtain a copy
32   * of the License at
33   * 
34   * http://www.apache.org/licenses/LICENSE-2.0
35   * 
36   * Unless required by applicable law or agreed to in writing, software
37   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
38   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
39   * License for the specific language governing permissions and limitations
40   * under the License.
41   */
42  
43  /* $Id: MathComponentUI16.java,v 439a683a20f9 2008/02/18 19:45:38 maxberger $ */
44  
45  /**
46   * @version $Revision: 439a683a20f9 $
47   */
48  public class MathComponentUI16 extends MathComponentUI {
49      /**
50       * Default Constructor.
51       */
52      public MathComponentUI16() {
53          super();
54      }
55  
56      /** {@inheritDoc} */
57      @Override
58      public BaselineResizeBehavior getBaselineResizeBehavior(final JComponent c) {
59          final BaselineResizeBehavior retVal;
60          switch (((JMathComponent) c).getVerticalAlignment()) {
61          case SwingConstants.TOP:
62              retVal = Component.BaselineResizeBehavior.CONSTANT_ASCENT;
63              break;
64          case SwingConstants.BOTTOM:
65              retVal = Component.BaselineResizeBehavior.CONSTANT_DESCENT;
66              break;
67          case SwingConstants.CENTER:
68              retVal = Component.BaselineResizeBehavior.CENTER_OFFSET;
69              break;
70          default:
71              retVal = Component.BaselineResizeBehavior.OTHER;
72          }
73          return retVal;
74      }
75  }