当前位置: 首页>>代码示例>>Java>>正文


Java Toolkit.getDefaultToolkit方法代码示例

本文整理汇总了Java中java.awt.Toolkit.getDefaultToolkit方法的典型用法代码示例。如果您正苦于以下问题:Java Toolkit.getDefaultToolkit方法的具体用法?Java Toolkit.getDefaultToolkit怎么用?Java Toolkit.getDefaultToolkit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.Toolkit的用法示例。


在下文中一共展示了Toolkit.getDefaultToolkit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import java.awt.Toolkit; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    Robot robot = new Robot();

    SwingUtilities.invokeAndWait(new Runnable() {

        public void run() {
            createAndShowUI();
        }
    });

    toolkit.realSync();
    clickCell(robot, 1, 1);
    Util.hitKeys(robot, KeyEvent.VK_BACK_SPACE, KeyEvent.VK_BACK_SPACE,
            KeyEvent.VK_BACK_SPACE);

    toolkit.realSync();
    clickColumnHeader(robot, 1);

    toolkit.realSync();
    clickColumnHeader(robot, 1);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:23,代码来源:bug7055065.java

示例2: getForm

import java.awt.Toolkit; //导入方法依赖的package包/类
/**
 * Опредилить Singleton.
 *
 * @param parent относительно этого контрола модальность и позиционирование
 * @param modal режим модальности
 */
private static void getForm(JFrame parent, boolean modal, String verDB) {
    QLog.l().logger().info("Демонстрация информации о программе.");
    if (aboutForm == null) {
        aboutForm = new FAbout(parent, modal);
    }
    if (aboutForm != null) {
        // Отцентирируем
        final Toolkit kit = Toolkit.getDefaultToolkit();
        aboutForm
            .setLocation((Math.round(kit.getScreenSize().width - aboutForm.getWidth()) / 2),
                (Math.round(kit.getScreenSize().height - aboutForm.getHeight()) / 2));
    }
    aboutForm.labelDBVer
        .setText(
            "".equals(verDB) ? "" : (getLocaleMessage("about.db_version") + " : " + verDB));
}
 
开发者ID:bcgov,项目名称:sbc-qsystem,代码行数:23,代码来源:FAbout.java

示例3: main

