|
import javax.swing.SwingUtilities;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JFrame;
import java.awt.Rectangle;
import javax.swing.JLabel;
import javax.swing.JButton;
import lightbox.LboxCombo;
public class SBUN extends JFrame {
private static final long serialVersionUID = 1L;
private JPanel jPanel = null;
private JLabel jLabel = null;
private LboxCombo lboxCombo = null;
private JButton jButton = null;
private JButton jButton1 = null;
private JButton jButton2 = null;
private JButton jButton3 = null;
private JButton jButton4 = null;
private JButton jButton5 = null;
/**
* This method initializes jPanel
*
* @return javax.swing.JPanel
*/
private JPanel getJPanel() {
if (jPanel == null) {
jLabel = new JLabel();
jLabel.setBounds(new Rectangle(23, 31, 88, 30));
jLabel.setText("処理区分");
jLabel.setFont(new java.awt.Font("MS Pゴシック", 0, 12));
jPanel = new JPanel();
jPanel.setLayout(null);
jPanel.add(jLabel, null);
jPanel.add(getLboxCombo(), null);
jPanel.add(getJButton(), null);
jPanel.add(getJButton1(), null);
jPanel.add(getJButton2(), null);
jPanel.add(getJButton3(), null);
jPanel.add(getJButton4(), null);
jPanel.add(getJButton5(), null);
}
return jPanel;
}
/**
* This method initializes lboxCombo
*
* @return testcontrol.LboxCombo
*/
private LboxCombo getLboxCombo() {
if (lboxCombo == null) {
lboxCombo = new LboxCombo();
lboxCombo.setBounds(new Rectangle(119, 33, 179, 24));
lboxCombo.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent e) {
}
});
lboxCombo.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
System.out.println(((LboxCombo)e.getSource()).isShowing());
}
});
}
return lboxCombo;
}
/**
* This method initializes jButton
*
* @return javax.swing.JButton
*/
private JButton getJButton() {
if (jButton == null) {
jButton = new JButton();
jButton.setFont(new java.awt.Font("MS Pゴシック", 0, 12));
jButton.setBounds(new Rectangle(51, 125, 252, 30));
jButton.setText("コンボボックスを開く");
jButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
lboxCombo.Open();
}
});
}
return jButton;
}
/**
* This method initializes jButton1
*
* @return javax.swing.JButton
*/
private JButton getJButton1() {
if (jButton1 == null) {
jButton1 = new JButton();
jButton1.setFont(new java.awt.Font("MS Pゴシック", 0, 12));
jButton1.setBounds(new Rectangle(51, 162, 252, 30));
jButton1.setText("コンボボックスを閉じる");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
lboxCombo.Close();
}
});
}
return jButton1;
}
/**
* This method initializes jButton2
*
* @return javax.swing.JButton
*/
private JButton getJButton2() {
if (jButton2 == null) {
jButton2 = new JButton();
jButton2.setFont(new java.awt.Font("MS Pゴシック", 0, 12));
jButton2.setBounds(new Rectangle(51, 199, 252, 30));
jButton2.setText("数値 \"1\" でコンボボックスを選択");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
lboxCombo.SelectByValue(1);
}
});
}
return jButton2;
}
/**
* This method initializes jButton3
*
* @return javax.swing.JButton
*/
private JButton getJButton3() {
if (jButton3 == null) {
jButton3 = new JButton();
jButton3.setFont(new java.awt.Font("MS Pゴシック", 0, 12));
jButton3.setBounds(new Rectangle(51, 236, 252, 30));
jButton3.setText("\"修正\"でコンボボックスを選択");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
lboxCombo.SelectByText("修正");
}
});
}
return jButton3;
}
/**
* This method initializes jButton4
*
* @return javax.swing.JButton
*/
private JButton getJButton4() {
if (jButton4 == null) {
jButton4 = new JButton();
jButton4.setFont(new java.awt.Font("MS Pゴシック", 0, 12));
jButton4.setBounds(new Rectangle(51, 273, 252, 30));
jButton4.setText("選択されたテキスト");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
JOptionPane.showMessageDialog(null,lboxCombo.SelectedText());
}
});
}
return jButton4;
}
/**
* This method initializes jButton5
*
* @return javax.swing.JButton
*/
private JButton getJButton5() {
if (jButton5 == null) {
jButton5 = new JButton();
jButton5.setFont(new java.awt.Font("MS Pゴシック", 0, 12));
jButton5.setBounds(new Rectangle(51, 310, 252, 30));
jButton5.setText("選択された値");
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
JOptionPane.showMessageDialog(null,lboxCombo.SelectedData());
}
});
}
return jButton5;
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO 自動生成されたメソッド・スタブ
SwingUtilities.invokeLater(new Runnable() {
public void run() {
SBUN thisClass = new SBUN();
thisClass.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
thisClass.setVisible(true);
}
});
}
/**
* This is the default constructor
*/
public SBUN() {
super();
initialize();
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setSize(371, 417);
this.setContentPane(getJPanel());
this.setTitle("JFrame");
this.lboxCombo.Add("新規", 1);
this.lboxCombo.Add("修正", 2);
this.lboxCombo.Add("削除", 9);
this.lboxCombo.Select(-1);
}
} // @jve:decl-index=0:visual-constraint="20,20"
| |