📄 dealcapture.java
字号:
/**
* Redistribution and use of this software and associated documentation
* ("Software"), with or without modification, are permitted provided
* that the following conditions are met:
*
* 1. Redistributions of source code must retain copyright
* statements and notices. Redistributions must also contain a
* copy of this document.
*
* 2. Redistributions in binary form must reproduce the
* above copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. The name "Exolab" must not be used to endorse or promote
* products derived from this Software without prior written
* permission of Exoffice Technologies. For written permission,
* please contact info@exolab.org.
*
* 4. Products derived from this Software may not be called "Exolab"
* nor may "Exolab" appear in their names without prior written
* permission of Exoffice Technologies. Exolab is a registered
* trademark of Exoffice Technologies.
*
* 5. Due credit should be given to the Exolab Project
* (http://www.exolab.org/).
*
* THIS SOFTWARE IS PROVIDED BY EXOFFICE TECHNOLOGIES AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* EXOFFICE TECHNOLOGIES OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Copyright 2000 (C) Exoffice Technologies Inc. All Rights Reserved.
*
* $Id: DealCapture.java,v 1.7 2002/02/19 09:09:47 mourikis Exp $
*
* Date Author Changes
* $Date jimm Created
*/
package openjms.examples.client.fx.dealcapture;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JComboBox;
import javax.swing.JTextField;
import javax.swing.JSeparator;
import javax.swing.JScrollPane;
import javax.swing.JLabel;
import javax.swing.JButton;
import javax.swing.border.EtchedBorder;
import javax.swing.border.TitledBorder;
import javax.swing.border.SoftBevelBorder;
import javax.swing.JOptionPane;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.FlowLayout;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.AWTEvent;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.GridLayout;
import java.awt.Insets;
import javax.jms.TopicConnectionFactory;
import java.util.Hashtable;
import javax.naming.InitialContext;
import javax.naming.Context;
import openjms.examples.client.fx.util.DateValidator;
import openjms.examples.client.fx.util.AmountValidator;
import openjms.examples.client.fx.util.RateValidator;
import org.exolab.jms.util.CommandLine;
/**
* The DealCapture is a small demo to introduce the power of OpenJMS. Deals
* are created by the DealCapture then published via OpenJMS to the
* dealBlotter.
*
*
* @version $Revision: 1.7 $ $Date: 2002/02/19 09:09:47 $
* @author <a href="mailto:mourikis@exolab.org">Jim Mourikis</a>
* @see openjms.examples.client.fx.dealblotter.DealTable
* @see openjms.examples.client.fx.dealblotter.DealBlotter
**/
public class DealCapture extends JFrame implements DealNotifierIfc
{
public DealCapture()
{
initComponents ();
pack ();
}
private void initComponents ()
{
commands_ = new JPanel ();
separator_ = new JSeparator ();
panel1_ = new JPanel ();
commit_ = new JButton ();
cancel_ = new JButton ();
amounts_ = new JPanel ();
date_ = new JTextField(6);
currencySelect_ = new JButton ();
buySellSelect_ = new JButton ();
amount1_ = new JTextField ();
amount2_ = new JTextField ();
currency2Label_ = new JLabel ();
buySellLabel_ = new JLabel ();
spacer3_ = new JLabel ();
spacer4_ = new JLabel ();
spotRateField_ = new JTextField ();
currencySelection_ = new JPanel ();
currency1_ = new JComboBox ();
currency2_ = new JComboBox ();
marketRate_ = new JLabel ();
marketRateLabel_ = new JLabel ();
products_ = new JComboBox ();
filler1_ = new JLabel ();
filller2_ = new JLabel ();
currentDate_ = new JLabel ();
spacer5_ = new JLabel ();
getContentPane ().setLayout (new GridBagLayout());
GridBagConstraints gridBagConstraints1;
setTitle ("OpenJMS FX Demo");
setResizable(false);
commands_.setLayout (new BorderLayout (0, 2));
commands_.add (separator_, BorderLayout.NORTH);
panel1_.setLayout (new FlowLayout (1, 70, 10));
commit_.setText ("Commit");
panel1_.add (commit_);
cancel_.setText ("Clear");
panel1_.add (cancel_);
commands_.add (panel1_, BorderLayout.SOUTH);
gridBagConstraints1 = new GridBagConstraints ();
gridBagConstraints1.gridx = 0;
gridBagConstraints1.gridy = 6;
gridBagConstraints1.fill = GridBagConstraints.HORIZONTAL;
getContentPane ().add (commands_, gridBagConstraints1);
amounts_.setLayout (new GridBagLayout ());
GridBagConstraints gridBagConstraints2;
products_.addItem("Spot ");
products_.addItem("Outright Forward ");
products_.addItem("Forward Swap ");
currency1_.addItem("USD");
currency2_.addItem("AUD");
currency2_.addItem("EUR");
currency2_.addItem("FRF");
currency2_.addItem("GBP");
currency2_.addItem("JPY");
gridBagConstraints2 = new GridBagConstraints();
gridBagConstraints2.gridx = 0;
gridBagConstraints2.gridy = 2;
gridBagConstraints2.ipady = 6;
gridBagConstraints2.insets = new Insets (0, 9, 0, 0);
gridBagConstraints2.anchor = GridBagConstraints.WEST;
amounts_.add(date_, gridBagConstraints2);
currencySelect_.setToolTipText("Select to toggle currency");
gridBagConstraints2 = new GridBagConstraints ();
gridBagConstraints2.gridx = 1;
gridBagConstraints2.gridy = 2;
gridBagConstraints2.insets = new Insets (0, 11, 0, 11);
amounts_.add (currencySelect_, gridBagConstraints2);
buySellSelect_.setToolTipText ("Select to toggle buy/sell");
gridBagConstraints2 = new GridBagConstraints ();
gridBagConstraints2.gridx = 2;
gridBagConstraints2.gridy = 2;
gridBagConstraints2.insets = new Insets (0, 11, 0, 11);
amounts_.add (buySellSelect_, gridBagConstraints2);
amount1_.setToolTipText ("Enter Currency 1 Amount");
amount1_.setBorder (new EtchedBorder());
amount1_.setColumns (10);
amount1_.setMinimumSize (new Dimension(8, 20));
amountValidator_ = new AmountValidator(amount1_);
gridBagConstraints2 = new GridBagConstraints ();
gridBagConstraints2.gridx = 3;
gridBagConstraints2.gridy = 2;
gridBagConstraints2.ipady = 6;
gridBagConstraints2.insets = new Insets (5, 0, 6, 14);
gridBagConstraints2.anchor = GridBagConstraints.WEST;
amounts_.add (amount1_, gridBagConstraints2);
amount2_.setBorder (new EtchedBorder());
amount2_.setEditable (false);
amount2_.setColumns (10);
amount2_.setMinimumSize (new Dimension(8, 20));
gridBagConstraints2 = new GridBagConstraints ();
gridBagConstraints2.gridx = 3;
gridBagConstraints2.gridy = 1;
gridBagConstraints2.ipady = 6;
gridBagConstraints2.anchor = GridBagConstraints.WEST;
amounts_.add (amount2_, gridBagConstraints2);
gridBagConstraints2 = new GridBagConstraints ();
gridBagConstraints2.gridx = 1;
gridBagConstraints2.gridy = 1;
gridBagConstraints2.insets = new Insets (8, 0, 8, 0);
amounts_.add (currency2Label_, gridBagConstraints2);
gridBagConstraints2 = new GridBagConstraints ();
gridBagConstraints2.gridx = 2;
gridBagConstraints2.gridy = 1;
amounts_.add (buySellLabel_, gridBagConstraints2);
gridBagConstraints2 = new GridBagConstraints ();
gridBagConstraints2.gridx = 0;
gridBagConstraints2.gridy = 0;
amounts_.add (spacer3_, gridBagConstraints2);
gridBagConstraints2 = new GridBagConstraints ();
gridBagConstraints2.gridx = 1;
gridBagConstraints2.gridy = 3;
gridBagConstraints2.ipady = 26;
amounts_.add (spacer4_, gridBagConstraints2);
spotRateField_.setToolTipText ("Enter the current spot rate");
spotRateField_.setColumns (9);
gridBagConstraints2 = new GridBagConstraints ();
gridBagConstraints2.gridx = 0;
gridBagConstraints2.gridy = 3;
gridBagConstraints2.ipady = 6;
gridBagConstraints2.insets = new Insets (0, 9, 12, 0);
gridBagConstraints2.anchor = GridBagConstraints.WEST;
amounts_.add (spotRateField_, gridBagConstraints2);
gridBagConstraints1 = new GridBagConstraints ();
gridBagConstraints1.gridx = 0;
gridBagConstraints1.gridy = 3;
gridBagConstraints1.anchor = GridBagConstraints.WEST;
getContentPane ().add (amounts_, gridBagConstraints1);
currencySelection_.setLayout (new GridBagLayout ());
GridBagConstraints gridBagConstraints3;
currency1_.setPreferredSize (new Dimension(60, 25));
currency1_.setMinimumSize (new Dimension(60, 25));
currency1_.setToolTipText ("Select currency 1");
currency1_.setMaximumSize (new Dimension(60, 25));
gridBagConstraints3 = new GridBagConstraints ();
gridBagConstraints3.gridx = 0;
gridBagConstraints3.gridy = 3;
gridBagConstraints3.insets = new Insets (0, 9, 0, 9);
gridBagConstraints3.anchor = GridBagConstraints.WEST;
currencySelection_.add (currency1_, gridBagConstraints3);
currency2_.setPreferredSize (new Dimension(60, 25));
currency2_.setMinimumSize (new Dimension(60, 25));
currency2_.setToolTipText ("Select currency 2");
currency2_.setMaximumSize (new Dimension(60, 25));
gridBagConstraints3 = new GridBagConstraints ();
gridBagConstraints3.gridx = 0;
gridBagConstraints3.gridy = 3;
gridBagConstraints3.insets = new Insets (0, 83, 0, 0);
gridBagConstraints3.anchor = GridBagConstraints.EAST;
currencySelection_.add (currency2_, gridBagConstraints3);
gridBagConstraints3 = new GridBagConstraints ();
gridBagConstraints3.gridx = 2;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -