|
Mostrar Mensajes
|
Páginas: 1 [2] 3
|
11
|
Programación / Java / Re: Bloquear pantalla
|
en: 9 Septiembre 2013, 17:40 pm
|
Me pasa algo raro, lo corro en el Eclipse y funciona a la perfeccion, una vez que acaba que cierro el programa ya no puedo volver a abrir la consola y ni el task manager, pero ese no es el problema, lo que note, es que si lo hago jar y lo ejecuto, si me permite abrir la consola
|
|
|
12
|
Programación / Java / Re: Bloquear pantalla
|
en: 9 Septiembre 2013, 17:09 pm
|
Puede ser algo provisional o chapusera como dices tu, pero es una alternativa al problema =P Para esto hay que tener ingenio y la verdad eso nunca se me ocurrio xD pero soluciona el problema que teniamos que es lo importante jajaja
|
|
|
13
|
Programación / Java / Re: Bloquear pantalla
|
en: 9 Septiembre 2013, 14:50 pm
|
El codigo es parecido al que puse, pero tiene una pequeña falla de seguridad. En windows 7 si presionas Windows + tab te deja desplazarte entre las ventanas y aunque regreses a la ventana del programa presionas windows+r y escribes cmd y si te abre la consola aunque no mires lo que haces y ahi se puede finalizar el proceso. Esa es la falla mas importante que tiene, la otra es que si tengo dos monitores, con pasar el administrador de tareas al segundo monitor puedo finalizar el programa.
|
|
|
14
|
Programación / Java / Re: Bloquear pantalla
|
en: 6 Septiembre 2013, 18:17 pm
|
Andube investigando, y encontre este codigo en una pagina, el cual puedo modificar para hacer lo que necesito, pero la situacion es esta. Si los datos que meten en el campo de texto son correctos, debe desbloquear la pantalla, hasta ahi no hay ningun problema, el problema es que de ahi usan una aplicacion hecha por un provedor y al final imprime una etiqueta, se puede saber cuando cambia el estado de impresion para que cuando imprima volver a bloquear la pantalla y que asi se este repitiendo? Este es el codigo que encontre: import javax.swing.JOptionPane; /** * @web http://www.jc-mouse.net/ * @author Mouse */ public class jFrameBlocked extends javax.swing.JFrame {
/** * Creates new form jFrameBlocked */ public jFrameBlocked() { this.setUndecorated(true);//quita bordes a jframe initComponents(); this.setDefaultCloseOperation( DO_NOTHING_ON_CLOSE );//evita cerra jframe con ALT+C this.setExtendedState( MAXIMIZED_BOTH );//maximizado this.setAlwaysOnTop(true);//siempre al frente //nueva instancia de jBlocked pasando como parametros e este JFrame new jBlocked( this ).block(); }
/** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints;
jPanel1 = new javax.swing.JPanel(); jPanel2 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); user = new javax.swing.JTextField(); pass = new javax.swing.JTextField(); btnSalir = new javax.swing.JButton(); btnEntrar = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jPanel1.setBackground(new java.awt.Color(51, 51, 255)); jPanel1.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1)); jPanel1.setLayout(new java.awt.GridBagLayout());
jPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder()); jPanel2.setLayout(new java.awt.GridBagLayout());
jLabel1.setText("Usuario :"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(40, 40, 5, 5); jPanel2.add(jLabel1, gridBagConstraints);
jLabel2.setText("Contraseña :"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(5, 40, 5, 5); jPanel2.add(jLabel2, gridBagConstraints);
user.setPreferredSize(new java.awt.Dimension(200, 32)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(40, 5, 5, 40); jPanel2.add(user, gridBagConstraints);
pass.setPreferredSize(new java.awt.Dimension(200, 32)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; gridBagConstraints.gridwidth = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 40); jPanel2.add(pass, gridBagConstraints);
btnSalir.setText("Cancelar"); btnSalir.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnSalirActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(30, 10, 40, 0); jPanel2.add(btnSalir, gridBagConstraints);
btnEntrar.setText("Entrar"); btnEntrar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnEntrarActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(30, 0, 40, 0); jPanel2.add(btnEntrar, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; jPanel1.add(jPanel2, gridBagConstraints);
getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);
pack(); }// </editor-fold>//GEN-END:initComponents
private void btnSalirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSalirActionPerformed System.exit(0); }//GEN-LAST:event_btnSalirActionPerformed
private void btnEntrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEntrarActionPerformed if( this.user.getText().equals("user") && this.pass.getText().equals("1234") ) { new jFrameGUI().setVisible(true); this.dispose(); } else { JOptionPane.showMessageDialog( this, "Access denied"); } }//GEN-LAST:event_btnEntrarActionPerformed
/** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(jFrameBlocked.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(jFrameBlocked.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(jFrameBlocked.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(jFrameBlocked.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold>
/* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new jFrameBlocked().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnEntrar; private javax.swing.JButton btnSalir; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JTextField pass; private javax.swing.JTextField user; // End of variables declaration//GEN-END:variables }
import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import javax.swing.JFrame; /** * @web http://www.jc-mouse.net/ * @author Mouse */ public class jBlocked { private JFrame jframe=null; /** * Constructor de clase */ public jBlocked( JFrame f ) { this.jframe = f; } /** * ejecuta una tarea cada "n" tiempo * Para evitar que el usuario utilice las teclas (WINDOWS + D)(TAB) y asi perder el foco * de la aplicación, cada 50 milisegundos se envia el JFrame al frente y se cambia su propiedad a maximizado */ public void block() { ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor(); scheduler.scheduleAtFixedRate( new Runnable() { @Override public void run() { front(); } }, 500, 50 , TimeUnit.MILLISECONDS ); //comienza dentro de 1/2 segundo y luego se repite cada N segundos } /** * */ public void front() { jframe.setExtendedState( JFrame.MAXIMIZED_BOTH );//maximizado jframe.toFront(); } }//--> fin
public class jFrameGUI extends javax.swing.JFrame {
/** * Creates new form jFrameGUI */ public jFrameGUI() { initComponents(); this.setLocationRelativeTo(null);//posicion al centro de la pantalla this.setAlwaysOnTop(true);//siempre al frente }
/** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints;
jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Access granted"); getContentPane().setLayout(new java.awt.GridBagLayout());
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 36)); // NOI18N jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel1.setText("Congratulations"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.insets = new java.awt.Insets(40, 100, 10, 100); getContentPane().add(jLabel1, gridBagConstraints);
jLabel2.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel2.setText("Access granted"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.insets = new java.awt.Insets(10, 10, 50, 10); getContentPane().add(jLabel2, gridBagConstraints);
pack(); }// </editor-fold>//GEN-END:initComponents
/** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(jFrameGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(jFrameGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(jFrameGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(jFrameGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold>
/* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new jFrameGUI().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; // End of variables declaration//GEN-END:variables }
|
|
|
15
|
Programación / Java / Bloquear pantalla
|
en: 6 Septiembre 2013, 15:34 pm
|
Necesito hacer un programa, el cual si no se llena cierta informacion en un Textfield que no te permita cambiarte de ventana dentro de windows, osea que no puedas quitar el programa hasta que llenes la informacion que se necesita, existe alguna funcion o algo para hacer esto?
|
|
|
17
|
Programación / Java / Almacenar valor devuelto por el CMD
|
en: 4 Septiembre 2013, 23:26 pm
|
Tengo un programa en java, que usa un comando de la consola, pero quisiera poder el almacenar el valor que devuelve en una variable para saber que usuario esta usando el programa Nota: No lo se si funciona asi, no lo e probado, solo modifique otro codigo que hice que ejecuta un Bat, pero queria ver si se podia almacenar el usuario devuelto por la consola Runtime aplicacionFOTXLF = Runtime.getRuntime(); try{aplicacionFOTXLF.exec("cmd.exe WHOAMI"); } catch(Exception e){System.out.println(e);}
|
|
|
18
|
Sistemas Operativos / Windows / Laptop no enciende
|
en: 14 Agosto 2013, 15:01 pm
|
Bueno, el otro dia me trajieron una laptop que tenia password de bios, la abri y le quite la pila un tiempo y la encendi sin cerrarla completamente y todo funcionaba, la cerre y ahora no quiere encender nada, nada mas encienden los leds y los ventiladores. Ya la volvi a desarmar y la volvi a armar y nada, le cambie la memoria RAM y tampoco. Alguna idea de que pueda ser? Sera la tarjeta madre?
|
|
|
|
|
|
|