src/org/objectweb/cjdbc/console/gui/frames/GuiVirtualDatabaseLoginFrame.java

説明を見る。
00001 00025 package org.objectweb.cjdbc.console.gui.frames; 00026 00027 import java.awt.Dimension; 00028 import java.awt.FlowLayout; 00029 import java.awt.Toolkit; 00030 import java.awt.event.ActionListener; 00031 00032 import javax.swing.JButton; 00033 import javax.swing.JDialog; 00034 import javax.swing.JFrame; 00035 import javax.swing.JLabel; 00036 import javax.swing.JPasswordField; 00037 import javax.swing.JTextField; 00038 import javax.swing.WindowConstants; 00039 00040 import org.objectweb.cjdbc.common.i18n.GuiTranslate; 00041 import org.objectweb.cjdbc.console.gui.constants.GuiCommands; 00042 import org.objectweb.cjdbc.console.gui.session.GuiSession; 00043 00050 public class GuiVirtualDatabaseLoginFrame extends JDialog 00051 { 00052 private JPasswordField passwordBox; 00053 private JTextField loginBox; 00054 private ActionListener actionListener; 00055 private String databaseName; 00056 private String controllerHost; 00057 private String controllerPort; 00058 00069 public GuiVirtualDatabaseLoginFrame(JFrame parent, ActionListener listener, 00070 String databaseName, String controllerHost, String controllerPort, 00071 GuiSession session) 00072 00073 { 00074 super(parent, GuiTranslate.get("frame.database.title", databaseName), true); 00075 00076 this.actionListener = listener; 00077 this.controllerHost = controllerHost; 00078 this.controllerPort = controllerPort; 00079 Toolkit toolkit = Toolkit.getDefaultToolkit(); 00080 Dimension dim = toolkit.getScreenSize(); 00081 int screenHeight = dim.height; 00082 int screenWidth = dim.width; 00083 int frameWidth = 450; 00084 int frameHeight = 80; 00085 this.setBounds((screenWidth - frameWidth) / 2, 00086 (screenHeight - frameHeight) / 2, frameWidth, frameHeight); 00087 this.validate(); 00088 this.setVisible(false); 00089 this.setResizable(false); 00090 this.getContentPane().setLayout(new FlowLayout()); 00091 this.databaseName = databaseName; 00092 00093 Dimension buttonDim = new Dimension(80, 20); 00094 00095 this.getContentPane().add(new JLabel(GuiTranslate.get("frame.database.login"))); 00096 loginBox = new JTextField(0); 00097 loginBox.setAlignmentX(CENTER_ALIGNMENT); 00098 String login = session.getAuthenticatedDatabaseLogin(databaseName); 00099 if (login != null) 00100 loginBox.setText(login); 00101 loginBox.setPreferredSize(buttonDim); 00102 loginBox.addActionListener(actionListener); 00103 this.getContentPane().add(loginBox); 00104 00105 this.getContentPane().add(new JLabel(GuiTranslate.get("frame.database.password"))); 00106 passwordBox = new JPasswordField(0); 00107 passwordBox.setPreferredSize(buttonDim); 00108 String pass = session.getAuthenticatedDatabasePassword(databaseName); 00109 if (pass != null) 00110 passwordBox.setText(pass); 00111 passwordBox.setAlignmentX(CENTER_ALIGNMENT); 00112 passwordBox.addActionListener(actionListener); 00113 this.getContentPane().add(passwordBox); 00114 00115 JButton optionConfirm = new JButton(GuiTranslate 00116 .get("frame.database.approve")); 00117 optionConfirm.setActionCommand(GuiCommands.COMMAND_DATABASE_AUTHENTICATE); 00118 optionConfirm.addActionListener(actionListener); 00119 this.getContentPane().add(optionConfirm); 00120 this.validate(); 00121 setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); 00122 } 00123 00129 public JTextField getLoginBox() 00130 { 00131 return loginBox; 00132 } 00133 00139 public JTextField getPasswordBox() 00140 { 00141 return passwordBox; 00142 } 00143 00149 public String getDatabaseName() 00150 { 00151 return databaseName; 00152 } 00153 00159 public String getControllerHost() 00160 { 00161 return controllerHost; 00162 } 00163 00169 public String getControllerPort() 00170 { 00171 return controllerPort; 00172 } 00173 }

CJDBCversion1.0.4に対してTue Oct 12 15:15:58 2004に生成されました。 doxygen 1.3.8