1 7 8 9 import org.jdesktop.swing.auth.*; 10 import javax.swing.ImageIcon ; 11 import javax.swing.JFrame ; 12 import javax.swing.JLabel ; 13 import javax.swing.SwingConstants ; 14 import javax.swing.UIManager ; 15 16 43 public class JXLoginPanelDemo { 44 static JFrame frame = new JFrame (); 45 46 public static void main(String [] args) { 47 48 JAASLoginService loginService = new JAASLoginService("test"); 49 try { 50 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); 51 } 52 catch (Exception e) { 53 e.printStackTrace(); 54 } 55 JLabel header = new JLabel (new ImageIcon (JXLoginPanelDemo.class 56 .getResource("resources/jdnc.png"))); 57 JLabel label = new JLabel ("Enter login information:"); 58 label.setHorizontalTextPosition(SwingConstants.LEFT); 59 label.setHorizontalAlignment(SwingConstants.LEFT); 60 JXLoginPanel.showLoginDialog(frame, null, null, loginService, 61 null, header, label, JXLoginPanel.SAVE_USERNAME); 62 System.exit(0); 63 } 64 } | Popular Tags |