|
@@ -35,6 +35,7 @@ public class TimePanel extends JPanel implements ActionListener{
|
|
|
final JButton timeBackwardBtn = new JButton();
|
|
|
JTextField iterationsField;
|
|
|
final JLabel iterationsLabel=new JLabel("Iterations:" , SwingConstants.CENTER);
|
|
|
+ JLabel hint = new JLabel("Invalid", SwingConstants.RIGHT);
|
|
|
private final JPanel btnAndSpeedPanel = new JPanel();
|
|
|
private final JPanel speedPanel = new JPanel();
|
|
|
private final JPanel timeBtnPanel = new JPanel();
|
|
@@ -275,12 +276,16 @@ public class TimePanel extends JPanel implements ActionListener{
|
|
|
btnAndSpeedPanel.setBorder(null);
|
|
|
btnAndSpeedPanel.add(timeBtnPanel, BorderLayout.NORTH);
|
|
|
btnAndSpeedPanel.add(speedPanel, BorderLayout.CENTER);
|
|
|
- iterationsPanel.setLayout(new GridLayout(3,1));
|
|
|
- iterationsPanel.add(iterationsLabel, BorderLayout.NORTH);
|
|
|
+ iterationsPanel.setLayout(new GridBagLayout());
|
|
|
+ GridBagConstraints c = new GridBagConstraints();
|
|
|
+ c.anchor = GridBagConstraints.CENTER;
|
|
|
+ c.fill = GridBagConstraints.HORIZONTAL;
|
|
|
+ c.gridx = 0;
|
|
|
+ c.gridy = 0;
|
|
|
+ iterationsPanel.add(iterationsLabel, c);
|
|
|
//iterationsLblHint=new LabelHint(iterationsLabel);
|
|
|
- JLabel hint = new JLabel("Invalid", SwingConstants.RIGHT);
|
|
|
hint.setForeground(Color.red);
|
|
|
- hint.setVisible(false);
|
|
|
+ hint.setText(" ");
|
|
|
iterationsField=new JTextField(6);//Considering hundreds of thousands in an extreme case
|
|
|
iterationsField.setText(""+cont.getModel().getIterations());
|
|
|
iterationsField.setToolTipText("0-" + MAX_ITERATIONS );
|
|
@@ -291,10 +296,10 @@ public class TimePanel extends JPanel implements ActionListener{
|
|
|
int a=Integer.parseInt(iterationsField.getText());
|
|
|
iterationsField.setBackground(Color.WHITE);//red stings
|
|
|
//this.actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "like Enter")); that is lagging
|
|
|
- hint.setVisible(false);
|
|
|
+ hint.setText(" ");
|
|
|
}catch(NumberFormatException n){
|
|
|
iterationsField.setBackground(GUI.PALE_RED);//red stings
|
|
|
- hint.setVisible(true);
|
|
|
+ hint.setText("Invalid");
|
|
|
}
|
|
|
}
|
|
|
);
|
|
@@ -303,10 +308,12 @@ public class TimePanel extends JPanel implements ActionListener{
|
|
|
updateIterationsInput();
|
|
|
}
|
|
|
});
|
|
|
- iterationsPanel.add(iterationsField);
|
|
|
- iterationsPanel.add(hint);
|
|
|
+ c.gridy = 1;
|
|
|
+ iterationsPanel.add(iterationsField, c);
|
|
|
+ c.gridy = 2;
|
|
|
+ iterationsPanel.add(hint, c);
|
|
|
//iterationsPanel.add(new JLabel(), BorderLayout.SOUTH);
|
|
|
- timePanel.setLayout(new BorderLayout());
|
|
|
+ timePanel.setLayout(new BorderLayout());;
|
|
|
timePanel.add(iterationsPanel, BorderLayout.WEST);
|
|
|
timePanel.add(timeSlider, BorderLayout.CENTER);
|
|
|
this.add(btnAndSpeedPanel, BorderLayout.WEST);
|