Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/voytechs/jnetanalyzer/message/swing/JMessageControlBox.java


1   /*
2    * File: JMessageControlBox.java
3    * Auth: Mark Bednarczyk
4    * Date: DATE
5    *   Id: $Id: JMessageControlBox.java,v 1.1.1.1 2003/09/22 16:32:06 voytechs Exp $
6    ********************************************
7    Copyright (C) 2003  Mark Bednarczyk
8   
9    This program is free software; you can redistribute it and/or
10   modify it under the terms of the GNU General Public License
11   as published by the Free Software Foundation; either version 2
12   of the License, or (at your option) any later version.
13  
14   This program is distributed in the hope that it will be useful,
15   but WITHOUT ANY WARRANTY; without even the implied warranty of
16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17   GNU General Public License for more details.
18  
19   You should have received a copy of the GNU General Public License
20   along with this program; if not, write to the Free Software
21   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22   ********************************************
23   * $Log: JMessageControlBox.java,v $
24   * Revision 1.1.1.1  2003/09/22 16:32:06  voytechs
25   * Initial import.
26   *
27   */
28  package com.voytechs.jnetanalyzer.message.swing;
29  
30  import java.lang.*;
31  import java.util.*;
32  
33  import java.awt.*;
34  import javax.swing.*;
35  import javax.swing.border.*;
36  
37  /**
38   * Control area in a message box.
39   * Control area has the following sub-areas defined.
40   * 1) Scalable text label 1-3 = labels in upper left hand corner.
41   * 2) Expansion/Collapse button in lower left corcer.
42   * 3) lights 1-3 = lights that can be set to any color in upper right corner.
43   */
44  public class JMessageControlBox 
45    extends JMessageComponent {
46  
47    /* Internal attributes */
48    private static final boolean debug = false;
49  
50    private JPanel labelPanel = new JPanel();
51    private JLabel label1 = new JLabel(" ");
52    private JLabel label2 = new JLabel(" ");
53    private JLabel label3 = new JLabel(" ");
54  
55    private JPanel lightPanel = new JPanel();
56    private JLabel light1 = new JLabel(".");
57    private JLabel light2 = new JLabel("o");
58    private JLabel light3 = new JLabel("O");
59    
60    private JPanel buttonPanel = new JPanel();
61    private JButton expandButton = new JButton("Expand/Collapse");
62  
63  
64    /**
65     *
66     * @param
67     * @exception
68     */
69    public JMessageControlBox() {
70  
71      labelPanel = new JPanel(); 
72      labelPanel.setLayout(new BoxLayout(labelPanel, BoxLayout.Y_AXIS));
73  
74      lightPanel = new JPanel();
75      lightPanel.setLayout(new BoxLayout(lightPanel, BoxLayout.Y_AXIS));
76  
77  
78      Box vBox = new Box(BoxLayout.Y_AXIS);
79  
80      Box hBox = new Box(BoxLayout.X_AXIS);
81  
82      labelPanel.add(label1);
83      labelPanel.add(label2);
84      labelPanel.add(label3);
85  
86      labelPanel.setBorder(new SoftBevelBorder(SoftBevelBorder.LOWERED));
87  
88      lightPanel.add(light1);
89      lightPanel.add(light2);
90      lightPanel.add(light3);
91  
92      lightPanel.setBorder(new SoftBevelBorder(SoftBevelBorder.LOWERED));
93  
94      hBox.add(labelPanel);
95      hBox.add(Box.createHorizontalStrut(20));
96      hBox.add(lightPanel);
97  
98      buttonPanel.add(expandButton);
99      buttonPanel.setBorder(new EtchedBorder(EtchedBorder.LOWERED));
100 
101     vBox.add(hBox);
102     vBox.add(buttonPanel);
103 
104     add(vBox);
105   }
106 
107   /**
108    * Set label 1 in UPPER LEFT corner.
109    */
110   public void setLabel1(String msg) {
111     label1.setText(msg);
112   }
113 
114   /**
115    * Set label 2 in UPPER LEFT corner.
116    */
117   public void setLabel2(String msg) {
118     label2.setText(msg);
119   }
120 
121   /**
122    * Set label 3 in UPPER LEFT corner.
123    */
124   public void setLabel3(String msg) {
125     label3.setText(msg);
126   }
127 
128   /**
129    * Test function for JMessageControlBox
130    * @param args command line arguments
131    */
132   public static void main(String [] args) {
133   }
134 
135 } /* END OF: JMessageControlBox */