package practice; import java.util.HashMap;import java.util.Iterator;import java.util.Map;import java.util.Set; public class HashMapEx3 { static HashMap phoneBook = new HashMap();//해시맵 생성 public static void main(String[] args) {// TODO Auto-generated method stubaddPhoneNo("친구", "이", "010-111-1111");addPhoneNo("친구", "김", "010-222-2222");addPhoneNo("친구", "김", "010-333-3333");addPhoneNo("회사", "김대리"..
package practice; import java.util.Collection;import java.util.Collections;import java.util.HashMap;import java.util.Iterator;import java.util.Map;import java.util.Set; public class HashMapEx2 { public static void main(String[] args) {// TODO Auto-generated method stubHashMap map = new HashMap();map.put("김", new Integer(90));map.put("김", new Integer(100));map.put("이", new Integer(100));map.put("..
package practice; import java.util.HashMap;import java.util.Scanner; public class HashMapEx1 { public static void main(String[] args) {// TODO Auto-generated method stub HashMap map = new HashMap();map.put("kim", "tiger");map.put("asdf", "1111");map.put("asdf", "1234");// 해시맵에 데이터를 추가, 키와 값 Scanner s = new Scanner(System.in); while (true) {System.out.println("id와 password를 입력해주세요.");System.out.p..
package practice; import java.util.Comparator;import java.util.TreeSet; public class ComparatorEx1 { public static void main(String[] args) {// TODO Auto-generated method stub TreeSet set1 = new TreeSet();TreeSet set2 = new TreeSet(new Descending());//내림차순으로 트리셋 객체 생성 int[] score = { 30, 50, 10, 20, 40 }; for (int i = 0; i < score.length; i++) {set1.add(new Integer(score[i]));set2.add(new Intege..
package practice; import java.util.TreeSet; public class TreeSetEx1 { public static void main(String[] args) {// TODO Auto-generated method stubTreeSet set = new TreeSet () ;String from = "b " ;String to ="d";set.add("abc") ;set.add("alien");set. add("bat") ;set.add("car");set.add("Car");set.add("disc") ;set . add("dance");set . add("dZZZZ");set.add("dzzzz ");set . add( "elephant");set.add("elev..
public class ClickAndDoubleClickEx extends JFrame {JPanel contentPane = new JPanel(); ClickAndDoubleClickEx() {setTitle("test");setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); contentPane.addMouseListener(new MyMouseListener());setContentPane(contentPane);setSize(300, 200);setVisible(true);} class MyMouseListener extends MouseAdapter {public void mouseClicked(MouseEvent e) {if (e.getClickCount()..
public class FlyingTextEx extends JFrame { JPanel contentPane = new JPanel();JLabel la = new JLabel("Hello");final int FLYING_UNIT = 50; FlyingTextEx() {setTitle("상,하,좌,우 키로 텍스트 움직이기");setDefaultCloseOperation(EXIT_ON_CLOSE); setContentPane(contentPane);contentPane.setLayout(null);contentPane.addKeyListener(new MyKeyListener());// 키리스너 추가 la.setLocation(50, 50);la.setSize(100, 20);contentPane.ad..