Example usage for java.awt Toolkit getDefaultToolkit

List of usage examples for java.awt Toolkit getDefaultToolkit

Introduction

In this page you can find the example usage for java.awt Toolkit getDefaultToolkit.

Prototype

public static synchronized Toolkit getDefaultToolkit() 

Source Link

Document

Gets the default toolkit.

Usage

From source file:net.sf.keystore_explorer.gui.actions.ExportKeyPairPrivateKeyAction.java

/**
 * Construct action.//w  w w . ja v  a 2 s.  co m
 *
 * @param kseFrame
 *            KeyStore Explorer frame
 */
public ExportKeyPairPrivateKeyAction(KseFrame kseFrame) {
    super(kseFrame);

    putValue(LONG_DESCRIPTION, res.getString("ExportKeyPairPrivateKeyAction.statusbar"));
    putValue(NAME, res.getString("ExportKeyPairPrivateKeyAction.text"));
    putValue(SHORT_DESCRIPTION, res.getString("ExportKeyPairPrivateKeyAction.tooltip"));
    putValue(SMALL_ICON, new ImageIcon(Toolkit.getDefaultToolkit()
            .createImage(getClass().getResource(res.getString("ExportKeyPairPrivateKeyAction.image")))));
}

From source file:QandE.Beeper2.java

public void actionPerformed(ActionEvent e) {
    if (BUTTON_CMD.equals(e.getActionCommand())) {
        startBeeping(beepsModel.getNumber().intValue());
    } else { //called by the Timer
        Toolkit.getDefaultToolkit().beep();
        if (--beepsRemaining < 1) {
            timer.stop();/*from  w w w  .  ja v  a  2  s.c om*/
        }
    }
}

From source file:ecg.ecgshow.ECGShowUI.java

public ECGShowUI(String title, long timeZone) { //
    super();//from   w  w  w  .  j  a  v  a 2 s. c om

    WIDTH = (int) Toolkit.getDefaultToolkit().getScreenSize().getWidth();
    HEIGHT = (int) Toolkit.getDefaultToolkit().getScreenSize().getHeight();
    createECGData(timeZone);
    createHeartRateData(timeZone);
    createPressureData(timeZone);
    createBloodOxygenData(timeZone);
    createGuardData();

}

From source file:NumericTextField.java

public void insertFailed(NumericPlainDocument doc, int offset, String str, AttributeSet a) {
    // By default, just beep
    Toolkit.getDefaultToolkit().beep();
}

From source file:UI.SecurityDashboard.java

/**
 * Creates new form Main/*from  w  w  w  .  j  a v  a 2 s.  c  om*/
 */
public SecurityDashboard() {
    //this.setUndecorated(true);
    //this.setAlwaysOnTop(true);

    this.setVisible(true);
    initComponents();
    MainViewPanel mvp = new MainViewPanel();
    performMetric1(mvp);
    performMetric2(mvp);
    performMetric3(mvp);
    performMetric4(mvp);
    performMetric5(mvp);
    performMetric6(mvp);
    performMetric7(mvp);
    performMetric8(mvp);
    performMetric9();

    //        Metric6Panel.setVisible(false);
    //        Metric7Panel.setVisible(false);
    //        Metric8Panel.setVisible(false);
    //        Metric9Panel.setVisible(false);

    Toolkit tk;
    tk = Toolkit.getDefaultToolkit();
    this.setSize((int) tk.getScreenSize().getWidth(), (int) tk.getScreenSize().getHeight());
    this.setTitle("Security Dashboard");
    sourceFolder.setBorder(new LineBorder(Color.BLACK));
    sourceFolder.setBorderPainted(true);

}

From source file:com.haulmont.cuba.desktop.sys.DesktopToolTipManager.java

protected DesktopToolTipManager() {
    closeTimer = new Timer(CLOSE_TIME, null);
    closeTimer.setRepeats(false);//from w w w.j a v a 2 s  .c o m
    closeTimer.addActionListener(e -> {
        if (window != null) {
            window.hide();
            window = null;
            tooltipShowing = false;
            toolTipWindow.removeMouseListener(DesktopToolTipManager.this);
            component.removeMouseListener(DesktopToolTipManager.this);
        }
    });

    Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
        protected MouseEvent event;

        @Override
        public void eventDispatched(AWTEvent e) {
            if (!tooltipShowing) {
                return;
            }
            event = (MouseEvent) e;
            if (event.getID() == MouseEvent.MOUSE_PRESSED) {
                if (event.getComponent() != null && event.getComponent().isShowing()) {
                    if (!isPointInComponent(event.getLocationOnScreen(), toolTipWindow))
                        hideTooltip();
                } else
                    hideTooltip();
            }
        }
    }, AWTEvent.MOUSE_EVENT_MASK);
}

