Note that there are some explanatory texts on larger screens.

plurals
  1. POJava String- Font style check
    text
    copied!<p>I need to do <code>font style check</code> for my selected text area. </p> <p>I used <code>applescript</code> to copy my highlighted/selected text area to clipboard and retrieve the clipboard value in java. I used <code>string</code> to capture the selected/highlighted value. </p> <p>Is there any way I can do <code>style check</code> using <code>String</code> in <code>java</code>.</p> <p>Code retrieve clipboard value:</p> <pre><code> String result = ""; Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); //odd: the Object param of getContents is not currently used Transferable contents = clipboard.getContents(null); boolean hasTransferableText = (contents != null) &amp;&amp; contents.isDataFlavorSupported(DataFlavor.stringFlavor); if ( hasTransferableText ) { try { result = (String)contents.getTransferData(DataFlavor.stringFlavor); } catch (UnsupportedFlavorException ex){ } catch (IOException ex) { } } return result; } </code></pre> <p>Font Info:</p> <pre><code>{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf360 {\fonttbl\f0\fnil\fcharset0 Verdana;\f1\fnil\fcharset0 Tahoma;} {\colortbl;\red255\green255\blue255;} \deftab720 \pard\pardeftab720\sa280 \f0\i\fs34 \cf0 testing \f1\i0 hello\'a0 \b Module \b0 \ul world} {\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf360 {\fonttbl\f0\fnil\fcharset0 Verdana;\f1\fnil\fcharset0 Tahoma;} {\colortbl;\red255\green255\blue255;} \deftab720 \pard\pardeftab720\sa280 \f0\i\fs34 \cf0 testing \f1\i0 hello\'a0 \b Module \b0 \ul world} </code></pre> <p>Please advice. Any advice/references is highly appreciated. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload