반응형
Wikipedia에 따르면 스플래시 스크린은 프로그램이나 운영체제가 로딩되는 동안 표시되는 이미지를 가리키는 컴퓨터 용어로서, 사용자에게 프로그램이 초기화되고 있다는 것을 시각적으로 보여주는 역할을 한다. Java SE 6(코드명 Mustang)가 출시되기 전에는 메인 메소드를 시작할 때 창을 만들고 그 속에 이미지를 배치하여 스플래시 스크린의 동작을 보여주는 것이 고작이었다. 이것도 나름대로 유용했지만, 창이 표시되기 전에 Java 런타임이 완전히 초기화될 필요가 있었다. 한편, 이 초기화 과정에는 AWT와 보통 Swing이 포함되어 초기 그래픽 디스플레이를 지연시키는 원인이 되었다. Mustang의 경우에는, 새로운 명령어 라인 옵션으로 이 기능을 훨씬 쉽게 만들어줄 뿐 아니라 사용자에게 이미지를 더 빠르게, 즉 Java 런타임이 시작되기도 전에 디스플레이를 가능하게 해준다. 이 기능이 최종적으로 포함되려면 JCP의 승인을 받아야 한다.

명령어 라인 옵션

명령어 라인으로 프로그램을 실행하면 -splash 명령어 라인 스위치를 통해 스플래시 스크린을 생성할 수 있다. 이 기능은 스크립트, 배치 파일, 바탕화면 바로가기 등을 이용해서 프로그램을 실행할 때 특히 유용하며, 명령어 라인 스위치 뒤에는 다음과 같은 이미지 이름이 온다.
   java -splash:Hello.png HelloWorld
-splash와 이미지 이름 사이에는 콜론이 들어간다. 이렇게 하면 런타임 환경이 완전히 초기화되기 전에 이미지가 즉시 디스플레이된다(화면의 중앙에 디스플레이됨). 스플래시 스크린 이미지에는 GIF, PNG, JPEG 등의 포맷이 사용될 수 있으며, 통상적인 Image 클래스와 마찬가지로 스플래시 스크린 이미지는 애니메이션, 투명(transparency), 반투명(translucency. Microsoft Windows 2000 또는 XP에서만 지원) 등의 효과를 지원한다. 애플리케이션이 첫 번째 창을 생성하면 스플래시 스크린은 사라진다.

JAR 파일 Manifest

일반적으로 대부분의 사용자는 명령어 라인 엔트리에 -splash를 삽입하기를 원치 않는다. 따라서, 보다 효과적으로 스플래시 스크린을 디스플레이하는 방법은 애플리케이션을 위한 manifest 파일을 생성한 다음 애플리케이션에 JAR 파일 내의 manifest와 이미지를 결합하는 것이다. 사용자가 JAR 파일로부터 애플리케이션을 론치할 때 스플래시 스크린이 표시되는데, 이 경우에는 사용자가 명령어 라인 옵션을 지정하지 않아도 된다.

manifest 파일 옵션은 SplashScreen-Image로 명명되고, 옵션 뒤에는 이미지 파일명이 온다. 파일이 JAR 파일의 톱 레벨에 있지 않을 경우에는 파일명의 전체 경로를 지정할 필요가 있다.

다음은 이 새로운 스플래시 스크린 기능들을 보여주는 간단한 예제이다 . 먼저, 다음 프로그램을 작성하도록 한다.
   import javax.swing.*;
   import java.awt.*;
   
   public class HelloSplash {
     public static void main(String args[]) {
       Runnable runner = new Runnable() {
         public void run() {
           try {
               Thread.sleep(1500);
           } catch (InterruptedException e) {
           }
           JFrame frame = new JFrame("Splash Me");
           frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
           JLabel label = new JLabel(
                "Hello, Splash", JLabel.CENTER);
           frame.add(label, BorderLayout.CENTER);
           frame.setSize(300, 95);
           frame.setVisible(true);
        }
       };
       EventQueue.invokeLater(runner);
     }
    } 
이어서 프로그램을 컴파일한다.
    javac HelloSplash.java
그런 다음 명령어 라인 -splash를 시험해본다. 작업을 단순화시키기 위해, 프로그램과 동일한 디렉터리에 있는 스플래시 스크린 이미지를 사용한다.
   java -splash:MyImage.png HelloSplash
MyImage가 즉시 화면 중앙에 배치되고, 이어서 Java 런타임 환경이 초기화되고 나면 애플리케이션 화면이 표시되는 것을 알 수 있다.

My Image

Hello Splash

이제 JAR 파일 방식을 시험해 보기로 하자. 먼저 manifest를 위한 manifest.mf 파일을 생성한다. 파일의 내용은 다음과 같은 형태이어야 한다.
   Manifest-Version: 1.0
   Main-Class: HelloSplash
   SplashScreen-Image: MyImage.png
이어서 JAR 파일을 패키지한다.
   jar -mcvf manifest.mf Splash.jar HelloSplash*.class MyImage.png
그런 다음 -splash 명령어 라인 옵션을 지정하지 않고 JAR를 실행한다.
   java -jar Splash.jar
이전과 마찬가지로 스플래시 스크린에 이어서 애플리케이션 화면이 표시되어야 한다.

여러분의 JAR 파일이 manifest에 지정된 스플래시 스크린 이미지를 가지고 있고, 사용자가 명령어 라인에서 스플래시 이미지를 지정하는 경우에는 명령어 라인 이미지에 우선권이 주어지고 대신 표시된다.

고급 기능

