Search in sources :

Example 21 with Toolkit

use of java.awt.Toolkit in project jdk8u_jdk by JetBrains.

the class AttributeValues method applyIMHighlight.

/**
     * If this has an imHighlight, create copy of this with those attributes
     * applied to it.  Otherwise return this unchanged.
     */
public AttributeValues applyIMHighlight() {
    if (imHighlight != null) {
        InputMethodHighlight hl = null;
        if (imHighlight instanceof InputMethodHighlight) {
            hl = (InputMethodHighlight) imHighlight;
        } else {
            hl = (InputMethodHighlight) ((Annotation) imHighlight).getValue();
        }
        Map imStyles = hl.getStyle();
        if (imStyles == null) {
            Toolkit tk = Toolkit.getDefaultToolkit();
            imStyles = tk.mapInputMethodHighlight(hl);
        }
        if (imStyles != null) {
            return clone().merge(imStyles);
        }
    }
    return this;
}
Also used : Toolkit(java.awt.Toolkit) InputMethodHighlight(java.awt.im.InputMethodHighlight) HashMap(java.util.HashMap) Map(java.util.Map) Annotation(java.text.Annotation)

Example 22 with Toolkit

use of java.awt.Toolkit in project jdk8u_jdk by JetBrains.

the class SwingTest method start.

private void start() throws Throwable {
    do {
        if ((this.method != null) && Modifier.isStatic(this.method.getModifiers())) {
            // invoke static method on the current thread
            run();
        } else {
            // invoke on the event dispatch thread
            SwingUtilities.invokeLater(this);
        }
        Toolkit tk = Toolkit.getDefaultToolkit();
        if (tk instanceof SunToolkit) {
            SunToolkit stk = (SunToolkit) tk;
            // wait until done
            stk.realSync();
        }
    } while (this.frame != null);
    if (this.error != null) {
        throw this.error;
    }
}
Also used : SunToolkit(sun.awt.SunToolkit) SunToolkit(sun.awt.SunToolkit) Toolkit(java.awt.Toolkit)

Example 23 with Toolkit

use of java.awt.Toolkit in project knime-core by knime.

the class HierarchicalGraphComponent method paint.

/**
 * {@inheritDoc}
 */
@Override
public void paint(final Graphics g) {
    Graphics2D g2 = (Graphics2D) g;
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    Toolkit tk = Toolkit.getDefaultToolkit();
    @SuppressWarnings("rawtypes") Map desktopHints = (Map) (tk.getDesktopProperty("awt.font.desktophints"));
    if (desktopHints != null) {
        g2.addRenderingHints(desktopHints);
    } else {
        g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
    }
    super.paint(g2);
    m_graph.paint(this, g2, 0, 0, this.getWidth(), this.getHeight());
}
Also used : Toolkit(java.awt.Toolkit) Map(java.util.Map) Graphics2D(java.awt.Graphics2D)

Example 24 with Toolkit

use of java.awt.Toolkit in project keystore-explorer by kaikramer.

the class KSE method fixAppClassName.

private static void fixAppClassName() {
    // Fix application name in Gnome top bar, see http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6528430
    Toolkit xToolkit = Toolkit.getDefaultToolkit();
    try {
        Field awtAppClassNameField = xToolkit.getClass().getDeclaredField("awtAppClassName");
        awtAppClassNameField.setAccessible(true);
        awtAppClassNameField.set(xToolkit, getApplicationName());
    } catch (Exception x) {
    // ignore
    }
}
Also used : Field(java.lang.reflect.Field) Toolkit(java.awt.Toolkit)

Example 25 with Toolkit

use of java.awt.Toolkit in project keystore-explorer by kaikramer.

the class JQuickStartPane method initComponents.

