Lines 172-178
Link Here
|
172 |
fm = g.getFontMetrics (paintFont); |
172 |
fm = g.getFontMetrics (paintFont); |
173 |
} |
173 |
} |
174 |
g.setFont (paintFont); |
174 |
g.setFont (paintFont); |
175 |
g.drawString (fontName == null ? "null" : fontName, // NOI18N |
175 |
g.drawString (NbBundle.getMessage(FontEditor.class, "MSG_Preview"), // NOI18N |
176 |
rectangle.x, |
176 |
rectangle.x, |
177 |
rectangle.y + (rectangle.height - fm.getHeight ()) / 2 + fm.getAscent ()); |
177 |
rectangle.y + (rectangle.height - fm.getHeight ()) / 2 + fm.getAscent ()); |
178 |
g.setFont (originalFont); |
178 |
g.setFont (originalFont); |
Lines 367-372
Link Here
|
367 |
JScrollPane sp = new JScrollPane (lFont); |
367 |
JScrollPane sp = new JScrollPane (lFont); |
368 |
sp.setVerticalScrollBarPolicy (JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); |
368 |
sp.setVerticalScrollBarPolicy (JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); |
369 |
la.setConstraints (sp, c); |
369 |
la.setConstraints (sp, c); |
|
|
370 |
positionScrollPaneOnSelected(sp, lFont); |
370 |
add (sp); |
371 |
add (sp); |
371 |
|
372 |
|
372 |
lStyle.setVisibleRowCount (5); |
373 |
lStyle.setVisibleRowCount (5); |
Lines 385-390
Link Here
|
385 |
sp.setVerticalScrollBarPolicy (JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); |
386 |
sp.setVerticalScrollBarPolicy (JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); |
386 |
c.insets = new Insets (5, 5, 0, 0); |
387 |
c.insets = new Insets (5, 5, 0, 0); |
387 |
la.setConstraints (sp, c); |
388 |
la.setConstraints (sp, c); |
|
|
389 |
positionScrollPaneOnSelected(sp, lStyle); |
388 |
add (sp); |
390 |
add (sp); |
389 |
|
391 |
|
390 |
c.gridwidth = GridBagConstraints.REMAINDER; |
392 |
c.gridwidth = GridBagConstraints.REMAINDER; |
Lines 405-414
Link Here
|
405 |
sp.setVerticalScrollBarPolicy (JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); |
407 |
sp.setVerticalScrollBarPolicy (JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); |
406 |
c.insets = new Insets (5, 5, 0, 0); |
408 |
c.insets = new Insets (5, 5, 0, 0); |
407 |
la.setConstraints (sp, c); |
409 |
la.setConstraints (sp, c); |
|
|
410 |
positionScrollPaneOnSelected(sp, lSize); |
408 |
add (sp); |
411 |
add (sp); |
409 |
|
412 |
|
410 |
c.gridwidth = GridBagConstraints.REMAINDER; |
413 |
c.gridwidth = GridBagConstraints.REMAINDER; |
411 |
c.weighty = 2.0; |
414 |
c.weighty = 0.0; |
412 |
JPanel p = new JPanel (new BorderLayout()); |
415 |
JPanel p = new JPanel (new BorderLayout()); |
413 |
p.setBorder (new TitledBorder (" " + NbBundle.getMessage(FontEditor.class, "CTL_Preview") + " ")); |
416 |
p.setBorder (new TitledBorder (" " + NbBundle.getMessage(FontEditor.class, "CTL_Preview") + " ")); |
414 |
|
417 |
|
Lines 432-438
Link Here
|
432 |
|
435 |
|
433 |
@Override |
436 |
@Override |
434 |
public Dimension getPreferredSize () { |
437 |
public Dimension getPreferredSize () { |
435 |
return new Dimension (400, 250); |
438 |
return new Dimension (400, 300); |
436 |
} |
439 |
} |
437 |
|
440 |
|
438 |
private void updateSizeList(int size) { |
441 |
private void updateSizeList(int size) { |
Lines 477-482
Link Here
|
477 |
p.validate(); |
480 |
p.validate(); |
478 |
} |
481 |
} |
479 |
repaint(); |
482 |
repaint(); |
|
|
483 |
} |
484 |
|
485 |
private void positionScrollPaneOnSelected(JScrollPane scroll, JList list) { |
486 |
if (list.getSelectedIndex() != -1) { |
487 |
int start = list.getSelectedIndex() - list.getVisibleRowCount() / 2; |
488 |
Rectangle selected = list.getCellBounds(start < 0 ? 0 : start, list.getSelectedIndex()); |
489 |
scroll.getViewport().setViewPosition(new Point(selected.x, selected.y)); |
490 |
} |
480 |
} |
491 |
} |
481 |
} |
492 |
} |
482 |
|
493 |
|