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;
20 import java.awt.Dimension;
21 import java.awt.FlowLayout;
22 import java.awt.GridLayout;
24 import javax.swing.JLabel;
25 import javax.swing.JPanel;
26 import javax.swing.JSlider;
29 import fr.orsay.lri.varna.VARNAPanel;
30 import fr.orsay.lri.varna.controlers.ControleurBorder;
31 import fr.orsay.lri.varna.controlers.ControleurSliderLabel;
33 public class VueBorder {
35 private VARNAPanel _vp;
36 private JSlider borderHeightSlider, borderWidthSlider;
39 public VueBorder(VARNAPanel vp) {
42 JPanel pup = new JPanel();
43 JPanel pdown = new JPanel();
45 panel.setLayout(new GridLayout(2, 1));
46 pup.setLayout(new FlowLayout(FlowLayout.LEFT));
47 pdown.setLayout(new FlowLayout(FlowLayout.LEFT));
49 borderHeightSlider = new JSlider(JSlider.HORIZONTAL, 0,
50 _vp.getHeight() / 2 - 10, _vp.getBorderSize().height);
51 // Turn on labels at major tick marks.
52 borderHeightSlider.setMajorTickSpacing(50);
53 borderHeightSlider.setMinorTickSpacing(10);
54 borderHeightSlider.setPaintTicks(true);
55 borderHeightSlider.setPaintLabels(true);
56 JLabel borderHeightLabel = new JLabel(String.valueOf(_vp
57 .getBorderSize().height));
58 borderHeightLabel.setPreferredSize(new Dimension(50, borderHeightLabel
59 .getPreferredSize().height));
60 borderHeightSlider.addChangeListener(new ControleurSliderLabel(
61 borderHeightLabel, false));
62 borderHeightSlider.addChangeListener(new ControleurBorder(this));
64 borderWidthSlider = new JSlider(JSlider.HORIZONTAL, 0,
65 _vp.getWidth() / 2 - 10, _vp.getBorderSize().width);
66 // Turn on labels at major tick marks.
67 borderWidthSlider.setMajorTickSpacing(50);
68 borderWidthSlider.setMinorTickSpacing(10);
69 borderWidthSlider.setPaintTicks(true);
70 borderWidthSlider.setPaintLabels(true);
71 JLabel borderWidthLabel = new JLabel(String
72 .valueOf(_vp.getBorderSize().width));
73 borderWidthLabel.setPreferredSize(new Dimension(50, borderWidthLabel
74 .getPreferredSize().height));
75 borderWidthSlider.addChangeListener(new ControleurSliderLabel(
76 borderWidthLabel, false));
77 borderWidthSlider.addChangeListener(new ControleurBorder(this));
79 JLabel labelW = new JLabel("Width:");
80 JLabel labelH = new JLabel("Height:");
83 pup.add(borderWidthSlider);
84 pup.add(borderWidthLabel);
87 pdown.add(borderHeightSlider);
88 pdown.add(borderHeightLabel);
94 public JPanel getPanel() {
98 public Dimension getDimension() {
99 return new Dimension(borderWidthSlider.getValue(), borderHeightSlider
103 public int getHeight() {
104 return borderHeightSlider.getValue();
107 public int getWidth() {
108 return borderWidthSlider.getValue();
111 public VARNAPanel get_vp() {