Search in sources :

Example 76 with ImageIcon

use of javax.swing.ImageIcon in project ACS by ACS-Community.

the class BeanGrouper method getStartButton.

/**
	 * This method initializes startButton<br>
	 * This JButton when click do a lot of effects, among them:<br>
	 * - Enabling and Disabling the corresponding widgets in the GUI.<br>
	 * - Starts the Sample 	
	 * @return javax.swing.JButton Reference to the Start Button.
	 */
private JButton getStartButton() {
    if (startButton == null) {
        startButton = new JButton();
        startButton.setIcon(new ImageIcon(getClass().getClassLoader().getResource("cl/utfsm/samplingSystemUI/img/player_play.png")));
        startButton.setToolTipText("Start the sampling.");
        startButton.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent e) {
                stopButton.setEnabled(true);
                pauseButton.setEnabled(true);
                startButton.setEnabled(false);
                //to change the freq dinamically
                //getFreqTextField().setEnabled(false);
                getTimeSampSpinner().setEnabled(false);
                getTimeWindowSpinner().setEnabled(false);
                getSaveButton().setEnabled(false);
                startSample();
                setTimeWindow();
            }
        });
    }
    return startButton;
}
Also used : ImageIcon(javax.swing.ImageIcon) JButton(javax.swing.JButton) ActionEvent(java.awt.event.ActionEvent)

Example 77 with ImageIcon

use of javax.swing.ImageIcon in project ACS by ACS-Community.

the class BeanGrouper method getStopButton.

/**
	 * Initializes the Stop Button, and also performs on click, the stop of the Sampling.
	 * @return javax.swing.JButton Reference to the Stop Button
	 */
private JButton getStopButton() {
    if (stopButton == null) {
        stopButton = new JButton();
        stopButton.setIcon(new ImageIcon(getClass().getClassLoader().getResource("cl/utfsm/samplingSystemUI/img/player_stop.png")));
        stopButton.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(ActionEvent arg0) {
                // Stop the samples
                pauseButton.setEnabled(false);
                stopSample();
                //UnPause the graph, if is already paused
                if (pausedGraph == true) {
                    for (DataPrinter i : samplers) {
                        i.pauseSampling(false);
                    }
                    pausedGraph = false;
                    pauseButton.setSelected(false);
                }
                // Enable/disable buttons
                timeSampSpinner.setEnabled(true);
                freqSpinner.setEnabled(true);
                timeWindowSpinner.setEnabled(true);
                stopButton.setEnabled(false);
            }
        });
    }
    return stopButton;
}
Also used : ImageIcon(javax.swing.ImageIcon) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton)

Example 78 with ImageIcon

use of javax.swing.ImageIcon in project ACS by ACS-Community.

the class BeanGrouper method getSaveButton.

private JToggleButton getSaveButton() {
    if (saveButton == null) {
        saveButton = new JToggleButton();
        saveButton.setIcon(new ImageIcon(getClass().getClassLoader().getResource("cl/utfsm/samplingSystemUI/img/filesave.png")));
        saveButton.setSelected(false);
        saveButton.setToolTipText("Press to start saving sampled data to file");
        saveButton.addChangeListener(new ChangeListener() {

            @Override
            public void stateChanged(ChangeEvent e) {
                if (saveButton.isSelected() == true) {
                    saveButton.setToolTipText("Press to stop saving sampled data to file");
                    for (DataPrinter dp : samplers) {
                        ((PlotPrinter) dp).setDumpToFile(true);
                    }
                } else {
                    saveButton.setToolTipText("Press to start saving sampled data to file");
                    for (DataPrinter dp : samplers) {
                        ((PlotPrinter) dp).setDumpToFile(false);
                    }
                }
            }
        });
    }
    return saveButton;
}
Also used : ImageIcon(javax.swing.ImageIcon) JToggleButton(javax.swing.JToggleButton) ChangeEvent(javax.swing.event.ChangeEvent) ChangeListener(javax.swing.event.ChangeListener)

Example 79 with ImageIcon

use of javax.swing.ImageIcon in project ACS by ACS-Community.

the class Toolbar method initialize.

/**
	 * Initialize the toolbar
	 * 
	 * @param <code>true</code> if the reduction rules are applied at startup
	 */
