ubuntu 에 jdk 간편하게 설치하기

Programming/Android 2013. 2. 27. 12:46 Posted by TanSanC
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install oracle-java7-installer

$ sudo add-apt-repository ppa:ferramroberto/java
$ sudo apt-get update
$ sudo apt-get install sun-java6-jdk sun-java6-plugin

출처 : http://krroo.blogspot.kr/2013/02/ubuntu-jdk.html

'Programming > Android' 카테고리의 다른 글

다중 액티비티 예제  (0) 2013.03.23
안드로이드 레이아웃 예제  (0) 2013.03.16
안드로이드 실습  (0) 2013.03.09
Intent 활용하기  (0) 2013.03.08
R.java import 에러  (0) 2012.11.27

JAVA 데이터베이스 실습 예제 UI

Programming/JAVA,JSP 2013. 2. 24. 12:51 Posted by TanSanC
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

import java.awt.BorderLayout;

import java.awt.GridLayout;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

 

import javax.swing.JButton;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JList;

import javax.swing.JPanel;


class UI extends JFrame{

    JPanel panel1;

    JPanel panel2;

    JPanel panel3;

    JPanel panel4;

    JList list1;

    JList list2;

    JList list3;

    JList list4;

    JButton updateButton;

   

    public UI()

    {

        JLabel label1 = new JLabel("book_id");

        JLabel label2 = new JLabel("title");

        JLabel label3 = new JLabel("publi");

        JLabel label4 = new JLabel("price");

        String[] listItem1 = { "green", "red", "orange", "dark blue" };

        String[] listItem2 = { "green", "red", "orange", "dark blue" };

        String[] listItem3 = { "green", "red", "orange", "dark blue" };

        String[] listItem4 = { "green", "red", "orange", "dark blue" };

        list1 = new JList(listItem1);

        list2 = new JList(listItem2);

        list3 = new JList(listItem3);

        list4 = new JList(listItem4);

        updateButton = new JButton("Update");

        panel1 = new JPanel(new BorderLayout());

        panel2 = new JPanel(new BorderLayout());

        panel3 = new JPanel(new BorderLayout());

        panel4 = new JPanel(new BorderLayout());

       

        setSize(600,400);

        setVisible(true);

        setLayout(new GridLayout(0, 5));

        add(panel1);

        add(panel2);

        add(panel3);

        add(panel4);

        add(updateButton);

        panel1.add(label1,BorderLayout.NORTH);

        panel2.add(label2,BorderLayout.NORTH);

        panel3.add(label3,BorderLayout.NORTH);

        panel4.add(label4,BorderLayout.NORTH);

        panel1.add(list1,BorderLayout.CENTER);

        panel2.add(list2,BorderLayout.CENTER);

        panel3.add(list3,BorderLayout.CENTER);

        panel4.add(list4,BorderLayout.CENTER);

    }

   

}

public class Test {

       public static Connection makeConnection()

       {

             String url = "jdbc:mysql://localhost/book_db";

             String id = "root";

             String password = "green";

             Connection con = null;

             try {

                    Class.forName("com.mysql.jdbc.Driver");

                    System.out.println("드라이버 적재 성공");

                    con = DriverManager.getConnection(url, id, password);

                    System.out.println("데이터베이스 연결 성공");

             } catch (ClassNotFoundException e) {

                    System.out.println("드라이버를 찾을 없습니다.");

             } catch (SQLException e) {

                    System.out.println("연결에 실패하였습니다.");

             }

             return con;

       }

       public static void main(String arg[]) throws SQLException {

           UI ui = new UI();

           Connection con = makeConnection();

           Statement stmt = con.createStatement();

           ResultSet rs = stmt.executeQuery("SELECT * FROM books");

           while (rs.next()) {

                  int id = rs.getInt("book_id");

                  String title = rs.getString("title");

                  System.out.println(id + " " + title);

           }

       }

}

'Programming > JAVA,JSP' 카테고리의 다른 글

JAVA JTABLE 사용 예제  (0) 2013.03.03
JAVA executeQuery INSERT DELETE  (0) 2013.03.02
JAVA JDBC 튜토리얼 예제 사이트  (0) 2013.02.24
JAVA 채팅 프로그램 + GUI  (0) 2013.02.23
RadioButton exam  (0) 2013.02.03

JAVA JDBC 튜토리얼 예제 사이트

Programming/JAVA,JSP 2013. 2. 24. 10:05 Posted by TanSanC
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

JAVA JDBC 튜토리얼 예제 사이트

http://docs.oracle.com/javase/tutorial/jdbc/basics/index.html

http://www.oracle.com/technetwork/java/javase/jdbc/index.html


'Programming > JAVA,JSP' 카테고리의 다른 글

JAVA executeQuery INSERT DELETE  (0) 2013.03.02
JAVA 데이터베이스 실습 예제 UI  (0) 2013.02.24
JAVA 채팅 프로그램 + GUI  (0) 2013.02.23
RadioButton exam  (0) 2013.02.03
[IT]자바의 위기, 한국 IT의 시금석  (0) 2013.02.02

JAVA 채팅 프로그램 + GUI

Programming/JAVA,JSP 2013. 2. 23. 12:11 Posted by TanSanC
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

Chat 실습.zip

JAVA 채팅 프로그램 + GUI

 

 

'Programming > JAVA,JSP' 카테고리의 다른 글

