Java 1.6 displays tables differently (worse)

2 views
Skip to first unread message

Nomi Harris

unread,
Apr 22, 2010, 5:22:24 PM4/22/10
to obo-ed...@googlegroups.com, Ed Lee, Nomi Harris
I recently upgraded my java from 1.5 to 1.6, and I don't like how 1.6
is displaying the annotation table in Phenote. (There are some other
differences in appearance, too, but that's the most objectionable.)

Here is a combined before-and-after screenshot. The left side shows
the current version of Phenote running with java 1.5; the right side
shows exactly the same version of Phenote with java 1.6:

Picture 2.png

Jim Balhoff

unread,
Apr 22, 2010, 6:21:26 PM4/22/10
to Nomi Harris, Ed Lee, obo-ed...@googlegroups.com
Hi Nomi,

This is a problem resulting from a change to the look-and-feel classname on Apple's 1.6. The differences you see are the Quaqua nicer look vs. the built-in Apple look. I fixed the detection which switches to Quaqua in Phenote.

- Jim


On Apr 22, 2010, at 5:22 PM, Nomi Harris wrote:

> I recently upgraded my java from 1.5 to 1.6, and I don't like how 1.6 is displaying the annotation table in Phenote. (There are some other differences in appearance, too, but that's the most objectionable.)
>
> Here is a combined before-and-after screenshot. The left side shows the current version of Phenote running with java 1.5; the right side shows exactly the same version of Phenote with java 1.6:
>
>
>
>
> The phenote code has calls to set up the look of the table--these seem to work in java 1.5 but not java 1.6. The relevant parts that I found are:
> this.characterTable.putClientProperty("Quaqua.Table.style", "striped"); // in CharacterTemplateTable
>
> There's also a class called CorrectLineBorderCellEditor with methods such as:
> public CorrectLineBorderCellEditor(JComboBox comboBox) {
> super(comboBox);
> comboBox.setBorder(new LineBorder(Color.black));
> }
>
> These ought to do the trick, but with java 1.6, they're not.
>
> I wondered if any of you had any suggestions, before I spend more time on this.
>
> Thanks,
> Nomi<Picture 2.png>--
> You received this message because you are subscribed to the Google Groups "OBO-Edit Developers Group" group.
> To post to this group, send email to obo-ed...@googlegroups.com.
> To unsubscribe from this group, send email to obo-edit-dev...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/obo-edit-dev?hl=en.
>

____________________________________________
James P. Balhoff, Ph.D.
National Evolutionary Synthesis Center
2024 West Main St., Suite A200
Durham, NC 27705
USA



--
You received this message because you are subscribed to the Google Groups "OBO-Edit Developers Group" group.
To post to this group, send email to obo-ed...@googlegroups.com.
To unsubscribe from this group, send email to obo-edit-dev...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/obo-edit-dev?hl=en.

Ed Lee

unread,
Apr 22, 2010, 6:20:12 PM4/22/10
to Nomi Harris, obo-ed...@googlegroups.com
Hi Nomi,

Here's some example code to get that Quaqua look across the border
(should work with Java 6 and on all the difference L&F). You'll
of course need to modify it accordingly, but it should give
you an idea:

<source_code>

import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;

import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.DefaultTableModel;


public class TableTest extends JFrame {

public TableTest() {
init();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
pack();
}

private void init() {
JPanel panel = new JPanel();
add(panel);

Integer[][] data = { { 1, 2, 3, 4, 5 }, { 6, 7, 8, 9, 10 },
{ 11, 12, 13, 14, 15 } };
String [] colNames = { "A", "B", "C", "D", "E" };

JTable table = new JTable(new DefaultTableModel(data, colNames));
table.setIntercellSpacing(new Dimension(0, 0));
table.setDefaultRenderer(Object.class, new DefaultTableCellRenderer() {

@Override
public Component getTableCellRendererComponent(JTable table,
Object value, boolean isSelected, boolean hasFocus,
int row, int column) {
JLabel label = (JLabel)super.getTableCellRendererComponent(table, value,
isSelected, hasFocus, row, column);
label.setBorder(BorderFactory.createLineBorder(Color.GRAY));
if (row % 2 == 0) {
label.setBackground(new Color(175, 238, 238));
}
else {
label.setBackground(Color.WHITE);
}
return label;
}
});

panel.add(table);
}

public static void main(String [] args) {
new TableTest().setVisible(true);
}

}

</source_code>

Cheers,
Ed

Ed Lee

unread,
Apr 22, 2010, 6:17:03 PM4/22/10
to Nomi Harris, obo-ed...@googlegroups.com
Hi Nomi,

> The phenote code has calls to set up the look of the table--these seem
> to work in java 1.5 but not java 1.6. The relevant parts that I found
> are:
> this.characterTable.putClientProperty("Quaqua.Table.style",
> "striped"); // in CharacterTemplateTable

I wonder whether there are some incompatibility issues with Quaqua
between Java 5.0 and Java 6. You might want to try to use the
most current version of Quaqua and see whether that helps.
The one thing to keep in mind is that Quaqua is a Mac L&F library,
so that look will only apply to Macs. Personally, I gave up on
using it since it had a few too many issues for my taste.

> There's also a class called CorrectLineBorderCellEditor with methods
> such as:
> public CorrectLineBorderCellEditor(JComboBox comboBox) {
> super(comboBox);
> comboBox.setBorder(new LineBorder(Color.black));
> }
>
> These ought to do the trick, but with java 1.6, they're not.

I don't see anything in particular that's an issue with the above code
(assuming that the super class constructor adds the comboBox reference
to a container, rather than copy it). Hard to tell without looking at
the rest of the code.

Nomi Harris

unread,
Apr 23, 2010, 1:13:21 PM4/23/10
to Jim Balhoff, Ed Lee, obo-ed...@googlegroups.com
Hey, thanks so much for fixing it, Jim! Now the tables look nice again.

Yesterday I had tried downloading the latest quaqua library and making
a new jar. When I use that new quaqua.jar, I get this exception from
Phenote (though everything looks fine):
Warning: class
ch.randelshofer.quaqua.QuaquaManager.updateAvailableLAFs() couldn't
access resource file "laf.txt".
java.io.IOException: File laf.txt not found
at
ch
.randelshofer
.quaqua.QuaquaManager.updateAvailableLAFs(QuaquaManager.java:325)
at
ch.randelshofer.quaqua.QuaquaManager.<clinit>(QuaquaManager.java:199)
at
ch.randelshofer.quaqua.QuaquaLookAndFeel.<init>(QuaquaLookAndFeel.java:
43)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun
.reflect
.NativeConstructorAccessorImpl
.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun
.reflect
.DelegatingConstructorAccessorImpl
.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:
513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at javax.swing.UIManager.setLookAndFeel(UIManager.java:562)
at phenote.main.Phenote.initLookAndFeel(Phenote.java:180)
at phenote.main.Phenote.initBackend(Phenote.java:114)
at
phenote.main.PhenoteStartupTask.initPhenote(PhenoteStartupTask.java:121)
at
phenote.main.PhenoteStartupTask.<init>(PhenoteStartupTask.java:65)
at phenote.main.PhenotePlus
$PhenoteRunnable.run(PhenotePlus.java:21)
at
java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:633)
at
java
.awt
.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:
296)
at
java
.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:
211)
at
java
.awt
.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:
201)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:
122)

With the old quaqua.jar that's in the Phenote repository, I don't get
that exception.

Nomi
Reply all
Reply to author
Forward
0 new messages