private void initialize(boolean reduce) {
    setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));
    setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
    // Add the button to inhibit sounds
    add(soundComponent);
    // Add the label and the combobox for auto ack
    Font fnt = autoAckLbl.getFont();
    Font newFont = fnt.deriveFont(fnt.getSize() * 80 / 100);
    autoAckLbl.setFont(newFont);
    add(Box.createHorizontalStrut(2));
    add(autoAckLbl);
    autoAckLevelCB.setFont(newFont);
    autoAckLevelCB.setEditable(false);
    autoAckLevelCB.setOpaque(true);
    // Set the colors of the renderers
    ComboBoxValues.initSizes();
    autoAckLevelCB.setRenderer(new ComboBoxRenderer());
    autoAckLevelCB.setSelectedIndex(ComboBoxValues.NONE.ordinal());
    autoAckLevelCB.setMaximumRowCount(ComboBoxValues.values().length);
    autoAckLevelCB.setEditable(false);
    autoAckLevelCB.addActionListener(this);
    Dimension d = new Dimension(ComboBoxValues.getWidth(), ComboBoxValues.getHeight());
    autoAckLevelCB.setMinimumSize(d);
    add(Box.createHorizontalStrut(5));
    add(autoAckLevelCB);
    activeReductionIcon = new ImageIcon(this.getClass().getResource("/alma/acsplugins/alarmsystem/gui/resources/arrow_in.png"));
    inactiveReductionIcon = new ImageIcon(this.getClass().getResource("/alma/acsplugins/alarmsystem/gui/resources/arrow_out.png"));
    reductionRulesBtn = new JToggleButton("Reduce", activeReductionIcon, reduce);
    reductionRulesBtn.setFont(newFont);
    add(Box.createHorizontalStrut(5));
    add(reductionRulesBtn);
    reductionRulesBtn.addActionListener(this);
    add(Box.createHorizontalStrut(5));
    add(pauseBtn);
    pauseBtn.addActionListener(this);
    pauseBtn.setFont(newFont);
    add(Box.createHorizontalStrut(5));
    add(new JSeparator(JSeparator.VERTICAL));
    add(Box.createHorizontalStrut(5));
    JLabel searchLbl = new JLabel("Search");
    add(searchLbl);
    searchLbl.setFont(newFont);
    add(Box.createHorizontalStrut(5));
    add(searchTF);
    searchTF.setEditable(true);
    searchTF.getDocument().addDocumentListener(this);
    searchTF.setToolTipText("Search");
    add(Box.createHorizontalStrut(3));
    add(prevSearchBtn);
    prevSearchBtn.setToolTipText("Search prev");
    prevSearchBtn.addActionListener(this);
    add(Box.createHorizontalStrut(3));
    add(nextSearchBtn);
    nextSearchBtn.setToolTipText("Search next");
    nextSearchBtn.addActionListener(this);
    add(Box.createHorizontalStrut(3));
    add(showBtn);
    showBtn.setFont(newFont);
    showBtn.setToolTipText("Filter in");
    showBtn.addActionListener(this);
    add(Box.createHorizontalStrut(3));
    add(hideBtn);
    hideBtn.setFont(newFont);
    hideBtn.setToolTipText("Filter out");
    hideBtn.addActionListener(this);
    add(Box.createHorizontalStrut(2));
    ratioSearchBtns();
}
Also used : ImageIcon(javax.swing.ImageIcon) JToggleButton(javax.swing.JToggleButton) BoxLayout(javax.swing.BoxLayout) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) Font(java.awt.Font) JSeparator(javax.swing.JSeparator)

Example 80 with ImageIcon

use of javax.swing.ImageIcon in project ACS by ACS-Community.

the class LoggingClient method getStatusLinePnl.

/**
	 * Returns the panel for the status line
	 * 
	 * @return the panel for the status line
	 */
