List of usage examples for java.awt Cursor WAIT_CURSOR
int WAIT_CURSOR
To view the source code for java.awt Cursor WAIT_CURSOR.
Click Source Link
From source file:Main.java
public static void main(String[] args) { JFrame aWindow = new JFrame(); aWindow.setBounds(200, 200, 200, 200); aWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); aWindow.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); aWindow.setVisible(true);//from ww w . j a va2 s. c om }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setSize(new Dimension(500, 500)); JDialog dialog = new JDialog(frame, "Export", ModalityType.MODELESS); dialog.setSize(300, 300);//from ww w. j a v a 2s .c om JDialog dialog1 = new JDialog(dialog, "Export", ModalityType.APPLICATION_MODAL); dialog1.setSize(200, 200); frame.add(new JButton(new AbstractAction("Dialog") { @Override public void actionPerformed(ActionEvent e) { frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); dialog.setVisible(true); dialog1.setVisible(true); } })); frame.setVisible(true); }
From source file:edu.harvard.mcz.imagecapture.ImageCaptureApp.java
/**Main method for starting the application. * /*ww w. j a v a 2 s. c om*/ * @param args are not used. */ public static void main(String[] args) { log.debug(UIManager.getLookAndFeel()); log.debug(UIManager.getLookAndFeel().getID()); if (UIManager.getLookAndFeel().getID().equals("Aqua")) { // check for "Aqua" try { UIManager.setLookAndFeel( // OSX Aqua look and feel uses space on forms much too inefficiently // switch to the normal Java look and feel instead. UIManager.getCrossPlatformLookAndFeelClassName()); } catch (UnsupportedLookAndFeelException e) { log.error(e); } catch (ClassNotFoundException e) { log.error(e); } catch (InstantiationException e) { log.error(e); } catch (IllegalAccessException e) { log.error(e); } } System.out.println("Starting " + APP_NAME + " " + APP_VERSION); System.out.println(APP_COPYRIGHT); System.out.println(APP_LICENSE); log.debug("Starting " + APP_NAME + " " + APP_VERSION); // open UI and start MainFrame mainFrame = new MainFrame(); Singleton.getSingletonInstance().setMainFrame(mainFrame); Singleton.getSingletonInstance().getMainFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); Singleton.getSingletonInstance().unsetCurrentUser(); Singleton.getSingletonInstance().getMainFrame().setStatusMessage("Starting...."); log.debug("User interface started"); // Load properties ImageCaptureProperties properties = new ImageCaptureProperties(); Singleton.getSingletonInstance().setProperties(properties); log.debug("Properties loaded"); // Set up a barcode (text read from barcode label for pin) matcher/builder if (Singleton.getSingletonInstance().getProperties().getProperties() .getProperty(ImageCaptureProperties.KEY_COLLECTION) .equals(ImageCaptureProperties.COLLECTION_MCZENT)) { // ** Configured for the MCZ Entomology Collection, use MCZ assumptions. MCZENTBarcode barcodeTextBuilderMatcher = new MCZENTBarcode(); Singleton.getSingletonInstance().setBarcodeBuilder((BarcodeBuilder) barcodeTextBuilderMatcher); Singleton.getSingletonInstance().setBarcodeMatcher((BarcodeMatcher) barcodeTextBuilderMatcher); } else if (Singleton.getSingletonInstance().getProperties().getProperties() .getProperty(ImageCaptureProperties.KEY_COLLECTION) .equals(ImageCaptureProperties.COLLECTION_ETHZENT)) { // ** Configured for the ETHZ Entomology Collection, use MCZ assumptions. ETHZBarcode barcodeTextBuilderMatcher = new ETHZBarcode(); Singleton.getSingletonInstance().setBarcodeBuilder((BarcodeBuilder) barcodeTextBuilderMatcher); Singleton.getSingletonInstance().setBarcodeMatcher((BarcodeMatcher) barcodeTextBuilderMatcher); } else { log.error("Configured collection not recognized. Unable to Start"); ImageCaptureApp.exit(EXIT_ERROR); } // Force a login dialog by connecting to obtain record count; SpecimenLifeCycle sls = new SpecimenLifeCycle(); try { Singleton.getSingletonInstance().getMainFrame().setCount(sls.findSpecimenCountThrows()); ImageCaptureApp.doStartUp(); } catch (ConnectionException e) { log.error(e.getMessage()); ImageCaptureApp.doStartUpNot(); } // Experimental chat support, working on localhost. /** Context context = null; Hashtable contextProperties = new Hashtable(2); contextProperties.put(Context.PROVIDER_URL,"iiop://127.0.0.1:3700"); contextProperties.put("java.naming.factory.initial", "com.sun.enterprise.naming.SerialInitContextFactory"); contextProperties.put("java.naming.factory.url.pkgs", "com.sun.enterprise.naming"); contextProperties.put("java.naming.factory.state", "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl"); try { context = new InitialContext(contextProperties); } catch (NamingException ex) { ex.printStackTrace(); } if (context!=null) { ConnectionFactory connectionFactory; try { connectionFactory = (ConnectionFactory)context.lookup("jms/InsectChatTopicFactory"); Topic chatTopic = (Topic)context.lookup("jms/InsectChatTopic"); TopicConnection connection = (TopicConnection) connectionFactory.createConnection(); TopicSession session = connection.createTopicSession(false,Session.AUTO_ACKNOWLEDGE); TopicSubscriber subscriber = session.createSubscriber(chatTopic); connection.start(); while (true) { Message m = subscriber.receive(1); if (m != null) { if (m instanceof TextMessage) { TextMessage message = (TextMessage) m; String originator = message.getStringProperty("Originator"); String text = message.getText(); System.out.println("Message: " + originator + ": " + text); } else { break; } } } } catch (NamingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (JMSException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } */ }
From source file:org.pegadi.client.ApplicationLauncher.java
public static void main(String[] args) { com.sun.net.ssl.internal.ssl.Provider provider = new com.sun.net.ssl.internal.ssl.Provider(); java.security.Security.addProvider(provider); setAllPermissions();//from w ww .jav a 2 s . co m /** * If we are on Apples operating system, we would like to use the screen * menu bar It is the first property we set in our main method. This is * to make sure that the property is set before awt is loaded. */ if (System.getProperty("os.name").toLowerCase().startsWith("mac os x")) { System.setProperty("apple.laf.useScreenMenuBar", "true"); } Logger log = LoggerFactory.getLogger(ApplicationLauncher.class); /** * Making sure default L&F is System */ if (!UIManager.getLookAndFeel().getName().equals(UIManager.getSystemLookAndFeelClassName())) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { log.warn("Unable to change L&F to System", e); } } long start = System.currentTimeMillis(); // Splash Splash splash = new Splash("/images/splash.png"); splash.setVisible(true); splash.setCursor(new Cursor(Cursor.WAIT_CURSOR)); if (System.getSecurityManager() == null) { System.setSecurityManager(new RMISecurityManager()); } ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( "org/pegadi/client/client-context.xml"); closeContextOnShutdown(context); long timeToLogin = System.currentTimeMillis() - start; log.info("Connected OK after {} ms", timeToLogin); log.info("Java Version {}", System.getProperty("java.version")); splash.dispose(); }
From source file:Main.java
public static void setWaitCursorFor(Component frame) { frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); }
From source file:Main.java
public static void setBusyCursor(Component comp, boolean busy) { if (busy) {//from ww w. j av a 2 s.com comp.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); } else { comp.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }
From source file:Main.java
/** * Toggles the cursor for the given component and all child components between * the wait cursor and the normal one./* w w w .j a va 2s . c o m*/ */ public static void setWaitCursor(final Component c, final boolean wait) { setCursor(c, wait ? Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR) : null); }
From source file:Main.java
public static WindowAdapter createConfirmOnExitAdapter(final JFrame frame, final String title, final String message) { frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); return new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent ev) { int result = JOptionPane.showConfirmDialog(frame, message, title, JOptionPane.YES_OPTION); if (result == JOptionPane.OK_OPTION) { frame.getContentPane().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); System.exit(0);/*from w ww. ja v a 2 s. co m*/ } } }; }
From source file:MainClass.java
void dumpComponentInfo(AccessibleContext ac) { AccessibleComponent ax = ac.getAccessibleComponent(); if (ax != null) { String s = ac.getAccessibleName(); if (s != null && s.equals("OK")) { System.out.println("Background color: " + ax.getBackground()); System.out.println("Cursor: " + ax.getCursor()); Cursor c = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR); ax.setCursor(c);//from w ww . ja va 2 s . c o m System.out.println("Foreground color: " + ax.getForeground()); System.out.println("Location: " + ax.getLocationOnScreen()); } } int nChildren = ac.getAccessibleChildrenCount(); for (int i = 0; i < nChildren; i++) dumpComponentInfo(ac.getAccessibleChild(i).getAccessibleContext()); }
From source file:Main.java
public Main() { super(new BorderLayout()); JProgressBar progressBar = new JProgressBar(0, 100); progressBar.setValue(0);/*from w w w .j a v a2s . c om*/ progressBar.setStringPainted(true); taskOutput = new JTextArea(5, 20); taskOutput.setEditable(false); startButton = new JButton("Start"); startButton.setActionCommand("start"); startButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { startButton.setEnabled(false); setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); final Task task = new Task(); task.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent pce) { if ("progress".equals(pce.getPropertyName())) { int progress = (Integer) pce.getNewValue(); progressBar.setValue(progress); taskOutput.append(String.format("Completed %d%% of task.\n", task.getProgress())); } } }); task.execute(); } }); JPanel panel = new JPanel(); panel.add(startButton); panel.add(progressBar); add(panel, BorderLayout.PAGE_START); add(new JScrollPane(taskOutput), BorderLayout.CENTER); }