Search in sources :

Example 1 with RoundedPanel

use of com.willwinder.universalgcodesender.uielements.components.RoundedPanel in project Universal-G-Code-Sender by winder.

the class WizardPanelImportSettings method initComponents.

private void initComponents() {
    labelDescription = new JLabel("<html><body><p>" + Localization.getString("platform.plugin.setupwizard.import-settings.intro") + "</p></body></html>");
    fileInfoPanel = new RoundedPanel(8);
    fileInfoPanel.setBackground(ThemeColors.VERY_LIGHT_BLUE_GREY);
    fileInfoPanel.setForeground(ThemeColors.LIGHT_GREY);
    labelNameValue = new JLabel("");
    labelNameValue.setFont(labelNameValue.getFont().deriveFont(Font.BOLD, 16));
    labelFirmware = new JLabel(Localization.getString("platform.plugin.setupwizard.import-settings.firmware"), JLabel.RIGHT);
    labelFirmware.setFont(labelFirmware.getFont().deriveFont(Font.BOLD));
    labelFirmwareValue = new JLabel("");
    labelCreatedBy = new JLabel(Localization.getString("platform.plugin.setupwizard.import-settings.created-by"), JLabel.RIGHT);
    labelCreatedBy.setFont(labelCreatedBy.getFont().deriveFont(Font.BOLD));
    labelCreatedByValue = new JLabel("");
    labelDate = new JLabel(Localization.getString("platform.plugin.setupwizard.import-settings.created-date"), JLabel.RIGHT);
    labelDate.setFont(labelDate.getFont().deriveFont(Font.BOLD));
    labelDateValue = new JLabel("");
    labelSettingsImported = new JLabel("<html><body>" + "<h3>" + Localization.getString("platform.plugin.setupwizard.import-settings.finished-title") + "</h3>" + "<p>" + Localization.getString("platform.plugin.setupwizard.import-settings.finished-description") + "</p>" + "</body></html>");
    labelSettingsImported.setVerticalAlignment(SwingConstants.CENTER);
    labelSettingsImported.setIcon(ImageUtilities.loadImageIcon("icons/checked32.png", false));
    buttonOpen = new JButton(Localization.getString("platform.plugin.setupwizard.import-settings.open-settings"));
    buttonOpen.addActionListener(event -> {
        JFileChooser fileChooser = FirmwareSettingsFileTypeFilter.getSettingsFileChooser();
        int returnVal = fileChooser.showOpenDialog(new JFrame());
        if (returnVal == JFileChooser.APPROVE_OPTION) {
            loadSettingsFile(fileChooser.getSelectedFile());
        }
    });
    buttonImport = new JButton(Localization.getString("platform.plugin.setupwizard.import-settings.import"));
    buttonImport.addActionListener(event -> importSettings());
}
Also used : JFileChooser(javax.swing.JFileChooser) JFrame(javax.swing.JFrame) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) RoundedPanel(com.willwinder.universalgcodesender.uielements.components.RoundedPanel)

Example 2 with RoundedPanel

use of com.willwinder.universalgcodesender.uielements.components.RoundedPanel 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)

Example 3 with RoundedPanel

use of com.willwinder.universalgcodesender.uielements.components.RoundedPanel in project Universal-G-Code-Sender by winder.

the class MachineStatusPanel method addAxisPanel.