private void initComponents() {
    jqslHeading = new JQuickStartLabel(res.getString("JQuickStartPane.jqslHeading.text"));
    jqslHeading.setForeground(TEXT_COLOR);
    jqslHeading.setFont(jqslHeading.getFont().deriveFont(20f));
    Toolkit toolKit = Toolkit.getDefaultToolkit();
    ImageIcon newImage = new ImageIcon(toolKit.createImage(getClass().getResource(res.getString("JQuickStartPane.jqsbNewKeyStore.image"))));
    ImageIcon newImageRollOver = new ImageIcon(toolKit.createImage(getClass().getResource(res.getString("JQuickStartPane.jqsbNewKeyStore.rollover.image"))));
    jqsbNewKeyStore = new JQuickStartButton(new NewAction(kseFrame), res.getString("JQuickStartPane.jqsbNewKeyStore.text"), newImage, newImageRollOver, TEXT_COLOR, TEXT_ROLLOVER_COLOR);
    jqsbNewKeyStore.setOpaque(false);
    ImageIcon openImage = new ImageIcon(toolKit.createImage(getClass().getResource(res.getString("JQuickStartPane.jqsbOpenKeyStore.image"))));
    ImageIcon openImageRollOver = new ImageIcon(toolKit.createImage(getClass().getResource(res.getString("JQuickStartPane.jqsbOpenKeyStore.rollover.image"))));
    jqsbOpenKeyStore = new JQuickStartButton(new OpenAction(kseFrame), res.getString("JQuickStartPane.jqsbOpenKeyStore.text"), openImage, openImageRollOver, TEXT_COLOR, TEXT_ROLLOVER_COLOR);
    jqsbOpenKeyStore.setOpaque(false);
    ImageIcon openDefaultImage = new ImageIcon(toolKit.createImage(getClass().getResource(res.getString("JQuickStartPane.jqsbOpenDefaultKeyStore.image"))));
    ImageIcon openDefaultImageRollOver = new ImageIcon(toolKit.createImage(getClass().getResource(res.getString("JQuickStartPane.jqsbOpenDefaultKeyStore.rollover.image"))));
    jqsbOpenDefaultKeyStore = new JQuickStartButton(new OpenDefaultAction(kseFrame), res.getString("JQuickStartPane.jqsbOpenDefaultKeyStore.text"), openDefaultImage, openDefaultImageRollOver, TEXT_COLOR, TEXT_ROLLOVER_COLOR);
    jqsbOpenDefaultKeyStore.setOpaque(false);
    ImageIcon openCaCertificatesImage = new ImageIcon(toolKit.createImage(getClass().getResource(res.getString("JQuickStartPane.jqsbOpenCaCertificatesKeyStore.image"))));
    ImageIcon openCaCertificatesImageRollOver = new ImageIcon(toolKit.createImage(getClass().getResource(res.getString("JQuickStartPane.jqsbOpenCaCertificatesKeyStore.rollover.image"))));
    jqsbOpenCaCertificatesKeyStore = new JQuickStartButton(new OpenCaCertificatesAction(kseFrame), res.getString("JQuickStartPane.jqsbOpenCaCertificatesKeyStore.text"), openCaCertificatesImage, openCaCertificatesImageRollOver, TEXT_COLOR, TEXT_ROLLOVER_COLOR);
    jqsbOpenCaCertificatesKeyStore.setOpaque(false);
    ImageIcon examineCertificateImage = new ImageIcon(toolKit.createImage(getClass().getResource(res.getString("JQuickStartPane.jqsbExamineCertificate.image"))));
    ImageIcon examineCertificateImageRollOver = new ImageIcon(toolKit.createImage(getClass().getResource(res.getString("JQuickStartPane.jqsbExamineCertificate.rollover.image"))));
    jqsbExamineCertificate = new JQuickStartButton(new ExamineFileAction(kseFrame), res.getString("JQuickStartPane.jqsbExamineCertificate.text"), examineCertificateImage, examineCertificateImageRollOver, TEXT_COLOR, TEXT_ROLLOVER_COLOR);
    jqsbExamineCertificate.setOpaque(false);
    ImageIcon helpImage = new ImageIcon(toolKit.createImage(getClass().getResource(res.getString("JQuickStartPane.jqsbHelp.image"))));
    ImageIcon helpImageRollOver = new ImageIcon(toolKit.createImage(getClass().getResource(res.getString("JQuickStartPane.jqsbHelp.rollover.image"))));
    jqsbHelp = new JQuickStartButton(new HelpAction(kseFrame), res.getString("JQuickStartPane.jqsbHelp.text"), helpImage, helpImageRollOver, TEXT_COLOR, TEXT_ROLLOVER_COLOR);
    jqsbHelp.setOpaque(false);
    GridBagConstraints gbc_jqslHeading = new GridBagConstraints();
    gbc_jqslHeading.gridheight = 1;
    gbc_jqslHeading.gridwidth = 3;
    gbc_jqslHeading.gridx = 0;
    gbc_jqslHeading.gridy = 0;
    gbc_jqslHeading.insets = new Insets(0, 0, 20, 0);
    GridBagConstraints gbc_jqsbNewKeyStore = new GridBagConstraints();
    gbc_jqsbNewKeyStore.gridheight = 1;
    gbc_jqsbNewKeyStore.gridwidth = 1;
    gbc_jqsbNewKeyStore.gridx = 0;
    gbc_jqsbNewKeyStore.gridy = 1;
    gbc_jqsbNewKeyStore.insets = new Insets(0, 0, 10, 10);
    GridBagConstraints gbc_jqsbOpenKeyStore = new GridBagConstraints();
    gbc_jqsbOpenKeyStore.gridheight = 1;
    gbc_jqsbOpenKeyStore.gridwidth = 1;
    gbc_jqsbOpenKeyStore.gridx = 1;
    gbc_jqsbOpenKeyStore.gridy = 1;
    gbc_jqsbOpenKeyStore.insets = new Insets(0, 10, 10, 10);
    GridBagConstraints gbc_jqsbOpenDefaultKeyStore = new GridBagConstraints();
    gbc_jqsbOpenDefaultKeyStore.gridheight = 1;
    gbc_jqsbOpenDefaultKeyStore.gridwidth = 1;
    gbc_jqsbOpenDefaultKeyStore.gridx = 2;
    gbc_jqsbOpenDefaultKeyStore.gridy = 1;
    gbc_jqsbOpenDefaultKeyStore.insets = new Insets(0, 10, 10, 10);
    GridBagConstraints gbc_jqsbOpenCaCertificatesKeyStore = new GridBagConstraints();
    gbc_jqsbOpenCaCertificatesKeyStore.gridheight = 1;
    gbc_jqsbOpenCaCertificatesKeyStore.gridwidth = 1;
    gbc_jqsbOpenCaCertificatesKeyStore.gridx = 0;
    gbc_jqsbOpenCaCertificatesKeyStore.gridy = 2;
    gbc_jqsbOpenCaCertificatesKeyStore.insets = new Insets(10, 0, 0, 10);
    GridBagConstraints gbc_jqsbExamineCertificate = new GridBagConstraints();
    gbc_jqsbExamineCertificate.gridheight = 1;
    gbc_jqsbExamineCertificate.gridwidth = 1;
    gbc_jqsbExamineCertificate.gridx = 1;
    gbc_jqsbExamineCertificate.gridy = 2;
    gbc_jqsbExamineCertificate.insets = new Insets(10, 10, 0, 10);
    GridBagConstraints gbc_jqsbHelp = new GridBagConstraints();
    gbc_jqsbHelp.gridheight = 1;
    gbc_jqsbHelp.gridwidth = 1;
    gbc_jqsbHelp.gridx = 2;
    gbc_jqsbHelp.gridy = 2;
    gbc_jqsbHelp.insets = new Insets(10, 10, 0, 0);
    jpQuickStart = new JPanel(new GridBagLayout());
    jpQuickStart.setOpaque(false);
    jpQuickStart.add(jqslHeading, gbc_jqslHeading);
    jpQuickStart.add(jqsbNewKeyStore, gbc_jqsbNewKeyStore);
    jpQuickStart.add(jqsbOpenKeyStore, gbc_jqsbOpenKeyStore);
    jpQuickStart.add(jqsbOpenDefaultKeyStore, gbc_jqsbOpenDefaultKeyStore);
    jpQuickStart.add(jqsbOpenCaCertificatesKeyStore, gbc_jqsbOpenCaCertificatesKeyStore);
    jpQuickStart.add(jqsbExamineCertificate, gbc_jqsbExamineCertificate);
    jpQuickStart.add(jqsbHelp, gbc_jqsbHelp);
    // Put in panel to prevent resize of controls and center them
    // horizontally
    jpNonResizeCenterHorizontally = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
    jpNonResizeCenterHorizontally.setOpaque(false);
    jpNonResizeCenterHorizontally.add(jpQuickStart);
    // Set pane's layout to center controls vertically
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    add(Box.createVerticalGlue());
    add(jpNonResizeCenterHorizontally);
}
Also used : ImageIcon(javax.swing.ImageIcon) JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) HelpAction(org.kse.gui.actions.HelpAction) Insets(java.awt.Insets) FlowLayout(java.awt.FlowLayout) ExamineFileAction(org.kse.gui.actions.ExamineFileAction) GridBagLayout(java.awt.GridBagLayout) BoxLayout(javax.swing.BoxLayout) OpenCaCertificatesAction(org.kse.gui.actions.OpenCaCertificatesAction) OpenAction(org.kse.gui.actions.OpenAction) OpenDefaultAction(org.kse.gui.actions.OpenDefaultAction) Toolkit(java.awt.Toolkit) NewAction(org.kse.gui.actions.NewAction)

Aggregations

Toolkit (java.awt.Toolkit)93 Dimension (java.awt.Dimension)27 Point (java.awt.Point)20 Image (java.awt.Image)19 BufferedImage (java.awt.image.BufferedImage)14 URL (java.net.URL)14 GraphicsDevice (java.awt.GraphicsDevice)8 GraphicsEnvironment (java.awt.GraphicsEnvironment)7 Insets (java.awt.Insets)7 Rectangle (java.awt.Rectangle)6 IOException (java.io.IOException)6 Field (java.lang.reflect.Field)6 MediaTracker (java.awt.MediaTracker)5 ImageIcon (javax.swing.ImageIcon)5 Frame (java.awt.Frame)4 Clipboard (java.awt.datatransfer.Clipboard)4 Font (java.awt.Font)3 Graphics (java.awt.Graphics)3 GraphicsConfiguration (java.awt.GraphicsConfiguration)3 Method (java.lang.reflect.Method)3