대개의 경우에는 명령어 라인 -splash 및 manifest SplashScreen-Image 옵션으로 충분하지만, Mustang에는 더 많은 스플래시 스크린 기능이 들어 있다. java.awt 패키지는 단순히 스플래시 스크린 이미지를 보여주는 것 이상의 진보된 기능을 위한 SplashScreen 클래스를 제공한다.

-splash 명령어 라인 옵션이나 manifest의 SplashScreen-Image 옵션으로 이미지가 생성된 경우에는 SplashScreen 클래스의 getSplashScreen() 메소드가 생성된 화면을 반환한다. 이미지가 생성되지 않았다면 getSplashScreen()이 null을 반환한다.

다른 SplashScreen 메소드를 이용해서 스플래시 스크린과 관련된 다양한 사실을 알아낼 수 있다.
  • getBounds()는 스플래시 스크린 직사각형의 바운드를 반환한다.
  • getImageURL()은 스플래시 스크린 이미지의 URL을 반환한다.
  • getSize()는 스플래시 스크린 창의 크기를 반환한다.
  • isVisible()은 스플래시 스크린이 가시적인지 여부를 알려준다.
스플래시 스크린이 로드된 후에 이미지를 변경할 수 있지만, 이는 애플리케이션이 시작되기 전까지만 가능하다. 여기에는 두 가지 방법이 사용된다. setImageURL() 메소드는 디스플레이할 새 이미지에 대한 URL을 제공할 수 있게 해주고, 더 일반적인 두 번째 방법은 getGraphics() 메소드를 호출하여 창의 그래픽 컨텍스트(java.awt.Graphics)를 얻는 것이다. 그런 다음 통상적인 그래픽과 Java 2D API를 통해 이미지를 업데이트하는데, 그 이유는 이것이 단순한 java.awt.Graphics가 아니라 Graphics2D의 인스턴스이기 때문이다. 그래픽 컨텍스트에 드로우(draw)한 후 SplashScreenupdate() 메소드를 호출하여 업데이트된 이미지를 드로우한다.

다음은 스플래시 스크린에 표시되는 일련의 색상을 순환하는 후반의 동작을 보여주는 예제이다. 이것이 프로그레스 바, 또는 애플리케이션 초기화의 진행 상태를 나타내는 다른 상태 데이터를 디스플레이하는 것을 상상해보라.
   import javax.swing.*;
   import java.awt.*;
   import java.awt.geom.*;
   import java.util.*;

   public class ExtendedSplash {
     public static void main(String args[]) {
       Runnable runner = new Runnable() {
         public void run() {
           Random random = new Random();
           SplashScreen splash = SplashScreen.getSplashScreen();
           Graphics2D g = (Graphics2D)splash.getGraphics();
           Dimension dim = splash.getSize();
           Color colors[] = {Color.RED, Color.ORANGE, 
             Color.YELLOW, Color.GREEN, Color.BLUE, 
             Color.MAGENTA};
           for (int i=0; i<100; i++) {
             g.setColor(colors[i % colors.length]);
             g.fillRect(50, 50, dim.width-100, dim.height-100);
             splash.update();
             try {
               Thread.sleep(250);
             } catch (InterruptedException ignored) {
             }
           }
           JFrame frame = new JFrame("Splash Me2");
           frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
           JLabel label = 
             new JLabel("Hello, Splash", JLabel.CENTER);
           frame.add(label, BorderLayout.CENTER);
           frame.setSize(300, 95);
           frame.setVisible(true);
         }
       };
       EventQueue.invokeLater(runner);
     }
   }
color Splash

스플래시 스크린 이미지 위에서 어떻게 드로잉이 이루어지는지 주목할 것.

예제는 색상 순환이 완료된 후의 프레임을 보여주는데, 이는 시동 과정의 전형적인 양상으로, 초기화가 완료된 후 프레임이 표시되면서 스플래시 스크린을 가리게 된다.

마지막으로 언급할 SplashScreen 옵션의 경우 close() 메소드가 사용되는데, 창을 닫고 관련된 리소스를 해제하고자 할 경우에 이 메소드를 호출할 수 있다. 첫 번째 창이 가시적으로 되면 이 메소드가 자동으로 호출되기 때문에 굳이 호출할 필요는 없다.

스플래시 스크린을 이용하는 방법에 관한 자세한 내용은 테크니컬 아티클 “Mustang의 새로운 스플래시 스크린 기능(New Splash-Screen Functionality in Mustang)”을 참조하기 바란다. 아울러, SplashScreen 클래스를 위한 javadoc을 함께 참조할 것.

<출처: http://blog.sdnkorea.com/blog/171 >

참고자료로 구글링을 하면서  스플래시 스크린 자료를 찾았다.
http://www.jcreator.co.kr/tag/Splash%20Screen 
<이전 스플래시 스크린 자료 -window 클래스를 이용 >
http://www.devdaily.com/java/edu/SplashScreen
http://www.javapractices.com/topic/TopicAction.do?Id=149
반응형

Install TPTP 4.5.2 using the Ganymede update site

Ganymede is the Eclipse simultaneous release in 2008. It includes TPTP 4.5.2 and all of its dependencies. The Ganymede update site provides an easy way to install TPTP and its dependencies. Step-by-Step illustration is also available on the TPTP wiki page.

  1. Install Eclipse SDK version 3.4
  2. From the menu, select Help > Software Updates.
  3. Select the "Available Software" tab in the "Software Updates and Add-ons" dialog box.
  4. Expand the "Ganymede" entry.
  5. Expand the "Testing and Performance" entry and choose the options to install. Equinox p2 will automatically install the required dependencies.
  6. Click Install, and follow the instructions to complete the installation. Restart Eclipse when prompted.

 

반응형
반응형

 

top 이미지

