/*
import java.util.*;
public class Main
{
public static HashMap<String, Integer> ss = new HashMap<String, Integer>();
public static void view()
{
Set<String> keys = ss.keySet();
Iterator<String> it = keys.iterator();
while(it.hasNext())
{
String key = it.next();
System.out.print("("+key+","+ss.get(key)+") ");
}
System.out.println();
}
public static void main(String[] args) {
System.out.println("**포인트 관리 프로그램입니다**");
Scanner t = new Scanner(System.in);
while(true) {
System.out.print("이름과 포인트 입력>>");
String n = t.next();
int k = t.nextInt();
if(n.equals("그만")) {
break;
}
Set<String> keys = ss.keySet();
Iterator<String> it = keys.iterator();
int x=0;
while(it.hasNext())
{
String key = it.next();
if(key.equals(n))
{
x=1;
int value=ss.get(key);
ss.remove(key);
ss.put(key, value+k);
break;
}
}
if(x==0) ss.put(n, k);
Main.view();
}
}
}
GUI Graphic User Interface
CUI Command User Interface
최상위컨테이너
컨테이너
컴포넌트
import javax.swing.*;
public class Main extends JFrame {
public Main()
{
//setTitle("300*300 스윙 프레임 만들기");
super("300*300 스윙 프레임 만들기");
setSize(300, 300);
setVisible(true);
}
public static void main(String[] args) {
new Main();
}
}
//*/
//import javax.swing.*;
//import java.awt.*;
//
//public class Main extends JFrame {
// public Main() {
// setTitle("CoNtEnTpAnE JFrame");
// setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//
// Container cp = getContentPane();
// cp.setBackground(Color.DARK_GRAY);
// cp.setLayout(new FlowLayout());
// cp.add(new JButton("click"));
// cp.add(new JButton("Ignore"));
// cp.add(new JLabel("search"));
// cp.add(new JTextField("heyhey"));
// cp.add(new JList());
// setSize(400, 400);
// setVisible(true);
//
// }
// public static void main(String[] args) {
// new Main();
// }
//}
/*
import javax.swing.*;
import java.awt.*;
public class Main extends JFrame {
public Main() {
setTitle("Flowlayout");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container c = getContentPane();
c.setLayout(new FlowLayout(FlowLayout.LEFT, 100, 50));
c.add(new JButton("add"));
c.add(new JButton("sub"));
c.add(new JButton("mult"));
c.add(new JButton("div"));
setSize(300, 300);
setVisible(true);
}
public static void main(String[] args) {
new Main();
}
}*/
//import javax.swing.*;
//import java.awt.*;
//
//public class Main extends JFrame {
// public Main() {
// setTitle("BorderLayout");
// setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// Container c = getContentPane();
// c.setLayout(new BorderLayout(30, 20));
//
// c.add(new JButton("Calculate"), BorderLayout.CENTER);
// c.add(new JButton("add"), BorderLayout.NORTH);
// c.add(new JButton("sub"), BorderLayout.SOUTH);
// c.add(new JButton("mul"), BorderLayout.EAST);
// c.add(new JButton("div"), BorderLayout.WEST);
//
// setSize(300, 300);
// setVisible(true);
// }
// public static void main(String[] args) {
// new Main();
// }
//}
//import javax.swing.*;
//import java.awt.*;
//
//public class Main extends JFrame {
// public Main()
// {
// setTitle("김재성1");
// setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//
// GridLayout grid = new GridLayout(4,2);
// grid.setVgap(5);
//
// Container c = getContentPane();
// c.setLayout(grid);
// c.add(new JLabel(" 이름"));
// c.add(new JTextField(""));
// c.add(new JLabel(" 나이"));
// c.add(new JTextField(""));
//
// setSize(300, 200);
// setVisible(true);
// }
// public static void main(String[] args) {
// new Main();
// }
//}
/*
import javax.swing.*;
import java.awt.*;
public class Main extends JFrame {
public Main() {
setTitle("Null Container Sample");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container c = getContentPane();
c.setLayout(null);
JLabel la = new JLabel("Hello, Press Buttons");
la.setLocation(130, 50);
la.setSize(200, 20);
c.add(la);
for(int i=1; i<=9; i++) {
JButton b = new JButton(Integer.toString(i));
b.setLocation(i*15, i*15);
b.setSize(50, 20);
c.add(b);
}
setSize(400, 400);
setVisible(true);
}
public static void main(String[] args) {
new Main();
}
}*/