보안상의 이유로 사용자 ID 레이블에 기본 사용자 이름 (예 : Windows 로그인에 의한 사용자 이름) 값을 설정해야하며 어떻게해야합니까?

Vasanth

보안상의 이유로 로그인 한 창에서 사용자 ID (기본값)를 설정해야하는데 전혀 모르겠습니다. 여기에 내 코드가 있습니다.

import javax.swing.*;    
import java.awt.event.*;  
public class PasswordFieldExample {  
    public static void main(String[] args) {    
    JFrame f=new JFrame("User-ID");    
     final JLabel label = new JLabel();            
     label.setBounds(20,150, 200,50);  

     JLabel l1=new JLabel("User-Id:");    
        l1.setBounds(20,20, 80,30);    
        JButton b = new JButton("Login");  
        b.setBounds(100,120, 80,30);    
        final JTextField text = new JTextField(12); text.setText(System.getProperty("user.name")); text.setBounds(100, 20, 100, 30);
               f.add(l1); f.add(label); f.add(b); f.add(text);  
                f.setSize(300,300);    
                f.setLayout(null);    
                f.setVisible(true);     
               /** b.addActionListener(new ActionListener() {  
                // public void actionPerformed(ActionEvent e) {       
                 //  String data = "Username " + text.getText();
                  // label.setText(data);          
               // }  
        });   */
    }  
}  
XtremeBaumer

System.getProperty("user.name");기본 계정 이름으로 Java 사용

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

Related 관련 기사

뜨겁다태그

보관