List of usage examples for javax.swing JOptionPane showMessageDialog
public static void showMessageDialog(Component parentComponent, Object message) throws HeadlessException
From source file:br.com.tiagods.util.FTPUpload.java
public boolean uploadFile(File arquivo, String novoNome) { FTPConfig cf = FTPConfig.getInstance(); FTPClient ftp = new FTPClient(); try {//w w w .j a va 2s . c o m ftp.connect(cf.getValue("host"), Integer.parseInt(cf.getValue("port"))); ftp.login(cf.getValue("user"), cf.getValue("pass")); //ftp.connect(server,port); //ftp.login(user,pass); ftp.enterLocalPassiveMode(); ftp.setFileType(FTP.BINARY_FILE_TYPE); boolean done; try (InputStream stream = new FileInputStream(arquivo)) { String remoteFile = novoNome; System.out.println("Start uploading first file"); done = ftp.storeFile(cf.getValue("dirFTP") + "/" + remoteFile, stream); stream.close(); } if (done) { JOptionPane.showMessageDialog(null, "Arquivo enviado com sucesso!"); return true; } return false; } catch (IOException e) { System.out.println("Erro = " + e.getMessage()); return false; } finally { try { if (ftp.isConnected()) { ftp.logout(); ftp.disconnect(); } } catch (IOException ex) { ex.printStackTrace(); } } }
From source file:framework.classes.PoolConexion.java
/** * CONFIGURE CONNECTION//from w ww . j a va 2 s. co m */ public static void iniciar_BasicDataSourceFactory() { Properties propiedades = new Properties(); /* setMaxActive(): N mx de conexiones que se pueden abrir simultneamente. setMinIdle(): N mn de conexiones inactivas que queremos que haya. Si el n de conexiones baja de este n, se abriran ms. setMaxIdle(): N mx de conexiones inactivas que queremos que haya. Si hay ms, se irn cerrando. */ propiedades.setProperty("driverClassName", "com.mysql.jdbc.Driver"); propiedades.setProperty("url", "jdbc:mysql://127.0.0.1:3306/SQL_BD"); propiedades.setProperty("maxActive", "10"); propiedades.setProperty("maxIdle", "8"); propiedades.setProperty("minIdle", "0"); propiedades.setProperty("maxWait", "500"); propiedades.setProperty("initialSize", "5"); propiedades.setProperty("defaultAutoCommit", "true"); propiedades.setProperty("username", "root"); propiedades.setProperty("password", "root"); propiedades.setProperty("validationQuery", "select 1"); propiedades.setProperty("validationQueryTimeout", "100"); propiedades.setProperty("initConnectionSqls", "SELECT 1;SELECT 2"); propiedades.setProperty("poolPreparedStatements", "true"); propiedades.setProperty("maxOpenPreparedStatements", "10"); try { //propiedades.load(new FileInputStream("src/config/datasource_config.properties")); dataSource = (BasicDataSource) BasicDataSourceFactory.createDataSource(propiedades); } catch (Exception e) { JOptionPane.showMessageDialog(null, e.toString()); } }
From source file:hr.fer.zemris.vhdllab.platform.ui.command.DevShowModalDialogCommand.java
@Override protected void doExecuteCommand() { Frame owner = Application.instance().getActiveWindow().getControl(); JOptionPane.showMessageDialog(owner, "is it modal?"); }
From source file:application.bbdd.pool.java
public static void inicializa_BasicDataSourceFactory() { Properties propiedades = new Properties(); /*//from w ww . ja v a 2s . c om setMaxActive(): N mx de conexiones que se pueden abrir simultneamente. setMinIdle(): N mn de conexiones inactivas que queremos que haya. Si el n de conexiones baja de este n, se abriran ms. setMaxIdle(): N mx de conexiones inactivas que queremos que haya. Si hay ms, se irn cerrando. */ propiedades.setProperty("driverClassName", "com.mysql.jdbc.Driver"); propiedades.setProperty("url", "jdbc:mysql://127.0.0.1:3306/application"); propiedades.setProperty("maxActive", "10"); propiedades.setProperty("maxIdle", "8"); propiedades.setProperty("minIdle", "0"); propiedades.setProperty("maxWait", "500"); propiedades.setProperty("initialSize", "5"); propiedades.setProperty("defaultAutoCommit", "true"); propiedades.setProperty("username", "root"); propiedades.setProperty("password", "1234"); propiedades.setProperty("validationQuery", "select 1"); propiedades.setProperty("validationQueryTimeout", "100"); propiedades.setProperty("initConnectionSqls", "SELECT 1;SELECT 2"); propiedades.setProperty("poolPreparedStatements", "true"); propiedades.setProperty("maxOpenPreparedStatements", "10"); try { //propiedades.load(new FileInputStream("src/config/datasource_config.properties")); dataSource = (BasicDataSource) BasicDataSourceFactory.createDataSource(propiedades); } catch (Exception e) { JOptionPane.showMessageDialog(null, e.toString()); } }
From source file:finale.year.stage.utility.Util.java
public static boolean isAv(JFrame frame) { //Try to access the server try {/*from ww w. ja v a2 s . co m*/ final URL url = new URL(ROOT); final URLConnection con = url.openConnection(); con.connect(); } catch (MalformedURLException e) { JOptionPane.showMessageDialog(frame, "Check Internet Connection"); } catch (IOException ex) { JOptionPane.showMessageDialog(frame, "Check Internet Connection"); return false; } return true; }
From source file:classes.connectionPool.java
public static Connection getConexion() { Connection con = null;/*from ww w . j ava 2s. co m*/ try { con = dataSource.getConnection(); } catch (SQLException e) { JOptionPane.showMessageDialog(null, e.toString()); } return con; }
From source file:banking.modules.salary_comp.java
private void Sal_table() { try {/* ww w .ja v a 2 s . c o m*/ String sql = "select * from salary_components"; pst = conn.prepareStatement(sql); rs = pst.executeQuery(); table_salary_comp.setModel(DbUtils.resultSetToTableModel(rs)); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } { } }
From source file:Classes.DBConnection.java
/** * Closes a connection to database //from w ww . j a va 2 s.c om * @param con is the connection to close */ public void CloseConnection(Connection con) { try { if (con != null) { con.close(); } } catch (SQLException e) { JOptionPane.showMessageDialog(null, "Ha sido imposible cerrar la conexion!"); } }
From source file:WebBrowserBasedOnJEditorPane.java
public WebBrowserBasedOnJEditorPane() { setDefaultCloseOperation(EXIT_ON_CLOSE); JPanel pnlURL = new JPanel(); pnlURL.setLayout(new BorderLayout()); pnlURL.add(new JLabel("URL: "), BorderLayout.WEST); pnlURL.add(txtURL, BorderLayout.CENTER); getContentPane().add(pnlURL, BorderLayout.NORTH); getContentPane().add(ep, BorderLayout.CENTER); getContentPane().add(lblStatus, BorderLayout.SOUTH); ActionListener al = new ActionListener() { public void actionPerformed(ActionEvent ae) { try { String url = ae.getActionCommand().toLowerCase(); if (url.startsWith("http://")) url = url.substring(7); ep.setPage("http://" + IDN.toASCII(url)); } catch (Exception e) { e.printStackTrace();/* www . ja v a2 s. c om*/ JOptionPane.showMessageDialog(WebBrowserBasedOnJEditorPane.this, "Browser problem: " + e.getMessage()); } } }; txtURL.addActionListener(al); setSize(300, 300); setVisible(true); }
From source file:gephi.spade.panel.FCSOperations.java
public FCSOperations(File inputFile) throws FileNotFoundException, IOException { this(new fcsFile(inputFile, true)); JOptionPane.showMessageDialog(null, "line 32"); }