gFinger 손끝으로 만드는 세상

 

 

http://poi.apache.org

 

 

 

 

 

 

 

 

 

눈으로 보고 화면을 디자인 하고 개발하는 Visual Basic류의 GUI 디자이너와 개발 툴이 JAVA에서도 깔끔하게 가능한 방법이 있군요.

 

구글에서 거금을 들여 공개한 WindowBuilder Pro라는 툴 입니다.
이클립스 환경에서 JAVA 화면을 디자인 하고 코딩까지 연계해서 개발 할 수 있습니다.
(클릭 : WindowBuilder Pro 사이트)
 

 



Eclipse 버전에 따라 설치하는 방법이 차이가 있습니다. 
(설치 주소가 약간 다릅니다)
(클릭 : 버전 별 WindowBuilder Pro 주소)

 



제가 설치한 Eclipse 버전은 3.6 입니다.

Available Software dialog에서 3.6 버전의 주소인 “http://dl.google.com/eclipse/inst/d2wbpro/latest/3.6”를 입력하면 설치할 수 있는 아이템 리스트가 나타납니다.

모두 선택하고 설치 합니다.

 

 

 

 

 

 

이클립스 환경에서 자바 프로그램인 Hello World를 만들어 봤습니다.
소소한 프로그램을 짜 볼까 하고 선택한 언어와 개발 툴 입니다.

개인에게는 무료로 제공되는 언어와 개발 툴이 많습니다.
그러나 상업용 까지 무료가 아닌 경우가 대부분 입니다.
공부한 언어나 개발 툴이 상업용으로 이어지지 않으니 문제가 좀 있네요.
그런면에서 자바는 조금 더 자유가 있으니 자바를 주력 언어로 하는 것이 좋다는 생각이 듭니다. (언어와 개발 툴은 상업용으로도 보다 자유롭게 풀어 주는 것이 좋을 것 같습니다)

 

 

  

 

 

 

 

 

 

 

 

붉은 부분을 타이핑

 

public class HelloWorld {
    public static void main(String[] args)
    {
            System.out.println("Hello World"); 
    }
}

 

 

 

 

 

 

 

 


 

 

자바 컴파일러 다운로드

http://java.sun.com/javase/downloads/index.jsp

플랫폼의 종류 

SE - Standard Edition의 약자로, 자바 플랫폼에서 가장 널리쓰이는 API(라이브러리)

EE - Enterprise Edition의 약자로 대규모 API를 지원하며, 특히 서버관련 개발을 위한 플랫폼.

ME - Micro Edition의 약자로 휴대전화, PDA등을 위한 플랫폼.

C:\Program Files\Java\jdk1.6.0_14\bin

 

C:\Program Files\Java\jdk1.6.0_14\bin

 

%classpath%;

 

자바 개발 환경 이클립스

http://www.eclipse.org/downloads/

WorkBench를 눌러 프로그램을 제작

 

자바 스크립트로 2001년 1월에 만든 Stack Demo 프로그램

 

 

<html>
<head>
<title> Html Stack </title>
</head>

<script language="javascript">
<!--
// [ ]---------------------------------------[ ]
//  |             Stack Object                |
//  |                         Written by lng  |
//  |                            2001. 1. xx  |
// [ ]---------------------------------------[ ]

   function Push(TrVal)
   {
      this.Stack[this.Head] = TrVal
      this.Head++
   }

   function Pop()
   {
     if (this.Head>0)
     {
         this.Head--
         return this.Stack[this.Head+1]
     }
     else
         return null
   }

   function GetTop()
   {
     if (this.Head>0)
     {
         return this.Stack[this.Head]
     }
     else
         return null
   }
   function GetnValue(nValue)
   {
     if (this.Head>=nValue)
     {
         return this.Stack[nValue]
     }
     else
         return null
   }

   function Getn()
   {
      return this.Head
   }

   function IsEmpty()
   {
     if (this.Head>0)
     {
         return false
     }
     else
         return true
   }

   function ProStack()
   {

      this.Head = 0
      this.Push = Push           // Push a value to the stack
      this.Pop = Pop             // Pop a value to the stack
      this.ViewTop = GetTop      // Get a value which is the value on top of the stack
      this.IsEmpty = IsEmpty     // Check the stack which is empty or not
      this.GetnValue = GetnValue // Get a value which is the value of n'st in the stack
      this.GetTop = GetTop      
      this.Getn = Getn
      this.Stack = new Array()
      return this
   }

