From 410d9890ee07332a70dbd72de8e828ce52f32179 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Tue, 30 Aug 2005 16:07:26 +0000 Subject: [PATCH] UserColour gui modified --- src/jalview/appletgui/UserDefinedColours.java | 5 ++ src/jalview/jbappletgui/GUserDefinedColours.java | 96 +++++++++++----------- 2 files changed, 54 insertions(+), 47 deletions(-) diff --git a/src/jalview/appletgui/UserDefinedColours.java b/src/jalview/appletgui/UserDefinedColours.java index bcb1ddb..36df306 100755 --- a/src/jalview/appletgui/UserDefinedColours.java +++ b/src/jalview/appletgui/UserDefinedColours.java @@ -92,6 +92,7 @@ public class UserDefinedColours { int i = Integer.parseInt(rText.getText()); rScroller.setValue(i); + rScroller_adjustmentValueChanged(null); } catch (NumberFormatException ex) {} @@ -103,6 +104,7 @@ public class UserDefinedColours { int i = Integer.parseInt(gText.getText()); gScroller.setValue(i); + gScroller_adjustmentValueChanged(null); } catch (NumberFormatException ex) {} @@ -115,6 +117,7 @@ public class UserDefinedColours { int i = Integer.parseInt(bText.getText()); bScroller.setValue(i); + bScroller_adjustmentValueChanged(null); } catch (NumberFormatException ex) {} @@ -146,10 +149,12 @@ public class UserDefinedColours { Color col = new Color(R, G, B); target.setBackground(col); + target.repaint(); if (selectedButton != null) { selectedButton.setBackground(col); + selectedButton.repaint(); } } diff --git a/src/jalview/jbappletgui/GUserDefinedColours.java b/src/jalview/jbappletgui/GUserDefinedColours.java index bc57798..b26dd9a 100755 --- a/src/jalview/jbappletgui/GUserDefinedColours.java +++ b/src/jalview/jbappletgui/GUserDefinedColours.java @@ -31,20 +31,14 @@ public class GUserDefinedColours extends Panel { protected Button cancelButton = new Button(); protected Scrollbar rScroller = new Scrollbar(); Label label1 = new Label(); - Panel panel2 = new Panel(); - BorderLayout borderLayout1 = new BorderLayout(); - protected TextField rText = new TextField(); - Panel panel3 = new Panel(); - Label label4 = new Label(); + protected TextField rText = new TextField(); + Label label4 = new Label(); protected Scrollbar gScroller = new Scrollbar(); protected TextField gText = new TextField(); - BorderLayout borderLayout2 = new BorderLayout(); - Panel panel4 = new Panel(); - Label label5 = new Label(); + Label label5 = new Label(); protected Scrollbar bScroller = new Scrollbar(); protected TextField bText = new TextField(); - BorderLayout borderLayout3 = new BorderLayout(); - protected Panel target = new Panel(); + protected Panel target = new Panel(); public GUserDefinedColours() { try { @@ -83,82 +77,90 @@ public class GUserDefinedColours extends Panel { this.setBackground(new Color(212, 208, 223)); jPanel2.setBounds(new Rectangle(0, 265, 400, 35)); buttonPanel.setBounds(new Rectangle(0, 123, 400, 142)); - rScroller.setMaximum(255); + rScroller.setMaximum(256); rScroller.setMinimum(0); rScroller.setOrientation(0); rScroller.setUnitIncrement(1); - rScroller.addAdjustmentListener(new java.awt.event.AdjustmentListener() { + rScroller.setVisibleAmount(1); + rScroller.setBounds(new Rectangle(36, 27, 119, 19)); + rScroller.addAdjustmentListener(new java.awt.event.AdjustmentListener() { public void adjustmentValueChanged(AdjustmentEvent e) { rScroller_adjustmentValueChanged(e); } }); - label1.setText("R"); - panel2.setBounds(new Rectangle(20, 29, 180, 19)); - panel2.setLayout(borderLayout1); - rText.setText(" 0"); - rText.addActionListener(new java.awt.event.ActionListener() { + label1.setAlignment(Label.RIGHT); + label1.setText("R"); + label1.setBounds(new Rectangle(19, 30, 16, 15)); + rText.setFont(new java.awt.Font("Dialog", Font.PLAIN, 10)); + rText.setText("0 "); + rText.setBounds(new Rectangle(156, 27, 53, 19)); + rText.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { rText_actionPerformed(e); } }); - panel3.setLayout(borderLayout2); - label4.setText("G"); - gScroller.setMaximum(255); + label4.setAlignment(Label.RIGHT); + label4.setText("G"); + label4.setBounds(new Rectangle(15, 56, 20, 15)); + gScroller.setMaximum(256); gScroller.setMinimum(0); gScroller.setOrientation(0); gScroller.setUnitIncrement(1); - gScroller.addAdjustmentListener(new java.awt.event.AdjustmentListener() { + gScroller.setVisibleAmount(1); + gScroller.setBounds(new Rectangle(35, 52, 120, 20)); + gScroller.addAdjustmentListener(new java.awt.event.AdjustmentListener() { public void adjustmentValueChanged(AdjustmentEvent e) { gScroller_adjustmentValueChanged(e); } }); - gText.setText(" 0"); - gText.addActionListener(new java.awt.event.ActionListener() { + gText.setFont(new java.awt.Font("Dialog", Font.PLAIN, 10)); + gText.setText("0 "); + gText.setBounds(new Rectangle(156, 52, 53, 20)); + gText.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { gText_actionPerformed(e); } }); - panel3.setBounds(new Rectangle(19, 54, 181, 20)); - panel4.setLayout(borderLayout3); - label5.setText("B"); - bScroller.setMaximum(255); + label5.setAlignment(Label.RIGHT); + label5.setText("B"); + label5.setBounds(new Rectangle(14, 82, 20, 15)); + bScroller.setMaximum(256); bScroller.setMinimum(0); bScroller.setOrientation(0); bScroller.setUnitIncrement(1); - bScroller.addAdjustmentListener(new java.awt.event.AdjustmentListener() { + bScroller.setVisibleAmount(1); + bScroller.setBounds(new Rectangle(35, 78, 120, 20)); + bScroller.addAdjustmentListener(new java.awt.event.AdjustmentListener() { public void adjustmentValueChanged(AdjustmentEvent e) { bScroller_adjustmentValueChanged(e); } }); - bText.setSelectionStart(6); - bText.setText(" 0"); - bText.addActionListener(new java.awt.event.ActionListener() { + bText.setFont(new java.awt.Font("Dialog", Font.PLAIN, 10)); + bText.setText("0 "); + bText.setBounds(new Rectangle(157, 78, 52, 20)); + bText.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { bText_actionPerformed(e); } }); - panel4.setBounds(new Rectangle(19, 87, 180, 20)); - target.setBackground(Color.black); + target.setBackground(Color.black); target.setBounds(new Rectangle(229, 26, 134, 79)); this.add(jPanel2, null); jPanel2.add(okButton, null); jPanel2.add(applyButton, null); jPanel2.add(cancelButton, null); this.add(buttonPanel, null); - panel2.add(label1, BorderLayout.WEST); - panel2.add(rScroller, BorderLayout.CENTER); - panel2.add(rText, BorderLayout.EAST); - this.add(target, null); - this.add(panel4, null); - panel3.add(label4, BorderLayout.WEST); - panel3.add(gScroller, BorderLayout.CENTER); - panel3.add(gText, BorderLayout.EAST); - this.add(panel2, null); - panel4.add(label5, BorderLayout.WEST); - panel4.add(bScroller, BorderLayout.CENTER); - panel4.add(bText, BorderLayout.EAST); - this.add(panel3, null); - } + this.add(target, null); + this.add(gScroller); + this.add(rScroller); + this.add(bScroller); + this.add(label5); + this.add(label4); + this.add(label1); + this.add(gText); + this.add(rText); + this.add(bText); + } protected void okButton_actionPerformed(ActionEvent e) { } -- 1.7.10.2