공부/자바(JAVA)
자바(Swing) - 일정표(데이터베이스) 구현하기 (응용)
도도-도윤
2017. 10. 28. 18:19
자바(Swing) - 일정표(데이터베이스) 구현하기 (응용)
자바 스윙으로 구현하는 일정표(데이터베이스) 구현하기 입니다.
1. 일정표 구현 (시연)
2. 추가 내용

|
private JTable[] table; private JScrollPane[] scrollTablePane 추가
|

|
148줄 추가 = scrollTablePane 149줄 추가 = table
|

|
184줄 추가 = DBMS 185줄 추가 = DML
|
// itemPane 존재 여부 if ( itemPane [ count - 1 ] == null ) { itemPane [ count - 1 ] = new JPanel(); itemPane [ count - 1 ].setLayout( null ); if ( !state ) { jBtn [ count - 1 ] = new JButton( "" ); table [ count - 1 ] = new JTable(); scrollTablePane [ count - 1 ] = new JScrollPane ( table [ count - 1 ] ); } else { jBtn [ count - 1 ] = new JButton( day + "" ); header[0] = day + "일"; dml.select("select menuname as \"메뉴\" from food_tbl where date = '" + calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1) + "-" + day + " 07:00:00'"); cells = dml.getCells(); table [ count - 1 ] = new JTable(cells, header); scrollTablePane [ count - 1 ] = new JScrollPane ( table [ count - 1 ] ); state = false; } // end of if scrollTablePane [ count - 1 ].setBounds(0, 20, 100, 70); jBtn [ count - 1 ].setSize( 50, 20 ); itemPane [ count - 1 ].add( jBtn [ count - 1 ] ); itemPane [ count - 1 ].add( scrollTablePane [ count - 1 ] ); panBody.add( itemPane [ count - 1 ] ); } // end of if // itemPane 업데이트 else { // System.out.println("참" + day ); if ( !state ) { jBtn [ count - 1 ].setText( "" ); table [ count - 1 ].setModel(new DefaultTableModel()); } else { jBtn [ count - 1 ].setText( day + "" ); header[0] = day + "일"; dml.select("select menuname as \"메뉴\" from food_tbl where date = '" + calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1) + "-" + day + " 07:00:00'"); cells = dml.getCells(); table [ count - 1 ].setModel(new DefaultTableModel(cells, header) ); state = false; } // end of if } // end of if
|
208줄 추가 = table 209줄 추가 = scrollTablePane 216~219줄 추가 = dml.select 220줄 추가 = dml.cells() 222, 223줄 추가 = table [ count - 1 ], scrollPane[ count - 1 ]; 229줄 추가 = scrollTablePane.setBound(); 234줄 추가 = itemPane [ count - 1 ].add( scrollTablePane [ count - 1 ] ); 247줄 추가 = table [ count - 1 ].setModel(new DefaultTableModel()); 252~256줄 추가 = dml.select 257줄 추가 = dml.cells() 259줄 추가 = table
|
3. 데이터베이스 설계

|
Table = Food_TBL
|