Search in sources :

Example 1 with NavigationButtons

use of com.willwinder.ugs.nbp.setupwizard.NavigationButtons in project Universal-G-Code-Sender by winder.

the class WizardPanelSoftLimits method initComponents.

private void initComponents() {
    labelDescription = new JLabel("<html><body><p>" + Localization.getString("platform.plugin.setupwizard.soft-limits.intro") + "</p></body></html>");
    labelInstructions = new JLabel("<html><body><p>" + Localization.getString("platform.plugin.setupwizard.soft-limits.instructions") + "</p></body></html>");
    navigationButtons = new NavigationButtons(getBackend(), 1.0, (int) getBackend().getSettings().getJogFeedRate());
    checkboxEnableSoftLimits = new JCheckBox("Enable soft limits");
    checkboxEnableSoftLimits.addActionListener(event -> onSoftLimitsClicked());
    labelHomingIsNotEnabled = new JLabel(Localization.getString("platform.plugin.setupwizard.soft-limits.require-homing"), ImageUtilities.loadImageIcon("icons/information24.png", false), JLabel.LEFT);
    labelSoftLimitsNotSupported = new JLabel(Localization.getString("platform.plugin.setupwizard.soft-limits.not-available"), ImageUtilities.loadImageIcon("icons/information24.png", false), JLabel.LEFT);
    homeButton = new JButton("Home");
    homeButton.setMinimumSize(new Dimension(40, 36));
    homeButton.addActionListener(event -> {
        try {
            getBackend().performHomingCycle();
        } catch (Exception ignored) {
        // Never mind
        }
    });
    buttonUpdateSettingsX = new JButton(Localization.getString("platform.plugin.setupwizard.update"));
    buttonUpdateSettingsX.setEnabled(false);
    buttonUpdateSettingsX.addActionListener(event -> onSave(Axis.X));
    labelPositionX = new JLabel("  0.0 mm");
    textFieldSoftLimitX = new JTextField("0.00");
    textFieldSoftLimitX.addKeyListener(createKeyListenerChangeSetting(Axis.X, buttonUpdateSettingsX));
    buttonUpdateSettingsY = new JButton(Localization.getString("platform.plugin.setupwizard.update"));
    buttonUpdateSettingsY.setEnabled(false);
    buttonUpdateSettingsY.addActionListener(event -> onSave(Axis.Y));
    labelPositionY = new JLabel("  0.0 mm");
    textFieldSoftLimitY = new JTextField("0.00");
    textFieldSoftLimitY.addKeyListener(createKeyListenerChangeSetting(Axis.Y, buttonUpdateSettingsY));
    buttonUpdateSettingsZ = new JButton(Localization.getString("platform.plugin.setupwizard.update"));
    buttonUpdateSettingsZ.setEnabled(false);
    buttonUpdateSettingsZ.addActionListener(event -> onSave(Axis.Z));
    labelPositionZ = new JLabel("  0.0 mm");
    textFieldSoftLimitZ = new JTextField("0.00");
    textFieldSoftLimitZ.addKeyListener(createKeyListenerChangeSetting(Axis.Z, buttonUpdateSettingsZ));
    lengthComboBox = new JComboBox<>();
    lengthComboBox.addItem("Step 0.1 mm");
    lengthComboBox.addItem("Step 1.0 mm");
    lengthComboBox.addItem("Step 10.0 mm");
    lengthComboBox.addItem("Step 100.0 mm");
    lengthComboBox.addItemListener(itemEvent -> {
        if (lengthComboBox.getSelectedIndex() == 0) {
            navigationButtons.setStepSize(0.1);
        } else if (lengthComboBox.getSelectedIndex() == 1) {
            navigationButtons.setStepSize(1.0);
        } else if (lengthComboBox.getSelectedIndex() == 2) {
            navigationButtons.setStepSize(10.0);
        } else if (lengthComboBox.getSelectedIndex() == 3) {
            navigationButtons.setStepSize(100.0);
        }
    });
    lengthComboBox.setSelectedIndex(2);
}
Also used : JCheckBox(javax.swing.JCheckBox) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) NavigationButtons(com.willwinder.ugs.nbp.setupwizard.NavigationButtons) JTextField(javax.swing.JTextField) FirmwareSettingsException(com.willwinder.universalgcodesender.firmware.FirmwareSettingsException) ParseException(java.text.ParseException)

Example 2 with NavigationButtons

use of com.willwinder.ugs.nbp.setupwizard.NavigationButtons in project Universal-G-Code-Sender by winder.

the class WizardPanelStepCalibration method initComponents.

