> I have impletemed a JFrame Swing application.
> When I press ctrl+alt+del in Windows 2K the panel goes blank.
>
> Any ideas on how I can catch this and send a repaint to the frame?
Andy
OK, sorry when comming back from ctrl+alt+del ;)
I did not manage to reproduct the problem in less source code yet.
The samples I downloaded worked fine.
// BasIndPanel.java
// java -classpath classes\. com.dresdnerkb.basind.client.BasIndPanel
localhost 8000
package com.dresdnerkb.basind.client;
import java.net.*;
import java.text.*;
import java.util.*;
import java.awt.*;
import java.awt.event.WindowEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import javax.swing.*;
import javax.swing.table.*;
import com.dresdnerkb.basind.table.*;
public class BasIndPanel extends JFrame
{
private BasIndClient _client;
private BasIndView _view0, _view1, _view2;
private URL _url;
private Config _config;
private JPanel _basePanel, _viewsPanel;
private BondsPanel _bondsPanel;
private TypesPanel _typesPanel;
private FieldsPanel _fieldsPanel;
private JDialog _bondsDialog, _typesDialog, _fieldsDialog;
private String[] _prods, _terms, _fields;
private String _sortby, _order;
private int _width = 1000, _height= 1000;
private double _xscreenlocation = 0, _yscreenlocation = 0;
private final Color _fbgColor = new Color(30, 150, 50); // Feeder
Back Ground
private final Color _bbColor = new Color(30, 60, 180); // BB
private final Color _esColor = Color.red; // ES
private final Color _etcColor = new Color(30, 150, 50); // ETC
private final Color _hbgColor = new Color(30, 60, 180); // Highlight
Back Ground
private final Color _bggColor = new Color(220, 220, 220); // Back
Ground Gray
protected static Sorter.Comparer doubleComp = new Sorter.Comparer() {
public int compare(Object a, Object b) { return
(int)(Double.parseDouble((String)a) - Double.parseDouble((String)b));
}
};
public BasIndPanel()
{
super("Basis Indicator");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// Create and set up the window
_basePanel = new JPanel(new BorderLayout());
JPanel mainpanel = getPanel();
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
_width = getWidth();
_height = getHeight();
_config.setWidth(_width);
_config.setHeight(_height);
Point p = getLocation();
_xscreenlocation = p.getX();
_yscreenlocation = p.getY();
_config.setx(_xscreenlocation);
_config.sety(_yscreenlocation);
_config.save();
System.exit(0);
}
}
);
getContentPane().add(mainpanel);
init();
// Display the window
pack();
setSize(_width, _height);
setLocation(new Double(_xscreenlocation).intValue(),new
Double(_yscreenlocation).intValue());
show();
}
public static void main(String[] args)
{
final BasIndPanel basindpane = new BasIndPanel();
}
public void init()
{
String host = "basisindicator.tokyo.dresdnerkb.com";
// String host = "tky0410743";
int port = 8000;
try {
_url = new URL(new
URL("http://basisindicator.tokyo.dresdnerkb.com/basind/"),
"servlet/Config");
// _url = new URL(new URL("http://tky0410743/basind/"),
"servlet/Config");
}
catch (MalformedURLException mue) {
System.err.println("BasIndApplet::init> " + mue.toString());
}
initCommon(host, port);
}
public void initCommon(String host, int port)
{
_client = new BasIndClient(host, port);
try {
_client.start();
} catch(Exception ex) {
System.err.println("Starting up BasIndClient failed. host:
"+host + " port " + port);
ex.printStackTrace();
throw new RuntimeException(ex.toString());
}
_viewsPanel = new JPanel(new BorderLayout());
_config = new Config(_url);
_config.load();
_prods = _config.getProducts();
_terms = _config.getTerms();
_sortby = _config.getSortBy();
_order = _config.getOrder();
_fields = _config.getFields();
_width = _config.getWidth();
_height = _config.getHeight();
_xscreenlocation = _config.getx();
_yscreenlocation = _config.gety();
_view0 = createView0(_client);
_view1 = createView1(_client);
_view2 = createView2(_client);
_view0.start();
_view1.start();
_view2.start();
_basePanel.add(_view0, BorderLayout.NORTH);
for (int i = 0; i < _prods.length; i++) {
if (_prods[i].equals("RATES"))
_viewsPanel.add(_view1, BorderLayout.NORTH);
if (_prods[i].equals("JGBS"))
_viewsPanel.add(_view2, BorderLayout.CENTER);
}
_basePanel.add(_viewsPanel, BorderLayout.CENTER);
getContentPane().setLayout(new BorderLayout());
getContentPane().add(_basePanel);
}
/**
* When the user presses the refresh button.
*/
public void refresh()
{
_view1.stop();
_viewsPanel.remove(_view1);
for (int i = 0; i < _prods.length; i++) {
if (_prods[i].equals("RATES")) {
_view1 = createView1(_client);
_view1.start();
_viewsPanel.add(_view1, BorderLayout.NORTH);
}
else if (_prods[i].equals("JGBS")) {
_view2 = createView2(_client);
_view2.start();
_viewsPanel.add(_view2, BorderLayout.CENTER);
}
}
_basePanel.add(_viewsPanel, BorderLayout.CENTER);
_basePanel.invalidate();
_basePanel.validate();
_view2.stop();
_viewsPanel.remove(_view2);
_view2 = createView2(_client);
_view2.start();
_viewsPanel.add(_view2, BorderLayout.CENTER);
_viewsPanel.invalidate();
_viewsPanel.validate();
}
public void stop()
{
try {
_view2.stop();
_view1.stop();
_view0.stop();
_client.stop();
_client = null;
} catch(Exception ex) {
ex.printStackTrace();
throw new RuntimeException(ex.toString());
}
}
protected BasIndView createView0(BasIndClient client)
{
BasIndView view = new BasIndView(client, 2, 8);
view.setWidth(50);
view.setShowGrid(false);
view.setBackground(_bggColor);
view.setHighlight(2);
view.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
view.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
view.setFont(new Font("sansserif", Font.BOLD, 11));
// FEEDER STATUS
String[] feederRowCod = { "FEEDER STATUS" };
String[] feederColLbl = { "BB", "ES", "ETC" };
String[] feederColCod = { "BB", "ES", "ETC" };
TableCellRenderer[] feederRs = new
TableCellRenderer[feederColCod.length];
for (int i = 0; i < feederColCod.length; i++) {
feederRs[i] = new StringRenderer(_fbgColor, Color.yellow,
_hbgColor);
}
Color[] feederColLblForeColor = { _bbColor, _esColor, _etcColor };
Poster feederPoster = new Poster(view, 0, 0, 1, 3, false, true,
null, null, feederRowCod, feederColLbl, feederColCod, feederRs);
feederPoster.setColLblForeColor(feederColLblForeColor);
feederPoster.setTransportRIC(true);
feederPoster.loadPoster();
// TOOLBAR
view.addComponent(0, 3, 2, 5, new BasIndToolBar(this));
return view;
}
protected BasIndView createView1(BasIndClient client)
{
Color v1bg = new Color(150, 200, 255);
BasIndView view = new BasIndView(client, 16, 24);
view.setWidth(50);
view.setShowGrid(false);
view.setBackground(v1bg);
view.setHighlight(3);
view.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
view.setFont(new Font("sansserif", Font.BOLD, 11));
DoubleRenderer dR_0 = new DoubleRenderer(v1bg, Color.yellow,
_hbgColor, 0, false);
DoubleRenderer dR_2 = new DoubleRenderer(v1bg, Color.yellow,
_hbgColor, 2, false);
DoubleRenderer dR_3 = new DoubleRenderer(v1bg, Color.yellow,
_hbgColor, 3, false);
DoubleRenderer dR_4 = new DoubleRenderer(v1bg, Color.yellow,
_hbgColor, 4, false);
DoubleRenderer dR_6 = new DoubleRenderer(v1bg, Color.yellow,
_hbgColor, 6, false);
StringRenderer szR = new StringRenderer(v1bg, null, null);
// CONNECTION STATUS
view.link("CONNECTION,STATUS", 0, 0, null);
// DATE
SimpleDateFormat f = new SimpleDateFormat("M/d/yy");
JLabel dateLabel = new JLabel(f.format(new Date()));
dateLabel.setFont(new Font("sansserif", Font.BOLD, 11));
dateLabel.setForeground(new Color(50, 50, 50));
dateLabel.setHorizontalAlignment(JLabel.CENTER);
view.addComponent(0, 1, 1, 1, dateLabel);
// 10 YR FUTURE
String[] fut10RowCod = { "JGBc1", "JGBc2" };
String[] fut10ColLbl = { "TICKER", "ASK", "BID", "LAST", "CHG" };
String[] fut10ColCod = { "CODE", "ASK", "BID", "LAST", "NET CHANGE"
};
TableCellRenderer[] fut10Rs = { szR, dR_2, dR_2, dR_2, dR_2 };
Poster fut10Poster = new Poster(view, 0, 3, 2, 5, false, true,
"10YR FUTURE", null, fut10RowCod, fut10ColLbl, fut10ColCod,
fut10Rs);
fut10Poster.loadPoster();
// 5 YR FUTURE
String[] fut5RowCod = { "JMBc1", "JMBc2" };
String[] fut5ColCod = { "CODE", "ASK", "BID", "LAST", "NET CHANGE"
};
TableCellRenderer[] fut5Rs = { szR, dR_2, dR_2, dR_2, dR_2 };
Poster fut5Poster = new Poster(view, 0, 7, 2, 5, false, false,
"5YR FUTURE", null, fut5RowCod, null, fut5ColCod, fut5Rs);
fut5Poster.loadPoster();
// CCY
String[] ccyRowLbl = { "JPY", "EUR" };
String[] ccyRowCod = { "JPY=", "EURJPY=" };
String[] ccyColCod = { "ASK", "BID" };
TableCellRenderer[] ccyRs = { dR_2, dR_2 };
Poster ccyPoster = new Poster(view, 0, 10, 2, 2, true, false,
"CCY", ccyRowLbl, ccyRowCod, null, ccyColCod, ccyRs);
ccyPoster.loadPoster();
// EUROYEN
String[] euroRowCod = { "JEYc1", "JEYc2", "JEYc3", "JEYc4", "JEYc5",
"JEYc6" };
String[] euroColLbl = { "TICKER", "ASK", "BID", "LAST", "CHG" };
String[] euroColCod = { "CODE", "ASK", "BID", "LAST", "NET CHANGE"
};
TableCellRenderer[] euroRs = { szR, dR_3, dR_3, dR_3, dR_3 };
Poster euroPoster = new Poster(view, 5, 1, 6, 5, false, true,
"EUROYEN", null, euroRowCod, euroColLbl, euroColCod, euroRs);
euroPoster.loadPoster();
// 10YR FUT SPREAD
String[] fut10spRowCod = { "JGBc1-c2" };
String[] fut10spColCod = { "CODE", "ASK", "BID", "LAST", "NET
CHANGE" };
TableCellRenderer[] fut10spRs = { szR, dR_2, dR_2, dR_2, dR_2 };
Poster fut10spPoster = new Poster(view, 5, 9, 1, 5, false, false,
"10YR FUT SPREAD", null, fut10spRowCod, null, fut10spColCod,
fut10spRs);
fut10spPoster.loadPoster();
// 5YR FUT SPREAD
String[] fut5spRowCod = { "JMBc1-c2" };
String[] fut5spColCod = { "CODE", "ASK", "BID", "LAST", "NET CHANGE"
};
TableCellRenderer[] fut5spRs = { szR, dR_2, dR_2, dR_2, dR_2 };
Poster fut5spPoster = new Poster(view, 5, 11, 1, 5, false, false,
"5YR FUT SPREAD", null, fut5spRowCod, null, fut5spColCod,
fut5spRs);
fut5spPoster.loadPoster();
// NIKKEI
String[] nikkeiRowCod = { "JNIc1" };
String[] nikkeiColCod = { "CODE", "ASK", "BID", "LAST", "NET CHANGE"
};
TableCellRenderer[] nikkeiRs = { szR, dR_0, dR_0, dR_0, dR_0 };
Poster nikkeiPoster = new Poster(view, 5, 13, 1, 5, false, false,
"NIKKEI", null, nikkeiRowCod, null, nikkeiColCod, nikkeiRs);
nikkeiPoster.loadPoster();
// SWAP
String[] swapRowLbl = { "1", "2", "3", "4", "5", "6", "7", "8", "9",
"10", "12", "15", "20", "30" };
String[] swapRowCod = { "JPYSB6L1Y=TKFX", "JPYSB6L2Y=TKFX",
"JPYSB6L3Y=TKFX", "JPYSB6L4Y=TKFX", "JPYSB6L5Y=TKFX",
"JPYSB6L6Y=TKFX", "JPYSB6L7Y=TKFX", "JPYSB6L8Y=TKFX",
"JPYSB6L9Y=TKFX", "JPYSB6L10Y=TKFX",
"JPYSB6L12Y=TKFX", "JPYSB6L15Y=TKFX", "JPYSB6L20Y=TKFX",
"JPYSB6L30Y=TKFX" };
String[] swapColLbl = { "ASK", "BID", "MID" };
String[] swapColCod = { "ASK", "BID", "MID" };
TableCellRenderer[] swapRs = { dR_3, dR_3, dR_3 };
Poster swapPoster = new Poster(view, 10, 1, 14, 3, true, true,
"SWAP", swapRowLbl, swapRowCod, swapColLbl, swapColCod, swapRs);
swapPoster.loadPoster();
// LIBOR
String[] liborRowLbl = { "1", "2", "3", "4", "5", "6", "7", "8",
"9", "10", "11", "12" };
String[] liborRowCod = { "JPY1MFSR=", "JPY2MFSR=", "JPY3MFSR=",
"JPY4MFSR=", "JPY5MFSR=", "JPY6MFSR=",
"JPY7MFSR=", "JPY8MFSR=", "JPY9MFSR=", "JPY10MFSR=",
"JPY11MFSR=", "JPY1YFSR=" };
String[] liborColCod = { "PRIM ACT 1" };
TableCellRenderer[] liborRs = { dR_4 };
Poster liborPoster = new Poster(view, 14, 1, 12, 1, true, false,
"LIBOR", liborRowLbl, liborRowCod, null, liborColCod, liborRs);
liborPoster.loadPoster();
// VS 1st FUTURE
String[] vs1stRowCod = { "JBCTD1" };
String[] vs1stColLbl_1 = { "CTD", "CF" };
String[] vs1stColCod_1 = { "ISSUE", "CF" };
TableCellRenderer[] vs1stRs_1 = { szR, dR_6 };
Poster vs1stPoster_1 = new Poster(view, 16, 1, 1, 2, false, true,
"VS 1st FUTURE", null, vs1stRowCod, vs1stColLbl_1, vs1stColCod_1,
vs1stRs_1);
vs1stPoster_1.loadPoster();
String[] vs1stColLbl_2 = { "SaBPV", "SiBPV", "SaCHG", "SiCHG" };
String[] vs1stColCod_2 = { "SaBPV", "SiBPV", "SaCHG", "SiCHG" };
TableCellRenderer[] vs1stRs_2 = { dR_3, dR_3, dR_3, dR_3 };
Poster vs1stPoster_2 = new Poster(view, 16, 4, 1, 4, false, true,
"BPV", null, vs1stRowCod, vs1stColLbl_2, vs1stColCod_2, vs1stRs_2);
vs1stPoster_2.loadPoster();
// VS 2nd FUTURE
String[] vs2ndRowCod = { "JBCTD2" };
String[] vs2ndColLbl_1 = { "CTD", "CF" };
String[] vs2ndColCod_1 = { "ISSUE", "CF" };
TableCellRenderer[] vs2ndRs_1 = { szR, dR_6 };
Poster vs2ndPoster_1 = new Poster(view, 16, 8, 1, 2, false, true,
"VS 2nd FUTURE", null, vs2ndRowCod, vs2ndColLbl_1, vs2ndColCod_1,
vs2ndRs_1);
vs2ndPoster_1.loadPoster();
String[] vs2ndColLbl_2 = { "SaBPV", "SiBPV", "SaCHG", "SiCHG" };
String[] vs2ndColCod_2 = { "SaBPV", "SiBPV", "SaCHG", "SiCHG" };
TableCellRenderer[] vs2ndRs_2 = { dR_3, dR_3, dR_3, dR_3 };
Poster vs2ndPoster_2 = new Poster(view, 16, 11, 1, 4, false, true,
"BPV", null, vs2ndRowCod, vs2ndColLbl_2, vs2ndColCod_2, vs2ndRs_2);
vs2ndPoster_2.loadPoster();
// STRING
String[] stringRowCod = { "JEYc1", "JEYc2", "JEYc3", "JEYc4",
"JEYc5", "JEYc6",
"JEYc7", "JEYc8", "JEYc9", "JEYc10", "JEYc11", "JEYc12" };
String[] stringColCod = { "CODE", "ASK", "BID", "MID" };
TableCellRenderer[] stringRs = { szR, dR_3, dR_3, dR_3 };
Poster stringPoster = new Poster(view, 20, 1, 12, 4, false, false,
"STRING CALCULATION", null, stringRowCod, null, stringColCod,
stringRs);
stringPoster.loadPoster();
return view;
}
protected BasIndView createView2(BasIndClient client)
{
ColumnGroup[] groups = new ColumnGroup[_fields.length];
for (int i = 0; i < groups.length; i++) {
if (_fields[i].equals("INDICATION")) {
groups[i] = new ColumnGroup("INDICATION");
groups[i].add(new ColumnGroup("ASK"));
groups[i].add(new ColumnGroup("BID"));
}
else if (_fields[i].equals("LAST")) {
groups[i] = new ColumnGroup("LAST");
}
else if (_fields[i].equals("SNAPSHOT")) {
groups[i] = new ColumnGroup("SNAPSHOT");
groups[i].add(new ColumnGroup("TIME"));
groups[i].add(new ColumnGroup("FUT"));
groups[i].add(new ColumnGroup("SwSpd"));
}
else if (_fields[i].equals("SPREAD VS PCS")) {
groups[i] = new ColumnGroup("SPREAD VS PCS");
groups[i].add(new ColumnGroup("ASK"));
groups[i].add(new ColumnGroup("BID"));
groups[i].add(new ColumnGroup("LAST"));
}
else if (_fields[i].equals("PCS")) {
groups[i] = new ColumnGroup("PCS");
}
else if (_fields[i].equals("FV")) {
groups[i] = new ColumnGroup("FV");
}
else if (_fields[i].equals("VS SWAP")) {
groups[i] = new ColumnGroup("VS SWAP");
groups[i].add(new ColumnGroup("ASK"));
groups[i].add(new ColumnGroup("BID"));
}
else if (_fields[i].equals("AGAINST 1ST")) {
groups[i] = new Column
roup("AGAINST 1st");
groups[i].add(new ColumnGroup("ASK"));
groups[i].add(new ColumnGroup("BID"));
}
else if (_fields[i].equals("AGAINST 2ND")) {
groups[i] = new ColumnGroup("AGAINST 2nd");
groups[i].add(new ColumnGroup("ASK"));
groups[i].add(new ColumnGroup("BID"));
}
else if (_fields[i].equals("TED")) {
groups[i] = new ColumnGroup("TED");
}
else if (_fields[i].equals("TH SI CHG")) {
groups[i] = new ColumnGroup("Th Si Chg");
groups[i].add(new ColumnGroup("1st"));
groups[i].add(new ColumnGroup("2nd"));
}
else if (_fields[i].equals("SABPV")) {
groups[i] = new ColumnGroup("SaBPV");
}
else if (_fields[i].equals("SIBPV")) {
groups[i] = new ColumnGroup("SiBPV");
}
else if (_fields[i].equals("CPN")) {
groups[i] = new ColumnGroup("CPN");
}
else if (_fields[i].equals("MAT")) {
groups[i] = new ColumnGroup("MAT");
}
else if (_fields[i].equals("SETTLE")) {
groups[i] = new ColumnGroup("SETTLE");
}
else if (_fields[i].equals("ISDATE")) {
groups[i] = new ColumnGroup("ISDATE");
}
else if (_fields[i].equals("FCDATE")) {
groups[i] = new ColumnGroup("FCDATE");
}
else if (_fields[i].equals("PRICE")) {
groups[i] = new ColumnGroup("PRICE");
groups[i].add(new ColumnGroup("ASK"));
groups[i].add(new ColumnGroup("BID"));
groups[i].add(new ColumnGroup("PRICE"));
}
else if (_fields[i].equals("SIMPLE")) {
groups[i] = new ColumnGroup("SIMPLE");
}
else if (_fields[i].equals("SEMI")) {
groups[i] = new ColumnGroup("SEMI");
}
else if (_fields[i].equals("STRING")) {
groups[i] = new ColumnGroup("STRING");
}
else if (_fields[i].equals("CF1")) {
groups[i] = new ColumnGroup("CF1");
}
else if (_fields[i].equals("CF2")) {
groups[i] = new ColumnGroup("CF2");
}
else if (_fields[i].equals("OFFER YIELD")) {
groups[i] = new ColumnGroup("OFFER YIELD");
groups[i].add(new ColumnGroup("ASK"));
groups[i].add(new ColumnGroup("BID"));
}
else if (_fields[i].equals("INTERP SWAP")) {
groups[i] = new ColumnGroup("INTERP SWAP");
groups[i].add(new ColumnGroup("ASK"));
groups[i].add(new ColumnGroup("BID"));
}
else if (_fields[i].equals("LIFE")) {
groups[i] = new ColumnGroup("LIFE");
}
}
String[] issues = null;
Vector vt = new Vector();
for (int i = 0; i < _terms.length; i++) {
String[] tempIssues = client.getIssues(_terms[i] + "*");
for (int j = 0; j < tempIssues.length; j++)
vt.addElement(tempIssues[j]);
tempIssues = null;
}
issues = new String[vt.size()];
vt.copyInto(issues);
boolean uporder = (_order.equals("ASCEND")) ? true : false;
int rows = issues.length;
int cols = ColumnGroup.getAllLeafCount(groups);
BasIndView view = new BasIndView(client, rows, cols);
view.setTableColumnHeader(groups);
view.setWidth(50);
view.setHighlight(3);
view.setFont(new Font("sansserif", Font.BOLD, 11));
Vector v = new Vector();
String keys[];
if (_sortby.equals("LIFE")) {
for (int i = 0; i < rows; i++) {
v.addElement(client.getData(issues[i] + ",LIFE"));
}
}
else if (_order.equals("DESCEND")) {
TreeMap termorder = new TreeMap();
int border, edge, num = 1, sign;
for (int i = 0; i < rows; i++) {
border = Sorter.first_num(issues[i]);
edge = (issues[i].endsWith("R")) ? issues[i].length()-1 :
issues[i].length();
String term = issues[i].substring(0, border);
int series = Integer.parseInt(issues[i].substring(border, edge));
if (!termorder.containsKey(term)) {
termorder.put(term, String.valueOf(num++));
}
sign = (uporder) ? 1 : -1;
int key = 100 + (sign) *
Integer.parseInt((String)termorder.get(term)) * 1000 + series;
v.addElement(new Integer(key).toString());
}
}
keys = new String[v.size()];
v.copyInto(keys);
Sorter.sort(keys, issues, 0, rows-1, uporder, doubleComp);
view.setIssues(issues);
DoubleRenderer dRO_3 = new DoubleRenderer(Color.white, Color.yellow,
_hbgColor, 3, true);
DoubleRenderer dRE_3 = new DoubleRenderer(_bggColor, Color.yellow,
_hbgColor, 3, true);
DoubleRenderer dRO_3H = new DoubleRenderer(Color.white,
Color.yellow, _hbgColor, 3, false);
DoubleRenderer dRE_3H = new DoubleRenderer(_bggColor, Color.yellow,
_hbgColor, 3, false);
DoubleRenderer dRO_0 = new DoubleRenderer(Color.white, Color.yellow,
_hbgColor, 0, true);
DoubleRenderer dRE_0 = new DoubleRenderer(_bggColor, Color.yellow,
_hbgColor, 0, true);
DoubleRenderer dRO_6 = new DoubleRenderer(Color.white, Color.yellow,
_hbgColor, 6, true);
DoubleRenderer dRE_6 = new DoubleRenderer(_bggColor, Color.yellow,
_hbgColor, 6, true);
DoubleRenderer dRO_100 = new DoubleRenderer(Color.white,
Color.yellow, _hbgColor, 3, true); dRO_100.setMultiplier(100.0);
DoubleRenderer dRE_100 = new DoubleRenderer(_bggColor, Color.yellow,
_hbgColor, 3, true); dRE_100.setMultiplier(100.0);
DoubleRenderer dRO_2 = new DoubleRenderer(Color.white, Color.yellow,
_hbgColor, 2, true);
DoubleRenderer dRE_2 = new DoubleRenderer(_bggColor, Color.yellow,
_hbgColor, 2, true);
DateRenderer dtRO = new DateRenderer(Color.white, Color.yellow,
_hbgColor, "M/d/yy");
DateRenderer dtRE = new DateRenderer(_bggColor, Color.yellow,
_hbgColor, "M/d/yy");
DateRenderer tmRO = new DateRenderer(Color.white, Color.yellow,
_hbgColor, "HH:mm");
DateRenderer tmRE = new DateRenderer(_bggColor, Color.yellow,
_hbgColor, "HH:mm");
DoubleRenderer dR_3;
DoubleRenderer dR_3H;
DoubleRenderer dR_0;
DoubleRenderer dR_6;
DoubleRenderer dR_100;
DoubleRenderer dR_2;
DateRenderer dtR;
DateRenderer tmR;
for (int row = 0; row < rows; row++) {
if (row % 2 == 0) {
dR_3H = dRO_3;
dR_3 = dRO_3H;
dR_0 = dRO_0;
dR_6 = dRO_6;
dR_100 = dRO_100;
dtR = dtRO;
tmR = tmRO;
dR_2 = dRO_2;
}
else {
dR_3H = dRE_3;
dR_3 = dRE_3H;
dR_0 = dRE_0;
dR_6 = dRE_6;
dR_100 = dRE_100;
dtR = dtRE;
tmR = tmRE;
dR_2 = dRE_2;
}
for (int fi = 0, col = 0; fi < _fields.length; fi++) {
if (_fields[fi].equals("INDICATION")) {
view.link(issues[row] + ",ASK", row, col++, dR_3, true);
view.link(issues[row] + ",BID", row, col++, dR_3, true);
}
else if (_fields[fi].equals("LAST")) {
view.link(issues[row] + ",LAST", row, col++, dR_3, true);
}
else if (_fields[fi].equals("SNAPSHOT")) {
view.link(issues[row] + ",SNAPSHOT TIME", row, col++, tmR, true);
view.link(issues[row] + ",SNAPSHOT FIRST LAST", row, col++, dR_2,
true);
view.link(issues[row] + ",SNAPSHOT SWAP SPREAD", row, col++,
dR_3, true);
}
else if (_fields[fi].equals("SPREAD VS PCS")) {
view.link(issues[row] + ",ASK VS TSE", row, col++, dR_3, true);
view.link(issues[row] + ",BID VS TSE", row, col++, dR_3, true);
view.link(issues[row] + ",LAST VS TSE", row, col++, dR_3, true);
}
else if (_fields[fi].equals("PCS")) {
view.link(issues[row] + ",SIMPLEY", row, col++, dR_3);
}
else if (_fields[fi].equals("FV")) {
view.link(issues[row] + ",FV", row, col++, dR_3);
}
else if (_fields[fi].equals("VS SWAP")) {
view.link(issues[row] + ",ASK VS SWAP", row, col++, dR_3H);
view.link(issues[row] + ",BID VS SWAP", row, col++, dR_3H);
}
else if (_fields[fi].equals("AGAINST 1ST")) {
view.link(issues[row] + ",ASK AGAINST FIRST", row, col++, dR_3);
view.link(issues[row] + ",BID AGAINST FIRST", row, col++, dR_3);
}
else if (_fields[fi].equals("AGAINST 2ND")) {
view.link(issues[row] + ",ASK AGAINST SECOND", row, col++, dR_3);
view.link(issues[row] + ",BID AGAINST SECOND", row, col++, dR_3);
}
else if (_fields[fi].equals("TED")) {
view.link(issues[row] + ",TED", row, col++, dR_3);
}
else if (_fields[fi].equals("TH SI CHG")) {
view.link(issues[row] + ",SiCHG AGAINST FIRST", row, col++,
dR_3H);
view.link(issues[row] + ",SiCHG AGAINST SECOND", row, col++,
dR_3H);
}
else if (_fields[fi].equals("SABPV")) {
view.link(issues[row] + ",SaBPV", row, col++, dR_3);
}
else if (_fields[fi].equals("SIBPV")) {
view.link(issues[row] + ",SiBPV", row, col++, dR_3);
}
else if (_fields[fi].equals("CPN")) {
view.link(issues[row] + ",COUPON", row, col++, dR_100);
}
else if (_fields[fi].equals("MAT")) {
view.link(issues[row] + ",MATURITY", row, col++, dtR);
}
else if (_fields[fi].equals("SETTLE")) {
view.link(issues[row] + ",SETTLE", row, col++, dtR);
}
else if (_fields[fi].equals("ISDATE")) {
view.link(issues[row] + ",ISDATE", row, col++, dtR);
}
else if (_fields[fi].equals("FCDATE")) {
view.link(issues[row] + ",FCDATE", row, col++, dtR);
}
else if (_fields[fi].equals("PRICE")) {
view.link(issues[row] + ",ASK PRICE", row, col++, dR_3);
view.link(issues[row] + ",BID PRICE", row, col++, dR_3);
view.link(issues[row] + ",LAST PRICE", row, col++, dR_3);
}
else if (_fields[fi].equals("SIMPLE")) {
view.link(issues[row] + ",SIMPLE YIELD", row, col++, dR_3);
}
else if (_fields[fi].equals("SEMI")) {
view.link(issues[row] + ",SEMI YIELD", row, col++, dR_3);
}
else if (_fields[fi].equals("STRING")) {
view.link(issues[row] + ",STRING", row, col++, dR_3H);
}
else if (_fields[fi].equals("CF1")) {
view.link(issues[row] + ",CF1", row, col++, dR_6);
}
else if (_fields[fi].equals("CF2")) {
view.link(issues[row] + ",CF2", row, col++, dR_6);
}
else if (_fields[fi].equals("OFFER YIELD")) {
view.link(issues[row] + ",ASK OFFER YIELD", row, col++, dR_3);
view.link(issues[row] + ",BID OFFER YIELD", row, col++, dR_3);
}
else if (_fields[fi].equals("INTERP SWAP")) {
view.link(issues[row] + ",ASK INTERP SWAP", row, col++, dR_3H);
view.link(issues[row] + ",BID INTERP SWAP", row, col++, dR_3H);
}
else if (_fields[fi].equals("LIFE")) {
view.link(issues[row] + ",LIFE", row, col++, dR_0);
}
}
}
return view;
}
protected void createViewsDialog()
{
_typesPanel = new TypesPanel(_prods);
String[] oldprods = _typesPanel.getSelectedProducts();
JOptionPane viewspane = new JOptionPane(_typesPanel,
JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION);
_typesDialog = viewspane.createDialog(this, "View selector");
_typesDialog.setResizable(false);
_typesDialog.setModal(true);
_typesDialog.show();
Object value = viewspane.getValue();
if ((value instanceof Integer) && (((Integer)value).intValue() ==
JOptionPane.OK_OPTION)) {
_prods = _typesPanel.getSelectedProducts();
for (int i = 0; i < _prods.length; i++) {
if (_prods[i].equals("RATES")) {
_view1.stop();
_viewsPanel.remove(_view1);
}
else if (_prods[i].equals("JGBS")) {
_view2.stop();
_viewsPanel.remove(_view2);
}
}
_basePanel.remove(_viewsPanel);
_viewsPanel = new JPanel(new BorderLayout());
_config.setProducts(_prods);
_width = getWidth();
_height = getHeight();
_config.setWidth(_width);
_config.setHeight(_height);
Point p = getLocation();
_xscreenlocation = p.getX();
_yscreenlocation = p.getY();
_config.setx(_xscreenlocation);
_config.sety(_yscreenlocation);
_config.save();
for (int i = 0; i < _prods.length; i++) {
if (_prods[i].equals("RATES")) {
_view1 = createView1(_client);
_view1.start();
_viewsPanel.add(_view1, BorderLayout.NORTH);
}
else if (_prods[i].equals("JGBS")) {
_view2 = createView2(_client);
_view2.start();
_viewsPanel.add(_view2, BorderLayout.CENTER);
}
}
_basePanel.add(_viewsPanel, BorderLayout.CENTER);
_basePanel.invalidate();
_basePanel.validate();
}
else {
_typesPanel.setSelectedProducts(oldprods);
}
_typesDialog.dispose();
}
protected void createBondsDialog()
{
_bondsPanel = new BondsPanel(_terms, _sortby, _order);
String[] oldterms = _bondsPanel.getTerms();
String oldsortby = _bondsPanel.getSortBy();
String oldorder = _bondsPanel.getOrder();
JOptionPane bondspane = new JOptionPane(_bondsPanel,
JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION);
_bondsDialog = bondspane.createDialog(this, "Bonds Selector");
_bondsDialog.setResizable(false);
_bondsDialog.setModal(true);
_bondsDialog.show();
Object value = bondspane.getValue();
if ((value instanceof Integer) && (((Integer)value).intValue() ==
JOptionPane.OK_OPTION)) {
_terms = _bondsPanel.getTerms();
_sortby = _bondsPanel.getSortBy();
_order = _bondsPanel.getOrder();
_view2.stop();
_viewsPanel.remove(_view2);
_view2 = createView2(_client);
_view2.start();
_viewsPanel.add(_view2, BorderLayout.CENTER);
_viewsPanel.invalidate();
_viewsPanel.validate();
_config.setTerms(_terms);
_config.setSortBy(_sortby);
_config.setOrder(_order);
_width = getWidth();
_height = getHeight();
_config.setWidth(_width);
_config.setHeight(_height);
Point p = getLocation();
_xscreenlocation = p.getX();
_yscreenlocation = p.getY();
_config.setx(_xscreenlocation);
_config.sety(_yscreenlocation);
_config.save();
}
else {
_bondsPanel.setTerms(oldterms);
_bondsPanel.setSortBy(oldsortby);
_bondsPanel.setOrder(oldorder);
}
_bondsDialog.dispose();
}
protected void createFieldsDialog()
{
_fieldsPanel = new FieldsPanel(_fields);
String[] oldfields = _fieldsPanel.getViewList();
JOptionPane fieldspane = new JOptionPane(_fieldsPanel,
JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION);
_fieldsDialog = fieldspane.createDialog(this, "Fields Selector");
_fieldsDialog.setResizable(false);
_fieldsDialog.setModal(true);
_fieldsDialog.show();
Object value = fieldspane.getValue();
if ((value instanceof Integer) && (((Integer)value).intValue() ==
JOptionPane.OK_OPTION)) {
_fields = _fieldsPanel.getViewList();
_view2.stop();
_viewsPanel.remove(_view2);
_view2 = createView2(_client);
_view2.start();
_viewsPanel.add(_view2, BorderLayout.CENTER);
_viewsPanel.invalidate();
_viewsPanel.validate();
_config.setFields(_fields);
_width = getWidth();
_height = getHeight();
_config.setWidth(_width);
_config.setHeight(_height);
Point p = getLocation();
_xscreenlocation = p.getX();
_yscreenlocation = p.getY();
_config.setx(_xscreenlocation);
_config.sety(_yscreenlocation);
_config.save();
}
else {
_fieldsPanel.setViewList(oldfields);
}
_fieldsDialog.dispose();
}
public JPanel getPanel() { return _basePanel; }
public void setURL(URL url) { this._url = url; }
public URL getURL() { return _url; }
}
> > I have impletemed a JFrame Swing application.
> > When I press ctrl+alt+del in Windows 2K the panel goes blank.
[quoted text clipped - 12 lines]
>
> SSCCE please.
Andrew Thompson - 15 Dec 2003 10:53 GMT
> Andy
My name is not Andy
> OK, sorry when comming back from ctrl+alt+del ;)
>
> I did not manage to reproduct the problem in less source code yet.
Then do not _post_ yet. Or if you want people
to look at that much code, post an URL.
(They most likely will not though)
For the sake of everybody, please do not post
33Kb of code. If that is as far as you have
managed to trim it, you need do more before
posting.
Nobody here has time to wade through 33Kb
of code.
Further tips,
You need to remove package statements,
they just complicates things, and are not relevant
to the problem.
Ensure your source does not go over 80 characters,
or newsreaders will wrap it, resulting in compile errors.
After I had done those two simple things my IDE
jumped to 100 errors and I stopped.
Please ensure future source can be 'cut, paste
and compiled' ..and keep it under 20Kb - I think
most people would start to ignore you at around
10-15Kb..
--
Andrew Thompson
* http://www.PhySci.org/ PhySci software suite
* http://www.1point1C.org/ 1.1C - Superluminal!
* http://www.AThompson.info/andrew/ personal site
Lars Schouw - 16 Dec 2003 00:18 GMT
Andy
I will see how much I can trim it down ;)
Lars
Skippy - 16 Dec 2003 13:32 GMT
> Andy
It's Andrew!
Lars Schouw - 17 Dec 2003 06:36 GMT
Sorry Andrew, Andrew, Andrew..
> > Andy
>
> It's Andrew!
Andrew Thompson - 17 Dec 2003 08:33 GMT
Hi Lars,
> Sorry Andrew, Andrew, Andrew..
..you've got it right now, that's what matters. :-)
Look forward to seeing that trimmed code
of yours, maybe we can come up with an
answer.
> > > Andy
> >
> > It's Andrew!
Hi Skippy. ;-)
Lars Schouw - 18 Dec 2003 05:20 GMT
Andrew!
I found out that the problem does not exist under Windows 2003 exterprise server.
I have the problem under Windows 2K sp4.
I will email you all the source code.
Lars
Andrew Thompson - 18 Dec 2003 06:41 GMT
> Andrew!
>
> I found out that the problem does not exist under Windows 2003 exterprise server.
> I have the problem under Windows 2K sp4.
>
> I will email you all the source code.
No. But wait, let me recons..NO!
Put it to the group.
Even beyond the fact that I do not have
Windows 2K sp4 is a good reason to
put it the group in the hope that someone
else _has_.
But, remember to keep it small, I would
recommend no bigger than 15Kb, 20Kb at
the outside.
--
Andrew Thompson
* http://www.PhySci.org/ PhySci software suite
* http://www.1point1C.org/ 1.1C - Superluminal!
* http://www.AThompson.info/andrew/ personal site
Lars Schouw - 19 Dec 2003 01:42 GMT
Andrew
I have setup virtual PC with Windows 2K SP4 on my PC.
I will try to get the result once again with some smaller code.
My first try did not reproduce the problem; I have to include more code.
Lars
> > Andrew!
> >
[quoted text clipped - 16 lines]
> recommend no bigger than 15Kb, 20Kb at
> the outside.