ComboBoxDialog.java
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2008, AIST, the University of Tokyo and General Robotix Inc.
00003  * All rights reserved. This program is made available under the terms of the
00004  * Eclipse Public License v1.0 which accompanies this distribution, and is
00005  * available at http://www.eclipse.org/legal/epl-v10.html
00006  * Contributors:
00007  * General Robotix Inc.
00008  * National Institute of Advanced Industrial Science and Technology (AIST) 
00009  */
00017 package com.generalrobotix.ui.util;
00018 
00019 import java.awt.*;
00020 import javax.swing.*;
00021 
00022 
00023 @SuppressWarnings("serial")
00024 public class ComboBoxDialog extends AlertBox {
00025     JComboBox combo_;
00026 
00027     public ComboBoxDialog(Frame owner, String caption, String message, Object[] item) {
00028         super(owner, caption, JOptionPane.QUESTION_MESSAGE, OK_CANCEL_TYPE);
00029         setTitle("InputDialog");
00030         setCaption(caption);
00031         setMessage(message);
00032         _init(item);
00033     }
00034 
00035     private void _init(Object[] item) {
00036         combo_ = new JComboBox(item);
00037         setInputAreaWidth(300);
00038         addInputComponent(
00039             null,
00040             combo_,
00041             ModalDialog.MULTILINE_CAPTION,
00042             true
00043         );
00044     }
00045 
00046     public Object showComboBoxDialog() {
00047         int res = showModalDialog();
00048         if (res == ModalDialog.OK_BUTTON) {
00049             return combo_.getSelectedItem();
00050         }
00051         return null;
00052     }
00053 
00054 }


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Thu Apr 11 2019 03:30:15