//-->
</script>

<body>
<center>
<form name="stack">
   <p>
   <h2> STACK DEMO </h>
   <br> <br> <br>
   <input type="button" name="but0" value="push 0" onClick="PushItem('0')">
   <input type="button" name="but1" value="push 1" onClick="PushItem('1')">
   <input type="button" name="but2" value="push 2" onClick="PushItem('2')">
   <input type="button" name="but3" value="push 3" onClick="PushItem('3')">
   <input type="button" name="but4" value="push 4" onClick="PushItem('4')">
   <input type="button" name="but5" value="push 5" onClick="PushItem('5')">
   <input type="button" name="but6" value="push 6" onClick="PushItem('6')">
   <input type="button" name="but7" value="push 7" onClick="PushItem('7')">
   <input type="button" name="but8" value="push 8" onClick="PushItem('8')">
   <input type="button" name="but9" value="push 9" onClick="PushItem('9')">
   <input type="button" name="but9" value="pop" onClick="PopItem()">
   </p>
   <p>
     <table border=0>
        <tr>
           <th> bottom of the stack</th>
           <th> <-------------------------------------------------------------------> </th>
           <th> top of the stack</th>
        <tr>
     </table>
     <input type="text" name="text1" value=" " size=100> <br>
     <br><br>
     Number of item in the stack :  <input type="text" name="text2" value=" " size=2> 
   </p>

<script language="javascript">
<!--
   TStack = new ProStack
   function PushItem(AValue)
   {
       TStack.Push(AValue)
       DisplayStack()
   }

   function PopItem(AValue)
   {
       TStack.Pop()
       DisplayStack()
   }

   function DisplayStack()
   {
      var i
      i = TStack.Getn()
      document.stack.text1.value = ""
      document.stack.text2.value = i
      for(i=0;i<TStack.Getn();i++)
         document.stack.text1.value
           = document.stack.text1.value + " < " + TStack.GetnValue(i) + " > "
   }
//-->
</script>

</form>
</center>
</body>
</html>

오래전 하드 디스크를 뒤져 보다가 2001년 1월에 자바 스크립트로 만든 계산기가 있었다.
 

 

 

 

 

 

 

 

 

<<소스>>

<html>
<head>
<title> Html 계산기 </title>
</head>

<script language="javascript">
<!--
// [ ]---------------------------------------[ ]
//  |             Stack Object                |
//  |                         Written by lng  |
//  |                            2001. 1. xx  |
// [ ]---------------------------------------[ ]

   function Push(TrVal)
   {
      this.Stack[this.Head] = TrVal
      this.Head++
   }

   function Pop()
   {
     if (this.Head>0)
     {
         this.Head--
         return this.Stack[this.Head+1]
     }
     else
         return null
   }

   function GetTop()
   {
     if (this.Head>0)
     {
         return this.Stack[this.Head]
     }
     else
         return null
   }
   function GetnValue(nValue)
   {
     if (this.Head>=nValue)
     {
         return this.Stack[nValue]
     }
     else
         return null
   }

   function Getn()
   {
      return this.Head
   }

   function IsEmpty()
   {
     if (this.Head>0)
     {
         return false
     }
     else
         return true
   }

   function ProStack()
   {

      this.Head = 0
      this.Push = Push           // Push a value to the stack
      this.Pop = Pop             // Pop a value to the stack
      this.ViewTop = GetTop      // Get a value which is the value on top of the stack
      this.IsEmpty = IsEmpty     // Check the stack which is empty or not
      this.GetnValue = GetnValue // Get a value which is the value of n'st in the stack
      this.GetTop = GetTop      
      this.Getn = Getn
      this.Stack = new Array()
      return this
   }

//-->
</script>

