본문 바로가기

Study/Programming

(82)
자바 Server, Client import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.DataOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.net.ServerSocket; import java.net.Socket; import java.text.SimpleDateFormat; import java.util.Date; public class TcpIpServer4 { public static void main(String args[]..
자바 Network Chat import java.net.*; import java.io.*; import java.util.Date; import java.text.SimpleDateFormat; public class TcpIpServer { public static void main(String args[]) { ServerSocket serverSocket = null; try { // 서버소켓을 생성하여 7777번 포트와 결합(bind)시킨다. serverSocket = new ServerSocket(7777); System.out.println(getTime()+"서버가 준비되었습니다."); } catch(IOException e) { e.printStackTrace(); } while(true) { try { Syste..
자바 Swing 달력 스케줄 관리 import java.awt.BorderLayout; import java.awt.GridLayout; import java.util.Calendar; import javax.swing.DefaultComboBoxModel; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTable; import javax.swing.SwingUtilities; import javax.swing.JScrollPane; import javax.swing.ListSelectionModel; import java.awt.GridBagLayout; import java.awt.Dimensio..
자바 데이터 변경 import java.sql.*; public class JdbcEx4 { public static void main(String[] args){ Connection conn = null; PreparedStatement pstmt = null; try { String strUrl = "jdbc:oracle:thin:@211.183.2.35:1521:orcl"; String strId = "scott"; String strPwd = "tiger"; Class.forName("oracle.jdbc.driver.OracleDriver"); conn = DriverManager.getConnection(strUrl, strId, strPwd); // String query = "insert into dept2..
자바 우편번호 찾기 import javax.swing.table.AbstractTableModel; public class ZipTableModel1 extends AbstractTableModel { String[] columnNames = {"번호", "우편번호", "시도", "구군", "동", "번지"}; Object[][] data = { {"", "", "", "", "", ""}, }; public ZipTableModel1() { } public ZipTableModel1(Object[][] data) { this.data = data; } public int getColumnCount() { return columnNames.length; } public int getRowCount() { return dat..
jdbc import java.sql.Connection; import java.sql.*; public class JdbcEx1 { public static void main(String[] args){ Connection conn = null; Statement stmt = null; try { String strUrl = "jdbc:oracle:thin:@211.183.2.35:1521:orcl"; String strId = "scott"; String strPwd = "tiger"; Class.forName("oracle.jdbc.driver.OracleDriver"); System.out.println("드라이버 로드 성공"); conn = DriverManager.getConnection(strUrl,..
자바 Swing 달력 import java.awt.*; import java.util.ArrayList; public class Calendar extends Frame { private static final long serialVersionUID = 1L; private Panel panel = null; private Panel panel1 = null; private Choice choice = null; private Choice choice1 = null; private Label label = null; private Label label1 = null; private Button[] bt2 = new Button[42]; private int year=0; private int month=0; private P..
자바 File IO 받은 문자 출력, 파일 생성/삭제/변경 import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; //Byte기반에서 한글 지원이 안되는 부분을 해결 public class FileEx10 { public static void main(String[] args){ // FileInputStream fis = null; // InputStreamReader isr = null; BufferedReader br = null; try{ // fis = new FileInputStream("/home/whitefox/te..