X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FSliderPanel.java;h=fc7c7602659d41a45931b81f2929afd11d9d6092;hb=bad9b1c3e957e44c2fa5ad3a0717ea2a40c1bc12;hp=3e23728024c87d2756cdf7a51a6b58f63d3f6774;hpb=95a46891288f4fc63d690cab4f56879678f54fb6;p=jalview.git diff --git a/src/jalview/appletgui/SliderPanel.java b/src/jalview/appletgui/SliderPanel.java index 3e23728..fc7c760 100755 --- a/src/jalview/appletgui/SliderPanel.java +++ b/src/jalview/appletgui/SliderPanel.java @@ -1,6 +1,6 @@ /* * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -25,11 +25,12 @@ import java.awt.*; import java.awt.event.*; import jalview.datamodel.*; -import jalview.jbappletgui.*; import jalview.schemes.*; -public class SliderPanel - extends GSliderPanel +public class SliderPanel extends Panel + implements ActionListener, + AdjustmentListener, + MouseListener { AlignmentPanel ap; boolean forConservation = true; @@ -153,6 +154,11 @@ public class SliderPanel public SliderPanel(AlignmentPanel ap, int value, boolean forConserve, ColourSchemeI cs) { + try { + jbInit(); + } catch (Exception e) { + e.printStackTrace(); + } this.ap = ap; this.cs = cs; forConservation = forConserve; @@ -173,14 +179,8 @@ public class SliderPanel slider.setBlockIncrement(1); } - slider.addAdjustmentListener(new AdjustmentListener() - { - public void adjustmentValueChanged(AdjustmentEvent evt) - { - valueField.setText(slider.getValue() + ""); - valueChanged(slider.getValue()); - } - }); + slider.addAdjustmentListener(this); + slider.addMouseListener(this); slider.setValue(value); valueField.setText(value + ""); @@ -235,7 +235,24 @@ public class SliderPanel allGroupsCheck.setEnabled(b); } - public void valueField_actionPerformed(ActionEvent e) + public void actionPerformed(ActionEvent evt) + { + if(evt.getSource()==applyButton) + applyButton_actionPerformed(); + else if(evt.getSource()==undoButton) + undoButton_actionPerformed(); + else if(evt.getSource()==valueField) + valueField_actionPerformed(); + } + + public void adjustmentValueChanged(AdjustmentEvent evt) + { + valueField.setText(slider.getValue() + ""); + valueChanged(slider.getValue()); + } + + + public void valueField_actionPerformed() { try { @@ -258,4 +275,77 @@ public class SliderPanel return Integer.parseInt(valueField.getText()); } + // this is used for conservation colours, PID colours and redundancy threshold + protected Scrollbar slider = new Scrollbar(); + protected TextField valueField = new TextField(); + protected Label label = new Label(); + Panel jPanel1 = new Panel(); + Panel jPanel2 = new Panel(); + protected Button applyButton = new Button(); + protected Button undoButton = new Button(); + FlowLayout flowLayout1 = new FlowLayout(); + protected Checkbox allGroupsCheck = new Checkbox(); + BorderLayout borderLayout1 = new BorderLayout(); + BorderLayout borderLayout2 = new BorderLayout(); + FlowLayout flowLayout2 = new FlowLayout(); + + private void jbInit() throws Exception { + this.setLayout(borderLayout2); + + // slider.setMajorTickSpacing(10); + // slider.setMinorTickSpacing(1); + // slider.setPaintTicks(true); + slider.setBackground(Color.white); + slider.setFont(new java.awt.Font("Verdana", 0, 11)); + slider.setOrientation(0); + valueField.setFont(new java.awt.Font("Verdana", 0, 11)); + valueField.setText(" "); + valueField.addActionListener(this); + label.setFont(new java.awt.Font("Verdana", 0, 11)); + label.setText("set this label text"); + jPanel1.setLayout(borderLayout1); + jPanel2.setLayout(flowLayout1); + applyButton.setFont(new java.awt.Font("Verdana", 0, 11)); + applyButton.setLabel("Apply"); + applyButton.addActionListener(this); + undoButton.setEnabled(false); + undoButton.setFont(new java.awt.Font("Verdana", 0, 11)); + undoButton.setLabel("Undo"); + undoButton.addActionListener(this); + allGroupsCheck.setEnabled(false); + allGroupsCheck.setFont(new java.awt.Font("Verdana", 0, 11)); + allGroupsCheck.setLabel("Apply threshold to all groups"); + allGroupsCheck.setName("Apply to all Groups"); + this.setBackground(Color.white); + this.setForeground(Color.black); + jPanel2.add(label, null); + jPanel2.add(applyButton, null); + jPanel2.add(undoButton, null); + jPanel2.add(allGroupsCheck); + jPanel1.add(valueField, java.awt.BorderLayout.EAST); + jPanel1.add(slider, java.awt.BorderLayout.CENTER); + this.add(jPanel1, java.awt.BorderLayout.SOUTH); + this.add(jPanel2, java.awt.BorderLayout.CENTER); + } + + protected void applyButton_actionPerformed() + { } + + protected void undoButton_actionPerformed() + { } + + public void mousePressed(MouseEvent evt) + { } + + public void mouseReleased(MouseEvent evt) + { + if (ap.overviewPanel != null) + ap.overviewPanel.updateOverviewImage(); + } + public void mouseClicked(MouseEvent evt) + {} + public void mouseEntered(MouseEvent evt) + {} + public void mouseExited(MouseEvent evt) + {} }