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.applications;
20 import java.awt.BorderLayout;
21 import java.awt.Color;
22 import java.awt.Component;
23 import java.awt.Dimension;
25 import java.awt.GridLayout;
26 import java.awt.Image;
27 import java.awt.Point;
28 import java.awt.Rectangle;
29 import java.awt.Toolkit;
30 import java.awt.datatransfer.DataFlavor;
31 import java.awt.datatransfer.Transferable;
32 import java.awt.dnd.DnDConstants;
33 import java.awt.dnd.DropTarget;
34 import java.awt.dnd.DropTargetDragEvent;
35 import java.awt.dnd.DropTargetDropEvent;
36 import java.awt.dnd.DropTargetEvent;
37 import java.awt.dnd.DropTargetListener;
38 import java.awt.event.ActionEvent;
39 import java.awt.event.ActionListener;
40 import java.awt.event.AdjustmentEvent;
41 import java.awt.event.AdjustmentListener;
42 import java.awt.event.MouseEvent;
43 import java.awt.event.MouseListener;
44 import java.awt.geom.Point2D.Double;
46 import java.text.DateFormat;
47 import java.util.ArrayList;
48 import java.util.Collection;
49 import java.util.Date;
50 import java.util.Hashtable;
51 import java.util.List;
54 import javax.swing.DefaultListModel;
55 import javax.swing.DefaultListSelectionModel;
56 import javax.swing.Icon;
57 import javax.swing.JButton;
58 import javax.swing.JFrame;
59 import javax.swing.JLabel;
60 import javax.swing.JList;
61 import javax.swing.JOptionPane;
62 import javax.swing.JPanel;
63 import javax.swing.JScrollBar;
64 import javax.swing.JScrollPane;
65 import javax.swing.JSplitPane;
66 import javax.swing.JTextField;
67 import javax.swing.ListModel;
68 import javax.swing.ListSelectionModel;
69 import javax.swing.UIManager;
70 import javax.swing.UnsupportedLookAndFeelException;
71 import javax.swing.event.ListSelectionEvent;
72 import javax.swing.event.ListSelectionListener;
73 import javax.swing.text.BadLocationException;
74 import javax.swing.text.DefaultHighlighter;
76 import fr.orsay.lri.varna.VARNAPanel;
77 import fr.orsay.lri.varna.components.ReorderableJList;
78 import fr.orsay.lri.varna.components.ZoomWindow;
79 import fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax;
80 import fr.orsay.lri.varna.exceptions.ExceptionLoadingFailed;
81 import fr.orsay.lri.varna.exceptions.ExceptionNonEqualLength;
82 import fr.orsay.lri.varna.exceptions.ExceptionUnmatchedClosingParentheses;
83 import fr.orsay.lri.varna.factories.RNAFactory;
84 import fr.orsay.lri.varna.interfaces.InterfaceVARNAListener;
85 import fr.orsay.lri.varna.interfaces.InterfaceVARNARNAListener;
86 import fr.orsay.lri.varna.interfaces.InterfaceVARNASelectionListener;
87 import fr.orsay.lri.varna.models.BaseList;
88 import fr.orsay.lri.varna.models.FullBackup;
89 import fr.orsay.lri.varna.models.VARNAConfig;
90 import fr.orsay.lri.varna.models.rna.Mapping;
91 import fr.orsay.lri.varna.models.rna.ModeleBP;
92 import fr.orsay.lri.varna.models.rna.ModeleBase;
93 import fr.orsay.lri.varna.models.rna.RNA;
95 public class VARNAGUI extends JFrame implements DropTargetListener, InterfaceVARNAListener, MouseListener, AdjustmentListener {
100 private static final long serialVersionUID = -790155708306987257L;
102 private static final String DEFAULT_SEQUENCE = "CAGCACGACACUAGCAGUCAGUGUCAGACUGCAIACAGCACGACACUAGCAGUCAGUGUCAGACUGCAIACAGCACGACACUAGCAGUCAGUGUCAGACUGCAIA";
104 private static final String DEFAULT_STRUCTURE1 = "..(((((...(((((...(((((...(((((.....)))))...))))).....(((((...(((((.....)))))...))))).....)))))...)))))..";
105 private static final String DEFAULT_STRUCTURE2 = "..(((((...(((((...(((((........(((((...(((((.....)))))...)))))..................))))).....)))))...)))))..";
106 // private static final String DEFAULT_STRUCTURE1 = "((((....))))";
107 // private static final String DEFAULT_STRUCTURE2 =
108 // "((((..(((....)))..))))";
110 private VARNAPanel _vp;
112 private JPanel _tools = new JPanel();
113 private JPanel _input = new JPanel();
115 private JPanel _seqPanel = new JPanel();
116 private JPanel _strPanel = new JPanel();
117 private JLabel _info = new JLabel();
119 private JTextField _str = new JTextField(DEFAULT_STRUCTURE1);
120 Object _hoverHighlightStr = null;
121 ArrayList<Object> _selectionHighlightStr = new ArrayList<Object>();
123 private JTextField _seq = new JTextField(DEFAULT_SEQUENCE);
124 Object _hoverHighlightSeq = null;
125 ArrayList<Object> _selectionHighlightSeq = new ArrayList<Object>();
128 private ZoomWindow _zoomWindow;
129 private JLabel _strLabel = new JLabel(" Str:");
130 private JLabel _seqLabel = new JLabel(" Seq:");
131 private JButton _createButton = new JButton("Create");
132 private JButton _deleteButton = new JButton("Delete");
133 private JButton _duplicateButton = new JButton("Snapshot");
135 private JPanel _listPanel = new JPanel();
136 private ReorderableJList _sideList = null;
139 private static String errorOpt = "error";
140 @SuppressWarnings("unused")
141 private boolean _error;
143 private Color _backgroundColor = Color.white;
145 private JScrollBar _vert = new JScrollBar(JScrollBar.VERTICAL);
146 private JScrollBar _horiz = new JScrollBar(JScrollBar.HORIZONTAL);
148 private static int _nextID = 1;
149 @SuppressWarnings("unused")
150 private int _algoCode;
152 private BackupHolder _rnaList;
160 private void RNAPanelDemoInit()
162 DefaultListModel dlm = new DefaultListModel();
165 int marginTools = 40;
167 DefaultListSelectionModel m = new DefaultListSelectionModel();
168 m.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
169 m.setLeadAnchorNotificationEnabled(false);
172 _sideList = new ReorderableJList();
173 _sideList.setModel(dlm);
174 _sideList.addMouseListener(this);
175 _sideList.setSelectionModel(m);
176 _sideList.setPreferredSize(null);
178 _sideList.addListSelectionListener( new ListSelectionListener(){
179 public void valueChanged(ListSelectionEvent arg0) {
180 //System.out.println(arg0);
181 if (!_sideList.isSelectionEmpty() && !arg0.getValueIsAdjusting())
183 FullBackup sel = (FullBackup) _sideList.getSelectedValue();
184 _vp.setConfig(sel.config);
186 _seq.setText(sel.rna.getSeq());
187 _str.setText(sel.rna.getStructDBN(true));
192 _rnaList = new BackupHolder(dlm,_sideList);
193 RNA _RNA1 = new RNA("User defined 1");
194 RNA _RNA2 = new RNA("User defined 2");
196 _vp = new VARNAPanel("0",".");
197 _zoomWindow = new ZoomWindow(_vp);
198 _RNA1.setRNA(DEFAULT_SEQUENCE, DEFAULT_STRUCTURE1);
199 _RNA1.drawRNARadiate(_vp.getConfig());
200 _RNA2.setRNA(DEFAULT_SEQUENCE, DEFAULT_STRUCTURE2);
201 _RNA2.drawRNARadiate(_vp.getConfig());
202 } catch (ExceptionNonEqualLength e) {
204 } catch (ExceptionUnmatchedClosingParentheses e2) {
205 e2.printStackTrace();
206 } catch (ExceptionFileFormatOrSyntax e3) {
207 e3.printStackTrace();
209 _vp.setPreferredSize(new Dimension(400, 400));
210 _rnaList.add(_vp.getConfig().clone(),_RNA2,generateDefaultName());
211 _rnaList.add(_vp.getConfig().clone(),_RNA1,generateDefaultName(),true);
214 JScrollPane listScroller = new JScrollPane(_sideList);//,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
215 listScroller.setPreferredSize(new Dimension(150, 0));
217 setBackground(_backgroundColor);
218 _vp.setBackground(_backgroundColor);
221 Font textFieldsFont = Font.decode("MonoSpaced-PLAIN-12");
223 _seqLabel.setHorizontalTextPosition(JLabel.LEFT);
224 _seqLabel.setPreferredSize(new Dimension(marginTools, 15));
225 _seq.setFont(textFieldsFont);
226 _seq.setText(DEFAULT_SEQUENCE);
228 _createButton.addActionListener(new ActionListener() {
229 public void actionPerformed(ActionEvent e) {
231 RNA nRNA = new RNA(generateDefaultName());
232 nRNA.setRNA(_seq.getText(), _str.getText());
233 nRNA.drawRNARadiate(_vp.getConfig());
234 _rnaList.add(new VARNAConfig(),nRNA,true);
235 } catch (ExceptionUnmatchedClosingParentheses e1) {
236 JOptionPane.showMessageDialog(_vp, e1.getMessage(),"Error", JOptionPane.ERROR_MESSAGE);
237 } catch (ExceptionFileFormatOrSyntax e1) {
238 JOptionPane.showMessageDialog(_vp, e1.getMessage(),"Error", JOptionPane.ERROR_MESSAGE);
244 _seqPanel.setLayout(new BorderLayout());
245 _seqPanel.add(_seqLabel, BorderLayout.WEST);
246 _seqPanel.add(_seq, BorderLayout.CENTER);
248 _strLabel.setPreferredSize(new Dimension(marginTools, 15));
249 _strLabel.setHorizontalTextPosition(JLabel.LEFT);
250 _str.setFont(textFieldsFont);
251 _strPanel.setLayout(new BorderLayout());
252 _strPanel.add(_strLabel, BorderLayout.WEST);
253 _strPanel.add(_str, BorderLayout.CENTER);
255 _input.setLayout(new GridLayout(2, 0));
256 _input.add(_seqPanel);
257 _input.add(_strPanel);
259 JPanel goPanel = new JPanel();
260 goPanel.setLayout(new BorderLayout());
262 _tools.setLayout(new BorderLayout());
263 _tools.add(_input, BorderLayout.CENTER);
264 _tools.add(_info, BorderLayout.SOUTH);
265 _tools.add(goPanel, BorderLayout.EAST);
267 _deleteButton.addActionListener(new ActionListener() {
268 public void actionPerformed(ActionEvent e) {
269 _rnaList.removeSelected();
272 // BH 2018 SwingJS can't clone, as it does not implement serialization
273 if (/** @j2sNative false && */ true)
274 _duplicateButton.addActionListener(new ActionListener() {
275 public void actionPerformed(ActionEvent e) {
276 _rnaList.add((VARNAConfig)_vp.getConfig().clone(),_vp.getRNA().clone(),_vp.getRNA().getName()+"-"+DateFormat.getTimeInstance(DateFormat.LONG).format(new Date()),true);
279 JPanel ops = new JPanel();
280 ops.setLayout(new GridLayout(1,2));
281 ops.add(_deleteButton);
282 if (/** @j2sNative false && */ true)
283 ops.add(_duplicateButton);
285 JPanel opspanel = new JPanel(new BorderLayout());
286 opspanel.add(ops,BorderLayout.NORTH);
287 opspanel.add(_zoomWindow,BorderLayout.SOUTH);
289 _zoomWindow.setPreferredSize(new Dimension(-1,200));
292 JLabel j = new JLabel("Structure Manager",JLabel.CENTER);
293 _listPanel.setLayout(new BorderLayout());
295 _listPanel.add(opspanel,BorderLayout.SOUTH);
296 _listPanel.add(j,BorderLayout.NORTH);
297 _listPanel.add(listScroller,BorderLayout.CENTER);
299 goPanel.add(_createButton, BorderLayout.CENTER);
301 JPanel vpScroll = new JPanel();
302 vpScroll.setLayout(new BorderLayout());
303 _horiz.setVisible(false);
304 _horiz.addAdjustmentListener(this);
305 _vert.setVisible(false);
306 _vert.addAdjustmentListener(this);
307 vpScroll.add(_horiz,BorderLayout.SOUTH);
308 vpScroll.add(_vert,BorderLayout.EAST);
309 vpScroll.add(_vp,BorderLayout.CENTER);
310 JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,true,_listPanel,vpScroll);
311 getContentPane().setLayout(new BorderLayout());
312 getContentPane().add(split, BorderLayout.CENTER);
313 getContentPane().add(_tools, BorderLayout.NORTH);
317 DropTarget dt = new DropTarget(_vp, this);
319 _vp.addRNAListener(new InterfaceVARNARNAListener(){
320 public void onSequenceModified(int index, String oldseq, String newseq) {
321 //System.out.println("Sequence changed: Index:"+index+" ["+oldseq+"]=>["+newseq+"]");
324 public void onStructureModified(Set<ModeleBP> current,
325 Set<ModeleBP> addedBasePairs, Set<ModeleBP> removedBasePairs) {
327 //System.out.println("Structure changed: ");
328 for (ModeleBP s:addedBasePairs)
330 //System.out.println(" Added: "+result);
332 for (ModeleBP s:removedBasePairs)
334 //System.out.println(" Removed: "+result);
337 public void onRNALayoutChanged(Hashtable<Integer, Double> previousPositions) {
338 //System.out.print("Layout changed, bases#: ");
340 for (Integer s:previousPositions.keySet())
342 //System.out.println(result);
347 _vp.addSelectionListener(new InterfaceVARNASelectionListener(){
349 public void onHoverChanged(ModeleBase oldbase, ModeleBase newBase) {
350 if (_hoverHighlightSeq!=null)
352 _seq.getHighlighter().removeHighlight(_hoverHighlightSeq);
353 _hoverHighlightSeq = null;
355 if (_hoverHighlightStr!=null)
357 _str.getHighlighter().removeHighlight(_hoverHighlightStr);
358 _hoverHighlightStr = null;
363 int i = newBase.getIndex();
364 int[] shifts = _vp.getRNA().getStrandShifts();
365 _hoverHighlightSeq = _seq.getHighlighter().addHighlight(i+shifts[i], i+shifts[i]+1, new DefaultHighlighter.DefaultHighlightPainter(Color.green) );
366 _hoverHighlightStr = _str.getHighlighter().addHighlight(i+shifts[i], i+shifts[i]+1, new DefaultHighlighter.DefaultHighlightPainter(Color.green) );
367 } catch (BadLocationException e) {
373 public void onSelectionChanged(BaseList selection,
374 BaseList addedBases, BaseList removedBases) {
375 for(Object tag: _selectionHighlightSeq)
377 _seq.getHighlighter().removeHighlight(tag);
379 _selectionHighlightSeq.clear();
380 for(Object tag: _selectionHighlightStr)
382 _str.getHighlighter().removeHighlight(tag);
384 _selectionHighlightStr.clear();
385 int[] shifts = _vp.getRNA().getStrandShifts();
386 for (ModeleBase m: selection.getBases())
389 int i = m.getIndex();
390 _selectionHighlightSeq.add(_seq.getHighlighter().addHighlight(i+shifts[i], i+shifts[i]+1, new DefaultHighlighter.DefaultHighlightPainter(Color.orange) ));
391 _selectionHighlightStr.add(_str.getHighlighter().addHighlight(i+shifts[i], i+shifts[i]+1, new DefaultHighlighter.DefaultHighlightPainter(Color.orange) ));
392 } catch (BadLocationException e) {
400 _vp.addVARNAListener(this);
402 new Thread(_zoomWindow).start();
405 protected void showRNA(RNA rna) {
406 _vp.showRNAInterpolated(rna);
407 _zoomWindow.repaint();
411 public void addRNA(RNA r, VARNAConfig cfg)
416 public static String generateDefaultName()
418 return "User file #"+_nextID++;
421 public RNA getRNA() {
422 return (RNA)_sideList.getSelectedValue();
427 public String[][] getParameterInfo() {
429 // Parameter Name Kind of Value Description,
430 { "sequenceDBN", "String", "A raw RNA sequence" },
431 { "structureDBN", "String",
432 "An RNA structure in dot bracket notation (DBN)" },
433 { errorOpt, "boolean", "To show errors" }, };
438 _vp.setBackground(_backgroundColor);
442 @SuppressWarnings("unused")
443 private Color getSafeColor(String col, Color def) {
446 result = Color.decode(col);
447 } catch (Exception e) {
449 result = Color.getColor(col, def);
450 } catch (Exception e2) {
457 public VARNAPanel get_varnaPanel() {
461 public void set_varnaPanel(VARNAPanel surface) {
466 public JTextField get_seq() {
470 public void set_seq(JTextField _seq) {
474 public JLabel get_info() {
478 public void set_info(JLabel _info) {
482 public static void main(String[] args) {
483 List<Image> icons = new ArrayList<Image>();
484 //JOptionPane.showMessageDialog(null, ""+Toolkit.getDefaultToolkit().getImage("./VARNA16x16.png"), "Check", JOptionPane.INFORMATION_MESSAGE);
485 icons.add(Toolkit.getDefaultToolkit().getImage("./VARNA16x16.png"));
486 icons.add(Toolkit.getDefaultToolkit().getImage("./VARNA32x32.png"));
487 icons.add(Toolkit.getDefaultToolkit().getImage("./VARNA64x64.png"));
488 VARNAGUI d = new VARNAGUI();
489 d.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
491 d.setIconImages(icons);
496 public void dragEnter(DropTargetDragEvent arg0) {
497 // TODO Auto-generated method stub
501 public void dragExit(DropTargetEvent arg0) {
502 // TODO Auto-generated method stub
506 public void dragOver(DropTargetDragEvent arg0) {
507 // TODO Auto-generated method stub
511 public void drop(DropTargetDropEvent dtde) {
513 Transferable tr = dtde.getTransferable();
514 DataFlavor[] flavors = tr.getTransferDataFlavors();
515 for (int i = 0; i < flavors.length; i++) {
516 if (flavors[i].isFlavorJavaFileListType()) {
517 dtde.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
518 Object ob = tr.getTransferData(flavors[i]);
519 if (ob instanceof List)
521 List list = (List) ob;
522 for (int j = 0; j < list.size(); j++) {
523 Object o = list.get(j);
525 if (dtde.getSource() instanceof DropTarget)
527 DropTarget dt = (DropTarget) dtde.getSource();
528 Component c = dt.getComponent();
529 if (c instanceof VARNAPanel)
531 String path = o.toString();
532 VARNAPanel vp = (VARNAPanel) c;
534 FullBackup bck = VARNAPanel.importSession((File) o); // BH SwingJS
535 _rnaList.add(bck.config, bck.rna,bck.name,true);
537 catch (ExceptionLoadingFailed e3)
539 ArrayList<RNA> rnas = RNAFactory.loadSecStr((File) o); // BH SwingJS
542 throw new ExceptionFileFormatOrSyntax("No RNA could be parsed from that source.");
545 dtde.dropComplete(true);
546 _vp.getVARNAUI().UIChooseRNAs(rnas);
551 r.drawRNA(vp.getConfig());
552 String name = r.getName();
555 name = path.substring(path.lastIndexOf(File.separatorChar)+1);
559 name += " - Molecule# "+id++;
561 _rnaList.add(vp.getConfig().clone(),r,name,true);
568 // If we made it this far, everything worked.
569 dtde.dropComplete(true);
573 // Hmm, the user must not have dropped a file list
575 } catch (Exception e) {
582 public void dropActionChanged(DropTargetDragEvent arg0) {
585 private class BackupHolder{
586 private DefaultListModel _rnaList;
587 private ArrayList<RNA> _rnas = new ArrayList<RNA>();
590 public BackupHolder(DefaultListModel rnaList, JList l)
596 public void add(VARNAConfig c, RNA r)
598 add(c, r, r.getName(),false);
601 public void add(VARNAConfig c, RNA r,boolean select)
603 add(c, r, r.getName(),select);
606 public void add(VARNAConfig c, RNA r, String name)
608 add(c, r, name,false);
610 public void add(VARNAConfig c, RNA r, String name, boolean select)
612 if (!_rnas.contains(r))
615 _l.removeSelectionInterval(0, _rnaList.size());
619 name = generateDefaultName();
621 FullBackup bck = new FullBackup(c,r,name);
626 _l.setSelectedIndex(0);
631 public void remove(int i)
637 public DefaultListModel getModel()
641 public boolean contains(RNA r)
643 return _rnas.contains(r);
645 /*public int getSize()
647 return _rnaList.getSize();
649 public FullBackup getElementAt(int i)
651 return (FullBackup) _rnaList.getElementAt(i);
654 public void removeSelected()
656 int i = _l.getSelectedIndex();
659 if (_rnaList.getSize()==1)
664 } catch (ExceptionUnmatchedClosingParentheses e1) {
665 } catch (ExceptionFileFormatOrSyntax e1) {
672 if (newi==_rnaList.getSize())
674 newi = _rnaList.getSize()-2;
676 FullBackup bck = (FullBackup) _rnaList.getElementAt(newi);
677 _l.setSelectedValue(bck,true);
685 public void onStructureRedrawn() {
686 // TODO Auto-generated method stub
690 public void onUINewStructure(VARNAConfig v, RNA r) {
691 _rnaList.add(v, r,r.getName(),true);
692 onZoomLevelChanged();
695 public void onWarningEmitted(String s) {
696 // TODO Auto-generated method stub
700 public void mouseClicked(MouseEvent e) {
701 if(e.getClickCount() == 2){
702 int index = _sideList.locationToIndex(e.getPoint());
703 ListModel dlm = _sideList.getModel();
704 FullBackup item = (FullBackup) dlm.getElementAt(index);;
705 _sideList.ensureIndexIsVisible(index);
706 Object newName = JOptionPane.showInputDialog(
708 "Specify a new name for this RNA",
710 JOptionPane.QUESTION_MESSAGE,
716 item.name = newName.toString();
717 this._sideList.repaint();
722 public void mouseEntered(MouseEvent arg0) {
723 // TODO Auto-generated method stub
727 public void mouseExited(MouseEvent arg0) {
728 // TODO Auto-generated method stub
732 public void mousePressed(MouseEvent arg0) {
733 // TODO Auto-generated method stub
737 public void mouseReleased(MouseEvent arg0) {
738 // TODO Auto-generated method stub
742 public void onZoomLevelChanged() {
743 if (_vp.getZoom()>1.02)
745 Rectangle r = _vp.getZoomedInTranslationBox();
746 _horiz.setMinimum(r.x);
747 _horiz.setMaximum(r.x+r.width+_vp.getWidth());
748 _horiz.getModel().setExtent(_vp.getWidth());
749 _horiz.getModel().setValue(_vp.getTranslation().x);
751 _horiz.setVisible(true);
753 _vert.setMinimum(r.y);
754 _vert.setMaximum(r.y+r.height+_vp.getHeight());
755 _vert.getModel().setExtent(_vp.getHeight());
756 _vert.getModel().setValue(_vp.getTranslation().y);
758 _vert.setVisible(true);
762 _horiz.setVisible(false);
763 _vert.setVisible(false);
767 public void onTranslationChanged() {
768 if (_vp.getZoom()>1.02)
770 int nx = _horiz.getMaximum()-(_vp.getTranslation().x-_horiz.getMinimum())-_vp.getWidth();
771 int ny = _vert.getMaximum()-(_vp.getTranslation().y-_vert.getMinimum())-_vp.getHeight();
772 _horiz.getModel().setValue(nx);
774 _vert.getModel().setValue(ny);
779 public void adjustmentValueChanged(AdjustmentEvent arg0) {
780 if (arg0.getSource()==_horiz)
782 _vp.setTranslation(new Point(_horiz.getMaximum()-(arg0.getValue()-_horiz.getMinimum())-_vp.getWidth(),_vp.getTranslation().y));
785 else if (arg0.getSource()==_vert)
787 _vp.setTranslation(new Point(_vp.getTranslation().x,_vert.getMaximum()-(arg0.getValue()-_vert.getMinimum())-_vp.getHeight()));