From source file:jpad.MainEditor.java

private void macSpecifics() {
    com.apple.eawt.Application app = new com.apple.eawt.Application();
    //app.setDockIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("res/icon.png")));
    try {/*from   w w  w  .j  a  va 2 s  .c o m*/
        OSXAdapter.setAboutHandler(this, getClass().getDeclaredMethod("showAbout", (Class[]) null));
        OSXAdapter.setQuitHandler(this, getClass().getDeclaredMethod("quitApp", (Class[]) null));
    } catch (Exception ex) {
        ex.printStackTrace();
    }
    //TODO: set keyboard shortcuts for openMenuItem
    openMenuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_O, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
}

From source file:SerialTransferTest.java

/**
 * Pastes the color from the system clipboard into the chooser.
 *///ww w  .ja  v  a 2 s. co  m
private void paste() {
    Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
    try {
        DataFlavor flavor = new DataFlavor("application/x-java-serialized-object;class=java.awt.Color");
        if (clipboard.isDataFlavorAvailable(flavor)) {
            Color color = (Color) clipboard.getData(flavor);
            chooser.setColor(color);
        }
    } catch (ClassNotFoundException e) {
        JOptionPane.showMessageDialog(this, e);
    } catch (UnsupportedFlavorException e) {
        JOptionPane.showMessageDialog(this, e);
    } catch (IOException e) {
        JOptionPane.showMessageDialog(this, e);
    }
}

From source file:MonitorSaurausRex.MainMenu.java

private boolean allAreEncFiles(File[] listOfFilesAndFolders) {
    for (File file : listOfFilesAndFolders) {
        String filePath = file.getAbsoluteFile().toString();
        if (!file.isDirectory()
                && !filePath.substring(filePath.length() - 4, filePath.length()).equals(".enc")) {
            System.out.println(file.getAbsoluteFile() + " is not encrypted");
            Toolkit.getDefaultToolkit().beep();
            JOptionPane.showMessageDialog(null,
                    "1 or more files are not encrypted !! \nPlease de-select them.");
            return false;
        }//from w  w w . j a v a  2  s  .  c  om

    }
    return false;
}

From source file:jdroidremote.ServerFrame.java

public void initEventDriven() {
    jbtRunServer.addActionListener(new ActionListener() {
        @Override// w  w w  . j av  a 2s . c  o  m
        public void actionPerformed(ActionEvent e) {
            new Thread(new Runnable() {
                @Override
                public void run() {
                    try {
                        serverSocket = new ServerSocket(5005);
                        System.out.println("Server is running...");
                        clientSocket = serverSocket.accept();
                        dis = new DataInputStream(clientSocket.getInputStream());
                        dos = new DataOutputStream(clientSocket.getOutputStream());
                        System.out.println(
                                "some device connected us from address: " + clientSocket.getInetAddress());

                        thReceiveMouseCoords.start();
                        thStartMonitoring.start();

                    } catch (IOException ex) {
                        Logger.getLogger(ServerFrame.class.getName()).log(Level.SEVERE, null, ex);
                    }
                }
            }).start();

            thReceiveMouseCoords = new Thread(new Runnable() {
                @Override
                public void run() {

                    System.out.println("START RECEIVING COORDS.............");

                    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
                    double width = screenSize.getWidth();
                    double height = screenSize.getHeight();

                    while (1 == 1) {
                        try {
                            String receivedStr = dis.readUTF();

                            if (receivedStr.contains("left_click")) {
                                robot.mousePress(KeyEvent.BUTTON1_DOWN_MASK);
                                robot.mouseRelease(KeyEvent.BUTTON1_DOWN_MASK);
                            } else if (receivedStr.contains("right_click")) {
                                robot.mousePress(KeyEvent.BUTTON3_DOWN_MASK);
                                robot.mouseRelease(KeyEvent.BUTTON3_DOWN_MASK);
                            } else if (receivedStr.contains("coords")) {
                                System.out.println(receivedStr);
                                String[] mouseCoords = receivedStr.split(":");

                                int x = (int) (Integer.parseInt(mouseCoords[0]) * width / 100);
                                int y = (int) (Integer.parseInt(mouseCoords[1]) * height / 100);

                                robot.mouseMove(x, y);
                            } else {
                                String[] dataArr = receivedStr.split("-");

                                typeCharacter(dataArr[1]);
                            }
                        } catch (IOException ex) {
                            Logger.getLogger(ServerFrame.class.getName()).log(Level.SEVERE, null, ex);
                        }
                    }
                }
            });
        }
    });
}