[sword-cvs] r50 - in trunk/app/src/org/crosswire: common/swing
flashcards
Apache
apache at crosswire.org
Mon Sep 20 13:37:01 MST 2004
Author:
Date: 2004-09-20 13:37:01 -0700 (Mon, 20 Sep 2004)
New Revision: 50
Modified:
trunk/app/src/org/crosswire/common/swing/RowTable.java
trunk/app/src/org/crosswire/flashcards/QuizPane.java
Log:
more changes
Modified: trunk/app/src/org/crosswire/common/swing/RowTable.java
===================================================================
--- trunk/app/src/org/crosswire/common/swing/RowTable.java 2004-09-20 20:27:12 UTC (rev 49)
+++ trunk/app/src/org/crosswire/common/swing/RowTable.java 2004-09-20 20:37:01 UTC (rev 50)
@@ -65,11 +65,9 @@
super(new RowTableModel(aList, columns));
setSortRenderer();
- // Don't display vertical lines in table
- // getColumnModel().setColumnMargin(0);
+ setColumnWidths(columns.getCharacterWidths(), columns.getFixedWidths());
+ setRowHeight(getStandardCharacterHeight() + (getRowMargin() << 1) + PADDING);
- setColumnWidths(columns.getCharacterWidths(), columns.getFixedWidths());
-
getTableHeader().addMouseListener(new MouseAdapter()
{
public void mouseClicked(MouseEvent e)
@@ -260,6 +258,24 @@
return twoStandardCharactersWidth - oneStandardCharacterWidth;
}
+ /**
+ * Size each column to something reasonable
+ * We do this by getting the height of the letter 'M'
+ * from the default Table Header Renderer and adding the margin size to it.
+ * and set the preferred width of the column
+ * as the width of some number of 'M's.
+ * @return int
+ */
+ private int getStandardCharacterHeight()
+ {
+ // The preferredSize of the component is more than just the character
+ final JTableHeader th = getTableHeader();
+ final TableCellRenderer renderer = th.getDefaultRenderer();
+ Component comp = renderer.getTableCellRendererComponent(this, ONE_STANDARD_CHARACTER, false, false, 0, 0);
+ final int height = comp.getPreferredSize().height;
+ return height;
+ }
+
/**
* Method addListSelectionListener
* @param listener ListSelectionListener
@@ -278,7 +294,7 @@
{
int newHeight = getRowHeight() * numRows;
// The following may be needed for Java 1.4
- // newHeight += table.getIntercellSpacing().height * (numRows + 1);
+ newHeight += getIntercellSpacing().height * (numRows + 1);
newHeight += getTableHeader().getPreferredSize().height;
final Insets insets = getInsets();
newHeight += insets.top + insets.bottom;
Modified: trunk/app/src/org/crosswire/flashcards/QuizPane.java
===================================================================
--- trunk/app/src/org/crosswire/flashcards/QuizPane.java 2004-09-20 20:27:12 UTC (rev 49)
+++ trunk/app/src/org/crosswire/flashcards/QuizPane.java 2004-09-20 20:37:01 UTC (rev 50)
@@ -367,7 +367,6 @@
}
}
-
public void showAnswer()
{
for (int i = 0; i < choicesPanel.getComponentCount(); i++)
More information about the sword-cvs
mailing list