private JPanel createStepPanel() { firstStepButton = new JButton("<<"); firstStepButton.addActionListener( new ActionListener() { public void actionPerformed(final ActionEvent e) { gotoFirstStep(); } }); previousStepButton = new JButton("<"); previousStepButton.addActionListener( new ActionListener() { public void actionPerformed(final ActionEvent e) { gotoPreviousStep(); } }); nextStepButton = new JButton(">"); nextStepButton.addActionListener( new ActionListener() { public void actionPerformed(final ActionEvent e) { gotoNextStep(); } }); lastStepButton = new JButton(">>"); lastStepButton.addActionListener( new ActionListener() { public void actionPerformed(final ActionEvent e) { gotoLastStep(); } }); stepPositionLabel = new JLabel("0/0"); final JPanel stepPanel = new JPanel(new GridBagLayout()); stepPanel.add( firstStepButton, new GridBagConstraints( 0, 0, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 5, 0)); stepPanel.add( previousStepButton, new GridBagConstraints( 1, 0, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 5, 0)); stepPanel.add( nextStepButton, new GridBagConstraints( 2, 0, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 5, 0)); stepPanel.add( lastStepButton, new GridBagConstraints( 3, 0, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 5, 0)); stepPanel.add( stepPositionLabel, new GridBagConstraints( 4, 0, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 5, 0)); stepPanel.setBorder(createTitledBorder("Step controls")); return stepPanel; }
private JPanel createBasicSettingsPanel() { final JLabel sequenceColumnLabel = new JLabel("Sequence Column:"); sequenceColumnChooser = new JComboBox(); sequenceColumnChooser.addActionListener( new ActionListener() { public void actionPerformed(final ActionEvent e) { calculateValueLists(); fillSequenceChooser(); } }); final JLabel timelineLabel = new JLabel("Timeline Column:"); timelineColumnChooser = new JComboBox(); timelineColumnChooser.addActionListener( new ActionListener() { public void actionPerformed(final ActionEvent e) { calculateValueLists(); fillSequenceChooser(); } }); final JLabel sequenceLabel = new JLabel("Sequence:"); sequenceToShowChooser = new JList<>(); serializeSequencesBox = new JCheckBox("Serialize when stepping/animating"); final JPanel basicSettingsPanel = new JPanel(new GridBagLayout()); int r = 0; basicSettingsPanel.add( sequenceColumnLabel, new GridBagConstraints( 0, r, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, DEFAULT_LABEL_INSETS, 0, 0)); r++; basicSettingsPanel.add( sequenceColumnChooser, new GridBagConstraints( 0, r, 1, 1, 1, 0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, DEFAULT_FIELD_INSETS, 0, 0)); r++; basicSettingsPanel.add( timelineLabel, new GridBagConstraints( 0, r, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, DEFAULT_LABEL_INSETS, 0, 0)); r++; basicSettingsPanel.add( timelineColumnChooser, new GridBagConstraints( 0, r, 1, 1, 1, 0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, DEFAULT_FIELD_INSETS, 0, 0)); r++; basicSettingsPanel.add( sequenceLabel, new GridBagConstraints( 0, r, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, DEFAULT_LABEL_INSETS, 0, 0)); r++; basicSettingsPanel.add( sequenceToShowChooser, new GridBagConstraints( 0, r, 1, 1, 1, 0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, DEFAULT_FIELD_INSETS, 0, 0)); r++; basicSettingsPanel.add( serializeSequencesBox, new GridBagConstraints( 0, r, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0)); r++; basicSettingsPanel.add( new JPanel(), new GridBagConstraints( 0, r, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.NONE, DEFAULT_SPACER_INSETS, 0, 0)); return basicSettingsPanel; }
private JPanel createAnimationsSettingsPanel() { final JLabel speedLabel = new JLabel("Speed (ms/step):"); speedField = new NumberField(10, NumberField.INTEGER); speedField.setText("200"); final JLabel fadeInLabel = new JLabel("Fade-in steps:"); fadeInField = new NumberField(10, NumberField.FLOAT); fadeInField.setText("1"); final JLabel holdLabel = new JLabel("Hold steps:"); holdField = new NumberField(10, NumberField.FLOAT); holdField.setText("1"); final JLabel fadeOutLabel = new JLabel("Fade-out steps:"); fadeOutField = new NumberField(10, NumberField.FLOAT); fadeOutField.setText("5"); final JPanel animationSettingsPanel = new JPanel(new GridBagLayout()); int r = 0; animationSettingsPanel.add( speedLabel, new GridBagConstraints( 0, r, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, DEFAULT_LABEL_INSETS, 0, 0)); r++; animationSettingsPanel.add( speedField, new GridBagConstraints( 0, r, 1, 1, 1, 0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, DEFAULT_FIELD_INSETS, 0, 0)); r++; animationSettingsPanel.add( fadeInLabel, new GridBagConstraints( 0, r, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, DEFAULT_LABEL_INSETS, 0, 0)); r++; animationSettingsPanel.add( fadeInField, new GridBagConstraints( 0, r, 1, 1, 1, 0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, DEFAULT_FIELD_INSETS, 0, 0)); r++; animationSettingsPanel.add( holdLabel, new GridBagConstraints( 0, r, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, DEFAULT_LABEL_INSETS, 0, 0)); r++; animationSettingsPanel.add( holdField, new GridBagConstraints( 0, r, 1, 1, 1, 0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, DEFAULT_FIELD_INSETS, 0, 0)); r++; animationSettingsPanel.add( fadeOutLabel, new GridBagConstraints( 0, r, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, DEFAULT_LABEL_INSETS, 0, 0)); r++; animationSettingsPanel.add( fadeOutField, new GridBagConstraints( 0, r, 1, 1, 1, 0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, DEFAULT_FIELD_INSETS, 0, 0)); r++; animationSettingsPanel.add( new JPanel(), new GridBagConstraints( 0, r, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.NONE, DEFAULT_SPACER_INSETS, 0, 0)); return animationSettingsPanel; }
private JPanel createControlsPanel() { addStaticTransitionsButton = new JButton("Show all transitions"); addStaticTransitionsButton.addActionListener( new ActionListener() { public void actionPerformed(final ActionEvent e) { addFixedTransitions(); } }); startSteppingButton = new JButton("Start stepping"); startSteppingButton.addActionListener( new ActionListener() { public void actionPerformed(final ActionEvent e) { startStepping(); } }); animateTransitionsButton = new JButton("Animate transitions"); animateTransitionsButton.addActionListener( new ActionListener() { public void actionPerformed(final ActionEvent e) { addAnimatedTransitions(); } }); removeTransitionsButton = new JButton("Remove transitions"); removeTransitionsButton.addActionListener( new ActionListener() { public void actionPerformed(final ActionEvent e) { removeTransitions(); } }); exportImagesButton = new JButton("Export all steps as images"); exportImagesButton.addActionListener( new ActionListener() { public void actionPerformed(final ActionEvent e) { exportImages(); } }); repeatAnimationCheckbox = new JCheckBox("Repeat Animations"); repeatAnimationCheckbox.setSelected(false); final GridBagConstraints buttonConstraints = new GridBagConstraints( 0, GridBagConstraints.RELATIVE, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, DEFAULT_BUTTON_INSETS, 0, 0); final JPanel panel = new JPanel(new GridBagLayout()); panel.add(addStaticTransitionsButton, buttonConstraints); panel.add(removeTransitionsButton, buttonConstraints); panel.add(exportImagesButton, buttonConstraints); panel.add(animateTransitionsButton, buttonConstraints); panel.add(startSteppingButton, buttonConstraints); panel.add(repeatAnimationCheckbox, buttonConstraints); panel.add( createStepPanel(), new GridBagConstraints( 0, GridBagConstraints.RELATIVE, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE, DEFAULT_SPACER_INSETS, 0, 0)); panel.add( new JPanel(), new GridBagConstraints( 0, GridBagConstraints.RELATIVE, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.NONE, DEFAULT_SPACER_INSETS, 0, 0)); return panel; }