Open Choiseonghyeok opened 4 years ago
import javax.swing.; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; public class Main extends JFrame{ public Main(){ JPanel p = new JPanel(); JButton j1 = new JButton("Enrollment"); JButton j2 = new JButton("Login"); JButton j3 = new JButton("Admin"); JTextField t1 = new JTextField(); JPasswordField t2 = new JPasswordField(); JLabel l1 = new JLabel("ID"); JLabel l2 = new JLabel("Password"); j1.setBounds(720,450,150,30); //회원가입 j2.setBounds(720,400,150,30); //로그인 j3.setBounds(900,420,100,40); //Admin t1.setBounds(700,300,200,30); //아이디칸 t2.setBounds(700,350,200,30); //비밀번호칸 l1.setBounds(600,300,150,30); //아이디 l2.setBounds(600,350,150,30); //비밀번호 add(j1); add(j2); add(j3); add(t1); add(t2); add(l1); add(l2); setSize(1500,1000); setLayout(null); setVisible(true); j1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Main2 f2 = new Main2(); f2.setVisible(true); } });; j2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e2) { try { String s1; char[] s2 = new char[20]; s1=t1.getText(); s2=t2.getPassword(); for(char cha : s2) { Character.toString(cha); } if(a.find(s1,s2)) {
JOptionPane.showMessageDialog(null, "Sucess Login!"); //Main3 f3 = new Main3(); //일반 점주용 페이지 } else { JOptionPane.showMessageDialog(null, "Wrong ID or Password"); } } catch (IOException E10) { E10.printStackTrace(); } } }); j3.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e3) { String s1 = ("admin"); String s2 = ("mykd"); //제품키 String s3; char[] s4 = new char[20]; String s5 = ""; s3=(String) t1.getText(); s4=t2.getPassword(); for(char cha : s4) { Character.toString(cha); s5 += (s5.equals(""))?""+cha+"":""+cha+""; } if(s3.equals(s1)&&s5.equals(s2)) { JOptionPane.showMessageDialog(null, "Hello, Sir!"); //Main4 f4 = new Main4(); //관리자용 페이지 } else { JOptionPane.showMessageDialog(null, "Wrong ID or Password"); } } }); } public static void main(String[] args) { Main gui = new Main(); gui.setVisible(true); }
}
import javax.swing.; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; public class Main extends JFrame{ public Main(){ JPanel p = new JPanel(); JButton j1 = new JButton("Enrollment"); JButton j2 = new JButton("Login"); JButton j3 = new JButton("Admin"); JTextField t1 = new JTextField(); JPasswordField t2 = new JPasswordField(); JLabel l1 = new JLabel("ID"); JLabel l2 = new JLabel("Password"); j1.setBounds(720,450,150,30); //회원가입 j2.setBounds(720,400,150,30); //로그인 j3.setBounds(900,420,100,40); //Admin t1.setBounds(700,300,200,30); //아이디칸 t2.setBounds(700,350,200,30); //비밀번호칸 l1.setBounds(600,300,150,30); //아이디 l2.setBounds(600,350,150,30); //비밀번호 add(j1); add(j2); add(j3); add(t1); add(t2); add(l1); add(l2); setSize(1500,1000); setLayout(null); setVisible(true); j1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Main2 f2 = new Main2(); f2.setVisible(true); } });; j2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e2) { try { String s1; char[] s2 = new char[20]; s1=t1.getText(); s2=t2.getPassword(); for(char cha : s2) { Character.toString(cha); } if(a.find(s1,s2)) {
}