tailieunhanh - Professional Java JDK 6 Edition 2007 phần 4

getTail () phương pháp được sử dụng để sản xuất bắt đầu và kết thúc của tập tin XML, các bộ phận mà không phải là lặp đi lặp lại cho mỗi bản ghi nhật ký, nhưng là cần thiết để tạo ra một tập tin XML hợp lệ. Chương 1: Các tính năng chính của Java Ngôn ngữ và thư viện | Chapter 4 Developing Effective User Interfaces with JFC public interface Command public void execute The Teststrategy interface is implemented by the StartsWithAEIOU and AlphabeticChars classes so the CardLayoutPanel application can apply different string algorithms to the user-specified text. Regular expression constructs are used to determine the patterns of the strings passed into the test method public interface TestStrategy public boolean test String s public class StartsWithAEIOU implements TestStrategy public boolean test String s if s null 0 return false return .charAt 0 A .charAt 0 E .charAt 0 I .charAt 0 O .charAt 0 U public class convertUppercase implements TestStrategy public boolean test String s if s null 0 return false Pattern pattern a-zA-Z Matcher match s if return false else return true main routine omitted for brevity Figure 4-14 represents the CardLayoutPanel application modeled in the previous source code. Users can enter text in the card layout shown in the top panel and click either strategy pattern button to apply the appropriate Strategy algorithm to that text. Results of those actions will be rendered in the card layout below. All of the button components employ the Command pattern to allow the application to determine at runtime the proper executed method to invoke based on the user s navigations. 207 Part II A Broad Understanding of Java APIs Tools and Techniques Figure 4-14 GroupLayout The GroupLayout manager is a component of the NetBeans framework that is being considered for inclusion in the SE 6 Java framework. The GroupLayout manager is important in that it allows for horizontal and vertical layout positioning in an independent flexible this manager layout groups can be formed in both a sequential and parallel fashion. Sequentially they are placed one after another and in parallel they are .