List of usage examples for javax.swing JButton setOpaque
@BeanProperty(expert = true, description = "The component's opacity") public void setOpaque(boolean isOpaque)
From source file:ome.formats.importer.gui.GuiCommonElements.java
/** * Add a button//from w w w . j av a 2 s. com * * @param container - parent container * @param label - button label * @param mnemonic - button mnemonic * @param tooltip - button tool tip * @param placement - TableLayout placement in parent container * @param debug - turn on/off red debug borders * @return JButton */ public static JButton addButton(Container container, String label, int mnemonic, String tooltip, String placement, boolean debug) { JButton button = new JButton(label); button.setMnemonic(mnemonic); button.setToolTipText(tooltip); button.setOpaque(!getIsMac()); container.add(button, placement); if (debug == true) button.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.red), button.getBorder())); return button; }
From source file:ome.formats.importer.gui.GuiCommonElements.java
/** * Add a button with an icon in it//from www.j a v a 2s . co m * * @param container - parent container * @param label - button label * @param image - button image * @param width - button width * @param height - button height * @param mnemonic - button mnemonic * @param tooltip - tool tip for button * @param placement - TableLayout placement in parent container * @param debug - turn on/off red debug borders * @return JButton with image */ public static JButton addIconButton(Container container, String label, String image, Integer width, Integer height, Integer mnemonic, String tooltip, String placement, boolean debug) { JButton button = null; if (image == null) { button = new JButton(label); } else { java.net.URL imgURL = GuiImporter.class.getResource(image); if (imgURL != null && label.length() > 0) { button = new JButton(label, new ImageIcon(imgURL)); } else if (imgURL != null) { button = new JButton(null, new ImageIcon(imgURL)); } else { button = new JButton(label); log.error("Couldn't find icon: " + image); } } if (width != null && height != null && width > 0 && height > 0) { button.setMaximumSize(new Dimension(width, height)); button.setPreferredSize(new Dimension(width, height)); button.setMinimumSize(new Dimension(width, height)); button.setSize(new Dimension(width, height)); } if (mnemonic != null) button.setMnemonic(mnemonic); button.setOpaque(!getIsMac()); button.setToolTipText(tooltip); container.add(button, placement); if (isMotif() == true) { Border b = BorderFactory.createLineBorder(Color.gray); button.setMargin(new Insets(0, 0, 0, 0)); button.setBorder(b); } if (debug == true) button.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.red), button.getBorder())); return button; }
From source file:op.care.bhp.PnlBHP.java
private java.util.List<Component> addFilter() { java.util.List<Component> list = new ArrayList<Component>(); jdcDatum = new JDateChooser(new Date()); jdcDatum.setFont(new Font("Arial", Font.PLAIN, 18)); jdcDatum.setMinSelectableDate(BHPTools.getMinDatum(resident)); jdcDatum.setBackground(Color.WHITE); jdcDatum.addPropertyChangeListener(new PropertyChangeListener() { @Override//www .j a va 2 s. c o m public void propertyChange(PropertyChangeEvent evt) { if (initPhase) { return; } if (evt.getPropertyName().equals("date")) { reloadDisplay(); } } }); list.add(jdcDatum); JPanel buttonPanel = new JPanel(); buttonPanel.setBackground(Color.WHITE); buttonPanel.setLayout(new HorizontalLayout(5)); buttonPanel.setBorder(new EmptyBorder(0, 0, 0, 0)); JButton homeButton = new JButton( new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_start.png"))); homeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { jdcDatum.setDate(jdcDatum.getMinSelectableDate()); } }); homeButton.setPressedIcon( new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_start_pressed.png"))); homeButton.setBorder(null); homeButton.setBorderPainted(false); homeButton.setOpaque(false); homeButton.setContentAreaFilled(false); homeButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); JButton backButton = new JButton( new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_back.png"))); backButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { DateMidnight current = new DateMidnight(jdcDatum.getDate()); DateMidnight min = new DateMidnight(jdcDatum.getMinSelectableDate()); if (current.equals(min)) { return; } jdcDatum.setDate(SYSCalendar.addDate(jdcDatum.getDate(), -1)); } }); backButton .setPressedIcon(new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_back_pressed.png"))); backButton.setBorder(null); backButton.setBorderPainted(false); backButton.setOpaque(false); backButton.setContentAreaFilled(false); backButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); JButton fwdButton = new JButton(new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_play.png"))); fwdButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { DateMidnight current = new DateMidnight(jdcDatum.getDate()); if (current.equals(new DateMidnight())) { return; } jdcDatum.setDate(SYSCalendar.addDate(jdcDatum.getDate(), 1)); } }); fwdButton .setPressedIcon(new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_play_pressed.png"))); fwdButton.setBorder(null); fwdButton.setBorderPainted(false); fwdButton.setOpaque(false); fwdButton.setContentAreaFilled(false); fwdButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); JButton endButton = new JButton(new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_end.png"))); endButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { jdcDatum.setDate(new Date()); } }); endButton.setPressedIcon(new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_end_pressed.png"))); endButton.setBorder(null); endButton.setBorderPainted(false); endButton.setOpaque(false); endButton.setContentAreaFilled(false); endButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); buttonPanel.add(homeButton); buttonPanel.add(backButton); buttonPanel.add(fwdButton); buttonPanel.add(endButton); list.add(buttonPanel); // panelFilter.setContentPane(labelPanel); return list; }
From source file:op.care.dfn.PnlDFN.java
private List<Component> addFilters() { List<Component> list = new ArrayList<Component>(); jdcDate = new JDateChooser(new Date()); jdcDate.setFont(new Font("Arial", Font.PLAIN, 14)); jdcDate.setBackground(Color.WHITE); list.add(jdcDate);/*from w w w . j a v a2 s. c om*/ JPanel buttonPanel = new JPanel(); buttonPanel.setBackground(Color.WHITE); buttonPanel.setLayout(new HorizontalLayout(5)); buttonPanel.setBorder(new EmptyBorder(0, 0, 0, 0)); final JButton homeButton = new JButton( new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_start.png"))); homeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { jdcDate.setDate(jdcDate.getMinSelectableDate()); } }); homeButton.setPressedIcon( new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_start_pressed.png"))); homeButton.setBorder(null); homeButton.setBorderPainted(false); homeButton.setOpaque(false); homeButton.setContentAreaFilled(false); homeButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); final JButton backButton = new JButton( new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_back.png"))); backButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { DateMidnight current = new DateMidnight(jdcDate.getDate()); DateMidnight min = new DateMidnight(jdcDate.getMinSelectableDate()); if (current.equals(min)) { return; } jdcDate.setDate(SYSCalendar.addDate(jdcDate.getDate(), -1)); } }); backButton .setPressedIcon(new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_back_pressed.png"))); backButton.setBorder(null); backButton.setBorderPainted(false); backButton.setOpaque(false); backButton.setContentAreaFilled(false); backButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); final JButton fwdButton = new JButton( new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_play.png"))); fwdButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { DateMidnight current = new DateMidnight(jdcDate.getDate()); if (current.equals(new DateMidnight())) { return; } jdcDate.setDate(SYSCalendar.addDate(jdcDate.getDate(), 1)); } }); fwdButton .setPressedIcon(new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_play_pressed.png"))); fwdButton.setBorder(null); fwdButton.setBorderPainted(false); fwdButton.setOpaque(false); fwdButton.setContentAreaFilled(false); fwdButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); final JButton endButton = new JButton( new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_end.png"))); endButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { jdcDate.setDate(new Date()); } }); endButton.setPressedIcon(new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_end_pressed.png"))); endButton.setBorder(null); endButton.setBorderPainted(false); endButton.setOpaque(false); endButton.setContentAreaFilled(false); endButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); buttonPanel.add(homeButton); buttonPanel.add(backButton); buttonPanel.add(fwdButton); buttonPanel.add(endButton); list.add(buttonPanel); jdcDate.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if (initPhase) { return; } if (evt.getPropertyName().equals("date")) { reloadDisplay(); } } }); return list; }
From source file:org.apache.cayenne.modeler.editor.AbstractCallbackMethodsTab.java
private void addButtonAtHeader(JTable table, JButton button, ActionListener buttonListener, ImageIcon buttonIcon) {/*from www . j a v a2 s . c o m*/ PanelBuilder builder = new PanelBuilder(new FormLayout("left:10dlu, 2dlu", "center:10dlu")); CellConstraints cc = new CellConstraints(); button.setIcon(buttonIcon); button.setOpaque(false); button.setBorderPainted(false); button.setContentAreaFilled(false); button.addActionListener(buttonListener); builder.add(button, cc.xy(1, 1)); JPanel buttonPanel = builder.getPanel(); buttonPanel.setOpaque(false); JTableHeader header = table.getTableHeader(); header.setLayout(new BorderLayout()); header.setReorderingAllowed(false); header.setPreferredSize(new Dimension(150, 20)); header.add(buttonPanel, BorderLayout.EAST); }
From source file:org.apache.jmeter.util.JMeterUtils.java
/** * Create a button with the netscape style * * @param name/*from ww w . j av a2 s . c o m*/ * Description of Parameter * @param listener * Description of Parameter * @return Description of the Returned Value * @deprecated (3.0) not used */ @Deprecated public static JButton createButton(String name, ActionListener listener) { JButton button = new JButton(getImage(name + ".on.gif")); // $NON-NLS-1$ button.setDisabledIcon(getImage(name + ".off.gif")); // $NON-NLS-1$ button.setRolloverIcon(getImage(name + ".over.gif")); // $NON-NLS-1$ button.setPressedIcon(getImage(name + ".down.gif")); // $NON-NLS-1$ button.setActionCommand(name); button.addActionListener(listener); button.setRolloverEnabled(true); button.setFocusPainted(false); button.setBorderPainted(false); button.setOpaque(false); button.setPreferredSize(new Dimension(24, 24)); return button; }
From source file:org.apache.jmeter.util.JMeterUtils.java
/** * Create a button with the netscape style * * @param name// www. j a v a2 s. co m * Description of Parameter * @param listener * Description of Parameter * @return Description of the Returned Value * @deprecated (3.0) not used */ @Deprecated public static JButton createSimpleButton(String name, ActionListener listener) { JButton button = new JButton(getImage(name + ".gif")); // $NON-NLS-1$ button.setActionCommand(name); button.addActionListener(listener); button.setFocusPainted(false); button.setBorderPainted(false); button.setOpaque(false); button.setPreferredSize(new Dimension(25, 25)); return button; }
From source file:org.drugis.addis.gui.WelcomeDialog.java
private void removeBackground(JButton button) { button.setOpaque(false); button.setContentAreaFilled(false); button.setBorderPainted(false); }
From source file:org.eclipse.om2m.ipe.sample.gui.GUI.java
/** * Creates the frame./*from w w w . j av a2 s . c o m*/ */ public GUI() { setLocationByPlatform(true); setVisible(false); setResizable(false); setTitle("Sample Simulated IPE"); setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); setBounds((screenSize.width - 500) / 2, (screenSize.height - 570) / 2, 497, 570); contentPanel = new JPanel(); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPanel); contentPanel.setLayout(null); // Lamp0 Switcher0 JPanel panel_Lamp0 = new JPanel(); panel_Lamp0.setBounds(10, 5, 319, 260); contentPanel.add(panel_Lamp0); panel_Lamp0.setBorder(new LineBorder(new Color(0, 0, 0), 1, true)); panel_Lamp0.setLayout(null); LABEL_LAMP_0.setIcon(iconLampOFF); LABEL_LAMP_0.setHorizontalTextPosition(SwingConstants.CENTER); LABEL_LAMP_0.setHorizontalAlignment(SwingConstants.CENTER); LABEL_LAMP_0.setBounds(10, 9, 149, 240); panel_Lamp0.add(LABEL_LAMP_0); // Lamp0 Switch Button JButton button_Lamp0 = new JButton(); button_Lamp0.setOpaque(false); button_Lamp0.setPressedIcon(iconButtonON); button_Lamp0.setIcon(iconButtonOFF); button_Lamp0.setBounds(187, 44, 122, 155); panel_Lamp0.add(button_Lamp0); button_Lamp0.setMinimumSize(new Dimension(30, 23)); button_Lamp0.setMaximumSize(new Dimension(30, 23)); button_Lamp0.setPreferredSize(new Dimension(30, 23)); JLabel labelSwitcher0 = new JLabel("Switch LAMP_0"); labelSwitcher0.setFont(new Font("Vani", Font.BOLD | Font.ITALIC, 14)); labelSwitcher0.setFocusCycleRoot(true); labelSwitcher0.setBorder(null); labelSwitcher0.setAutoscrolls(true); labelSwitcher0.setBounds(187, 199, 118, 29); panel_Lamp0.add(labelSwitcher0); // Listener for Lamp0 Switch Button button_Lamp0.addActionListener(new java.awt.event.ActionListener() { // Button Clicked public void actionPerformed(java.awt.event.ActionEvent evt) { // Change Lamp0 State new Thread() { public void run() { // Send switch request to switch lamp0 state SampleMonitor.switchLamp(LAMP_0); } }.start(); } }); // Lamp1 Switcher 1 JPanel panel_Lamp1 = new JPanel(); panel_Lamp1.setBounds(10, 271, 319, 260); contentPanel.add(panel_Lamp1); panel_Lamp1.setBorder(new LineBorder(new Color(0, 0, 0), 1, true)); panel_Lamp1.setLayout(null); LABEL_LAMP_1.setIcon(iconLampOFF); LABEL_LAMP_1.setHorizontalTextPosition(SwingConstants.CENTER); LABEL_LAMP_1.setHorizontalAlignment(SwingConstants.CENTER); LABEL_LAMP_1.setBounds(10, 9, 154, 240); panel_Lamp1.add(LABEL_LAMP_1); // Lamp1 Switch Button JButton button_Lamp1 = new JButton(); button_Lamp1.setOpaque(false); button_Lamp1.setPressedIcon(iconButtonON); button_Lamp1.setIcon(iconButtonOFF); button_Lamp1.setBounds(187, 44, 122, 156); panel_Lamp1.add(button_Lamp1); button_Lamp1.setMinimumSize(new Dimension(30, 23)); button_Lamp1.setMaximumSize(new Dimension(30, 23)); button_Lamp1.setPreferredSize(new Dimension(30, 23)); JLabel labelSwitcher1 = new JLabel("Switch LAMP_1"); labelSwitcher1.setFont(new Font("Vani", Font.BOLD | Font.ITALIC, 14)); labelSwitcher1.setFocusCycleRoot(true); labelSwitcher1.setBorder(null); labelSwitcher1.setAutoscrolls(true); labelSwitcher1.setBounds(187, 199, 118, 29); panel_Lamp1.add(labelSwitcher1); // Listener for Lamp1 Switch Button button_Lamp1.addActionListener(new java.awt.event.ActionListener() { //Switch Button clicked public void actionPerformed(java.awt.event.ActionEvent evt) { // Change Lamp1 State new Thread() { public void run() { // Send switch request to switch lamp1 state SampleMonitor.switchLamp(LAMP_1); } }.start(); } }); // Switcher All lamps JButton buttonAllLamp = new JButton(); buttonAllLamp.setOpaque(false); buttonAllLamp.setPressedIcon(iconButtonON); buttonAllLamp.setIcon(iconButtonOFF); buttonAllLamp.setBounds(339, 190, 145, 168); contentPanel.add(buttonAllLamp); buttonAllLamp.setMinimumSize(new Dimension(30, 23)); buttonAllLamp.setMaximumSize(new Dimension(30, 23)); buttonAllLamp.setPreferredSize(new Dimension(30, 23)); JLabel labelSwitchAll = new JLabel("Switch All"); labelSwitchAll.setAutoscrolls(true); labelSwitchAll.setFont(new Font("Vani", Font.BOLD | Font.ITALIC, 14)); labelSwitchAll.setFocusCycleRoot(true); labelSwitchAll.setBorder(null); labelSwitchAll.setBounds(371, 369, 85, 29); contentPanel.add(labelSwitchAll); // Listener of Switch all Button buttonAllLamp.addActionListener(new java.awt.event.ActionListener() { // Switch Button Clicked public void actionPerformed(java.awt.event.ActionEvent evt) { // Change all lamps states new Thread() { public void run() { // Send switch all request to create a content with the current State SampleMonitor.switchAll(); } }.start(); } }); lampObserver = new SampleModel.LampObserver() { @Override public void onLampStateChange(String lampId, boolean state) { setLabel(lampId, state); } }; SampleModel.addObserver(lampObserver); }
From source file:org.eclipse.om2m.ipu.sample.GUI.java
/** * Creates the frame.//from w w w . ja v a 2 s. c o m */ public GUI() { setLocationByPlatform(true); setResizable(false); setTitle("Sample Simulated IPU"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); setBounds((screenSize.width - 500) / 2, (screenSize.height - 570) / 2, 497, 570); contentPanel = new JPanel(); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPanel); contentPanel.setLayout(null); // Lamp0 Switcher0 JPanel panel_Lamp0 = new JPanel(); panel_Lamp0.setBounds(10, 5, 319, 260); contentPanel.add(panel_Lamp0); panel_Lamp0.setBorder(new LineBorder(new Color(0, 0, 0), 1, true)); panel_Lamp0.setLayout(null); LABEL_LAMP_0.setIcon(iconLampOFF); LABEL_LAMP_0.setHorizontalTextPosition(SwingConstants.CENTER); LABEL_LAMP_0.setHorizontalAlignment(SwingConstants.CENTER); LABEL_LAMP_0.setBounds(10, 9, 149, 240); panel_Lamp0.add(LABEL_LAMP_0); // Lamp0 Switch Button JButton button_Lamp0 = new JButton(); button_Lamp0.setOpaque(false); button_Lamp0.setPressedIcon(iconButtonON); button_Lamp0.setIcon(iconButtonOFF); button_Lamp0.setBounds(187, 44, 122, 155); panel_Lamp0.add(button_Lamp0); button_Lamp0.setMinimumSize(new Dimension(30, 23)); button_Lamp0.setMaximumSize(new Dimension(30, 23)); button_Lamp0.setPreferredSize(new Dimension(30, 23)); JLabel labelSwitcher0 = new JLabel("Switch LAMP_0"); labelSwitcher0.setFont(new Font("Vani", Font.BOLD | Font.ITALIC, 14)); labelSwitcher0.setFocusCycleRoot(true); labelSwitcher0.setBorder(null); labelSwitcher0.setAutoscrolls(true); labelSwitcher0.setBounds(187, 199, 118, 29); panel_Lamp0.add(labelSwitcher0); // Listener for Lamp0 Switch Button button_Lamp0.addActionListener(new java.awt.event.ActionListener() { // Button Clicked public void actionPerformed(java.awt.event.ActionEvent evt) { // Change Lamp0 State new Thread() { public void run() { // Send switch request to switch lamp0 state Switchs.switchLamp(LAMP_0, !SampleMonitor.LAMPS.get(LAMP_0).getState()); } }.start(); } }); // Lamp1 Switcher 1 JPanel panel_Lamp1 = new JPanel(); panel_Lamp1.setBounds(10, 271, 319, 260); contentPanel.add(panel_Lamp1); panel_Lamp1.setBorder(new LineBorder(new Color(0, 0, 0), 1, true)); panel_Lamp1.setLayout(null); LABEL_LAMP_1.setIcon(iconLampOFF); LABEL_LAMP_1.setHorizontalTextPosition(SwingConstants.CENTER); LABEL_LAMP_1.setHorizontalAlignment(SwingConstants.CENTER); LABEL_LAMP_1.setBounds(10, 9, 154, 240); panel_Lamp1.add(LABEL_LAMP_1); // Lamp1 Switch Button JButton button_Lamp1 = new JButton(); button_Lamp1.setOpaque(false); button_Lamp1.setPressedIcon(iconButtonON); button_Lamp1.setIcon(iconButtonOFF); button_Lamp1.setBounds(187, 44, 122, 156); panel_Lamp1.add(button_Lamp1); button_Lamp1.setMinimumSize(new Dimension(30, 23)); button_Lamp1.setMaximumSize(new Dimension(30, 23)); button_Lamp1.setPreferredSize(new Dimension(30, 23)); JLabel labelSwitcher1 = new JLabel("Switch LAMP_1"); labelSwitcher1.setFont(new Font("Vani", Font.BOLD | Font.ITALIC, 14)); labelSwitcher1.setFocusCycleRoot(true); labelSwitcher1.setBorder(null); labelSwitcher1.setAutoscrolls(true); labelSwitcher1.setBounds(187, 199, 118, 29); panel_Lamp1.add(labelSwitcher1); // Listener for Lamp1 Switch Button button_Lamp1.addActionListener(new java.awt.event.ActionListener() { //Switch Button clicked public void actionPerformed(java.awt.event.ActionEvent evt) { // Change Lamp1 State new Thread() { public void run() { // Send switch request to switch lamp1 state Switchs.switchLamp(LAMP_1, !SampleMonitor.LAMPS.get(LAMP_1).getState()); } }.start(); } }); // Switcher All lamps JButton buttonAllLamp = new JButton(); buttonAllLamp.setOpaque(false); buttonAllLamp.setPressedIcon(iconButtonON); buttonAllLamp.setIcon(iconButtonOFF); buttonAllLamp.setBounds(339, 190, 145, 168); contentPanel.add(buttonAllLamp); buttonAllLamp.setMinimumSize(new Dimension(30, 23)); buttonAllLamp.setMaximumSize(new Dimension(30, 23)); buttonAllLamp.setPreferredSize(new Dimension(30, 23)); JLabel labelSwitchAll = new JLabel("Switch All"); labelSwitchAll.setAutoscrolls(true); labelSwitchAll.setFont(new Font("Vani", Font.BOLD | Font.ITALIC, 14)); labelSwitchAll.setFocusCycleRoot(true); labelSwitchAll.setBorder(null); labelSwitchAll.setBounds(371, 369, 85, 29); contentPanel.add(labelSwitchAll); // Listener of Switch all Button buttonAllLamp.addActionListener(new java.awt.event.ActionListener() { // Switch Button Clicked public void actionPerformed(java.awt.event.ActionEvent evt) { // Change all lamps states new Thread() { public void run() { // Send switch all request to create a content with the current State Switchs.switchAll(!(SampleMonitor.LAMPS.get(LAMP_0).getState() && SampleMonitor.LAMPS.get(LAMP_1).getState())); } }.start(); } }); }