Design Patterns Java™ Workbook
Chapter 27. Decorator DECORATOR classes typically implement their operations by relying on the decorator object they receive in ...
Chapter 27. Decorator This program uses the ClassLoader class to find the URL (uniform resource locator) of the demo.doc file. I ...
Chapter 27. Decorator Figure 27.2. Oozinoz developers use the OozinozFilter class as the superclass for classes that decorate ou ...
Chapter 27. Decorator package com.oozinoz.io; import java.io.*; public abstract class OozinozFilter extends FilterWriter { prote ...
Chapter 27. Decorator Figure 27.3. The Oozinoz filters can decorate a Writer object with behaviors that manipulate ad copy text ...
Chapter 27. Decorator while (true) { String s = in.readLine(); if (s == null) { break; } out.write(s + "\n"); } out.close(); in. ...
Chapter 27. Decorator import java.io.*; public class LowerCaseFilter extends OozinozFilter { protected LowerCaseFilter(Writer ou ...
Chapter 27. Decorator public void paintComponent(Graphics g) { super.paintComponent(g); // paint the background int nPoint = 101 ...
Chapter 27. Decorator Figure 27.4. The FunPanel class accepts x and y functions to plot. The setXY() method in the FunPanel clas ...
Chapter 27. Decorator protected void calculateExtrema() { for (int i = 0; i < nPoint; i++) { double t = ((double) i) / (nPoin ...
Chapter 27. Decorator Figure 27.5. Each subclass of Function implements f(t) in a way that corresponds to the class name. You ca ...
Chapter 27. Decorator // y = 1 - 4 * (t - .5)*2; Function ft = new Arithmetic('-', new T(), new Constant(.5)); Function y = new ...
Chapter 27. Decorator Figure 27.6. You can apply Decorator to create and to plot new functions without introducing new classes. ...
Chapter 27. Decorator The constructor for the Abs class collaborates with its superclass to store a source function in source[0] ...
Chapter 27. Decorator package com.oozinoz.function; public class Arithmetic extends Function { protected char operator; public A ...
Chapter 27. Decorator // ?? Function brightness = // ?? p.setXY(new T(), brightness); com.oozinoz.ui.SwingFacade.launch( p, " Br ...
Chapter 27. Decorator functions around each other, you will develop a rich set of functions that you can compose at runtime. Dec ...
Chapter 27. Decorator launch.setBorder( new CompoundBorder( new LineBorder(Color.black, 4), new CompoundBorder( new BevelBorder( ...
Chapter 27. Decorator b.addMouseListener ( new MouseAdapter() { public void mouseEntered(MouseEvent e) { b.setBackground(Color.c ...
Chapter 28. Iterator............................................................................................................ ...
«
8
9
10
11
12
13
14
15
16
17
»
Free download pdf