001: /*
002: * DDS (Data Distribution Service) for JacORB
003: *
004: * Copyright (C) 2005 , Ahmed yehdih <ahmed.yehdih@gmail.com>, fouad
005: * allaoui <fouad.allaoui@gmail.com>, Didier Donsez (didier.donsez@ieee.org)
006: *
007: * This program is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU Library General Public License
009: * as published by the Free Software Foundation; either version 2
010: * of the License, or (at your option) any later version.
011: *
012: * This program is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
015: * GNU Library General Public License for more details.
016: *
017: * You should have received a copy of the GNU Library General Public
018: * License along with this program; if not, write to the Free Software
019: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
020: * 02111-1307, USA.
021: *
022: * Coontact: Ahmed yehdih <ahmed.yehdih@gmail.com>, fouad allaoui
023: * <fouad.allaoui@gmail.com>, Didier Donsez (didier.donsez@ieee.org)
024: * Contributor(s)
025: *
026: **/
027: package demo.dds.dcps.temperaturesample;
028:
029: import java.awt.LayoutManager;
030:
031: public class TemperatureFrame extends javax.swing.JFrame {
032:
033: public String Temperature_String;
034: public TemperatureDataReaderListenerImpl parent;
035: private javax.swing.JMenuItem exitMenuItem;
036: private javax.swing.JMenu fileMenu;
037: private javax.swing.JLabel jLabel1;
038: private javax.swing.JPanel jPanel1;
039: private javax.swing.JButton jButton1;
040: private javax.swing.JMenuBar menuBar;
041:
042: public TemperatureFrame(TemperatureDataReaderListenerImpl parent) {
043: initComponents();
044: this .parent = parent;
045: }
046:
047: private void initComponents() {
048: jPanel1 = new javax.swing.JPanel();
049: jLabel1 = new javax.swing.JLabel();
050: jButton1 = new javax.swing.JButton();
051: menuBar = new javax.swing.JMenuBar();
052: fileMenu = new javax.swing.JMenu();
053: exitMenuItem = new javax.swing.JMenuItem();
054:
055: setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
056:
057: jPanel1.setLayout(null);
058: jPanel1
059: .addComponentListener(new java.awt.event.ComponentAdapter() {
060: });
061:
062: jLabel1.setBackground(new java.awt.Color(153, 51, 255));
063: jLabel1
064: .setFont(new java.awt.Font("Microsoft Sans Serif", 1,
065: 50));
066: jLabel1.setText("jLabel1");
067: jLabel1.setLocation(60, 10);
068: jLabel1.setSize(200, 100);
069: jLabel1
070: .addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
071: });
072: jPanel1.add(jLabel1);
073:
074: jButton1.setLabel("Click Here to product Alarm");
075: jButton1.setLocation(30, 100);
076: jButton1.setSize(200, 30);
077: jButton1.setVisible(false);
078: jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
079: public void mouseReleased(java.awt.event.MouseEvent evt) {
080: jButton1MouseReleased(evt);
081: }
082: });
083: jPanel1.add(jButton1, null);
084:
085: getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);
086:
087: fileMenu.setText("File");
088: exitMenuItem.setText("Exit");
089: exitMenuItem
090: .addActionListener(new java.awt.event.ActionListener() {
091: public void actionPerformed(
092: java.awt.event.ActionEvent evt) {
093: exitMenuItemActionPerformed(evt);
094: }
095: });
096:
097: fileMenu.add(exitMenuItem);
098: menuBar.add(fileMenu);
099: setJMenuBar(menuBar);
100: setBounds(500, 350, 300, 200);
101:
102: this .setTitle("Temperature");
103: }
104:
105: public void setjButton1Visible(boolean b) {
106: jButton1.setVisible(b);
107: }
108:
109: private void exitMenuItemActionPerformed(
110: java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitMenuItemActionPerformed
111: System.exit(0);
112: }
113:
114: public void SetText(double temperature) {
115: this .jLabel1.setText(temperature + "°C");
116: }
117:
118: public void SetText(String message) {
119: this .jLabel1.setText(message);
120: }
121:
122: public void SetColorLablel() {
123: jLabel1.setForeground(new java.awt.Color(204, 0, 0));
124: ;
125: }
126:
127: private void jButton1MouseReleased(java.awt.event.MouseEvent evt) {
128: parent.sendMessageForProducer("ALERT !");
129: jButton1.setVisible(false);
130: }
131: }
|