From: Robin Rosenberg <robin.rosenberg@dewire.com>
To: spearce@spearce.org
Cc: git@vger.kernel.org, Robin Rosenberg <robin.rosenberg@dewire.com>
Subject: [EGIT PATCH 1/8] Set table row height for the glog JTable
Date: Wed, 1 Oct 2008 01:53:40 +0200 [thread overview]
Message-ID: <1222818823-22780-1-git-send-email-robin.rosenberg@dewire.com> (raw)
For some obscure reason JTable has a fixed default row size
of 16 pixels. This doesn't work well outside the default
look-and-feels shipped with the JRE, e.g. the GTK look and
feel for Linux.
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
.../org/spearce/jgit/awtui/CommitGraphPane.java | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/org.spearce.jgit/src/org/spearce/jgit/awtui/CommitGraphPane.java b/org.spearce.jgit/src/org/spearce/jgit/awtui/CommitGraphPane.java
index 2be0e95..4ab2136 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/awtui/CommitGraphPane.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/awtui/CommitGraphPane.java
@@ -52,6 +52,7 @@
import javax.swing.table.AbstractTableModel;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.JTableHeader;
+import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
import javax.swing.table.TableModel;
@@ -83,8 +84,18 @@ public CommitGraphPane() {
allCommits = new SwingCommitList();
configureHeader();
setShowHorizontalLines(false);
- setRowMargin(0);
setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ configureRowHeight();
+ }
+
+ private void configureRowHeight() {
+ int h = 0;
+ for (int i = 0; i<getColumnCount(); ++i) {
+ TableCellRenderer renderer = getDefaultRenderer(getColumnClass(i));
+ Component c = renderer.getTableCellRendererComponent(this, "Ã
Oj", false, false, 0, i);
+ h = Math.max(h, c.getPreferredSize().height);
+ }
+ setRowHeight(h + getRowMargin());
}
/**
--
1.6.0.1.310.gf789d0.dirty
next reply other threads:[~2008-09-30 23:56 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-30 23:53 Robin Rosenberg [this message]
2008-09-30 23:53 ` [EGIT PATCH 2/8] Move AWTPlotRenderer to its own file Robin Rosenberg
2008-09-30 23:53 ` [EGIT PATCH 3/8] Dispose of allocated colors on finalize() Robin Rosenberg
2008-09-30 23:53 ` [EGIT PATCH 4/8] Align commit text properly in jgit glog Robin Rosenberg
2008-10-01 0:02 ` Robin Rosenberg
2008-10-01 14:38 ` Shawn O. Pearce
2008-10-01 19:31 ` [EGIT PATCH 0/3] jgit glog alignment fixes Robin Rosenberg
2008-10-01 19:31 ` [EGIT PATCH 1/3] Set table row height for the glog JTable Robin Rosenberg
2008-10-01 19:31 ` [EGIT PATCH 2/3] Move AWTPlotRenderer to its own file Robin Rosenberg
2008-10-01 19:31 ` [EGIT PATCH 3/3] Align commit text properly in jgit glog Robin Rosenberg
2008-10-01 14:37 ` [EGIT PATCH 3/8] Dispose of allocated colors on finalize() Shawn O. Pearce
2008-10-01 17:48 ` Robin Rosenberg
2008-10-01 14:32 ` [EGIT PATCH 2/8] Move AWTPlotRenderer to its own file Shawn O. Pearce
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1222818823-22780-1-git-send-email-robin.rosenberg@dewire.com \
--to=robin.rosenberg@dewire.com \
--cc=git@vger.kernel.org \
--cc=spearce@spearce.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).