/*
import java.util.Vector;
public class Main {
public static void main(String[] args) {
Vector<Integer> v = new Vector<Integer>();
v.add(5);
v.add(4);
v.add(-1);
v.add(2,100);
System.out.println("벡터 내의 요소 객체수 : "+v.size());
try{
Thread.sleep(1000);
}catch(InterruptedException e){
e.printStackTrace();
}
System.out.println("벡터의 현재 용랼 : "+v.capacity());
for(int i=1 ; i<=3 ; i++) {
try{
Thread.sleep(1000);
}catch(InterruptedException e){
e.printStackTrace();
}
System.out.println(".");
}
try{
Thread.sleep(1000);
}catch(InterruptedException e){
e.printStackTrace();
}
for(int i=0 ; i<v.size() ; i++) {
int n = v.get(i);
System.out.println(n);
try{
Thread.sleep(1000);
}catch(InterruptedException e){
e.printStackTrace();
}
}
int sum = 0;
for(int i=0 ; i<v.size() ; i++) {
int n = v.elementAt(i);
sum += n;
}
try{
Thread.sleep(1000);
}catch(InterruptedException e){
e.printStackTrace();
}
System.out.println("벡터에 있는 정수의 합 : "+sum);
}
}
*/
//import java.util.Vector;
//class Point {
// private int x,y;
// public Point(int x,int y) {
// this.x=x; this.y=y;
// }
// public String toString() {
// return"("+x+","+y+")";
// }
//}
//public class Main {
// public static void main(String[] args) {
// Vector<Point> v = new Vector<Point>();
// v.add(new Point(2,3));
// v.add(new Point(-5,20));
// v.add(new Point(30,-8));
// v.remove(1);
// for(int i=0 ; i<v.size(); i++) {
// Point p = v.get(i);
// System.out.println(p);
// }
// }
//}
/*
import java.util.*;
public class Main {
public static void main(String[] args) {
Vector<Integer> v = new Vector<Integer>();
v.add(5);
v.add(4);
v.add(-1);
v.add(2,100);
Iterator<Integer> it = v.iterator();
while(it.hasNext()) {
int n = it.next();
System.out.println(n);
}
int sum=0;
it = v.iterator();
while(it.hasNext()) {
int n = it.next();
sum+= n;
}
System.out.println("벡터에 있는 정수합 : "+sum);
}
}
*/
/*
import javax.swing.*;
import java.awt.*;
import java.util.*;
import java.awt.event.*;
public class Main extends JFrame {
private MP p = new MP();
boolean isDragging = false;
public Main() {
setTitle("그림판");
setDefaultCloseOperation(EXIT_ON_CLOSE);
setContentPane(p);
p.setBackground(Color.white);
setSize(300,300);
setVisible(true);
}
public static void main(String[] args) {
new Main();
}
class MP extends JPanel {
private Vector<Point> vStart = new Vector<Point>();
private Vector<Point> vEnd = new Vector<Point>();
Point startP;
Point DragP;
public MP() {
addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
startP = e.getPoint();
}
public void mouseReleased(MouseEvent e) {
isDragging=false;
Point endP = e.getPoint();
vStart.add(startP);
vEnd.add(endP);
repaint();
}
});
addMouseMotionListener(new MouseMotionListener() {
public void mouseMoved(MouseEvent e) {}
public void mouseDragged(MouseEvent e) {
isDragging=true;
DragP = e.getPoint();
repaint();
}
});
}
public void paintComponent(Graphics g) {
super.paintComponent(g);
g.setColor(Color.BLACK);
if(isDragging)g.drawLine(startP.x,startP.y,DragP.x,DragP.y);
for(int i=0 ; i<vStart.size() ; i++) {
Point s = vStart.elementAt(i);
Point e = vEnd.elementAt(i);
g.drawLine((int)s.getX(),(int)s.getY(),(int)e.getX(),(int)e.getY());
}
}
}
}
*/