Aplicação simples de password
Publicado por Alberto Ivo 10/08/2006
[ Hits: 7.733 ]
Veja como fazer um simples password em Java num frame.
import java.awt.*; import java.awt.event.*; import javax.swing.*; public class PasswordField extends JFrame { private JLabel label; private JPasswordField passwordField; public PasswordField() { super( "Testing JTextField and JPasswordField" ); Container container = getContentPane(); container.setLayout( new FlowLayout() ); label = new JLabel("Digite algo e pressione Enter. \n"); container.add( label ); passwordField = new JPasswordField( "Viva o Linux" ); container.add( passwordField ); TextFieldHandler handler = new TextFieldHandler(); passwordField.addActionListener( handler ); setSize( 325, 100 ); setVisible( true ); } public static void main( String args[] ) { PasswordField application = new PasswordField(); application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); } private class TextFieldHandler implements ActionListener { public void actionPerformed( ActionEvent event ) { String string = ""; if ( event.getSource() == passwordField ) { JPasswordField pwd = ( JPasswordField ) event.getSource(); string = "passwordField: " + new String( passwordField.getPassword() ); } JOptionPane.showMessageDialog( null, string ); } } }
Nenhum comentário foi encontrado.
Instalação e configuração do Chrony
Programa IRPF - Guia de Instalação e Resolução de alguns Problemas
Criando uma Infraestrutura para uma micro Empresa
O Que Fazer Após Instalar Ubuntu 25.04
O Que Fazer Após Instalar Fedora 42
Debian 12 -- Errata - Correções de segurança
Instalando o Pi-Hole versão v5.18.4 depois do lançamento da versão v6.0
Instalação de Drivers da Placa de Vídeo (1)