일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- 세일즈포스
- 프랑스어
- 프랑스어기초
- 국비과정
- SF
- 제목은음식인데
- 마케팅클라우드
- 프랑스어배우는이유
- 힘들다
- 힘들어도
- MarketingCloud
- 마무리구원투수내동생땡큐
- 음식사진없음
- 생산성 #24시간알차게 #올해의시간트레이닝 #셀프코치
- 윈도우 #크롬탭 #크롭탭복사 #크롬탭복제 #크롬사용법 #크롬꿀팁 #업무꿀팁 #일상꿀팁
- JPOP
- 프랑스어단어
- 셀포
- 더이상의 자세한 설명은 생략한다
- 다먹어치움
- Today
- Total
뚜벅이
JTABLE 연습. 본문
Class JTable
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JTable
- 자바 도큐먼트 자료이다. JTable 이친구는 컴포넌트이자 컨테이너인 독특한 녀석이라고 할수 있겠다.
JTables are typically placed inside of a JScrollPane. By default, a JTable will adjust its width such that a horizontal scrollbar is unnecessary.
To enable sorting and filtering of rows, use a RowSorter. You can set up a row sorter in either of two ways:
- Directly set the RowSorter. For example: table.setRowSorter(new TableRowSorter(model)).
- Set the autoCreateRowSorter property to true, so that the JTable creates a RowSorter for you. For example: setAutoCreateRowSorter(true).
- JTABLE 자체 Sotring 기능이 있다고 한다 ㄷㄷㄷ
When designing applications that use the JTable it is worth paying close attention to the data structures that will represent the table's data. The DefaultTableModel is a model implementation that uses a Vector of Vectors of Objects to store the cell values.
Object 자료형의 vector 이중 벡터 가 dTM에 들어간다 .
A good rule of thumb for deciding whether to use the AbstractTableModel or the DefaultTableModel is to use the AbstractTableModel as the base class for creating subclasses and the DefaultTableModel when subclassing is not required.
이말이 무슨 말인 지 모르겠다.
protected int | autoResizeMode
Determines if the table automatically resizes the width of the table's columns to take up the entire width of the table, and how it does the resizing. |
protected TableCellEditor | cellEditor
The active cell editor object, that overwrites the screen real estate occupied by the current cell and allows the user to change its contents. |
protected int | editingColumn
Identifies the column of the cell being edited. |
protected int | editingRow
Identifies the row of the cell being edited. |
protected ListSelectionModel | selectionModel
The ListSelectionModel of the table, used to keep track of row selections. |
JTable(TableModel dm)
Constructs a JTable that is initialized with dm as the data model, a default column model, and a default selecti
JTable(TableModel dm, TableColumnModel cm, ListSelectionModel sm)
Constructs a JTable that is initialized with dm as the data model, cm as the column model, and sm as the selection model. // 이거로 써주자,
int | getAutoResizeMode()
Returns the auto resize mode of the table. |
table auto resize...
TableCellEditor | getCellEditor()
Returns the active cell editor, which is null if the table is not currently editing. |
TableCellEditor | getCellEditor(int row, int column)
Returns an appropriate editor for the cell specified by row and column. |
TableCellRenderer | getCellRenderer(int row, int column)
Returns an appropriate renderer for the cell specified by this row and column. |
TableCellEditor | getDefaultEditor(Class<?> columnClass)
Returns the editor to be used when no editor has been set in a TableColumn. |
TableCellRenderer | getDefaultRenderer(Class<?> columnClass)
Returns the cell renderer to be used when no renderer has been set in a TableColumn. |
Object | getValueAt(int row, int column)
Returns the cell value at row and column. |
void | setCellEditor(TableCellEditor anEditor)
Sets the active cell editor. |
void | setCellSelectionEnabled(boolean cellSelectionEnabled)
Sets whether this table allows both a column selection and a row selection to exist simultaneously. |
void | setUI(TableUI ui)
Sets the L&F object that renders this component and repaints. |
힌트는 - > tablecelleditor class 에 있을 것 같다.. // TAble UI는 뭐하느놈일까?
히트는 이 둘중 하나에 있는거가타.
stackoverflow.com/questions/2856480/resizing-a-imageicon-in-a-jbutton
stackoverflow.com/questions/16343098/resize-a-picture-to-fit-a-jlabel/16345968#16345968
자동화 추구하기.
여러 개 튜플 한번에 inserrt 하기
insert 반복문 어떻게 쓰나요?0 2 4,279
by 아이엔유[2015.01.26 17:10:44]
oracle 11g, pl/sql쓰고 있는 초초급개발자입니다
인터넷에 찾아보니 sql로 for문을 만들수 있다고 해서
FOR i in 1..5 LOOP
insert into a(name, lv, parentlv values('예병조', '33'+i, '44');
END LOOP
이런식으로 했는데 'ORA-00900: SQL 문이 부적합합니다' 라는 에러가 납니다. 빨간색 표시된 for에서부터 에러가 나요..
insert는 for문이 안되나요??
등록 목록
by 백면서생 [2015.01.26 17:30:17]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
-- parentlv --> parentlv)
begin for i in 1..5 loop insert into a(name, lv, parentlv) values('예병조',33+i, '44'); end loop; end;
insert into a (name, lv, parentlv) select '예병조', 33+level, '44' from dual connect by level <= 5
-- 34,35,36의 형태면 33+i -- 331,332,333의 형태면 '33'||i |
데이터 밀어넣어주기
수백만건
///////////////////////////
3. 프로시저 만들기
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
DELIMITER $$ DROP PROCEDURE IF EXISTS test_proc1;
CREATE PROCEDURE test_proc1()
BEGIN DECLARE done INT DEFAULT FALSE; DECLARE v_count INT DEFAULT -1; DECLARE v_id varchar(20); DECLARE v_name varchar(20); DECLARE v_useYn varchar(20);
-- select한 결과를 cursor1로 정의 DECLARE cursor1 CURSOR FOR SELECT id , name , useYn FROM TEST_TB1;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
OPEN cursor1;
my_loop: LOOP
-- loop 하며 cursor1의 데이터를 불러와 변수에 넣는다. FETCH cursor1 INTO v_id , v_name , v_useYn;
SET v_count = v_count +1 ;
-- cursor1 반복이 끝나면 loop 빠져나간다. IF done THEN LEAVE my_loop; END IF;
IF(v_id = 1) THEN UPDATE TEST_TB1 SET name = '전효성' WHERE id = v_id;
ELSEIF (v_id = 2) THEN INSERT INTO TEST_TB1(name, useYn) VALUES('insert값', 'N');
ELSE UPDATE TEST_TB1 SET name = CONCAT(v_name, v_id) WHERE id = v_id;
END IF;
END LOOP;
SELECT v_count;
-- 커서를 닫는다. CLOSE cursor1;
END $$
DELIMITER ;
|
cs |
cursor1에서 select한 데이터를 모두 갖고 있고
fetch를 통해 cursor의 데이터를 변수에 담고
변수에 담은 데이터를 하나씩 LOOP를 돌면서
IF문에 걸릴경우 UPDATE나 INSERT문을 만나
처리를 진행하게 된다.
LOOP를 돌릴때마다 변수의 count를 올리고 있다.
4. 프로시저 호출하기
1 |
CALL test_proc1(); |
cs |
프로시저를 실행하게 되면 기존 데이터가 변경되고 신규 데이터가 추가된 것을 확인 할 수 있다.