private void addAxisPanel(char axis, JLabel work, JLabel machine) {
    RoundedPanel axisPanel = new RoundedPanel(COMMON_RADIUS);
    axisPanel.setBackground(ThemeColors.VERY_DARK_GREY);
    axisPanel.setForeground(ThemeColors.LIGHT_BLUE);
    axisPanel.setLayout(new MigLayout("fillx, wrap 2, inset 7, gap 0", "[left][grow, right]"));
    RoundedPanel resetPanel = new RoundedPanel(COMMON_RADIUS);
    resetPanel.setForeground(ThemeColors.LIGHT_BLUE);
    resetPanel.setBackground(ThemeColors.DARK_BLUE_GREY);
    resetPanel.setBackgroundDisabled(ThemeColors.VERY_DARK_GREY);
    resetPanel.setHoverBackground(ThemeColors.MED_BLUE_GREY);
    resetPanel.setLayout(new MigLayout("inset 5 15 5 15"));
    JLabel axisLabel = new JLabel(String.valueOf(axis));
    axisLabel.setForeground(ThemeColors.LIGHT_BLUE);
    resetPanel.add(axisLabel, "al center, dock center, id axis");
    JLabel zeroLabel = new JLabel("0");
    zeroLabel.setForeground(ThemeColors.LIGHT_BLUE);
    resetPanel.add(zeroLabel, "pos (axis.x + axis.w - 4) (axis.y + axis.h - 25)");
    work.setForeground(ThemeColors.LIGHT_BLUE);
    machine.setForeground(ThemeColors.LIGHT_BLUE);
    axisPanel.add(resetPanel, "sy 2");
    axisPanel.add(work);
    axisPanel.add(machine, "span 2");
    machineStatusFontManager.addAxisResetLabel(axisLabel);
    machineStatusFontManager.addAxisResetZeroLabel(zeroLabel);
    machineStatusFontManager.addWorkCoordinateLabel(work);
    machineStatusFontManager.addMachineCoordinateLabel(machine);
    add(axisPanel, "growx, span 2");
    resetPanel.addClickListener(() -> resetCoordinateButton(axis));
    axisResetControls.add(axisPanel);
}
Also used : MigLayout(net.miginfocom.swing.MigLayout) JLabel(javax.swing.JLabel) RoundedPanel(com.willwinder.universalgcodesender.uielements.components.RoundedPanel)

Example 4 with RoundedPanel

use of com.willwinder.universalgcodesender.uielements.components.RoundedPanel in project Universal-G-Code-Sender by winder.

the class PreviewListPanel method setCategory.

public void setCategory(Category category) {
    buttonsPanel.removeAll();
    sources.stream().flatMap(source -> source.getCliparts(category).stream()).sorted((clipart1, clipart2) -> clipart1.getName().compareTo(clipart2.getName())).forEach(clipart -> {
        Component preview = clipart.getPreview();
        RoundedPanel roundedPanel = new RoundedPanel(12);
        roundedPanel.setLayout(new MigLayout("fill, inset 0"));
        roundedPanel.setMinimumSize(new Dimension(128, 128));
        roundedPanel.setForeground(ThemeColors.LIGHT_GREY);
        roundedPanel.setBackground(Color.WHITE);
        roundedPanel.setHoverBackground(ThemeColors.LIGHT_GREY);
        roundedPanel.setPressedBackground(ThemeColors.VERY_LIGHT_BLUE_GREY);
        roundedPanel.add(preview, "grow");
        roundedPanel.addClickListener(() -> {
            selectedClipart = clipart;
            selectAction.actionPerformed(new ActionEvent(roundedPanel, 0, "selected_clipart"));
        });
        buttonsPanel.add(roundedPanel);
    });
    buttonsPanel.revalidate();
    buttonsPanel.repaint();
}
Also used : java.awt(java.awt) List(java.util.List) ActionListener(java.awt.event.ActionListener) RoundedPanel(com.willwinder.universalgcodesender.uielements.components.RoundedPanel) com.willwinder.ugs.nbp.designer.gui.clipart.sources(com.willwinder.ugs.nbp.designer.gui.clipart.sources) MigLayout(net.miginfocom.swing.MigLayout) Optional(java.util.Optional) ActionEvent(java.awt.event.ActionEvent) ThemeColors(com.willwinder.universalgcodesender.uielements.helpers.ThemeColors) javax.swing(javax.swing) ArrayList(java.util.ArrayList) ActionEvent(java.awt.event.ActionEvent) MigLayout(net.miginfocom.swing.MigLayout) RoundedPanel(com.willwinder.universalgcodesender.uielements.components.RoundedPanel)

Aggregations

RoundedPanel (com.willwinder.universalgcodesender.uielements.components.RoundedPanel)4 MigLayout (net.miginfocom.swing.MigLayout)3 JLabel (javax.swing.JLabel)2 com.willwinder.ugs.nbp.designer.gui.clipart.sources (com.willwinder.ugs.nbp.designer.gui.clipart.sources)1 NavigationButtons (com.willwinder.ugs.nbp.setupwizard.NavigationButtons)1 FirmwareSettingsException (com.willwinder.universalgcodesender.firmware.FirmwareSettingsException)1 ThemeColors (com.willwinder.universalgcodesender.uielements.helpers.ThemeColors)1 java.awt (java.awt)1 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Optional (java.util.Optional)1 javax.swing (javax.swing)1 JButton (javax.swing.JButton)1 JFileChooser (javax.swing.JFileChooser)1 JFrame (javax.swing.JFrame)1