본문 바로가기
반응형

IT 실무/JAVA4

[Java] 파일 입출력(I/O)의 기본적인 이해 자바는 편의를 위해 많은 종류의 스트림을 제공하고 있기 때문에 초보자 입장에서는 어떤 스트림을 사용해야 되는지 햇갈릴 때가 많다. 그냥 다른 사람이 쓴 예제를 복사, 붙여넣기 하다 보니 스트림을 여러개 중첩한, 불필요하게 복잡한 소스를 사용하기도 한다. 만들고 있는 프로그램이 제대로된 프로젝트가 아니라, 학교 프로그래밍 과제라던가 파일 입출력이 큰 비중을 차지 하지 않는 간단한 프로그램이라면 그냥 기본적인 스트림만 사용해도 된다. 그럼 뭐가 기본적인 스트림이고, 어떻게 사용하는지 알아 보자. JAVA의 스트림은 '바이트 기반'인 InputStream과 OutputStream. 그리고 '문자 기반'인 Reader와 Writer가 있다. 1. 바이트 기반 바이트 기반의 스트림들은 모두 InputStraem과.. 2013. 10. 28.
[AWT&Swing] JTable JScrollPane 크기 조절(표가 보여지는 크기) setPreferredSize(new java.awt.Dimension(int width, int height)); 행 높이 조절 setRowHeight(int row_height); setRowHeight(int row_index, int row_height); 열 너비 조절 (javax.swing.table.TableColumn 를 include 해야된다.) TableColumn column = table.getColumnModel().getColumn(int index); column.setPreferredWidth(int width); 여러 column을 조절하고 싶을때 ex) int widths[] = { 10, 50, 50, 10, 100,.. 2012. 12. 14.
[AWT&Swing] Repaint, Validate, Invalidate, Revalidate Repaint() Repaint() method just repaints the component. It is the method of Component class. Repaint() causes calls paint() method of a Component if it is a lightweight component. It is better to call the repaint method rather than paint method because painting system calls paint at appropriate time which coalesces multiple calls into one call. Another disadvantage of calling paint rather than r.. 2012. 12. 4.
[자바] 작업 수행시간 체크를 위한 기본 소스 public static void main(String[] args) { long start_time = System.currentTimeMillis(); //이 사이에 작업 내용을 넣는다. long end_time = System.currentTimeMillis(); System.out.println("수행시간: " + String.format("%,d msec", end_time - start_time)); } 2012. 11. 16.
반응형