import java.awt.Toolkit; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {
    Image img = createTestImage();

    Toolkit tk = Toolkit.getDefaultToolkit();

    LUTCompareTest o = new LUTCompareTest(img);

    tk.prepareImage(img, -1, -1, o);

    while(!o.isImageReady()) {
        synchronized(lock) {
            try {
                lock.wait(200);
            } catch (InterruptedException e) {
            }
        }
    }

    checkResults(img);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:21,代码来源:LUTCompareTest.java

示例4: getShell32Icon

import java.awt.Toolkit; //导入方法依赖的package包/类
/**
 * Gets an icon from the Windows system icon list as an <code>Image</code>
 */
static Image getShell32Icon(int iconID, boolean getLargeIcon) {
    boolean useVGAColors = true; // Will be ignored on XP and later

    int size = getLargeIcon ? 32 : 16;

    Toolkit toolkit = Toolkit.getDefaultToolkit();
    String shellIconBPP = (String)toolkit.getDesktopProperty("win.icon.shellIconBPP");
    if (shellIconBPP != null) {
        useVGAColors = shellIconBPP.equals("4");
    }

    long hIcon = getIconResource("shell32.dll", iconID, size, size, useVGAColors);
    if (hIcon != 0) {
        Image icon = makeIcon(hIcon, getLargeIcon);
        disposeIcon(hIcon);
        return icon;
    }
    return null;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:Win32ShellFolder2.java

示例5: getShell32Icon

import java.awt.Toolkit; //导入方法依赖的package包/类
/**
 * Gets an icon from the Windows system icon list as an {@code Image}
 */
static Image getShell32Icon(int iconID, boolean getLargeIcon) {
    boolean useVGAColors = true; // Will be ignored on XP and later

    int size = getLargeIcon ? 32 : 16;

    Toolkit toolkit = Toolkit.getDefaultToolkit();
    String shellIconBPP = (String)toolkit.getDesktopProperty("win.icon.shellIconBPP");
    if (shellIconBPP != null) {
        useVGAColors = shellIconBPP.equals("4");
    }

    long hIcon = getIconResource("shell32.dll", iconID, size, size, useVGAColors);
    if (hIcon != 0) {
        Image icon = makeIcon(hIcon, getLargeIcon);
        disposeIcon(hIcon);
        return icon;
    }
    return null;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:Win32ShellFolder2.java

示例6: main

import java.awt.Toolkit; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {

       Frame frame = new Frame();
        final Toolkit toolkit = Toolkit.getDefaultToolkit();
        final GraphicsEnvironment graphicsEnvironment =
                GraphicsEnvironment.getLocalGraphicsEnvironment();
        final GraphicsDevice graphicsDevice =
                graphicsEnvironment.getDefaultScreenDevice();

        final Dimension screenSize = toolkit.getScreenSize();
        final Insets screenInsets = toolkit.getScreenInsets(
                graphicsDevice.getDefaultConfiguration());

        final Rectangle availableScreenBounds = new Rectangle(screenSize);

        availableScreenBounds.x += screenInsets.left;
        availableScreenBounds.y += screenInsets.top;
        availableScreenBounds.width -= (screenInsets.left + screenInsets.right);
        availableScreenBounds.height -= (screenInsets.top + screenInsets.bottom);

        frame.setBounds(availableScreenBounds.x, availableScreenBounds.y,
                availableScreenBounds.width, availableScreenBounds.height);
        frame.setVisible(true);

        Rectangle frameBounds = frame.getBounds();
        frame.setExtendedState(Frame.MAXIMIZED_BOTH);
        ((SunToolkit) toolkit).realSync();

        Rectangle maximizedFrameBounds = frame.getBounds();
        if (maximizedFrameBounds.width < frameBounds.width
                || maximizedFrameBounds.height < frameBounds.height) {
            throw new RuntimeException("Maximized frame is smaller than non maximized");
        }
    }
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:35,代码来源:MaximizedToMaximized.java

示例7: altReleased

import java.awt.Toolkit; //导入方法依赖的package包/类
void altReleased(KeyEvent ev) {
    if (menuCanceledOnPress) {
        WindowsLookAndFeel.setMnemonicHidden(true);
        WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor);
        return;
    }

    MenuSelectionManager msm =
        MenuSelectionManager.defaultManager();
    if (msm.getSelectedPath().length == 0) {
        // if no menu is active, we try activating the menubar

        JMenuBar mbar = root != null ? root.getJMenuBar() : null;
        if(mbar == null && winAncestor instanceof JFrame) {
            mbar = ((JFrame)winAncestor).getJMenuBar();
        }
        JMenu menu = mbar != null ? mbar.getMenu(0) : null;

        // It might happen that the altRelease event is processed
        // with a reasonable delay since it has been generated.
        // Here we check the last deactivation time of the containing
        // window. If this time appears to be greater than the altRelease
        // event time the event is skipped to avoid unexpected menu
        // activation. See 7121442.
        // Also we must ensure that original source of key event belongs
        // to the same window object as winAncestor. See 8001633.
        boolean skip = false;
        Toolkit tk = Toolkit.getDefaultToolkit();
        if (tk instanceof SunToolkit) {
            Component originalSource = AWTAccessor.getKeyEventAccessor()
                    .getOriginalSource(ev);
            skip = SunToolkit.getContainingWindow(originalSource) != winAncestor ||
                    ev.getWhen() <= ((SunToolkit) tk).getWindowDeactivationTime(winAncestor);
        }

        if (menu != null && !skip) {
            MenuElement[] path = new MenuElement[2];
            path[0] = mbar;
            path[1] = menu;
            msm.setSelectedPath(path);
        } else if(!WindowsLookAndFeel.isMnemonicHidden()) {
            WindowsLookAndFeel.setMnemonicHidden(true);
            WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor);
        }
    } else {
        if((msm.getSelectedPath())[0] instanceof ComboPopup) {
            WindowsLookAndFeel.setMnemonicHidden(true);
            WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor);
        }
    }

}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:53,代码来源:WindowsRootPaneUI.java

示例8: getScalableImageMethod

