Package java.awt

Examples of java.awt.Toolkit$WindowList$Lock


            pack();
            setVisible(true);

            sp.setScrollPosition(10, 0);

            Toolkit t = Toolkit.getDefaultToolkit();
            t.beep();
        }
View Full Code Here


public class security implements Testlet
{
  public void test(TestHarness harness)
  {
    try {
      Toolkit toolkit = Toolkit.getDefaultToolkit();
      toolkit.getSystemEventQueue();

      AWTEventListener listener = new TestEventListener();

      Frame frame = new Frame();
      Properties props = new Properties();
      JobAttributes jobattrs = new JobAttributes();
      PageAttributes pageattrs = new PageAttributes();

      Permission[] listenToAllAWTEvents = new Permission[] {
  new AWTPermission("listenToAllAWTEvents")};

      Permission[] queuePrintJob = new Permission[] {
  new RuntimePermission("queuePrintJob")};

      Permission[] accessClipboard = new Permission[] {
  new AWTPermission("accessClipboard")};

      Permission[] accessEventQueue = new Permission[] {
  new AWTPermission("accessEventQueue")};

      TestSecurityManager sm = new TestSecurityManager(harness);
      try {
  sm.install();

  // throwpoint: java.awt.Toolkit-addAWTEventListener
  harness.checkPoint("addAWTEventListener");
  try {
    sm.prepareChecks(listenToAllAWTEvents);
    toolkit.addAWTEventListener(listener, AWTEvent.KEY_EVENT_MASK);
    sm.checkAllChecked();
  }
  catch (SecurityException ex) {
    harness.debug(ex);
    harness.check(false, "unexpected check");
  }

  // throwpoint: java.awt.Toolkit-removeAWTEventListener
  harness.checkPoint("removeAWTEventListener");
  try {
    sm.prepareChecks(listenToAllAWTEvents);
    toolkit.removeAWTEventListener(listener);
    sm.checkAllChecked();
  }
  catch (SecurityException ex) {
    harness.debug(ex);
    harness.check(false, "unexpected check");
  }

  // throwpoint: java.awt.Toolkit-getPrintJob(Frame, String, Properties)
  harness.checkPoint("getPrintJob(3-arg)");
  try {
    sm.prepareHaltingChecks(queuePrintJob);
    toolkit.getPrintJob(frame, "Test job", props);
    harness.check(false);   
  }
  catch (TestSecurityManager.SuccessException ex) {
    harness.check(true);
  }
  catch (SecurityException ex) {
    harness.debug(ex);
    harness.check(false, "unexpected check");
  }

  // throwpoint: java.awt.Toolkit-getPrintJob(Frame, String, JobAttributes, PageAttributes)
  harness.checkPoint("getPrintJob(4-arg)");
  try {
    sm.prepareHaltingChecks(queuePrintJob);
    toolkit.getPrintJob(frame, "Test job", jobattrs, pageattrs);
    harness.check(false);   
  }
  catch (TestSecurityManager.SuccessException ex) {
    harness.check(true);
  }
  catch (SecurityException ex) {
    harness.debug(ex);
    harness.check(false, "unexpected check");
  }

  // throwpoint: java.awt.Toolkit-getSystemClipboard
  harness.checkPoint("getSystemClipboard");
  try {
    sm.prepareChecks(accessClipboard);
    toolkit.getSystemClipboard();
    sm.checkAllChecked();
  }
  catch (SecurityException ex) {
    harness.debug(ex);
    harness.check(false, "unexpected check");
  }

  // throwpoint: java.awt.Toolkit-getSystemEventQueue
  harness.checkPoint("getSystemEventQueue");
  try {
    sm.prepareChecks(accessEventQueue);
    toolkit.getSystemEventQueue();
    sm.checkAllChecked();
  }
  catch (SecurityException ex) {
    harness.debug(ex);
    harness.check(false, "unexpected check");
View Full Code Here

    }
    int cnt2 = 0;

    @Override
    public void paint(Graphics g) {
        Toolkit tool = Toolkit.getDefaultToolkit();
        cnt2++;
        cnt2 = cnt2 % 2;
        xSize += cnt2;
        xSize = 123;
        ySize = (17713 - 1) / xSize;
View Full Code Here

                    java.awt.Image img = Utilities.makeGrayTransparent(getData());
                    tmp = Image.getInstance(img, null);
                } else if (overrideTransparency == null || overrideTransparency.isEmpty()) {
                    tmp = Image.getInstance(getData());
                } else {
                    Toolkit toolkit = Toolkit.getDefaultToolkit();
                    java.awt.Image img = toolkit.createImage(getData());
                    tmp = Image.getInstance(img, Color.decode(overrideTransparency));
                }
            }
            if (cacheImage) {
                image = tmp;
View Full Code Here

        }
        image.scaleToFit(scaleWidth, scaleHeight);
    }

    public static java.awt.Image makeGrayTransparent(byte[] imageData) {
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        java.awt.Image img = toolkit.createImage(imageData);
        ImageFilter filter = new RGBImageFilter() {

                public final int filterRGB(int x, int y, int rgb)
                {
                    int r = (rgb & 0xFF0000) >> 16;
                    int g = (rgb & 0xFF00) >> 8;
                    int b = rgb & 0xFF;
                    if (r == g && g == b) {
                        return ((0xFF - r) << 24) & 0xFF000000;
                    }
                    return rgb;
                }       
        };

        ImageProducer ip = new FilteredImageSource(img.getSource(), filter);
        return toolkit.createImage(ip);
    }
View Full Code Here

        defaults.add("TaskPane.specialTitleForeground", new ColorUIResource(Color.BLACK));
        defaults.add("TaskPane.specialTitleOver", new ColorUIResource(126, 124, 124));
        defaults.add("TaskPane.borderColor", new ColorUIResource(Color.WHITE));
      } else if (OS.isWindowsVista()) {
          //do not need to use safe method since the properties can never return null
         final Toolkit toolkit = Toolkit.getDefaultToolkit();
        
         defaults.add("TaskPane.foreground", new ColorUIResource(Color.WHITE));
         defaults.add("TaskPane.background",
                 new ColorUIResource((Color)toolkit.getDesktopProperty("win.3d.backgroundColor")));
         defaults.add("TaskPane.specialTitleBackground", new ColorUIResource(33, 89, 201));
         defaults.add("TaskPane.titleBackgroundGradientStart", new ColorUIResource(Color.WHITE));
         defaults.add("TaskPane.titleBackgroundGradientEnd",
                 new ColorUIResource((Color)toolkit.getDesktopProperty("win.frame.inactiveCaptionColor")));
         defaults.add("TaskPane.titleForeground",
                 new ColorUIResource((Color)toolkit.getDesktopProperty("win.frame.inactiveCaptionTextColor")));
         defaults.add("TaskPane.specialTitleForeground", new ColorUIResource(Color.WHITE));
         defaults.add("TaskPane.borderColor", new ColorUIResource(Color.WHITE));
       } else {
         defaults.add("TaskPane.foreground", new ColorUIResource(Color.WHITE));
         defaults.add("TaskPane.background", new ColorUIResource(214, 223, 247));
View Full Code Here

    /**
     * Returns the system text anti-aliasing hint.
     */
    public static Object getTextAntialiasingHint() {
        if (textAntialiasingHint == null) {
            Toolkit toolkit = Toolkit.getDefaultToolkit();
            java.util.Map<?, ?> fontDesktopHints =
                (java.util.Map<?, ?>)toolkit.getDesktopProperty("awt.font.desktophints");

            if (fontDesktopHints == null) {
                textAntialiasingHint = RenderingHints.VALUE_TEXT_ANTIALIAS_ON;
            } else {
                textAntialiasingHint = fontDesktopHints.get(RenderingHints.KEY_TEXT_ANTIALIASING);
                if (textAntialiasingHint.equals(RenderingHints.VALUE_TEXT_ANTIALIAS_OFF)) {
                    textAntialiasingHint = RenderingHints.VALUE_TEXT_ANTIALIAS_ON;
                }

                // Listen for changes to the property
                toolkit.addPropertyChangeListener("awt.font.desktophints", new PropertyChangeListener() {
                    @Override
                    public void propertyChange(PropertyChangeEvent event) {
                        Platform.textAntialiasingHint = null;
                    }
                });
View Full Code Here

    /**
     * Returns the system multi-click interval.
     */
    public static int getMultiClickInterval() {
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        Integer multiClickInterval = (Integer)toolkit.getDesktopProperty("awt.multiClickInterval");

        if (multiClickInterval == null) {
            multiClickInterval = DEFAULT_MULTI_CLICK_INTERVAL;
        }

View Full Code Here

    /**
     * Returns the system cursor blink rate.
     */
    public static int getCursorBlinkRate() {
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        Integer cursorBlinkRate = (Integer)toolkit.getDesktopProperty("awt.cursorBlinkRate");

        if (cursorBlinkRate == null) {
            cursorBlinkRate = DEFAULT_CURSOR_BLINK_RATE;
        }

View Full Code Here

  protected void calcSizes() {
      GraphicsConfiguration gc = getGraphicsConfiguration();
    Rectangle screenRect = gc.getBounds();
//System.out.println("Screen bounds: "+screenRect);
    // System.out.println("Screen size: " + screenRect);
      Toolkit tk = Toolkit.getDefaultToolkit();
      Insets desktopInsets = tk.getScreenInsets(gc);
//System.out.println("Desktop insets: "+desktopInsets);
     
      Insets frameInsets = getInsets();     // only works after a pack() call
//System.out.println("Frame insets "+frameInsets);
     
View Full Code Here

TOP

Related Classes of java.awt.Toolkit$WindowList$Lock

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.