developerWorks가 후원하는 10번째 기묘세미나, '개발자 창의력 강화 프로젝트'가 12월 2일(화), 도곡동 군인공제회관 23층 온디맨드홀에서 열립니다!

기묘의 열번째 세미나에서는 개발자에게 꼭 필요하지만, 누구도 말하지 않았던 소프트웨어 창의력에 대해 이야기하고자 합니다.



누구나 생각의 힘을 통한 창의력을 발휘할 수 있지만, 어떻게, 어떤 상황에서 빛을 발하는지 알지 못하고 있습니다. 그리고 자신은 창의력과 거리가 멀다고 말합니다. 점점 복잡해지는 개발 환경과 프로세스 속에서 개발 진행시의 문제 해결 능력부터 새로운 서비스 개발에 이르기까지 창의력의 필요성과 힘은 강조되고 있습니다.


이번 기묘세미나에서는 현재의 상황에서 최선의 답을 찾기 위해 골몰하는 여러분에게 창의력을 강화할 수 있는 방법을 제시합니다.


 
· 일시 : 2008년 12월 2일(화) 13:00 - 18:00
· 장소 : 도곡동 군인공제회관 23층 온디맨드홀
· 주최 : 기묘
· 후원
    기업후원 :
    언론후원 :
    출판사후원 :
· 비용 : 55,000원(V. A. T 포함)

시간 내용 발표자
13:00 - 13:30   등록  
13:30 - 14:50   소프트웨어 개발에 창의력이 필요할까? 박재호
14:50 - 15:00   휴식  
15:00 - 16:20   실험정신으로 창의력을 펼치다 - 인디 소프트 이창신
16:20 - 16:40   휴식  
16:40 - 17:30   그룹 창의력으로 개발한 서비스 이재성
17:30 - 18:00   Q&A  

반응형

 
아직도 .NET Framework만 사용하고 계십니까? 그것의 빈자리를 채워줄 수많은 .NET용 무료 Framework들이 공개되었습니다. 수많은 Pattern & Practice 팀의 Application Block들 .NET의 유명한 OpenSource 프로젝트인 Castle을 인도하고 있던 Hamilton Verissimo가 Microsoft에 조인하게
됨으로써, 조만간 .NET도 Java처럼 Framework의 홍수시대를 맞이하고 있습니다.

또한 Framework의 중요성을 생산성 향상을 위해 필수적인 프로젝트의 기반 요소가 되었습니다.
이번 Framework’s Day를 통해서 Framework가 무엇인지 그리고 Framework 설계 방법과 유명한
무료 Framework들을 여러분에게 소개함으로써 이론적 배경과 활용 방법을 얻는 세미나를 Devpia의 Eva팀, Microsoft MVP들과 함께 준비했습니다.
주 제  Framework’s Day
개최일시  2008년 11월 29일 10:00~17:00
장소  한국소프트웨어진흥원 5층 교육장
참가대상  Wannabe 아키텍트, 소프트웨어 설계에 관심이 많은 분들
내용수준  Framework 설계와 사용에 관심이 많은 분들
가 격  무료
시 간 Session 강 좌 제 목
10:00 ~ 10:50 50분 Session 1  Evolving Framework (김용현)
11:00 ~ 11:50 50분 Session 2  Framework Engineering (손영수)
12:00 ~ 12:50 50분 점심시간
13:00 ~ 13:50 50분 Session 3  Application과 Framework 동시 구축하기 (고상원)
14:00 ~ 14:50 50분 Session 4  ASP.NET MVC Framework (장현희)
15:00 ~ 15:50 50분 Session 5  Data Entity Framework (한용희)
16:00 ~ 16:50 50분 Session 6  Spring.NET과 iBatis.NET (권효중)
  * 각 섹션의 쉬는 시간은 유연성 있게 조절합니다.
Evolving Framework
프레임워크를 만드는 것은 막연히 어렵게 느껴지지만, 막상 코드를 개발하다 보면 그리 어렵지 않게 만들 수 있을 것 같다는 느낌을 받곤 합니다. 코딩과정에서 공통적인 부분을 별도로 끌어 내어 관리 하는 것은 그리 어렵지 않습니다. 아마도 어렵다고 느껴지는 건 끌어낸 공통 코드를 앞으로 어떤 방향으로 조직하고 어떤 구조로 어떻게 발전시킬지 정하기가 어렵기 때문일 겁니다.
프레임워크란 무엇인지에 대해서 생각해 보고 좋은 프레임워크를 만들기 위해 어떤 식으로 발전시켜 나갈 것 인가에 대하여 소개합니다.
김 용 현  이스트소프트 알약개발팀장
- 데브피아 아키텍쳐 시삽
- 데브피아 아키텍쳐 스터디 팀 Eva 소속
- Microsoft MVP
 
