Java JButton orderOKCancelButtons(JButton okButton, JButton cancelButton)

Here you can find the source of orderOKCancelButtons(JButton okButton, JButton cancelButton)

Description

order OK Cancel Buttons

License

Apache License

Declaration

public static List orderOKCancelButtons(JButton okButton, JButton cancelButton) 

Method Source Code

//package com.java2s;
/*//from   ww  w  .j  a va  2 s  .  c  om
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

import javax.swing.JButton;

public class Main {
    public static List orderOKCancelButtons(JButton okButton, JButton cancelButton) {
        List result = new ArrayList();
        if (isMacOSX()) {
            result.add(cancelButton);
            result.add(okButton);
        } else {
            result.add(okButton);
            result.add(cancelButton);
        }
        return result;
    }

    public static boolean isMacOSX() {
        return System.getProperty("os.name").toLowerCase(Locale.ENGLISH).startsWith("mac os x");
    }
}

Related

  1. getWFStep(Vector actionButtons, String action)
  2. initHelpButton(final JButton buttonHelp)
  3. nombreImg(JButton boton)
  4. normalizeComponentDimension(JComponent[] jButtonList)
  5. nullifyButtonUI(final JButton button)
  6. reduceNimbusButtonMargin(final JButton button)
  7. registerCancelButton(final JButton cancelButton)
  8. removeAllActionListeners(JButton button)
  9. removeAllListeners(JButton bouton)