Desktop.addInternalFrame(frame,
MessageManager
.getString("label.redundancy_threshold_selection"),
- 400, 100, false);
+ true, FRAME_WIDTH, FRAME_HEIGHT, false, true);
frame.addInternalFrameListener(new InternalFrameAdapter()
{
@Override
@Override
public void applyButton_actionPerformed(ActionEvent e)
{
- Vector del = new Vector();
+ List<SequenceI> del = new ArrayList<>();
undoButton.setEnabled(true);
{
if (value <= redundancy[i])
{
- del.addElement(originalSequences[i]);
+ del.add(originalSequences[i]);
}
}
// This has to be done before the restoreHistoryItem method of alignFrame
- // will
- // actually restore these sequences.
+ // will actually restore these sequences.
if (del.size() > 0)
{
SequenceI[] deleted = new SequenceI[del.size()];
int width = 0;
for (int i = 0; i < del.size(); i++)
{
- deleted[i] = (SequenceI) del.elementAt(i);
+ deleted[i] = del.get(i);
if (deleted[i].getLength() > width)
{
width = deleted[i].getLength();
@Override
public void stateChanged(ChangeEvent evt)
{
- valueField.setText(slider.getValue() + "");
+ valueField.setText(String.valueOf(slider.getValue()));
valueChanged(slider.getValue());
}
});
});
slider.setValue(value);
- valueField.setText(value + "");
+ valueField.setText(String.valueOf(value));
}
/**
if (!conservationSlider.isVisible())
{
Desktop.addInternalFrame(conservationSlider,
- conservationSlider.getTitle(), 420, 90, false);
+ conservationSlider.getTitle(), true, FRAME_WIDTH,
+ FRAME_HEIGHT, false, true);
conservationSlider.addInternalFrameListener(new InternalFrameAdapter()
{
@Override
if (!PIDSlider.isVisible())
{
- Desktop.addInternalFrame(PIDSlider, PIDSlider.getTitle(), 420, 90,
- false);
+ Desktop.addInternalFrame(PIDSlider, PIDSlider.getTitle(), true,
+ FRAME_WIDTH, FRAME_HEIGHT, false, true);
PIDSlider.setLayer(JLayeredPane.PALETTE_LAYER);
PIDSlider.addInternalFrameListener(new InternalFrameAdapter()
{
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
+import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
*/
public class GSliderPanel extends JPanel
{
+ private static final Font VERDANA_11 = new java.awt.Font("Verdana", 0, 11);
+
+ protected static final int FRAME_WIDTH = 420;
+
+ protected static final int FRAME_HEIGHT = 120;
+
// this is used for conservation colours, PID colours and redundancy threshold
protected JSlider slider = new JSlider();
protected JPanel southPanel = new JPanel();
- GridLayout gridLayout1 = new GridLayout();
-
- JPanel jPanel2 = new JPanel();
-
protected JButton applyButton = new JButton();
protected JButton undoButton = new JButton();
- FlowLayout flowLayout1 = new FlowLayout();
-
protected JCheckBox allGroupsCheck = new JCheckBox();
- BorderLayout borderLayout1 = new BorderLayout();
-
- JPanel jPanel1 = new JPanel();
-
- BorderLayout borderLayout2 = new BorderLayout();
-
/**
* Creates a new GSliderPanel object.
*/
}
/**
- * DOCUMENT ME!
- *
- * @throws Exception
- * DOCUMENT ME!
+ * Constructs and lays out the controls
*/
- private void jbInit() throws Exception
+ private void jbInit()
{
- this.setLayout(gridLayout1);
slider.setMajorTickSpacing(10);
slider.setMinorTickSpacing(1);
slider.setPaintTicks(true);
slider.setBackground(Color.white);
- slider.setFont(new java.awt.Font("Verdana", 0, 11));
+ slider.setFont(VERDANA_11);
slider.setDoubleBuffered(true);
slider.addMouseListener(new MouseAdapter()
{
slider_mouseReleased(e);
}
});
- valueField.setFont(new java.awt.Font("Verdana", 0, 11));
+ valueField.setFont(VERDANA_11);
valueField.setMinimumSize(new Dimension(6, 14));
valueField.setPreferredSize(new Dimension(50, 12));
valueField.setText("");
valueField_actionPerformed();
}
});
- label.setFont(new java.awt.Font("Verdana", 0, 11));
+ label.setFont(VERDANA_11);
label.setOpaque(false);
label.setHorizontalAlignment(SwingConstants.CENTER);
label.setText(MessageManager.getString("label.set_this_label_text"));
- southPanel.setLayout(borderLayout1);
- gridLayout1.setRows(2);
- jPanel2.setLayout(flowLayout1);
- applyButton.setFont(new java.awt.Font("Verdana", 0, 11));
+
+ applyButton.setFont(VERDANA_11);
applyButton.setOpaque(false);
applyButton.setText(MessageManager.getString("action.apply"));
- applyButton.addActionListener(new java.awt.event.ActionListener()
+ applyButton.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
}
});
undoButton.setEnabled(false);
- undoButton.setFont(new java.awt.Font("Verdana", 0, 11));
+ undoButton.setFont(VERDANA_11);
undoButton.setOpaque(false);
undoButton.setText(MessageManager.getString("action.undo"));
- undoButton.addActionListener(new java.awt.event.ActionListener()
+ undoButton.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
}
});
allGroupsCheck.setEnabled(false);
- allGroupsCheck.setFont(new java.awt.Font("Verdana", 0, 11));
+ allGroupsCheck.setFont(VERDANA_11);
allGroupsCheck.setOpaque(false);
allGroupsCheck
.setText(MessageManager.getString("action.apply_all_groups"));
- allGroupsCheck.addActionListener(new java.awt.event.ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- allGroupsCheck_actionPerformed(e);
- }
- });
+
+ this.setLayout(new GridLayout(2, 0));
this.setBackground(Color.white);
- this.setPreferredSize(new Dimension(415, 84));
- jPanel2.setOpaque(false);
- southPanel.setOpaque(false);
- jPanel1.setLayout(borderLayout2);
+
+ JPanel firstRow = new JPanel(new FlowLayout());
+ firstRow.setOpaque(false);
+ firstRow.add(label);
+ firstRow.add(applyButton);
+ firstRow.add(undoButton);
+ this.add(firstRow);
+
+ JPanel jPanel1 = new JPanel(new BorderLayout());
jPanel1.setOpaque(false);
- this.add(jPanel2, null);
- jPanel2.add(label, null);
- jPanel2.add(applyButton, null);
- jPanel2.add(undoButton, null);
- this.add(southPanel, null);
- southPanel.add(jPanel1, java.awt.BorderLayout.EAST);
- southPanel.add(slider, java.awt.BorderLayout.CENTER);
- jPanel1.add(valueField, java.awt.BorderLayout.CENTER);
- jPanel1.add(allGroupsCheck, java.awt.BorderLayout.EAST);
+ jPanel1.add(valueField, BorderLayout.CENTER);
+ jPanel1.add(allGroupsCheck, BorderLayout.EAST);
+
+ southPanel.setLayout(new BorderLayout());
+ southPanel.setOpaque(false);
+ southPanel.add(jPanel1, BorderLayout.EAST);
+ southPanel.add(slider, BorderLayout.CENTER);
+ this.add(southPanel);
}
/**
{
}
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
- protected void allGroupsCheck_actionPerformed(ActionEvent e)
- {
- }
-
public void slider_mouseReleased(MouseEvent e)
{