JAVA 데이터베이스 실습 예제 UI  (0) 2013.02.24
JAVA JDBC 튜토리얼 예제 사이트  (0) 2013.02.24
RadioButton exam  (0) 2013.02.03
[IT]자바의 위기, 한국 IT의 시금석  (0) 2013.02.02
JAVA 비행기게임  (0) 2013.01.09

JAVA 계산기 실습 중간코드

실습과제 모음 2013. 2. 16. 10:41 Posted by TanSanC
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

import java.awt.event.ActionEvent;


import java.awt.event.ActionListener;




import javax.swing.JButton;


import javax.swing.JFrame;


import javax.swing.JPanel;


import javax.swing.JTextField;


class Cal extends JFrame {

private JTextField t1;

private JButton b1, b2, b3, b4, b5, b6, b7, b8, b9, b0;

JButton pl, mi, mu, di, cal, c;

String x, y;

int oldValue;


public Cal() {


setSize(285, 350);


setDefaultCloseOperation(EXIT_ON_CLOSE);


setTitle("Calculator");


JPanel p = new JPanel();


p.setLayout(null);




t1 = new JTextField(10);


p.add(t1);




b1 = new JButton("1");


p.add(b1);


b1.addActionListener(new Number());




b2 = new JButton("2");


p.add(b2);


b2.addActionListener(new Number());





b3 = new JButton("3");


p.add(b3);


b3.addActionListener(new Number());




b4 = new JButton("4");


p.add(b4);


b4.addActionListener(new Number());




b5 = new JButton("5");


p.add(b5);


b5.addActionListener(new Number());




b6 = new JButton("6");


p.add(b6);


b6.addActionListener(new Number());




b7 = new JButton("7");


p.add(b7);


b7.addActionListener(new Number());




b8 = new JButton("8");


p.add(b8);


b8.addActionListener(new Number());




b9 = new JButton("9");


p.add(b9);


b9.addActionListener(new Number());




b0 = new JButton("0");


p.add(b0);


b0.addActionListener(new Number());




pl = new JButton("+");


p.add(pl);


pl.addActionListener(new Number());




mi = new JButton("-");


p.add(mi);


mi.addActionListener(new Number());




mu = new JButton("*");


p.add(mu);


mu.addActionListener(new Number());




di = new JButton("/");


p.add(di);


di.addActionListener(new Number());




cal = new JButton("=");


p.add(cal);


cal.addActionListener(new Number());




c = new JButton("C");


p.add(c);


c.addActionListener(new Number());




t1.setBounds(10, 10, 245, 80);


b1.setBounds(10, 105, 45, 45);


b2.setBounds(60, 105, 45, 45);


b3.setBounds(110, 105, 45, 45);


b4.setBounds(10, 155, 45, 45);


b5.setBounds(60, 155, 45, 45);


b6.setBounds(110, 155, 45, 45);


b7.setBounds(10, 205, 45, 45);


b8.setBounds(60, 205, 45, 45);


b9.setBounds(110, 205, 45, 45);


b0.setBounds(60, 255, 45, 45);


pl.setBounds(160, 105, 45, 45);


mi.setBounds(160, 155, 45, 45);


mu.setBounds(160, 205, 45, 45);


di.setBounds(160, 255, 45, 45);


c.setBounds(110, 255, 45, 45);


cal.setBounds(210, 105, 45, 195);




add(p);


setVisible(true);


}




private class Number implements ActionListener {


public void actionPerformed(ActionEvent e) {


if(e.getSource() == b1)

{

t1.setText(t1.getText() + "1");

}

else if(e.getSource() == b2)

{

t1.setText(t1.getText() + "2");

}

else if(e.getSource() == b3)

{

t1.setText(t1.getText() + "3");

}

else if(e.getSource() == b4)

{

t1.setText(t1.getText() + "4");

}

else if(e.getSource() == b5)

{

t1.setText(t1.getText() + "5");

}

else if(e.getSource() == b6)

{

t1.setText(t1.getText() + "6");

}

else if(e.getSource() == b7)

{

t1.setText(t1.getText() + "7");

}

else if(e.getSource() == b8)

{

t1.setText(t1.getText() + "8");

}

else if(e.getSource() == b9)

{

t1.setText(t1.getText() + "9");

}

else if(e.getSource() == b0)

{

t1.setText(t1.getText() + "0");

}

else if(e.getSource() == pl)

{

oldValue = 

Integer.parseInt(t1.getText());

t1.setText("");

}

else if(e.getSource() == mi)

{

oldValue = 

Integer.parseInt(t1.getText());

t1.setText("");

}

else if(e.getSource() == mu)

{

oldValue = 

Integer.parseInt(t1.getText());

t1.setText("");

}

else if(e.getSource() == di)

{

oldValue = 

Integer.parseInt(t1.getText());

t1.setText("");

}

else if(e.getSource() == c)

{

t1.setText("");

}


}


}


}




public class cals {


public static void main(String[] args) {


Cal Cals = new Cal();




}


}

'실습과제 모음' 카테고리의 다른 글

JAVA 가계부 프로그램  (0) 2013.03.02
JAVA 직원 관리 프로그램 작성  (0) 2013.03.02
C 언어 실습문제 모음  (0) 2013.01.09
CPP 실습과제 1208  (0) 2012.12.08
123  (0) 2012.11.03