Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * MonitorFotovoltaicoApp.java
- */
- package monitorfotovoltaico;
- import bancoDeDados.AcessoBD;
- import java.sql.Timestamp;
- import org.jdesktop.application.Application;
- import org.jdesktop.application.SingleFrameApplication;
- /**
- * The main class of the application.
- */
- public class MonitorFotovoltaicoApp extends SingleFrameApplication{
- //nome do driver JDBC e URL do banco de dados
- static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
- static final String DATABASE_URL = "jdbc:mysql://localhost/fotovoltaico";
- static final String USERNAME = "root";
- static final String PASSWORD = "root";
- static AcessoBD acessoBD;
- /*public MonitorFotovoltaicoApp()
- {
- acessoBD = new AcessoBD(JDBC_DRIVER, DATABASE_URL, USERNAME, PASSWORD);
- }*/
- /**
- * At startup create and show the main frame of the application.
- */
- @Override protected void startup() {
- show(new MonitorFotovoltaicoView(this));
- }
- /**
- * This method is to initialize the specified window by injecting resources.
- * Windows shown in our application come fully initialized from the GUI
- * builder, so this additional configuration is not needed.
- */
- @Override protected void configureWindow(java.awt.Window root) {
- }
- /**
- * A convenient static getter for the application instance.
- * @return the instance of MonitorFotovoltaicoApp
- */
- public static MonitorFotovoltaicoApp getApplication() {
- return Application.getInstance(MonitorFotovoltaicoApp.class);
- }
- /**
- * Main method launching the application.
- */
- public static void main(String[] args)
- {
- launch(MonitorFotovoltaicoApp.class, args);
- acessoBD = new AcessoBD(JDBC_DRIVER, DATABASE_URL, USERNAME, PASSWORD);
- acessoBD.consultarBanco();
- MyMetodos myMetodos = new MyMetodos();
- System.out.printf("%s\n", myMetodos.getCurrentTimestamp());
- System.out.printf("%s\n", this.getCurrentTimestamp()); // nao aceita???
- //new MonitorFotovoltaicoApp();
- }
- public String getCurrentTimestamp()
- {
- Timestamp current_timestamp = new Timestamp(System.currentTimeMillis());
- String my_timestamp = current_timestamp.toString();
- return my_timestamp.substring(0, 19);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement