/* * This file is part of the Remote Sensor Actuator Interface (ReSAI). * * Copyright(c) Andreas Kipp, Frederic Siepmann * http://opensource.cit-ec.de/projects/resai * * This file may be licensed under the terms of of the * GNU Lesser General Public License Version 3 (the ``LGPL''), * or (at your option) any later version. * * Software distributed under the License is distributed * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either * express or implied. See the LGPL for the specific language * governing rights and limitations. * * You should have received a copy of the LGPL along with this * program. If not, go to http://www.gnu.org/licenses/lgpl.html * or write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The development of this software was supported by the * Excellence Cluster EXC 277 Cognitive Interaction Technology. * The Excellence Cluster EXC 277 is a grant of the Deutsche * Forschungsgemeinschaft (DFG) in the context of the German * Excellence Initiative. * */ /** * Login GUI. * * @author akipp */ package de.unibi.airobots.resaijavaclient.gui; import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Toolkit; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JPasswordField; import javax.swing.JProgressBar; import javax.swing.JTextField; public class Login { private JFrame frame = new JFrame("ReSAI JAVA Client"); private static final long serialVersionUID = 1L; private JLabel lblUsername = new JLabel("Username:"); private JLabel lblPassword = new JLabel("Password:"); private JLabel lblServer = new JLabel("Server:"); private JLabel lblPort = new JLabel("Port:"); private JLabel lblServerAccount = new JLabel("Serveraccount:"); private JTextField txtUsername = new JTextField(20); private JPasswordField txtPassword= new JPasswordField(20); private JTextField txtServer = new JTextField(20); private JTextField txtPort = new JTextField(20); private JTextField txtServerAccount = new JTextField(20); private JButton btnLogin = new JButton("Login"); private JButton btnCancel = new JButton("Cancel"); private JProgressBar progBar = new JProgressBar(0, 6); public Login() { frame.setTitle("ReSAI JAVA Client"); txtUsername.setText("andiroid3"); txtPassword.setText("hallowelt"); txtPort.setText("5222"); txtServer.setText("jabber.rootbash.com"); txtServerAccount.setText("andiroid1@jabber.rootbash.com"); JPanel pane = new JPanel(); pane.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy = 0; pane.add(lblServer,c); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 1; c.gridy = 0; pane.add(txtServer,c); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy = 1; pane.add(lblPort,c); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 1; c.gridy = 1; pane.add(txtPort,c); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy = 2; pane.add(lblServerAccount,c); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 1; c.gridy = 2; pane.add(txtServerAccount,c); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy = 3; pane.add(lblUsername,c); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 1; c.gridy = 3; pane.add(txtUsername,c); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy = 4; pane.add(lblPassword,c); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 1; c.gridy = 4; pane.add(txtPassword,c); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy = 5; pane.add(btnLogin,c); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 1; c.gridy = 5; pane.add(btnCancel,c); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy = 6; c.gridwidth = 2; pane.add(progBar,c); progBar.setEnabled(false); frame.add(pane); frame.pack(); frame.setVisible(true); Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); frame.setLocation((int) dim.getWidth() / 2 - frame.getSize().width / 2, (int) dim.getHeight() / 2 - frame.getSize().height / 2); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } public JTextField getTxtUsername() { return txtUsername; } public void setTxtUsername(JTextField txtUsername) { this.txtUsername = txtUsername; } public JPasswordField getTxtPassword() { return txtPassword; } public void setTxtPassword(JPasswordField txtPassword) { this.txtPassword = txtPassword; } public JTextField getTxtServer() { return txtServer; } public void setTxtServer(JTextField txtServer) { this.txtServer = txtServer; } public JTextField getTxtPort() { return txtPort; } public void setTxtPort(JTextField txtPort) { this.txtPort = txtPort; } public JButton getBtnLogin() { return btnLogin; } public void setBtnLogin(JButton btnLogin) { this.btnLogin = btnLogin; } public JButton getBtnCancel() { return btnCancel; } public void setBtnCancel(JButton btnCancel) { this.btnCancel = btnCancel; } public void close() { frame.dispose(); } public void setProgBar(JProgressBar progBar) { this.progBar = progBar; } public JProgressBar getProgBar() { return progBar; } public JTextField getTxtServerAccount() { return txtServerAccount; } public void setTxtServerAccount(JTextField txtServerAccount) { this.txtServerAccount = txtServerAccount; } }