import java.awt.Toolkit; //导入方法依赖的package包/类
private static Method getScalableImageMethod(String name,
        Class... parameterTypes) throws Exception {
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    Method method = toolkit.getClass().getDeclaredMethod(name, parameterTypes);
    method.setAccessible(true);
    return method;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:8,代码来源:MultiResolutionImageTest.java

示例9: getContent

import java.awt.Toolkit; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
public Object getContent(URLConnection urlc, Class[] classes) throws IOException {
    Class<?>[] cls = classes;
    for (int i = 0; i < cls.length; i++) {
        if (cls[i].isAssignableFrom(URLImageSource.class)) {
            return new URLImageSource(urlc);
        }
        if (cls[i].isAssignableFrom(Image.class)) {
            Toolkit tk = Toolkit.getDefaultToolkit();
            return tk.createImage(new URLImageSource(urlc));
        }
    }
    return null;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:15,代码来源:gif.java

示例10: appReOpened

import java.awt.Toolkit; //导入方法依赖的package包/类
@Override
public void appReOpened(final AppReOpenedEvent e) {
    final ApplicationEvent ae = new ApplicationEvent(Toolkit.getDefaultToolkit());
    sendEventToEachListenerUntilHandled(ae, new EventDispatcher() {
        public void dispatchEvent(final ApplicationListener listener) {
            listener.handleReOpenApplication(ae);
        }
    });
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:10,代码来源:_AppEventLegacyHandler.java

示例11: realUngrabWindow

import java.awt.Toolkit; //导入方法依赖的package包/类
void realUngrabWindow() {
    Toolkit tk = Toolkit.getDefaultToolkit();
    if(grabbedWindow != null) {
        if(tk instanceof sun.awt.SunToolkit) {
            ((sun.awt.SunToolkit)tk).ungrab(grabbedWindow);
        } else {
            grabbedWindow.removeComponentListener(this);
            grabbedWindow.removeWindowListener(this);
        }
        grabbedWindow = null;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:BasicPopupMenuUI.java

示例12: main

import java.awt.Toolkit; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {

        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
        Robot robot = new Robot();
        robot.setAutoDelay(50);

        SwingUtilities.invokeAndWait(new Runnable() {
            public void run() {
                createAndShowGUI();
            }
        });

        toolkit.realSync();

        SwingUtilities.invokeAndWait(new Runnable() {
            public void run() {
                fileChooser.setSelectedFile(file);
            }
        });

        toolkit.realSync();

        robot.keyPress(KeyEvent.VK_ENTER);
        robot.keyRelease(KeyEvent.VK_ENTER);
        toolkit.realSync();

        if (!defaultKeyPressed) {
            throw new RuntimeException("Default button is not pressed");
        }
    }
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:31,代码来源:bug8021253.java

示例13: createInputMethodWindow

import java.awt.Toolkit; //导入方法依赖的package包/类
static Window createInputMethodWindow(String title, InputContext context, boolean isSwing) {
    if (GraphicsEnvironment.isHeadless()) {
        throw new HeadlessException();
    }
    if (isSwing) {
        return new InputMethodJFrame(title, context);
    } else {
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        if (toolkit instanceof InputMethodSupport) {
            return ((InputMethodSupport)toolkit).createInputMethodWindow(
                title, context);
        }
    }
    throw new InternalError("Input methods must be supported");
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:InputMethodContext.java

示例14: handleMouseEvent

import java.awt.Toolkit; //导入方法依赖的package包/类
/**
 * Handles mouse events.
 */
void handleMouseEvent(int eventType, int modifierFlags, int buttonNumber,
                      int clickCount, int x, int y, int absX, int absY) {
    final SunToolkit tk = (SunToolkit)Toolkit.getDefaultToolkit();
    if ((buttonNumber > 2 && !tk.areExtraMouseButtonsEnabled())
            || buttonNumber > tk.getNumberOfButtons() - 1) {
        return;
    }

    int jeventType = isNpapiCallback ? NSEvent.npToJavaEventType(eventType) :
                                       NSEvent.nsToJavaEventType(eventType);

    int jbuttonNumber = MouseEvent.NOBUTTON;
    int jclickCount = 0;

    if (jeventType != MouseEvent.MOUSE_MOVED &&
        jeventType != MouseEvent.MOUSE_ENTERED &&
        jeventType != MouseEvent.MOUSE_EXITED)
    {
        jbuttonNumber = NSEvent.nsToJavaButton(buttonNumber);
        jclickCount = clickCount;
    }

    int jmodifiers = NSEvent.nsToJavaModifiers(modifierFlags);
    boolean jpopupTrigger = NSEvent.isPopupTrigger(jmodifiers);

    eventNotifier.notifyMouseEvent(jeventType, System.currentTimeMillis(), jbuttonNumber,
            x, y, absX, absY, jmodifiers, jclickCount,
            jpopupTrigger, null);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:33,代码来源:CPlatformResponder.java

示例15: handleAbout

import java.awt.Toolkit; //导入方法依赖的package包/类
@Override
public void handleAbout(final AboutEvent e) {
    final ApplicationEvent ae = new ApplicationEvent(Toolkit.getDefaultToolkit());
    sendEventToEachListenerUntilHandled(ae, new EventDispatcher() {
        public void dispatchEvent(final ApplicationListener listener) {
            listener.handleAbout(ae);
        }
    });

    if (ae.isHandled()) return;
    parent.openCocoaAboutWindow();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:_AppEventLegacyHandler.java


注:本文中的java.awt.Toolkit.getDefaultToolkit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。