moved result box out of scroll pane and colored it blue to make it more obvious; split long tooltips into multiple lines

git-svn-id: svn://anubis/gvsu@464 45c1a28c-8058-47b2-ae61-ca45b979098e
This commit is contained in:
josh 2009-11-27 20:01:45 +00:00
parent c65455c0b5
commit 0840b237fd

View File

@ -152,7 +152,7 @@ class RetirementCalculatorPanel
field = new JTextField(); field = new JTextField();
field.addFocusListener(this); field.addFocusListener(this);
myFields.put("employer pension", field); myFields.put("employer pension", field);
myToolTips.put(field, "If your employer has a pension plan that will pay you a certain amount after you retire from them, then enter that amount here."); myToolTips.put(field, "If your employer has a pension plan that will pay you a certain amount<br/>after you retire from them, then enter that amount here.");
addDollarRow(inner, addDollarRow(inner,
new JLabel(" - from an employer pension plan?", new JLabel(" - from an employer pension plan?",
SwingConstants.RIGHT), SwingConstants.RIGHT),
@ -169,7 +169,7 @@ class RetirementCalculatorPanel
field = new JTextField(); field = new JTextField();
field.addFocusListener(this); field.addFocusListener(this);
myFields.put("other income", field); myFields.put("other income", field);
myToolTips.put(field, "If there is any other annual income you expect to receive after retirement not already accounted for, enter the amount here."); myToolTips.put(field, "If there is any other annual income you expect to receive after retirement<br/>not already accounted for, enter the amount here.");
addDollarRow(inner, new JLabel(" - other?", SwingConstants.RIGHT), field); addDollarRow(inner, new JLabel(" - other?", SwingConstants.RIGHT), field);
addRow(inner, makeDivider()); addRow(inner, makeDivider());
@ -219,22 +219,23 @@ class RetirementCalculatorPanel
buttons.add(myResetButton); buttons.add(myResetButton);
buttons.add(Box.createHorizontalGlue()); buttons.add(Box.createHorizontalGlue());
addRow(inner, makeDivider());
addRow(inner, myToolTipBox); addRow(inner, myToolTipBox);
// addRow(inner, makeDivider());
addRow(inner, buttons); addRow(inner, buttons);
addRow(inner, makeDivider()); // addRow(inner, makeDivider());
myResultBox = new JLabel(" ", SwingConstants.CENTER);
addRow(inner, myResultBox);
JScrollPane scrollpane = new JScrollPane(inner, JScrollPane scrollpane = new JScrollPane(inner,
ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
add(scrollpane); add(scrollpane);
myResultBox = new JLabel(" ", SwingConstants.CENTER);
myResultBox.setForeground(new Color(0, 0, 200));
add(myResultBox, BorderLayout.SOUTH);
reset(); reset();
} }
@ -257,7 +258,11 @@ class RetirementCalculatorPanel
String tooltip = myToolTips.get(e.getComponent()); String tooltip = myToolTips.get(e.getComponent());
if (tooltip != null) if (tooltip != null)
{ {
myToolTipBox.setText(tooltip); if (tooltip.indexOf("<br") < 0)
{
tooltip = tooltip + "<br/> &nbsp; ";
}
myToolTipBox.setText("<html>" + tooltip + "</html>");
} }
} }