Java JToolBar getToolbarOrientation(String location)

Here you can find the source of getToolbarOrientation(String location)

Description

Returns a toolbar orientation based on its location.

License

Open Source License

Parameter

Parameter Description
location a parameter

Declaration

public static int getToolbarOrientation(String location) 

Method Source Code


//package com.java2s;
/*/* w w  w  .  j  a  v  a2s  . c om*/
     
 This file is part of Subclient.
     
 Subclient is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.
     
 Subclient is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 GNU General Public License for more details.
     
 You should have received a copy of the GNU General Public License
 along with Subclient. If not, see <http://www.gnu.org/licenses/>.
     
 Copyright 2012, 2013 Alejandro Celaya Alastru?
     
 */

import java.awt.BorderLayout;

import javax.swing.JToolBar;

public class Main {
    /**
     * Returns a toolbar orientation based on its location.
     * Valid locations are BorderLayout.NORTH, BorderLayout.SOUTH, BorderLayout.EAST and BorderLayout.WEST.
     * In the first two cases orientation will be JToolBar.HORIZONTAL. In the other two cases it will be JToolBar.VERTICAL;
     * @param location
     * @return
     */
    public static int getToolbarOrientation(String location) {
        return (location.equalsIgnoreCase(BorderLayout.NORTH) || location.equalsIgnoreCase(BorderLayout.SOUTH))
                ? JToolBar.HORIZONTAL
                : JToolBar.VERTICAL;
    }
}

Related

  1. fixButton(AbstractButton button, String toolTip)
  2. floatToolBar(JToolBar tb, Point p)
  3. formatToolBar(JToolBar toolbar, int style)
  4. getToolbarButton(JToolBar toolbar, Action action)
  5. getToolBarFill(int orientation)
  6. hideChildButtonsWithTooltip(Container parent, String tooltip)
  7. initIconButton(AbstractButton button, String toolTip)
  8. isToolBarButton(JComponent c)
  9. isToolBarButton(JComponent c)