2 VARNA is a tool for the automated drawing, visualization and annotation of the secondary structure of RNA, designed as a companion software for web servers and databases.
3 Copyright (C) 2008 Kevin Darty, Alain Denise and Yann Ponty.
4 electronic mail : Yann.Ponty@lri.fr
5 paper mail : LRI, bat 490 Université Paris-Sud 91405 Orsay Cedex France
7 This file is part of VARNA version 3.1.
8 VARNA version 3.1 is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
11 VARNA version 3.1 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
12 without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 See the GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License along with VARNA version 3.1.
16 If not, see http://www.gnu.org/licenses.
18 package fr.orsay.lri.varna.views;
21 import java.awt.GraphicsEnvironment;
23 import javax.swing.JComboBox;
24 import javax.swing.JPanel;
25 import javax.swing.JSlider;
27 import fr.orsay.lri.varna.VARNAPanel;
29 public class VueFont {
31 private VARNAPanel _vp;
33 private JComboBox stylesBox;
34 private JComboBox boxPolice;
36 private JSlider sizeSlider;
38 public VueFont(VARNAPanel vp) {
44 public VueFont(Font f) {
51 GraphicsEnvironment ge = GraphicsEnvironment
52 .getLocalGraphicsEnvironment();
53 String[] polices = ge.getAvailableFontFamilyNames();
54 boxPolice = new JComboBox(polices);
56 sizeSlider = new JSlider(JSlider.HORIZONTAL, 4, 88, 14);
57 // Turn on labels at major tick marks.
58 sizeSlider.setMajorTickSpacing(10);
59 sizeSlider.setMinorTickSpacing(5);
60 sizeSlider.setPaintTicks(true);
61 sizeSlider.setPaintLabels(true);
63 String[] styles = { "Plain", "Italic", "Bold" };
64 stylesBox = new JComboBox(styles);
68 panel.add(sizeSlider);
72 private void buildViewFont() {
73 boxPolice.setSelectedItem(font.getFamily());
74 sizeSlider.setValue(font.getSize());
75 stylesBox.setSelectedItem(styleIntToString(font.getStyle()));
78 private void buildViewVPTitle() {
79 boxPolice.setSelectedItem(_vp.getTitleFont().getFamily());
80 sizeSlider.setValue(_vp.getTitleFont().getSize());
81 stylesBox.setSelectedItem(styleIntToString(_vp.getTitleFont()
85 public String styleIntToString(int styleInt) {
87 case Font.PLAIN:// Plain
89 case Font.ITALIC:// Italic
91 case Font.BOLD:// Bold
98 public JComboBox getStylesBox() {
102 public JComboBox getBoxPolice() {
106 public JPanel getPanel() {
110 public JSlider getSizeSlider() {
114 public Font getFont() {
116 switch (getStylesBox().getSelectedIndex()) {
130 return new Font((String) getBoxPolice().getSelectedItem(), style,
131 getSizeSlider().getValue());