private JPanel getStatusLinePnl() {
    if (statusLinePnl == null) {
        try {
            // Load the icons for the status of the connection
            connectionStatusIcons = new ImageIcon[5];
            connectionStatusIcons[CONNECTED_ICON] = new ImageIcon(this.getClass().getResource("/console-connected.png"));
            connectionStatusIcons[CONNECTING_ICON] = new ImageIcon(this.getClass().getResource("/console-connecting.png"));
            connectionStatusIcons[DISCONNECTED_ICON] = new ImageIcon(this.getClass().getResource("/console-disconnected.png"));
            connectionStatusIcons[SUSPENDED_ICON] = new ImageIcon(this.getClass().getResource("/console-suspended.png"));
            connectionStatusIcons[DELAY_ICON] = new ImageIcon(this.getClass().getResource("/console-delay.png"));
            connectionStatusLbl = new JLabel(connectionStatusIcons[CONNECTING_ICON]);
            // Create a label to show the status of the connection with the DB
            connectionDBLbl = new JLabel();
            statusLinePnl = new javax.swing.JPanel();
            statusLinePnl.setName("Status_line");
            statusLinePnl.setLayout(new java.awt.GridBagLayout());
            GridBagConstraints constraintsProgressBar = new GridBagConstraints();
            constraintsProgressBar.gridx = 0;
            constraintsProgressBar.gridy = 0;
            constraintsProgressBar.fill = GridBagConstraints.BOTH;
            constraintsProgressBar.anchor = GridBagConstraints.WEST;
            constraintsProgressBar.weightx = 1.0;
            constraintsProgressBar.insets = new Insets(1, 2, 1, 1);
            statusLinePnl.add(progressBar, constraintsProgressBar);
            GridBagConstraints constraintsNumFlt = new GridBagConstraints();
            constraintsNumFlt.gridx = 1;
            constraintsNumFlt.gridy = 0;
            constraintsNumFlt.insets = new Insets(1, 1, 1, 1);
            maxNumOfLogsLbl.setVisible(true);
            maxNumOfLogsLbl.setBorder(BorderFactory.createLoweredBevelBorder());
            Font fntNumFlt = maxNumOfLogsLbl.getFont();
            Font newFontNumFlt = fntNumFlt.deriveFont(fntNumFlt.getSize() - 2);
            maxNumOfLogsLbl.setFont(newFontNumFlt);
            statusLinePnl.add(maxNumOfLogsLbl, constraintsNumFlt);
            GridBagConstraints constraintsEngineFlt = new GridBagConstraints();
            constraintsEngineFlt.gridx = 2;
            constraintsEngineFlt.gridy = 0;
            constraintsEngineFlt.insets = new Insets(1, 1, 1, 1);
            engineFiltersLbl.setVisible(true);
            engineFiltersLbl.setBorder(BorderFactory.createLoweredBevelBorder());
            Font fntEngineFlt = engineFiltersLbl.getFont();
            Font newFontEngineFlt = fntEngineFlt.deriveFont(fntEngineFlt.getSize() - 2);
            engineFiltersLbl.setFont(newFontEngineFlt);
            statusLinePnl.add(engineFiltersLbl, constraintsEngineFlt);
            GridBagConstraints constraintsTableFlt = new GridBagConstraints();
            constraintsTableFlt.gridx = 3;
            constraintsTableFlt.gridy = 0;
            constraintsTableFlt.insets = new Insets(1, 1, 1, 1);
            tableFiltersLbl.setVisible(true);
            tableFiltersLbl.setBorder(BorderFactory.createLoweredBevelBorder());
            Font fntTableFlt = tableFiltersLbl.getFont();
            Font newFontTableFlt = fntTableFlt.deriveFont(fntTableFlt.getSize() - 2);
            tableFiltersLbl.setFont(newFontTableFlt);
            statusLinePnl.add(tableFiltersLbl, constraintsTableFlt);
            GridBagConstraints constraintsAudience = new GridBagConstraints();
            constraintsAudience.gridx = 4;
            constraintsAudience.gridy = 0;
            constraintsAudience.insets = new Insets(1, 1, 1, 1);
            audienceLbl.setVisible(true);
            audienceLbl.setBorder(BorderFactory.createLoweredBevelBorder());
            Font fnt = audienceLbl.getFont();
            Font newFont = fnt.deriveFont(fnt.getSize() - 2);
            audienceLbl.setFont(newFont);
            statusLinePnl.add(audienceLbl, constraintsAudience);
            GridBagConstraints constraintsConnectionDBStatus = new GridBagConstraints();
            constraintsConnectionDBStatus.gridx = 5;
            constraintsConnectionDBStatus.gridy = 0;
            constraintsConnectionDBStatus.insets = new Insets(1, 2, 1, 2);
            statusLinePnl.add(connectionDBLbl, constraintsConnectionDBStatus);
            GridBagConstraints constraintsJlogErrors = new GridBagConstraints();
            constraintsConnectionDBStatus.gridx = 6;
            constraintsConnectionDBStatus.gridy = 0;
            constraintsConnectionDBStatus.insets = new Insets(1, 2, 1, 2);
            statusLinePnl.add(jlogErrorLbl, constraintsJlogErrors);
            jlogErrorLbl.setVisible(false);
            jlogErrorLbl.setToolTipText("Error reading logs");
            jlogErrorLbl.addMouseListener(new MouseAdapter() {

                @Override
                public void mouseClicked(MouseEvent e) {
                    jlogErrorLbl.setVisible(false);
                    errorDialog.setVisible(true, LoggingClient.this);
                    super.mouseClicked(e);
                }
            });
            GridBagConstraints constraintsConnectionStatus = new GridBagConstraints();
            constraintsConnectionStatus.gridx = 7;
            constraintsConnectionStatus.gridy = 0;
            constraintsConnectionStatus.insets = new Insets(1, 2, 1, 2);
            statusLinePnl.add(connectionStatusLbl, constraintsConnectionStatus);
        } catch (java.lang.Throwable ivjExc) {
            handleException(ivjExc);
        }
    }
    return statusLinePnl;
}
Also used : ImageIcon(javax.swing.ImageIcon) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) MouseEvent(java.awt.event.MouseEvent) MouseAdapter(java.awt.event.MouseAdapter) JLabel(javax.swing.JLabel) Font(java.awt.Font) JPanel(javax.swing.JPanel)

Aggregations

ImageIcon (javax.swing.ImageIcon)427 JButton (javax.swing.JButton)109 ActionEvent (java.awt.event.ActionEvent)83 ActionListener (java.awt.event.ActionListener)70 JLabel (javax.swing.JLabel)67 Dimension (java.awt.Dimension)62 BufferedImage (java.awt.image.BufferedImage)51 JPanel (javax.swing.JPanel)48 Insets (java.awt.Insets)42 Image (java.awt.Image)31 BorderLayout (java.awt.BorderLayout)28 IOException (java.io.IOException)28 URL (java.net.URL)26 GridBagLayout (java.awt.GridBagLayout)23 JMenuItem (javax.swing.JMenuItem)23 Color (java.awt.Color)21 Point (java.awt.Point)21 LogTypeHelper (com.cosylab.logging.engine.log.LogTypeHelper)20 JToggleButton (javax.swing.JToggleButton)20 JScrollPane (javax.swing.JScrollPane)19