Aplicação simples de password
Publicado por Alberto Ivo 10/08/2006
[ Hits: 7.740 ]
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.
Como compartilhar a tela do Ubuntu com uma Smart TV (LG, Samsung, etc.)
Descritores de Arquivos e Swappiness
tux-gpt - Assistente de IA para o Terminal
Instalação e configuração do Chrony
Programa IRPF - Guia de Instalação e Resolução de alguns Problemas
Como instalar no Linux Jogos da Steam só para Windows
Instalando o Team Viewer no Debian Trixie - problema no Policykit
O Que Fazer Após Instalar Ubuntu 25.04
Erro ao atualizar o archlinux [RESOLVIDO] (2)
Erro ao executar o comando para dar um get email (0)