private void initComponents() {
    Font labelEstimatedFont = new Font(Font.SANS_SERIF, Font.PLAIN, 12);
    navigationButtons = new NavigationButtons(getBackend(), 1.0, (int) getBackend().getSettings().getJogFeedRate());
    buttonUpdateSettingsX = new JButton(Localization.getString("platform.plugin.setupwizard.update"));
    labelEstimatedStepsX = new JLabel("0 steps/mm");
    labelEstimatedStepsX.setFont(labelEstimatedFont);
    labelPositionX = new JLabel("  0.0 mm", JLabel.RIGHT);
    textFieldMeasuredX = new JTextField("0.0");
    textFieldMeasuredX.addKeyListener(createKeyListener(Axis.X, labelEstimatedStepsX));
    textFieldSettingStepsX = new JTextField("0.0");
    textFieldSettingStepsX.addKeyListener(createKeyListenerChangeSetting());
    buttonUpdateSettingsX.setEnabled(false);
    buttonUpdateSettingsX.addActionListener(createListenerUpdateSetting(Axis.X, textFieldSettingStepsX));
    buttonUpdateSettingsY = new JButton(Localization.getString("platform.plugin.setupwizard.update"));
    labelEstimatedStepsY = new JLabel(Localization.getString("platform.plugin.setupwizard.calibration.setting"));
    labelEstimatedStepsY.setFont(labelEstimatedFont);
    labelPositionY = new JLabel("  0.0 mm", JLabel.RIGHT);
    textFieldMeasuredY = new JTextField("0.0");
    textFieldMeasuredY.addKeyListener(createKeyListener(Axis.Y, labelEstimatedStepsY));
    textFieldSettingStepsY = new JTextField("0.0");
    textFieldSettingStepsY.addKeyListener(createKeyListenerChangeSetting());
    buttonUpdateSettingsY.setEnabled(false);
    buttonUpdateSettingsY.addActionListener(createListenerUpdateSetting(Axis.Y, textFieldSettingStepsY));
    buttonUpdateSettingsZ = new JButton(Localization.getString("platform.plugin.setupwizard.update"));
    labelEstimatedStepsZ = new JLabel("0 steps/mm");
    labelEstimatedStepsZ.setFont(labelEstimatedFont);
    labelPositionZ = new JLabel("  0.0 mm", JLabel.RIGHT);
    textFieldMeasuredZ = new JTextField("0.0");
    textFieldMeasuredZ.addKeyListener(createKeyListener(Axis.Z, labelEstimatedStepsZ));
    textFieldSettingStepsZ = new JTextField("0.0");
    textFieldSettingStepsZ.addKeyListener(createKeyListenerChangeSetting());
    buttonUpdateSettingsZ.setEnabled(false);
    buttonUpdateSettingsZ.addActionListener(createListenerUpdateSetting(Axis.Z, textFieldSettingStepsZ));
}
Also used : NavigationButtons(com.willwinder.ugs.nbp.setupwizard.NavigationButtons)

Example 3 with NavigationButtons

use of com.willwinder.ugs.nbp.setupwizard.NavigationButtons in project Universal-G-Code-Sender by winder.

the class WizardPanelMotorWiring method initComponents.

private void initComponents() {
    labelDescription = new JLabel("<html><body><p>" + Localization.getString("platform.plugin.setupwizard.motor-wiring.intro") + "</p></body></html>");
    softLimitsInfo = new RoundedPanel(8);
    softLimitsInfo.setLayout(new MigLayout("fill, inset 10, gap 0"));
    softLimitsInfo.setBackground(ThemeColors.VERY_LIGHT_BLUE_GREY);
    softLimitsInfo.setForeground(ThemeColors.LIGHT_GREY);
    softLimitsInfo.add(new JLabel(ImageUtilities.loadImageIcon("icons/information24.png", false)), "gapright 10");
    softLimitsInfo.add(new JLabel("<html><body>" + Localization.getString("platform.plugin.setupwizard.motor-wiring.soft-limits-enabled") + "</body></html>"));
    navigationButtons = new NavigationButtons(getBackend(), 0.1, 100);
    checkboxReverseX = new JCheckBox(Localization.getString("platform.plugin.setupwizard.motor-wiring.reverse-direction"));
    checkboxReverseX.addActionListener(event -> {
        if (getBackend().getController() != null) {
            try {
                getBackend().getController().getFirmwareSettings().setInvertDirection(Axis.X, checkboxReverseX.isSelected());
            } catch (FirmwareSettingsException e) {
                e.printStackTrace();
            }
        }
    });
    checkboxReverseY = new JCheckBox(Localization.getString("platform.plugin.setupwizard.motor-wiring.reverse-direction"));
    checkboxReverseY.addActionListener(event -> {
        if (getBackend().getController() != null) {
            try {
                getBackend().getController().getFirmwareSettings().setInvertDirection(Axis.Y, checkboxReverseY.isSelected());
            } catch (FirmwareSettingsException e) {
                e.printStackTrace();
            }
        }
    });
    checkboxReverseZ = new JCheckBox(Localization.getString("platform.plugin.setupwizard.motor-wiring.reverse-direction"));
    checkboxReverseZ.addActionListener(event -> {
        if (getBackend().getController() != null) {
            try {
                getBackend().getController().getFirmwareSettings().setInvertDirection(Axis.Z, checkboxReverseZ.isSelected());
            } catch (FirmwareSettingsException e) {
                e.printStackTrace();
            }
        }
    });
}
Also used : MigLayout(net.miginfocom.swing.MigLayout) RoundedPanel(com.willwinder.universalgcodesender.uielements.components.RoundedPanel) FirmwareSettingsException(com.willwinder.universalgcodesender.firmware.FirmwareSettingsException) NavigationButtons(com.willwinder.ugs.nbp.setupwizard.NavigationButtons)

Aggregations

NavigationButtons (com.willwinder.ugs.nbp.setupwizard.NavigationButtons)3 FirmwareSettingsException (com.willwinder.universalgcodesender.firmware.FirmwareSettingsException)2 RoundedPanel (com.willwinder.universalgcodesender.uielements.components.RoundedPanel)1 Dimension (java.awt.Dimension)1 ParseException (java.text.ParseException)1 JButton (javax.swing.JButton)1 JCheckBox (javax.swing.JCheckBox)1 JLabel (javax.swing.JLabel)1 JTextField (javax.swing.JTextField)1 MigLayout (net.miginfocom.swing.MigLayout)1