List of usage examples for javax.swing JFrame setEnabled
public void setEnabled(boolean b)
From source file:org.obiba.onyx.jade.instrument.gehealthcare.CardiosoftInstrumentRunner.java
/** * Create an information dialog that tells the user to wait while the data is being processed. *//* w ww . jav a2s .c o m*/ private void showProcessingDialog() { JPanel messagePanel = new JPanel(); messagePanel.setAlignmentX(Component.CENTER_ALIGNMENT); messagePanel.setLayout(new BoxLayout(messagePanel, BoxLayout.Y_AXIS)); JLabel message = new JLabel(ecgResourceBundle.getString("Message.ProcessingEcgMeasurement")); message.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); messagePanel.add(message); JLabel subMessage = new JLabel(ecgResourceBundle.getString("Message.ProcessingEcgMeasurementInstructions")); subMessage.setFont(new Font(Font.DIALOG, Font.PLAIN, 14)); subMessage.setForeground(Color.RED); messagePanel.add(subMessage); JFrame window = new JFrame(); window.add(messagePanel); window.pack(); // Make sure dialog stays on top of all other application windows. window.setAlwaysOnTop(true); window.setLocationByPlatform(true); // Center dialog horizontally at the bottom of the screen. Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); window.setLocation((screenSize.width - window.getWidth()) / 2, screenSize.height - window.getHeight() - 70); window.setEnabled(false); window.setVisible(true); }
From source file:Gui.loading_frames.LoadExcelDataGui.java
private void add_new_electrical_itemsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_add_new_electrical_itemsActionPerformed JFrame parent = this; Thread addingwindow = new Thread() { @Override//from w w w . j ava 2 s . com public void run() { AddNewElectricalItems a = new AddNewElectricalItems(); a.setDefaultCloseOperation(DISPOSE_ON_CLOSE); a.setVisible(true); a.addWindowListener(new java.awt.event.WindowAdapter() { @Override public void windowClosing(java.awt.event.WindowEvent windowEvent) { parent.setEnabled(true); parent.toFront(); parent.repaint(); } }); } }; setEnabled(false); addingwindow.start(); try { LoadDataFromDB.loadall(); } catch (InterruptedException ex) { Logger.getLogger(LoadExcelDataGui.class.getName()).log(Level.SEVERE, null, ex); } cp.refresh(); }