<body>
<center>
<form name="calc">
   <table cellspaceing=0 cellpadding=0 border=1>
      <th colspan=6> 
         <input type=text size=44 name=LCD align=right>
      </th>
      <tr>   
          <td align=center> <input type=text value="    " size=5 name=MemoryDisplay> </td>
          <td align=center colspan=2> <input type=button value="Backspace" name=BackSpace
              onClick="ExpAna(document.calc.LCD, 'BS')" > </td>
          <td colspan=2 align=center> <input type=button value="      CE      " name=CE
              onClick="ExpAna(document.calc.LCD, 'CE')"  > </td>
          <td align=center> <input type=button value="   C    " name=C
              onClick="ExpAna(document.calc.LCD, 'C')" > </td>
      </tr>
      <tr>
          <td align=center> <input type=button value="  MC  " name=MemoryClear
              onClick="ExpAna(document.calc.LCD, 'MC')" > </td>
          <td align=center> <input type=button value="    7  " name=Seven
              onClick="ExpAna(document.calc.LCD, '7')" > </td>
          <td align=center> <input type=button value="    8  " name=Eight
              onClick="ExpAna(document.calc.LCD, '8')" > </td>
          <td align=center> <input type=button value="    9  " name=Nine
              onClick="ExpAna(document.calc.LCD, '9')" > </td>
          <td align=center> <input type=button value="    /  " name=Slash
              onClick="ExpAna(document.calc.LCD, '/')"  > </td>
          <td align=center> <input type=button value="  Sqrt " name=Sqrt
              onClick="ExpAna(document.calc.LCD, 'SQRT')" > </td>
      </tr>
      <tr>
          <td align=center> <input type=button value="  MR  " name=MemoryRestore
              onClick="ExpAna(document.calc.LCD, 'MR')" > </td>
          <td align=center> <input type=button value="    4  " name=Four
              onClick="ExpAna(document.calc.LCD, '4')" > </td>
          <td align=center> <input type=button value="    5  " name=Five
              onClick="ExpAna(document.calc.LCD, '5')" > </td>
          <td align=center> <input type=button value="    6  " name=Six
              onClick="ExpAna(document.calc.LCD, '6')"  > </td>
          <td align=center> <input type=button value="    *  " name=Multifly
              onClick="ExpAna(document.calc.LCD, 'MUL')" > </td>
          <td align=center> <input type=button value="    %  " name=Percent
              onClick="ExpAna(document.calc.LCD, 'PER')" > </td>
      </tr>
      <tr>
          <td align=center> <input type=button value="  MS  " name=MemorySave
              onClick="ExpAna(document.calc.LCD, 'MS')" > </td>
          <td align=center> <input type=button value="    1  " name=One
              onClick="ExpAna(document.calc.LCD, '1')" > </td>
          <td align=center> <input type=button value="    2  " name=Two
              onClick="ExpAna(document.calc.LCD, '2')" > </td>
          <td align=center> <input type=button value="    3  " name=Three
              onClick="ExpAna(document.calc.LCD, '3')" > </td>
          <td align=center> <input type=button value="    -  " name=Minus
              onClick="ExpAna(document.calc.LCD, 'MINUS')" > </td>
          <td align=center> <input type=button value="   1/x " name=Reverse
              onClick="ExpAna(document.calc.LCD, 'REV')" > </td>
      </tr>
      <tr>
          <td align=center> <input type=button value="   M+  " name=MemoryPlus
              onClick="ExpAna(document.calc.LCD, 'MP')" > </td>
          <td align=center> <input type=button value="    0  " name=Zero
              onClick="ExpAna(document.calc.LCD, '0')" > </td>
          <td align=center> <input type=button value="  +/- " name=Significant
              onClick="ExpAna(document.calc.LCD, 'SIG')" > </td>
          <td align=center> <input type=button value="    .   " name=Point
              onClick="ExpAna(document.calc.LCD, 'POINT')" > </td>
          <td align=center> <input type=button value="   +   " name=Plus
              onClick="ExpAna(document.calc.LCD, 'PLUS')" > </td>
          <td align=center> <input type=button value="     =   " name=Equal
              onClick="ExpAna(document.calc.LCD, 'EQUAL')" > </td>
      </tr>
   </table>

   <input type=text size=44 name=debug align=right>

<script language="javascript">
<!--
   var AutoStatus=0   // Automata status. now Start status

   TStack = new ProStack()

   function ExpAna(LCD, KeyVal)
   {
     switch (AutoStatus)
     {
        case 0 :
           if (KeyVal >= "0" && KeyVal <="9")
           {
              LCD.value = KeyVal
              AutoStatus = 1
           }
           break

        case 1 :
           if (KeyVal == "BS")
           {
              document.calc.debug.value = LCD.value.length
              LCD.value = LCD.value.substring(0,LCD.value.length-1)
           }
           else if (KeyVal >= "0" && KeyVal <="9")
           {
              LCD.value = LCD.value + KeyVal
           }
           break          
        default :
     }
   }
//-->
</script>

</form>
</center>
</body>
</html>