Container
Method
|
Explain
|
Color getBackground() |
Component의 배경색을 얻음 |
void setBackground(Color c) |
Component의 배경색을 지정된 색으로 변경 |
Cursor getCursor() |
Component에 지정된 Cursor를 얻음 |
void setCursor(Cursor c) |
Component의 Cursor를 지정 |
Font getFont() |
Component에 지정되어 있는 Font를 얻음 |
void setFont(Font f) |
Component의 Font를 지정 |
Color getForeground() |
Component의 전경색을 얻음 |
void setForeground(Color c) |
Component의 전경색을 지정 |
int getHeigth() |
Component의 높이를 얻음 |
int getWidth() |
Component의 폭을 얻음 |
void setBounds(int x, int y, int width, int height) |
Component의 위치(x, y)와 크기를 지정 |
Rectangle getBounds() |
Component의 위치와 크기를 얻음 |
Point getLocation() |
Component의 위치를 얻음 |
void setLocation(int x, int y) |
Component의 위치를 지정 |
Dimension getSize() |
Component의 크기를 얻음 |
void setSize(int width, int height) |
Component의 크기를 지정 |
boolean hassFocus() |
Component가 현재 Focus를 갖고 있는지 알려줌 |
void requestFocus() |
Component가 Focus를 갖도록 함 |
void paint(Graphics g) |
Component를 화면에 그림 |
void repaint() |
Component를 화면에 다시 그림 |
void setEnabled(boolean b) |
Component를 사용가능(true) 불가능(false)하게 함 |
Container getParent() |
Component가 포함되어져 있는 Container(Parent)를 얻음 |
void setVisible(boolean b) |
Component가 화면에 보이게(true) 보이지 않게(false) 함 |
Container
Method
|
Explain
|
Component[] getComponents() |
Container에 포함되어 있는 모든 Component를 얻음 |
Component getComponent(int n) |
Container에 n번째로 추가된 Component를 얻음 |
Component getComponentAt(int x, int y) |
Container의 지정된 위치(x, y)에 있는 Component를 얻음 |
Component add(Component comp) |
Container에 Component를 추가 |
void remove(Component comp) |
Container에서 지정된 Component를 제거 |
Insets getInsets() |
Container의 경계의 크기를 알 수 있는 Inset객체를 얻음 |
LayoutManager getLayout() |
Container에 설정되어 있는 LayoutManager를 얻음 |
void setLayout(LayoutManager mgr) |
Container에 LayoutManager를 설정 |
Frame
Method
|
Explain
|
Frame(String title) |
Frame 생성(Title : Frame의 Title Bar에 출력될 Text) |
String getTitle() |
Title Bar에 있는 Text를 얻음 |
void setTitle(String title) |
Title Bar에 있는 Text 수정 |
void setState(int state) |
Frame의 상태(state)를 변경할 수 있으며 상태에는 두 가지 값중 하나 사용 Frame.ICONIFIED : Frame을 최소화 상태가 되게 함 Frame.NORMAL : Frame을 최소화 이전상태가 되게 함 |
int getState() |
Frame의 현재 상태(state)를 알 수 있음 |
void setResizeable(boolean resizable) |
Frame의 크기를 변경가능(true) 또는 불가능(false)하게 함 |
Button
Method
|
Explain
|
Button(String label) |
지정된 label을 가진 Button을 생성(label : Button 위에 나타날 Text) |
String getLable() |
Button에 나타나있는 Text를 얻음 |
void setLable(String label) |
Button에 나타나있는 Text를 변경 |
Choice
Method
|
Explain
|
void add(String item) |
Choice에 item을 추가 |
void remove(String item) |
Choice에서 item 제거 |
void remove(int index) |
지정된 순서에 있는 item을 제거 |
void removeAll() |
Choice의 모든 item을 제거 |
void insert(String item, int index) |
지정된 순서에 item을 추가 |
String getItem(int index) |
지정된 순서에 item을 얻음 |
int getItemCount() |
현재 Choice에 추가되어 있는 item의 개수를 알려줌 |
int getSelectedIndex() |
현재 선택되어져 있는 item의 index 값을 얻음 |
String getSelectedItem() |
현재 선택되어져 있는 item을 얻음 |
List
Method |
Explain |
List(int rows, boolean mutipleMode) |
rows : List의 줄 크기 지정 multipleMode : List 목록중 다중선택 가능(true)/불가능(false) |
List(int rows) |
List의 줄 크기만 지정하고 다중선택은 불가능하게 List 생성 |
List() |
List의 줄 크기를 기본 값인 4줄로 지정하고 다중선택은 불가능하게 List 생성 |
void add(String item) |
item을 List에 추가 |
void add(String item, int index) |
지정된 위치에 item을 추가 |
void replaceItem(String newValue, int index) |
지정된 위치의 item을 새로운 item으로 변경 |
void remove(String item) |
List에서 해당 item 제거 |
void remove(int index) |
지정된 위치에 있는 item 제거 |
void removeAll() |
List의 모든 item을 제거 |
int getRows() |
List에 Scroll 없이 볼 수 있는 item의 수를 얻음 |
String getItem(int index) |
지정된 위치에 있는 item을 얻음 |
String[] getItem() |
List에 있는 모든 item을 얻음 |
int getItemCount() |
List에 있는 item이 모두 몇 개인지 알려줌 |
void select(int index) |
지정된 위치에 있는 item을 선택 |
void deselect(int index) |
지정된 위치에 있는 item 선택 해재 |
int getSelectedIndex() |
현재 선택되어 있는 item의 index 값을 얻음 |
int[] getSelectedIndexes() |
현재 선택되어 있는 item들의 index 값을 얻음(다중선택인 경우) |
String getSelectedItem() |
현재 선택되어 있는 item을 얻음 |
String[] getSelectedItems() |
현재 선택되어 있는 item들을 얻음(다중선택인 경우) |
boolean isIndexSelected(int index) |
지덩된 위치의 item이 선택되어 있는지 알려줌 |
void setMultipleMode(boolean b) |
List를 다중선택으로 할 것인지 결정(MultipleMode : True) |
Label
Method
|
Explain
|
Label(String text, int alignment) |
text : 화면에 나타낼 text을 String으로 넣음 alignment : text의 정렬방식(Lable.LEFT/Label.CENTER/Label.RIGHT) |
Label(String text) |
text : 화면에 나타낼 text 지정(alignment : 기본값(Lable.LEFT) |
String getText() |
Label의 text를 얻어옴 |
void setText(String text) |
Label의 text를 주어진 값으로 변경 |
void setAlignment(int alignment) |
Label의 text 정렬을 지정(Lable.LEFT/Label.CENTER/Label.RIGHT) |
Checkbox
Method
|
Explain
|
Checkbox(String text, boolean state) |
text : Checkbox와 함께 보여질 Text를 지정 state : Checkbox가 선택된 상태(true)와 선택되지 않은 상태(false)가 있음 |
Checkbox(String text) |
Checkbox와 함께 보여질 text를 지정 state는 기본값(Check 해제 상태) |
Checkbox() |
text 없이 Checkbox만 나타나고 Checkbox는 선택해제 상태 |
Checkbox(String text, CheckboxGroup group, boolean state) |
group : CheckboxGroup 객체 참조 CheckboxGroup을 이용해 radio Button으로 만듦 |
String getLabel() |
Checkbox의 label을 얻음 |
void setLable(String label) |
Checkbox의 label을 주어진 값으로 변경 |
boolean getState() |
Checkbox의 상태릉 얻음(Check 또는 Check 해제) |
void setState(boolean state) |
Checkbox의 상태를 설정(Check 또는 Check 해제) |
TextField
Method
|
Explain
|
TextField(String text, int col) |
text : TextField에 보여질 text에 지정 col : 입력 받을 글자의 수 지정(col 값에 따라 TextField 크기 결정) |
TextField(int col) |
col : 입력 받을 글자의 수 지정 |
TextField(String text) |
text : TextField에 보여질 text에 지정 |
void setEchoChar(char c) |
지정된 문자를 EchoChar로 지정(비밀번호 입력에 주로 사용) |
int getColumns() |
TextField의 Column 수를 얻음 |
void setText(String t) |
지정된 문자열을 TextField의 text로 지정 |
String getText() |
TextField의 text를 얻는다 |
void select(int selectionStart, int selectionEnd) |
selectionStart부터 selectionEnd까지의 text를 선택(Highlight) |
void selectAll() |
TextField의 모든 text를 선택된 상태가 되도록 함 |
String getSelectedText() |
TextField의 text 중 선택되어진 부분을 얻음 |
void setEditable(boolean b) |
TextField의 text를 편집가능(true)/불가능(false)하도록 함 |
TextArea
Method
|
Explain
|
TextArea(String text, int row, int col, int scrollbar) |
text : TextArea에 보여질 text를 지정 row : TextArea의 줄(row) 수를 지정 col : TextArea의 열(column) 수를 지정 scrollbar : TextArea에 사용할 scrollbar의 종류와 사용여부 지정 (TextArea.SCROLLBARS_BOTH, TextArea.SCROLLBARS_NONE, TextArea.SCROLLBARS_HORIZONTAL_ONLY, TextArae.SCROLLBARS_VERTICAL_ONLY) |
TextArea(int row, int col) |
row : TextArea의 줄(row) 수를 지정 col : TextArea의 열(column) 수를 지정 text가 없는 빈 TextArea를 생성(Scoll Bar는 양쪽 다 존재) |
int getRows() |
TextArea의 행 개수를 얻음 |
int getColumns() |
TextArea의 열 개수를 얻음 |
void setRows(int rows) |
지정된 값으로 TextArea의 행 개수를 설정 |
void setColumns(int columns) |
지정된 값으로 TextArea의 열 개수를 설정 |
void append(string str) |
TextArea에 있는 text의 맨 마지막에 문자열을 덧붙임 |
void insert(String str, int pos) |
TextArea에 있는 text의 지정된 위치에 문자열을 넣음 |
void replaceRange(string str, int start, int end) |
Text에 있는 text의 start부터 end 범위에 있는 문자열을 str에 지정된 값으로 변경 |
void setText(String t) |
지정된 문자열을 TextArea의 text로 지정 |
String getText() |
TextArea의 text를 얻음 |
Scrollbar
Method
|
Explain
|
Scrollbar() Scrollbar(int orientation) Scrollbar(int orientation, int value, int visible, int min, int max) |
orientation : Scroll Bar의 종류 지정(Scrollbar.VERTICAL or Scrollbar.HORIZONTAL) value : Scrollbar의 초기값 visible : Scroll Button의 크기 min : Scroll Bar가 가질 수 있는 최소값 max : Scroll Bar가 가질 수 있는 최대값 |
int getValue() |
현재 설정된 Scrollbar의 값을 얻음 |
void setValue(int newValue) |
Scrollbar의 값을 지정된 값으로 설정 |
ScrollPane
Method
|
Explain
|
ScrollPane(int scrollbarDisplayPolicy) |
scrollbarDisplayPolicy : Scroll Bar 표시 정책 지정 (SCROLLBARS_ALWAYS/SCROLLBARS_AS_NEEDED/SCROLLBARS_NEVER) |
ScrollPane() |
ScrollPane의 객체 생성 |
Dialog
Method
|
Explain
|
Dialog(Frame parent, String title, boolean modal) |
parent : 어떤 Frame에 속할 것인지 지정 title : Dialog의 titlebar에 나타날 text 지정 modal : Dialog를 필수 응답으로 할 것인지 결정 |
Dialog(Frame parent, String title) |
modal을 지정하지 않으면 false로 지정됨 |
void show() |
Dialog가 화면에 나타나도록 설정 |
void hide() |
Dialog가 화면에 보이지 않도록 설정 |
void dispose() |
Dialog를 닫음 |
String getTitle() |
Dialog의 titlebar에 나타난 text를 얻음 |
void setModal(boolean b) |
Dialog를 modal(ture) 또는 modaless(false)로 함 |
void setResizable(boolean resizable) |
사용자에 의해서 Dialog의 크기가 변경 가능/불가능 하도록 설정 |
FileDialog
Method
|
Explain
|
FileDialog(Frame parent, String title, int mode) |
parent : 어떤 Frame에 속한 것인지 지정 title : FileDialog의 titlebar에 나타날 text 지정 mode : FileDialog.LOAD, FileDialog.SAVE 중 하나 선택 |
FileDialog(Frame parent, String title) |
mode를 생략 시 기본값으로 FileDialog.LOAD 사용 |
String getFile() |
FileDialog에 의해 선택된 File의 이름을 얻음 |
String getDirectory() |
FileDialog에 의해 선택된 File의 경로를 얻음 |
void setFile(String file) |
FileDialog에 지정된 File을 설정 |
void setDirectory(String dir) |
FileDialog에 지정된 Diretory를 설정 |
'Java > Method' 카테고리의 다른 글
AWT Method II (0) | 2015.09.05 |
---|---|
Thread (0) | 2015.08.22 |
Random (0) | 2015.08.19 |
Properties (0) | 2015.08.19 |
TreeMap (0) | 2015.08.19 |