1 /*
2 * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
485 });
486 }
487
488 @Override
489 public boolean isWindowOpacitySupported() {
490 return true;
491 }
492
493 @Override
494 public boolean isFrameStateSupported(int state) throws HeadlessException {
495 switch (state) {
496 case Frame.NORMAL:
497 case Frame.ICONIFIED:
498 case Frame.MAXIMIZED_BOTH:
499 return true;
500 default:
501 return false;
502 }
503 }
504
505 /**
506 * Determines which modifier key is the appropriate accelerator
507 * key for menu shortcuts.
508 * <p>
509 * Menu shortcuts, which are embodied in the
510 * {@code MenuShortcut} class, are handled by the
511 * {@code MenuBar} class.
512 * <p>
513 * By default, this method returns {@code Event.CTRL_MASK}.
514 * Toolkit implementations should override this method if the
515 * <b>Control</b> key isn't the correct key for accelerators.
516 * @return the modifier mask on the {@code Event} class
517 * that is used for menu shortcuts on this toolkit.
518 * @see java.awt.MenuBar
519 * @see java.awt.MenuShortcut
520 * @since 1.1
521 */
522 @Override
523 @SuppressWarnings("deprecation")
524 public int getMenuShortcutKeyMask() {
525 return Event.META_MASK;
526 }
527
528 @Override
529 public Image getImage(final String filename) {
530 final Image nsImage = checkForNSImage(filename);
531 if (nsImage != null) {
532 return nsImage;
533 }
534
535 if (imageCached(filename)) {
536 return super.getImage(filename);
537 }
538
539 String filename2x = getScaledImageName(filename);
540 return (imageExists(filename2x))
541 ? getImageWithResolutionVariant(filename, filename2x)
542 : super.getImage(filename);
543 }
544
545 @Override
546 public Image getImage(URL url) {
547
548 if (imageCached(url)) {
|
1 /*
2 * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
485 });
486 }
487
488 @Override
489 public boolean isWindowOpacitySupported() {
490 return true;
491 }
492
493 @Override
494 public boolean isFrameStateSupported(int state) throws HeadlessException {
495 switch (state) {
496 case Frame.NORMAL:
497 case Frame.ICONIFIED:
498 case Frame.MAXIMIZED_BOTH:
499 return true;
500 default:
501 return false;
502 }
503 }
504
505 @Override
506 @Deprecated(since = "10")
507 public int getMenuShortcutKeyMask() {
508 return Event.META_MASK;
509 }
510
511 @Override
512 public int getMenuShortcutKeyMaskEx() {
513 return InputEvent.META_DOWN_MASK;
514 }
515
516 @Override
517 public Image getImage(final String filename) {
518 final Image nsImage = checkForNSImage(filename);
519 if (nsImage != null) {
520 return nsImage;
521 }
522
523 if (imageCached(filename)) {
524 return super.getImage(filename);
525 }
526
527 String filename2x = getScaledImageName(filename);
528 return (imageExists(filename2x))
529 ? getImageWithResolutionVariant(filename, filename2x)
530 : super.getImage(filename);
531 }
532
533 @Override
534 public Image getImage(URL url) {
535
536 if (imageCached(url)) {
|