Browse Source

curr

master
esoe 3 years ago
parent
commit
aa65dd059e
  1. 9
      src/main/java/ru/egspt/moodle/Access.java
  2. 4
      src/main/java/ru/egspt/moodle/App.java
  3. 4
      src/main/java/ru/egspt/moodle/Base.java
  4. 78
      src/main/java/ru/egspt/moodle/panel/Account.java
  5. 5
      src/main/java/ru/egspt/moodle/panel/Controls.java
  6. 5
      src/main/java/ru/egspt/moodle/panel/CurrentList.java
  7. 5
      src/main/java/ru/egspt/moodle/panel/CurrentTag.java
  8. 0
      src/main/java/ru/egspt/moodle/panel/ReportSample.java
  9. 5
      src/main/java/ru/egspt/moodle/panel/ReportUser.java
  10. 5
      src/main/java/ru/egspt/moodle/panel/Users.java
  11. BIN
      target/classes/ru/egspt/moodle/Access.class
  12. BIN
      target/classes/ru/egspt/moodle/App.class
  13. BIN
      target/classes/ru/egspt/moodle/Base.class
  14. BIN
      target/classes/ru/egspt/moodle/panel/Account$1.class
  15. BIN
      target/classes/ru/egspt/moodle/panel/Account.class
  16. BIN
      target/classes/ru/egspt/moodle/panel/Controls.class
  17. BIN
      target/classes/ru/egspt/moodle/panel/CurrentList.class
  18. BIN
      target/classes/ru/egspt/moodle/panel/CurrentTag.class
  19. BIN
      target/classes/ru/egspt/moodle/panel/ReportUser.class
  20. BIN
      target/classes/ru/egspt/moodle/panel/Users.class

9
src/main/java/ru/egspt/moodle/Access.java

@ -26,12 +26,18 @@ public class Access { @@ -26,12 +26,18 @@ public class Access {
public static void setUserName() {
Access.userName = JOptionPane.showInputDialog("Укажите имя пользователя базы данных:");
}
public static void setUserName(String username){
Access.userName = username;
}
/**
* @param password the password to set
*/
public static void setPassword() {
Access.password = JOptionPane.showInputDialog("Укажите пароль пользователя базы данных:");
}
public static void setPassword(String password){
Access.password = password;
}
/**
* @param url the url to set
*/
@ -39,6 +45,9 @@ public class Access { @@ -39,6 +45,9 @@ public class Access {
String u = JOptionPane.showInputDialog("Укажите url базы данных:");
Access.url = "jdbc:MySQL://" + u + ":3306/moodle";
}
public static void setUrl(String url) {
Access.url = "jdbc:MySQL://" + url + ":3306/moodle";
}
}

4
src/main/java/ru/egspt/moodle/App.java

@ -10,12 +10,10 @@ import javax.swing.WindowConstants; @@ -10,12 +10,10 @@ import javax.swing.WindowConstants;
*
*/
public class App extends JPanel {
JFrame mainframe = new JFrame("mainframe");
JFrame mainframe = new JFrame("moodle-anyreport");
//Заполняем панельку компонентами
App(){
}
//устанавливаем панельку на форму
public void init(){

4
src/main/java/ru/egspt/moodle/Base.java

@ -28,6 +28,9 @@ import org.apache.poi.ss.usermodel.Cell; @@ -28,6 +28,9 @@ import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import ru.egspt.moodle.panel.Account;
import java.util.ArrayList;
import javax.swing.JOptionPane;
@ -445,6 +448,7 @@ public class Base { @@ -445,6 +448,7 @@ public class Base {
System.out.println("Подключение к серверу баз данных ...");
Connection conn = null;
try{
//new Account().init();
//данные аккаунта
String userName = Access.getUserName();
String password = Access.getPassword();

78
src/main/java/ru/egspt/moodle/panel/Account.java

@ -0,0 +1,78 @@ @@ -0,0 +1,78 @@
package ru.egspt.moodle.panel;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
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.Access;
public class Account 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 urlLabel = new JLabel("Адрес сервера: ");
private JTextField urlField = new JTextField(25);
private JButton connButton = new JButton("Подключиться");
private JButton connCloseButton = new JButton("Отключиться");
public Account(){
loginField.setText("esoe");//значения по умолчанию
urlField.setText("www.egspt.ru");//значения по умолчанию
this.add(loginLabel);
this.add(loginField);
this.add(passLabel);
this.add(passField);
this.add(urlLabel);
this.add(urlField);
this.add(connButton);
this.add(connCloseButton);
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);
}
public void init(){
JFrame mainframe = new JFrame("connaction");
mainframe.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
mainframe.add(this);
mainframe.setSize(320, 240);
mainframe.setVisible(true);
//настройка кнопки connButton
connButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.out.println("Нажата кнопка Connect");
Access.setUserName(loginField.getText());
Access.setPassword(String.valueOf(passField.getPassword()));
Access.setUrl(urlField.getText());
//tmpFrame.dispose();
System.out.println(Access.getUserName());
System.out.println(Access.getPassword());
System.out.println(Access.getURL());
mainframe.dispose();
}
});
}
public static void main( String[] args )
{
System.out.println( "Проверка работоспособности класса Account ..." );
Account acc = new Account();
acc.init();
}
}

5
src/main/java/ru/egspt/moodle/panel/Controls.java

@ -0,0 +1,5 @@ @@ -0,0 +1,5 @@
package ru.egspt.moodle.panel;
public class Controls {
}

5
src/main/java/ru/egspt/moodle/panel/CurrentList.java

@ -0,0 +1,5 @@ @@ -0,0 +1,5 @@
package ru.egspt.moodle.panel;
public class CurrentList {
}

5
src/main/java/ru/egspt/moodle/panel/CurrentTag.java

@ -0,0 +1,5 @@ @@ -0,0 +1,5 @@
package ru.egspt.moodle.panel;
public class CurrentTag {
}

0
src/main/java/ru/egspt/moodle/panel/ReportSample.java

5
src/main/java/ru/egspt/moodle/panel/ReportUser.java

@ -0,0 +1,5 @@ @@ -0,0 +1,5 @@
package ru.egspt.moodle.panel;
public class ReportUser {
}

5
src/main/java/ru/egspt/moodle/panel/Users.java

@ -0,0 +1,5 @@ @@ -0,0 +1,5 @@
package ru.egspt.moodle.panel;
public class Users {
}

BIN
target/classes/ru/egspt/moodle/Access.class

Binary file not shown.

BIN
target/classes/ru/egspt/moodle/App.class

Binary file not shown.

BIN
target/classes/ru/egspt/moodle/Base.class

Binary file not shown.

BIN
target/classes/ru/egspt/moodle/panel/Account$1.class

Binary file not shown.

BIN
target/classes/ru/egspt/moodle/panel/Account.class

Binary file not shown.

BIN
target/classes/ru/egspt/moodle/panel/Controls.class

Binary file not shown.

BIN
target/classes/ru/egspt/moodle/panel/CurrentList.class

Binary file not shown.

BIN
target/classes/ru/egspt/moodle/panel/CurrentTag.class

Binary file not shown.

BIN
target/classes/ru/egspt/moodle/panel/ReportUser.class

Binary file not shown.

BIN
target/classes/ru/egspt/moodle/panel/Users.class

Binary file not shown.
Loading…
Cancel
Save