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;
}
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;
}
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;
}
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();
}
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;
}
Aggregations