Java Applet은 웹표준에서 사용 금지가 됐고

다들 쓰지 말라고 한다.


그런데 뭐 어떻하나

디바이스랑 연결 된 프로그램들이 applet으로 쓰게 되있다


앞으로 쓸일이 별로 없겠지만


역사 공부한다고 생각하고 하는 수 밖에...

'Java' 카테고리의 다른 글

java bytecode  (0) 2018.04.01
Java Applet ReflectPermission  (0) 2018.03.28
BigDecimal을 사용하는 이유  (0) 2018.03.18
autoclose resource : try-with-resource  (0) 2018.03.09
자바 자체 인증키 발급  (0) 2018.01.02

table cell 안에 가로 숫자 바를 넣고 싶다.

div 안의 div의 넓이를 조절해서 바를 표현한다.

여기까지는 아무런 문제가 없다.

그런데 바를 우측 정렬을 하고 싶다면 문제가 발생한다.


<!doctype html>
<html>
<head>
<style>
table {
width : 20rem;
border-collapse: collapse;
}
td {
border : 1px solid black;
height : 1.3rem;
text-align : center;
}

td:nth-of-type(1) {
width : 33.3%;
}
td:nth-of-type(2) {
width : 33.3%;
}
td:nth-of-type(3) {
width : 33.3%;
}

.depthBar {
text-align : left;
padding : 3px 5px;
}
.depthBar > div {
display : inline-block;
line-height: 1rem;
width : 2%;
background-color: blue;
overflow: visible;
}

</style>
</head>
<body>
<table>
<tr>
<td>1</td>
<td>2</td>
<td><div class="depthBar"><div>12345</div></div></td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td><div class="depthBar"><div>1234</div></div></td>
</tr>
</table>
</body>
</html>


우측정렬이라서 글자를 우측에서 우측부터 찍을 줄 알았다.

그러나 글자는 우측 끝을 맞추려고 시도할 뿐

좌측부터 찍힌다.

즉 공간이 충분하지 않으면 좌측으로 튀어나가는 것이 아니라 우측으로 튀어나간다.

어찌보면 당연한 것 같기도 하지만

우측정렬을 했는데 글자가 우측으로 튀어나가길 바라는 사람이 있을까?


바안에 글자를 넣어서 해결하려는 게으름이 애초부터 잘못된 개념이라고 생각할 수도 있다.

하지만 이런 게으른 발상이 코드양을 줄려준다면 좋은 것 아닌가?


물론 이 문제는 다른 방향으로 좀 더 설정을 많이 해주면 해결 된다.




뭔가를 구현하고 객체를 얻어 올 때

templete method와 factory mehtod 두 용어가 같이 나올 때가 많다.

그래서 뭐가 다른지 혼란 스럽다.


잘 설명된 말을 빌려온다.

Templete Mehthod (https://en.wikipedia.org/wiki/Template_method_pattern) 

In software engineering, the template method pattern is a behavioral design pattern that defines the program skeleton of an algorithm in an operation, deferring some steps to subclasses.

처리 단계의 뼈대를 만드는 것


Factory Mehthod (https://en.wikipedia.org/wiki/Factory_method_pattern) 

In class-based programming, the factory method pattern is a creational pattern that uses factory methods to deal with the problem of creating objects without having to specify the exact class of the object that will be created.

최종 결정되지 않은 객체를 만드는 패턴


정확하지 않지만 단순하게 생각하면 팩토리 메서드는 프로퍼티가 변경 가능한 객체를 만드는 메서드라고 생각하면 될 것 같다.


+ Recent posts