Framework Engineering
Framework을 구축하기 위해 우리에게 필요한 공학적 기법들은 어떠한 것이 있을까요?
.NET Framework의 설계자인 Krzysztof Cwalina의 실제 경험을 공유해 드립니다. 이 세션을 통해 Framework를 잘 설계하기 위한 여러 가지 설계 가이드라인들과 툴들을 소개 드립니다.
손 영 수  데브피아 아키텍쳐 시삽
- 데브피아 아키텍쳐 시삽 (Eva 리더), Microsoft MVP
- 아키텍트 블로그 (아키텍트로 가는 길 http://www.arload.net )
- MSDN, JCO, INETA등의 다수 세미나 스피커, Micro Software 다수기고
- 사이텍미디어 자문위원
 
Application과 Framework 동시에 구축하기
느긋하게 Framework를 설계할 시간이 있다면 얼마나 좋을까요? 하지만 현업은 우릴 그렇게 나두지 않습니다. 어떻게 해야 Framework를 사용할 수많은 Application들과 함께 협업하여 성공적으로 Framework를 구축할 수 있을까요? 7가지의 Pattern Language 행동 강령을 여러분에게 소개합니다.
고 상 원  한양대학교 객체지향 연구실
- 한양대학교 객체지향 연구실
- 데브피아 아키텍쳐 스터디 팀 EVA 소속
 
ASP.NET MVC Framework
이 세션은 ASP.NET 플랫폼 상에서 Front Controller 패턴 바탕의 웹 애플리케이션 개발을 지원하는ASP.NET MVC Framework에 대해 설명합니다. ASP.NET MVC Framework의 내부 구조와 Front Controller 패턴에 기반한 웹 애플리케이션 개발 방법을 ASP.NET MVC Framework Beta 버전을 기준으로 간단한 예제와 함께 살펴봅니다.
장 현 희  MySpace.com 한국 지사 Senior Developer
- MySpace.com 한국 지사에서 Senior Developer
- ASP/ASP.NET 분야 Microsoft MVP
- 다수의 ASP/ASP.NET 관련 도서를 집필한 저자
- DevDays 등 크고 작은 세미나에서 발표자
 
 ADO.NET Entity Framework
지금까지의. NET의 데이터액세스 어플리케이션은 데이터베이스에 접근하기 위해서 대부분 ADO.NET을 직접 이용해 왔습니다. 그리고 이 경우 원하는 데이터를 얻기까지 상당부분의 코딩이 업무로 직과는 상관없이 필요했던 것이 사실입니다. 이제 Visual Studio 2008와는 별도로 제공되는 공개 라이브러리인 ADO.NET Entity Framework를 이용하면 좀더 많은 시간을 업무구현에 활용할 수 있습니다. 데이터베이스의 테이블수준이 아닌 개념적 상위수준의 데이터 라이브러리인 ADO.NET Entity Framework을 활용하는 방법을 소개합니다.
한 용 희  Microsoft MVP, 롯데 정보 통신
- Microsoft MVP, 롯데 정보 통신
- MSDN, 데브피아 세미나 강사
- 커뮤니티 히어로상 (2008)
 
 iBastis.NET 과 Spring.NET
닷넷 기반 Application에서 Java 진영의 Framework인 Spring.NET과 iBatis.NET의 사용법을 알아보고 MVC와 Entity Framework와는 또 다른 매력을 소개합니다. iBatis.NET 세션에서는 iBatis.NET의 소개와 여타 ORM 툴과의 차이점을 설명하고 활용 예를 보여드립니다. 그리고 Spring.NET의 모듈 별 기능 소개 및 활용 전략을 여러분과 공유합니다.
권 효 중  (주)중외정보기술 근무
- (주)중외정보기술 근무
- 자카르타 스트럿츠 프로그래밍 번역 (2003, 한빛미디어)
- 자카르타-서울 프로젝트 스트럿츠팀 리드
 
사이텍미디어(지앤선)
한국마이크로소프트 ("당신을 만나고 싶습니다" Hero 블로그 지원 - http://blog.ithero.co.kr)
 
- 세미나 당일 주차는 지원되지 않습니다. 가급적이면 대중교통을 이용하여 주시기 바랍니다.
- 문 의 : 02-511-4824(#132)
해당 세미나 등록
 

반응형

Java 6 update10 에서 윈도우 Frame 투명화가 가능해졌네요.

이리저리 찾아보고 있었는데 자료를 찾았습니다. ㅎㅎ

원래 투명하게 보이는걸 좋아해서.. 내가 만든 플램도 넣고 싶었는데..

Java 라서 안되는구나.. 했는데 드디어 지원한다니 ㅋㅋ

영문 자료입니다.. 즐프 하시길..^^

How to Create Translucent and Shaped Windows

http://java.sun.com/developer/technicalArticles/GUI/translucent_shaped_windows/

The article describes a feature that allows creating applications with translucent and shaped windows.

Contents
 
Introduction
Feature Overview
 
Translucent Windows
Shaped Windows
API Overview
Using the Feature
 
Determining the Support for a Desired Effect
Making a Window Translucent
 
Setting the Opacity Level of a Window
Enabling Per-Pixel Translucency
Setting the Opacity Level of a Window
Translucent and Shaped Windows Demo
Summary
 

JavaFX Script is a capable new language that offers a set of APIs for creating RIAs. It also provides you with access to the rich features of the the standard Java language. One of the major features introduced in the Java SE 6u10 release is the ability to create translucent and shaped windows. This includes:

  • making application windows translucent (tuning the general opacity of the window and using a per-pixel translucency effect)
  • setting shapes on application windows

This feature is available for objects of the java.awt.Window class and its descendants, for example javax.swing.JFrame, javax.swing.JFDialog, java.awt.Frame.

Translucent Windows
The translucent windows capability tunes the appearance of application windows using two different effects - simple translucency and per-pixel translucency. First, we will give an overview of the simple translucency effect. The simple translucency effect is used to make a window evenly translucent. When simple translucency is applied to a window, all the pixels of the window are assigned an alpha value which determines the level of opacity from the available range. The smaller the value, the more transparent the given window becomes. The minimum opacity level provides a completely transparent window, while the maximum opacity level represents a completely non-transparent (i.e. opaque) window. The following images demonstrate the use of the effect in four cases:

Dialog window without the effect applied Evenly translucent dialog window with opacity level 85%
Figure 1. Dialog window without the effect applied
Figure 2. Evenly translucent dialog window with opacity level 85%
Evenly translucent dialog window with opacity level 45% Evenly translucent dialog window with opacity level 25%
Figure 3. Evenly translucent dialog window with opacity level 45%
Figure 4. Evenly translucent dialog window with opacity level 25%
 

The screenshots are taken from the Translucent and Shaped Windows Demo. For details, see the Demo section. For more information about the effect and its use, see Setting the Opacity Level of a Window.

Another feature new to this release is the per-pixel translucency effect. Like simple translucency, per-pixel translucency can be used to make a window evenly translucent, though it is not recommended for performance reasons. However, it also enables you to control the opacity level of each individual pixel independently in order to make the window non-uniformly translucent or transparent. A good example of the use of the per-pixel effect is a gradient effect when the opacity "strength" of the window background increases from its top to the bottom. The following images show the per-pixel translucency effect in action for two cases:

The dialog window is evenly translucent using per-pixel alpha with 50% level
A gradient effect from fully translucent (upper left corner) to fully opaque
Figure 5. The dialog window is evenly translucent using per-pixel alpha with 50% level (note that the button remains opaque)
Figure 6. A gradient effect from fully translucent (upper left corner) to fully opaque (lower right corner) has been applied to the dialog window (note that the button remains opaque)
 

Note that when the per-pixel translucency effect is applied to make a window area transparent, the area may or may not remain clickable - this is a platform dependent behavior. For more information about the effect and its use, see Enabling Per-Pixel Translucency.

To sum up, the simple translucency effect is used to make a window evenly translucent or transparent, and the per-pixel translucency effect enables you to make a window evenly or non-uniformly translucent or transparent. Both the simple translucency and the per-pixel translucency can be used to make a window evenly translucent or transparent. However, when applied, the simple translucency effect consumes fewer system resources.

Shaped Windows
The other feature introduced in release 6u10 is the window shaping effect. Using shaping you can set any shape to an undecorated window. When the effect is applied, the desired area of a window becomes transparent. Thus, the combination of transparent and non-transparent pixels form the shape of a given window. The next images demonstrate window shaping in two cases:

Oval dialog window
Rounded rectangle dialog window
Figure 7. Oval dialog window
Figure 8. Rounded rectangle dialog window
 

Note that transparent areas of the window become unclickable. For more information about the effect and its use, see Setting the Shape of a Window.

These effects can be applied in combination. For example, you can create an oval shaped translucent window or a rounded rectangle window with the gradient effect applied:

Oval evenly translucent dialog window
Rounded rectangle dialog window with the gradient effect applied
Figure 9. Oval evenly translucent dialog window
Figure 10. Rounded rectangle dialog window with the gradient effect applied
 

Note that the effects may not be supported by the underlying platform (either because of hardware or software limitations or both). Therefore, before applying the effect, make sure that the platform supports it. For more details on system support, see Determining the Support for a Desired Effect.

The translucent and shaped windows feature is available through the new com.sun.awt.AWTUtilities class.

Note: the com.sun.awt.AWTUtilities class is not part of an officially supported API and appears as an implementation detail. The API is only meant for limited use outside of the core platform. It may change drastically between update releases, and it may even be removed or be moved in some other packages or classes. The class should be used via Java Reflection. Supported and public API will appear in the next major JDK release.

Method (* all the methods in the table are public and static)
Purpose
enum Translucency
Represents the kinds of translucency supported by the underlying system
boolean isTranslucencySupported(Translucency translucencyKind)
Returns if the given level of translucency is supported by the underlying system
void setWindowOpacity(Window window, float opacity)
Sets the opacity of a window
float getWindowOpacity(Window window)
Returns the opacity of a window
Shape getWindowShape(Window window)
Returns the shape of a window
void setWindowShape(Window window, Shape shape)
Sets the shape of a window
void setWindowOpaque(Window window, boolean isOpaque)
Enables the per-pixel translucency for a window
boolean isWindowOpaque(Window window)
Returns whether the window is opaque or translucent
boolean isTranslucencyCapable(GraphicsConfiguration gc)
Verifies whether a given graphics configuration supports the per-pixel translucency
 

Determining the Support for a Desired Effect
As already mentioned, the underlying system may not support the desired effect. That is why it is necessary to perform system support validation. The simple translucency and shaping effects require only general validation which indicates whether the system supports the effect in general.

To determine whether your system supports the effect, use the AWTUtilities.isTranslucencySupported() method passing a corresponding constant value as an argument. The constants PERPIXEL_TRANSPARENT, TRANSLUCENT, PERPIXEL_TRANSLUCENT represent shaping, simple translucency, and per-pixel translucency respectively. The next example shows how to determine whether your system supports simple translucency:

if (AWTUtilities.isTranslucencySupported(AWTUtilities.Translucency.TRANSLUCENT) {
      //perform translucency operations here
}
 

The per-pixel translucency also requires a window be created using a compatible graphics configuration. To check whether the given graphics configuration supports the per-pixel translucency effect use the isTranslucencyCapable() method. The following example shows how to determine whether the default graphics configuration supports per-pixel translucency:

if ((AWTUtilities.isTranslucencySupported(AWTUtilities.Translucency.PERPIXEL_TRANSLUCENT)) &&
      (AWTUtilities.isTranslucencyCapable(defaultTranslucencyCapableGC))) {
      //perform translucency operations here
}
 

In case the default graphics configuration is not per-pixel translucency capable, you can go through all available graphics configurations and find one capable of translucency. Use the following code snippet:

GraphicsEnvironment env =
           GraphicsEnvironment.getLocalGraphicsEnvironment();
       GraphicsDevice[] devices = env.getScreenDevices();

     for (int i = 0; i < devices.length && translucencyCapableGC == null; i++) {          GraphicsConfiguration[] configs = devices[i].getConfigurations();          for (int j = 0; j < configs.length && translucencyCapableGC == null; j++) {              if (AWTUtilities.isTranslucencyCapable(configs[j])) {                  translucencyCapableGC = configs[j];              }          }      }

 

Once it has been determined that the system supports the desired effect, you can proceed to apply it to your top-level windows.

Making a Window Translucent
Setting the Opacity Level of a Window
The general opacity level of the application window is controlled by the the setWindowOpacity method. This method takes window and opacity variables as arguments. The window argument defines the window to apply the effect to. This argument must be an instance of the java.awt.Window class or its descendant, such as javax.swing.JFrame. The opacity argument is responsible for the level of opacity of the window. The lower its value, the more transparent the window becomes. The range of allowed values is [0f ; 1f]. If you set the value to 0f, the window becomes completely transparent (i.e. invisible). If the value is set to 1f, then the window becomes completely opaque (which is equal to a case when the effect is not applied at all). If the opacity level value is out of the range, it throws an IllegalArgumentException. Note that the effect can not be applied to full-screen windows. If you are in full screen windows mode and the opacity value is lower than 1f, you will get an IllegalArgumentException.

The following code snippet shows how to set the opacity level for your window. To make the window translucent, the example uses the setWindowOpacity method via Java Reflection, passing window and 0.75f as arguments. Window is an instance of the JFrame class, 0.75f is the value of the translucency.

Note that all the examples from this article that use the AWTUtilities class should be implemented via Java Reflection API.

try {
   Class<?> awtUtilitiesClass = Class.forName("com.sun.awt.AWTUtilities");
   Method mSetWindowOpacity = awtUtilitiesClass.getMethod("setWindowOpacity", Window.class, float.class);
   mSetWindowOpacity.invoke(null, window, Float.valueOf(0.75f));
} catch (NoSuchMethodException ex) {
   ex.printStackTrace();
} catch (SecurityException ex) {
   ex.printStackTrace();
} catch (ClassNotFoundException ex) {
   ex.printStackTrace();
} catch (IllegalAccessException ex) {
   ex.printStackTrace();
} catch (IllegalArgumentException ex) {
   ex.printStackTrace();
} catch (InvocationTargetException ex) {
   ex.printStackTrace();
}
 

When applied, the method makes the frame translucent with a 75% level of opacity.

To get the current opacity of a window, use the getWindowOpacity method passing a window object as its argument. If the opacity level has not yet been set, this method returns 1.0f. In case the method returns 0f, the window is completely transparent. The next code snippet shows how to get the current level of opacity of a window:

float opacity = AWTUtilities.getWindowOpacity(frame);
 

Enabling Per-Pixel Translucency
The setWindowOpaque method is used to enable per-pixel alpha support for the given window. The method takes the window and isOpaque variables as arguments. The window argument defines the window you apply the effect to. Note that the argument must represent a window created using an effect compatible graphics configuration. For more information on graphics configurations, see Determining the Support for a Desired Effect. Also note that the window must not be in full-screen mode when making it non-opaque, or an IllegalArgumentException is thrown.

The isOpaque parameter defines whether the window must be opaque (true), or translucent (false). Once the window becomes non-opaque (the isOpaque is set to false), the drawing sub-system starts to respect the alpha value of each individual pixel. If a pixel gets painted with an alpha color component equal to zero, it becomes visually transparent; if the alpha of the pixel is equal to 255, the pixel is fully opaque. Interim values of the alpha color component make the pixel semi-transparent (i.e. translucent). The following code snippet shows how to enable the per-pixel alpha support for your window.

AWTUtilities.setWindowOpaque(frame, false);
 

If invoking the getWarningString on the window object returns a non-null String, this method will not affect the opacity of the window.

The following code snippet shows how to achieve the gradient effect. It is done by defining the parameters of the JPanel component using the GradientPaint method:

jPanel1 = new javax.swing.JPanel() {
      protected void paintComponent(Graphics g) {
          if (g instanceof Graphics2D) {
              final int R = 240;
              final int G = 240;
              final int B = 240; 

            Paint p =             new GradientPaint(0.0f, 0.0f, new Color(R, G, B, 0),                 getWidth(), getHeight(), new Color(R, G, B, 255), true);             Graphics2D g2d = (Graphics2D)g;             g2d.setPaint(p);             g2d.fillRect(0, 0, getWidth(), getHeight());      } else {     super.paintComponent(g);      }    }  }

 

Then the component should be placed on the frame:

frame.add(jPanel1);
 

Setting the Shape of a Window
To apply a shape to a window use the setWindowShape method. The method uses the window argument to define the window you want to set the shape to. Additionally, it uses the shape argument to define the desired shape. The shape can be any instance of the java.awt.Shape interface, for example, Ellipse2D.Float or RoundRectangle2D.Float. The next code snippet shows how to set an oval shape on your window. In the example, the fd argument represents the JFrame window, Ellipse2D.Float creates a new instance of an Ellipse2D object that defines the shape of the window:

fd.addComponentListener(new ComponentAdapter() {
     @Override
     public void componentResized(ComponentEvent evt) {
       Shape shape = null;
       shape = new Ellipse2D.Float(0, 0, fd.getWidth(), fd.getHeight());
       AWTUtilities.setWindowShape(fd, shape);
     }
});
 

It is recommended to set the shape using the componentResized() method as this enables precise control of the shape according to the current size of the window.

When setting the shape on your window, note that the effect supports only undecorated windows. If your window is decorated and you apply the effect, you will get the original shape of the window without the effect applied to it. If the window has been created by untrusted code (i.e. the window has a non-null warning string returned by getWarningString()), the method returns without affecting the shape of the window. Also note that the window must not be in the full-screen mode when setting a non-null shape. Otherwise, an IllegalArgumentException is thrown.

To get the current value of the shape of a window, use the getWindowShape method passing a window as an argument. The getWindowShape method returns an object that implements the shape interface and represents the shape previously set . If no shape has been set yet, or the shape has been reset to null, this method returns null. In other words, the default rectangular shape is displayed when the null argument is passed. The following code demonstrates how to get the current shape of the window:

Shape currentShape = AWTUtilities.getWindowShape(frame);
 

You can see the translucency and shape features in action by running the "TranslucencyShapeDemo" example. Click the Launch button to run Demo using Java Web Start. Note that in order to start the demo you must have JDK 6u10 or later installed and properly configured on your machine. You can download release 6u10 at the java.sun.com download page.

The application enables you to choose a desired effect or a combination of effects and apply it to an undecorated dialog window. The application interface contains the following elements: a slidebar to set the level of constant alpha for the simple translucency effect from the range [0% ; 100%], three radio buttons to set the shape of a window - rectangular, with rounded corners, or oval, a check box to enable or disable the per-pixel gradient effect, Paint Gradient check box to switch the per-pixel gradient effect on and off, Display/Hide the frame and Close the Application buttons. Once the settings are defined, click the Display the frame button to display the dialog window with the desired effect applied. Note that you can also change the effect spontaneously. To do so, choose an effect type when the window is displayed, the window will automatically switch its view. The dialog window itself contains the Reshape Me button. When clicked, the window randomly changes its size and location on the desktop. To hide the dialog window, click Hide the frame, to close the application, click Close the Application button.

Launches the TranslucentShapes application

You can find the entire code for this program in ControlFrame.java, FancyFrame.java, Main.java, and AWTUtilitiesWrapper.java, all of which are packed in the TranslucentShapes NetBeans project. Note that the application uses the Java Reflection API. The Reflection mechanism is implemented through the AWTUtilitiesWrapper class. You can download the TransclucentShapes NetBeans project as a zip file.

This article provides a description of the translucent and shaped windows feature. It includes an overview, discusses the feature API, and offers practical examples. The demo attached to the article shows the use of each featured effect individually as well as the use of the effects in combination.

반응형


WinExit을 업그레이드 하였다.

WinExit 1.51v
-알람파일 미리듣기 추가(mp3)
-알람파일설정가능
-셋업파일에 알람파일 경로와 볼륨 저장(alarm.ini)
--mp3 파일 재생을위한 방안 고려
--JMF 사용하였으나 해당 사용자가 JMF 설치를 해야 작동하므로
   관련 지식이 없는 사용자의 불편함 발생.. basicplayer 엔진사용
-- basicplayer 사용시 필요 라이브러리
이전포스트 : http://pmguda.com/496

GudaSong 개발계획(알람설정 미리듣기를 활용)
-객체지향 프로그램을 위해 분석 설계부터 차근차근 시작할예정
-마인드맵으로 기본 구조 설계
MP3 파일 재생기능이 추가된것이 가장 크게 변화된 점이다.

물론 이번에 추가된 MP3 재생 기능은 따로 GudaSong 을 개발 계획임

그외에 딱히 수정한 바는 없다. 약간의 소스 수정과 정리가 있긴 했지만 객체지향을 위해

여러 패키지로 나누고 분류하고 했지만 더 난잡해진것 같다.

처음부터 설계 없이 시작한 결과여서 그런것 같다. 므튼 개인적으로 만들면서 많이 배우는거 같다.

업데이트 계획이나 진행상황은 다음에 정리할 생각이다.
반응형

지난주 토요일, 11월 8일에 IBM developerWorks의 늦가을 행사 ‘개발자들의 수다’가 진행됐습니다.

개발자들의 수다 개발자들의 수다

이 날 행사는 정해진 아젠다 없이, 현장에서 대화 주제를 건의하고, 맘에 드는 주제의 그룹에 참가해서 자유롭게 대화를 하는 ’OST(Open Space Technology)’ 형식이었는데요, 사실 developerWorks에서도 처음으로 진행한 형식이었기 때문에 준비 과정에서 많은 걱정과 기대를 했었습니다.
이런 행사에 많은 분들이 참가 신청을 할까? 또 참가 신청한 분들이 그날 실제 참석을 할까? 얼마나 활발하게 주제 제안이 이뤄질까? 처음 만난 사람들과의 대화가 원활하게 진행될까? 등등.
사실 이 행사를 진행한 취지는 지난 1년간 developerWorks에 도움을 준 필자, 역자, 리뷰 블로거, 캠퍼스 위자드, 독자들이 한 자리에 모일 수 있는 자리를 마련하는 것과, 보다 성숙한 개발자 문화를 형성하는데 developerWorks가 조금이나마 일조하고자 함이었습니다.
그런데 실제 이번에 진행된 ‘개발자들의 수다’ 행사는 국내 개발자들의 의식이나 수준이 많이 성숙되어 있음을 보여주기에 충분했습니다. 우선 “무료 행사는 참가 신청자 중 50%만 오면 성공이다”라는 불문율을 과감히 깨고 전체 신청자 중 80%가 실제 참석을 했고, 주제 제안도 당초 세팅된 최대 주제 수가 21개였는데 이를 초과해 총 23개가 제안되었습니다. 그 때문에 몇몇 그룹은 다른 회의실에서 수다를 진행해야 했죠.

개발자들의 수다-주제 제안

제안된 수다 주제 중 유사한 주제는 제안자끼리 협의를 해서 하나로 합치기도 하고, 수다가 종결되지 않은 주제는 1막에서 2막, 3막으로 이어서 진행되는 등 유기적으로 자연스럽게 수다가 이뤄졌습니다.
IT에서의 XP 활용, 글로벌 서비스는 무엇이고 어떻게 해야 할까, 개발자의 미래는 어떠한가, Ruby on Rails, 개발자들은 딴짓으로 주로 무엇을 하나, 커뮤니티와 회사에서의 일, 왜 개발자는 밤에만 코딩하는가, 훌륭한 개발자가 되기 위해 대학생은 어떤 마음가짐과 자세를 가져야 하는가, 재충전을 위한 싸고 즐거운 여행, 3D 사용자 활용의 경험, 슬럼프 극복 방법, 개발자 때리지 마세요, 아이폰, 프로젝트 개발 기간의 압박, 열심히 일하기 vs 스마트하게 일하기, RIA 개발 방법, 개발자에게 창의력이란 등이 수다가 진행된 주제들입니다.

개발자들의 수다-대화중 개발자들의 수다-대화중

재미있는 것은 주로 기술과 관련됐거나 프로젝트의 어려움 등을 거론한 주제가 인기 있었던 반면 의외로 ‘개발자의 연애는 불가능한가’라는 주제는 대화 참여자가 없어 목록에서 제거되는 해프닝이 발생됐다는 것이죠. 우리 개발자들, 너무 ‘workaholic’이 아닌지.

개발자들의 수다-최종 아젠다

이 날 진행된 23개 주제 수다 중 최고의 수다로는 왜 개발자는 밤에만 코딩하는가, IT에서의 XP 활용, 훌륭한 개발자가 되기 위해 대학생은 어떤 마음가짐과 자세를 가져야 하는가, 개발자에게 창의력이란, 즐거운 개발자 등 5개의 수다가 투표 결과에 의해 선정됐습니다.

개발자들의 수다-공유 개발자들의 수다-공유

함께 한 모든 분들에게 감사의 인사를 전합니다.


<성군의 "개발자들의 수다" 후기>
위에 글은 DW(http://www.ibm.com/developerworks/kr/event/seminar/ost/final.html)
게시된 개발자들의 수다 후기이다.

개인적으로 개발자들의 세미나나 모임을 즐겨 찾아 다니려고 노력하는 편이다.
몇번의 세미나를 참석해 보았지만 생소한 분야나 어려운 내용등으로 인해 많은 것들을 얻지 못했다.
하지만 이번 개발자들의 수다는 자유 주제로 심도있는 이야기나 말그대로 수다를 떨기도 했지만
많은 것을 얻을수 있는 시간이였던거 같다.
특히 김기웅님과의 대화는 정말 즐겁고 많은 것을 얻을수 있는 시간이였다.
그분이 추천해신 책 "사랑하지 않으면 떠나라!" 를 집에 돌아오자 마자 질러버렸을 정도로
광팬(?)이 되어버린것 같다. 좀더 많은 이야기를 나누고 멘토가 되주셧으면 할정도이다.
그리고 오랫만에(?) 만난 2기 ,3기 DW 위저드 분들 역시 반가웠다. 특히 이국진님 ㅎㅎ
중간중간에 풍부한 간식거리(젤로 맘에 들었던점)와 함께 편한 이야기..
특히 개발자의 마인드 측면에서 많은 혼란이 있었는데 많은 도움이 되었다.
나와 같은 업종에 계신 선배님들 그리고 후배님들과의 대화의 장
어찌보면 세미나 등을 가면서도 그렇게 잘 알지 못하는 사람들과의 대화를 하기란 쉽지 않다.
그렇기에 더욱 뜻깊은 자리가 아니였나 한다.
 아참 그리고 DW 1기 활동을 할때 많은 도움을 주셨던 윤성균님 다시 만나서 반가웠다.
이렇게 글로 반가움을 전한다. // 이 글을 읽으실지 모르겠지만 힘들듯 ^^
반응형
기존의 구현하였던 WinExit을 조금 업그레이드 하였습니다.
별다르게 크게 달라진것은 없습니다.

마인드 맵으로 한번 WinExit을 그려봤습니다.
시험삼아 마인드맵을 그려본건데 괜찮은것 같네요.  별 계획이 없어서인지 마인드맵도 영~
조금씩 배워가면서 추가해야겠네요 ^^


-  중복실행 방지
-  상태바에 종료시간 출력
-  즉시 종료,재실행시 확인 다이얼로그
-  메뉴바 추가(Help -> about)
- OS의 default browser 를 가져오기(레지스트리 조회: java.util.prefs.Preferences )

추가사항
- 예약종료시간(해당시간설정, 날짜설정, 등등..)
- 예약 종료 형식의 다양화 고려
- 알람기능 추가 (MP3 파일 설정 기능)
- JWS를 이용한 배포
- JNI를 이용한 레지스트리 조회(윈도우 레지)
- jar화일의 이미지 로딩
- JWS 형식배포 고려
-WinExit의 중복실행을 방지하기 위해
--현재 프로세스에서 실행 여부를 체크
-윈도우 특정 플랫폼 명령어 의존발생
--systeminfo,tasklist  명령어 의존
JNLP 적용해보기..



반응형

http://www.sdnkorea.com/

썬 테크 블로거를 신청하였습니다.

자주 방문하는 사이트기도 하고 자바관련 자료도 블로그에 주를 이루고 있기 때문에 신청했습니다.

썬 메일링도 자주 블로그에 포스팅 하고 있구요.. 나름 썬매냐 기 때문에 ㅎㅎ

갠적으로 http://blog.sdnkorea.com/blog/  여기에 들어가서 JavaSE에 들어가서

재밌어 보이는 기술자료 있으면 적용해 보는 편입니다.

흥미유발 자료가 많은것 같아서.. 저한테는 말이죠.. ㅎㅎ

므튼 썬 테크 블로거로 화이팅!

+ Recent posts