1 /* 2 * Copyright (c) 2006 Stiftung Deutsches Elektronen-Synchroton, 3 * Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY. 4 * 5 * THIS SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "../AS IS" BASIS. 6 * WITHOUT WARRANTY OF ANY KIND, EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED 7 * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR PARTICULAR PURPOSE AND 8 * NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 9 * FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 10 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR 11 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. SHOULD THE SOFTWARE PROVE DEFECTIVE 12 * IN ANY RESPECT, THE USER ASSUMES THE COST OF ANY NECESSARY SERVICING, REPAIR OR 13 * CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. 14 * NO USE OF ANY SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. 15 * DESY HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, 16 * OR MODIFICATIONS. 17 * THE FULL LICENSE SPECIFYING FOR THE SOFTWARE THE REDISTRIBUTION, MODIFICATION, 18 * USAGE AND OTHER RIGHTS AND OBLIGATIONS IS INCLUDED WITH THE DISTRIBUTION OF THIS 19 * PROJECT IN THE FILE LICENSE.HTML. IF THE LICENSE IS NOT INCLUDED YOU MAY FIND A COPY 20 * AT HTTP://WWW.DESY.DE/LEGAL/LICENSE.HTM 21 */ 22 23 package de.desy.acop.demo.example; 24 25 import javax.swing.JFrame; 26 27 import de.desy.acop.displayers.AcopSpider; 28 29 public class SpiderExample { 30 31 public static void main(String[] args) { 32 33 //How to represent TINE connection errors with the spider? 34 //First we create an instance of the AcopSpider object. 35 AcopSpider spider = new AcopSpider(); 36 //and add it to your application GUI 37 JFrame applicationFrame = new JFrame(); 38 applicationFrame.getContentPane().add(spider); 39 //the spider should immediately start monitoring all TINE connections for any errors. 40 41 //If the displayed spider size does not match the size of the spider icon, 42 //we can rescale the image to fit the size of the spider component 43 spider.rescaleIconToFit(); 44 //or we can enable this t happen automatically whenever the spider component is resized 45 spider.setAutoResize(true); 46 47 //We can paint overlaid error notification signals over display components. 48 //This feature can be enabled globally 49 spider.setPaintOverlayDecorations(true); 50 //or disabled 51 spider.setPaintOverlayDecorations(false); 52 53 //We can add errors, which occur during operations to the spider 54 Exception exception = new RuntimeException(); 55 spider.addError(exception); 56 57 //we can check any time if there are any errors caught by the spider 58 spider.isError(); 59 } 60 }