2 * Copyright 2001 Sun Microsystems, Inc.
4 * See the file "license.terms" for information on usage and
5 * redistribution of this file, and for a DISCLAIMER OF ALL
8 import java.awt.Component;
9 import java.awt.Container;
10 import java.awt.BorderLayout;
11 import java.awt.Dimension;
12 import java.awt.GridBagLayout;
13 import java.awt.GridBagConstraints;
14 import java.awt.Insets;
16 import java.awt.event.WindowAdapter;
17 import java.awt.event.WindowEvent;
19 import javax.speech.synthesis.Synthesizer;
21 import javax.swing.JFrame;
22 import javax.swing.JPanel;
23 import javax.swing.LookAndFeel;
24 import javax.swing.SwingUtilities;
25 import javax.swing.UIManager;
27 import javax.swing.border.TitledBorder;
29 import com.sun.speech.engine.synthesis.SynthesizerMonitor;
30 import com.sun.speech.engine.EngineEventPanel;
33 * Implements the GUI for a SynthesizerMonitor.
35 public class Monitor extends JPanel {
37 private SynthesizerMonitor monitor;
38 private Synthesizer synthesizer;
39 private int width = 600;
40 private int height = 300;
44 * Constructs a Monitor for the given synthesizer
46 * @param synthesizer the synthesizer it monitors
47 * @param synthesizerName name of the synthesizer
49 public Monitor(Synthesizer synthesizer, String synthesizerName) {
50 TitledBorder titledBorder = new TitledBorder(synthesizerName);
51 setBorder(titledBorder);
52 setPreferredSize(new Dimension(width, height));
53 setSize(width, height);
54 this.synthesizer = synthesizer;
55 this.monitor = new SynthesizerMonitor(synthesizer);
61 * Populates this Monitor JPanel.
63 private void createMonitorPanel() {
64 GridBagLayout gridbag = new GridBagLayout();
67 GridBagConstraints c = new GridBagConstraints();
68 c.anchor = GridBagConstraints.WEST;
69 c.insets = new Insets(4,4,4,4);
73 c.fill = GridBagConstraints.BOTH;
75 Component sp = monitor.getStatePanel();
76 gridbag.setConstraints(sp, c);
79 EngineEventPanel eventPanel =
80 (EngineEventPanel) monitor.getEventPanel();
84 gridbag.setConstraints(eventPanel, c);