00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 package org.objectweb.cjdbc.console.gui.frames.jmxdesktop;
00026
00027 import java.awt.BorderLayout;
00028 import java.awt.GridLayout;
00029 import java.awt.event.ActionEvent;
00030 import java.awt.event.ActionListener;
00031
00032 import javax.swing.JButton;
00033 import javax.swing.JDialog;
00034 import javax.swing.JLabel;
00035 import javax.swing.JTextField;
00036
00037 import org.objectweb.cjdbc.common.i18n.GuiTranslate;
00038 import org.objectweb.cjdbc.console.gui.CjdbcGui;
00039 import org.objectweb.cjdbc.console.gui.constants.GuiCommands;
00040 import org.objectweb.cjdbc.console.gui.constants.GuiConstants;
00041
00042
00043
00044
00045
00046
00047
00048 public class SetSubjectDialog extends JDialog implements ActionListener
00049 {
00050
00051 private JTextField user;
00052 private JTextField password;
00053 private CjdbcGui gui;
00054
00055
00056
00057
00058
00059
00060 public SetSubjectDialog(CjdbcGui gui)
00061 {
00062 super(gui, "Set Subject", true);
00063 GuiConstants.centerComponent(this, 300, 100);
00064
00065 this.getContentPane().setLayout(new BorderLayout());
00066 this.getContentPane().setLayout(new GridLayout(3, 2));
00067
00068 user = new JTextField("");
00069 JLabel userLabel = new JLabel("User");
00070 this.getContentPane().add(userLabel);
00071 this.getContentPane().add(user);
00072
00073 password = new JTextField("");
00074 JLabel passwordLabel = new JLabel("Password");
00075 this.getContentPane().add(passwordLabel);
00076 this.getContentPane().add(password);
00077
00078 JButton ok = new JButton(GuiTranslate
00079 .get("frame.ok"));
00080 ok.setActionCommand(GuiCommands.COMMAND_CONFIRM_ACTION);
00081 ok.addActionListener(this);
00082 this.getContentPane().add(ok);
00083
00084 JButton cancel = new JButton(GuiTranslate
00085 .get("frame.cancel"));
00086 cancel.setActionCommand(GuiCommands.COMMAND_CANCEL_ACTION);
00087 cancel.addActionListener(this);
00088 this.getContentPane().add(cancel);
00089
00090 this.validate();
00091 this.gui = gui;
00092 this.setVisible(true);
00093
00094 }
00095
00096
00097
00098
00099 public void actionPerformed(ActionEvent e)
00100 {
00101 if (e.getActionCommand().equalsIgnoreCase(
00102 GuiCommands.COMMAND_CONFIRM_ACTION))
00103 {
00104 gui.getCurrentJmxClient().setCurrentSubject(user.getText(),
00105 password.getText());
00106 this.setVisible(false);
00107 }
00108 else if (e.getActionCommand().equalsIgnoreCase(
00109 GuiCommands.COMMAND_CANCEL_ACTION))
00110 {
00111 this.setVisible(false);
00112 }
00113 }
00114 }