You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
2.9 KiB

package main.java.ru.egspt.moodle;
import javax.swing.JPanel;
import java.awt.Color;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.WindowConstants;
import javax.swing.border.LineBorder;
import javax.swing.border.TitledBorder;
//import ru.egspt.moodle.events.ConnactionListener;
//import ru.egspt.moodle.events.DisconnectionListener;
public class AccessPane extends JPanel {
private JLabel loginLabel = new JLabel("Имя пользователя: ");
private JTextField loginField = new JTextField(25);
private JLabel passLabel = new JLabel("Пароль: ");
private JPasswordField passField = new JPasswordField(25);
private JLabel linkLabel = new JLabel("Адрес сервера: ");
private JTextField linkField = new JTextField(25);
private JButton connButton = new JButton("Подключиться");
private JButton DisconnButton = new JButton("Отключиться");
public AccessPane(Base base){
loginField.setText("esoe");//значения по умолчанию
linkField.setText("www.egspt.ru");//значения по умолчанию
this.add(loginLabel);
this.add(loginField);
this.add(passLabel);
this.add(passField);
this.add(linkLabel);
this.add(linkField);
this.add(connButton);
//настройка кнопки connButton
connButton.addActionListener(e -> BaseControls.ConnectToServer(base, this));
this.add(DisconnButton);
DisconnButton.addActionListener(e -> BaseControls.DisconnectFromServer(base));
TitledBorder border = new TitledBorder(new LineBorder(Color.black), "connection to mysql", TitledBorder.CENTER, TitledBorder.CENTER);
this.setBorder(border);
//this.setBorder(BorderFactory.createTitledBorder("аккаунт сервера базы данных"));
this.setSize(320, 240);
this.setVisible(true);
}
/**
* @return the loginField
*/
public JTextField getLoginField() {
return loginField;
}
/**
* @return the passField
*/
public JPasswordField getPassField() {
return passField;
}
/**
* @return the urlField
*/
public JTextField getLinkField() {
return linkField;
}
public static void main( String[] args ){
Base base = new Base();
//Data data;
System.out.println( "Проверка работоспособности класса Account ..." );
JFrame mainframe = new JFrame("connaction");
AccessPane acc = new AccessPane(base);
mainframe.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
mainframe.add(acc);
mainframe.setSize(320, 240);
mainframe.setVisible(true);
}
}