diff -r 3662dc3ca4aa o.n.core/src/org/netbeans/beaninfo/editors/Bundle.properties --- a/o.n.core/src/org/netbeans/beaninfo/editors/Bundle.properties Sat May 02 01:13:49 2009 +0200 +++ b/o.n.core/src/org/netbeans/beaninfo/editors/Bundle.properties Sat May 02 12:25:54 2009 +0100 @@ -237,6 +237,9 @@ JVM triggered when bitmap fonts are installed on the system. In order to use \ the font editor, you will need to uninstall all bitmap fonts on your system. \ See Apple BugReporter issue 3121780 for further details. +# http://en.wikipedia.org/wiki/The_quick_brown_fox_jumps_over_the_lazy_dog +# translators @see http://en.wikipedia.org/wiki/List_of_pangrams +MSG_Preview=The quick brown fox jumps over the lazy dog # will be same as CTL_OK in openide.explorer/src/org/openide/explorer/propertysheet/Bundle.properties CTL_OK=OK diff -r 3662dc3ca4aa o.n.core/src/org/netbeans/beaninfo/editors/FontEditor.java --- a/o.n.core/src/org/netbeans/beaninfo/editors/FontEditor.java Sat May 02 01:13:49 2009 +0200 +++ b/o.n.core/src/org/netbeans/beaninfo/editors/FontEditor.java Sat May 02 12:25:54 2009 +0100 @@ -172,7 +172,7 @@ fm = g.getFontMetrics (paintFont); } g.setFont (paintFont); - g.drawString (fontName == null ? "null" : fontName, // NOI18N + g.drawString (NbBundle.getMessage(FontEditor.class, "MSG_Preview"), // NOI18N rectangle.x, rectangle.y + (rectangle.height - fm.getHeight ()) / 2 + fm.getAscent ()); g.setFont (originalFont); @@ -367,6 +367,7 @@ JScrollPane sp = new JScrollPane (lFont); sp.setVerticalScrollBarPolicy (JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); la.setConstraints (sp, c); + positionScrollPaneOnSelected(sp, lFont); add (sp); lStyle.setVisibleRowCount (5); @@ -385,6 +386,7 @@ sp.setVerticalScrollBarPolicy (JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); c.insets = new Insets (5, 5, 0, 0); la.setConstraints (sp, c); + positionScrollPaneOnSelected(sp, lStyle); add (sp); c.gridwidth = GridBagConstraints.REMAINDER; @@ -405,10 +407,11 @@ sp.setVerticalScrollBarPolicy (JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); c.insets = new Insets (5, 5, 0, 0); la.setConstraints (sp, c); + positionScrollPaneOnSelected(sp, lSize); add (sp); c.gridwidth = GridBagConstraints.REMAINDER; - c.weighty = 2.0; + c.weighty = 0.0; JPanel p = new JPanel (new BorderLayout()); p.setBorder (new TitledBorder (" " + NbBundle.getMessage(FontEditor.class, "CTL_Preview") + " ")); @@ -432,7 +435,7 @@ @Override public Dimension getPreferredSize () { - return new Dimension (400, 250); + return new Dimension (400, 300); } private void updateSizeList(int size) { @@ -477,6 +480,14 @@ p.validate(); } repaint(); + } + + private void positionScrollPaneOnSelected(JScrollPane scroll, JList list) { + if (list.getSelectedIndex() != -1) { + int start = list.getSelectedIndex() - list.getVisibleRowCount() / 2; + Rectangle selected = list.getCellBounds(start < 0 ? 0 : start, list.getSelectedIndex()); + scroll.getViewport().setViewPosition(new Point(selected.x, selected.y)); + } } }