ComboBoxDialog.java
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008, AIST, the University of Tokyo and General Robotix Inc.
3  * All rights reserved. This program is made available under the terms of the
4  * Eclipse Public License v1.0 which accompanies this distribution, and is
5  * available at http://www.eclipse.org/legal/epl-v10.html
6  * Contributors:
7  * General Robotix Inc.
8  * National Institute of Advanced Industrial Science and Technology (AIST)
9  */
17 package com.generalrobotix.ui.util;
18 
19 import java.awt.*;
20 import javax.swing.*;
21 
22 
23 @SuppressWarnings("serial")
24 public class ComboBoxDialog extends AlertBox {
25  JComboBox combo_;
26 
27  public ComboBoxDialog(Frame owner, String caption, String message, Object[] item) {
28  super(owner, caption, JOptionPane.QUESTION_MESSAGE, OK_CANCEL_TYPE);
29  setTitle("InputDialog");
30  setCaption(caption);
31  setMessage(message);
32  _init(item);
33  }
34 
35  private void _init(Object[] item) {
36  combo_ = new JComboBox(item);
37  setInputAreaWidth(300);
38  addInputComponent(
39  null,
40  combo_,
42  true
43  );
44  }
45 
46  public Object showComboBoxDialog() {
47  int res = showModalDialog();
48  if (res == ModalDialog.OK_BUTTON) {
49  return combo_.getSelectedItem();
50  }
51  return null;
52  }
53 
54 }
#define null
our own NULL pointer
Definition: IceTypes.h:57
ComboBoxDialog(Frame owner, String caption, String message, Object[] item)


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Sat Apr 13 2019 02:14:20