// 생성자 public Login() { // 레이아웃 설정 layeredPane = new JLayeredPane(); layeredPane.setBounds(0, 0, Value.width, Value.height); layeredPane.setLayout(null); // 패널1 // 이미지 받아오기 try { img = ImageIO.read(new File("C:/Users/clown/Desktop/kicom_logo_w.png")); } catch (IOException e) { System.out.println("이미지 불러오기 실패"); System.exit(0); } MyPanel panel = new MyPanel(); panel.setBounds(0, 0, Value.width, Value.height); // 로그인 필드 id = new JLabel("아이디"); id.setBounds(Value.width / 12 * 5, Value.height / 2 - 10, 100, 30); layeredPane.add(id); id.setVisible(true); loginTextField = new JTextField(30); loginTextField.setBounds(Value.width / 12 * 5, Value.height / 2 + 20, 320, 30); loginTextField.setOpaque(false); layeredPane.add(loginTextField); loginTextField.setForeground(Color.black); loginTextField.setVisible(true); // 패스워드 pwd = new JLabel("비밀번호"); pwd.setBounds(Value.width / 12 * 5, Value.height / 2 + 70, 100, 30); layeredPane.add(pwd); pwd.setVisible(true); passwordField = new JPasswordField(15); passwordField.setBounds(Value.width / 12 * 5, Value.height / 2 + 100, 320, 30); passwordField.setOpaque(false); passwordField.setForeground(Color.black); layeredPane.add(passwordField); // 체크박스 check = new JCheckBox(); check.setBounds(Value.width / 7 * 3, Value.height / 2 + 130, 30, 30); layeredPane.add(check); // 아이디저장 reg = new JLabel("아이디 저장"); reg.setBounds(Value.width / 7 * 3 + 30, Value.height / 2 + 130, 70, 30); layeredPane.add(reg); // 체크박스 리스너(아이디 저장) check.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent e) { ID = loginTextField.getText(); if (e.getStateChange() == 1) { pref.put("ID", ID); pref.putInt("ch", 1); } else { pref.put("ID", ""); pref.putInt("ch", 0); } } }); if (pref.getInt("ch", ch) == 1) { loginTextField.setText(pref.get("ID", ID)); check.setSelected(true); } // 로그인버튼 추가 bt = new JButton("Login"); bt.setBounds(Value.width / 2 - 50, Value.height / 2 + 170, 100, 30); // 버튼 투명처리 bt.setBorderPainted(false); bt.setFocusPainted(false); layeredPane.add(bt); // 버튼 이벤트 bt.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub control.removePane(layeredPane); control.addPane(tab.getPane()); Value.layeredPane = layeredPane; } }); layeredPane.add(panel); }