JNLP copy/paste with Swing components

I have a simple JNLP application. When a window pops open asking for permission use the System clipboard I click "Yes". In the main-class file I call the following static function to initialize my Clipboard service:
public class FDW_Application {....
public static ClipboardService cs;
public static void setupClipboardService(){
try {cs = (ClipboardService)ServiceManager.lookup  ("javax.jnlp.ClipboardService");}
catch (UnavailableServiceException e) {
     FDW_Application.debugwindow(e.getMessage());
     cs = null;
Next, I use the following code to copy a string into the system clipboard
java.awt.datatransfer.StringSelection s = new java.awt.datatransfer.StringSelection (selectedValue.toString());
FDW_Application.cs.setContents(s);
myeditor.requestFocus();          
int caret_pos = myeditor.getCaretPosition ();
Next, I try to use the "Paste" function in swing to put the text into the control.
myeditor.paste(); /*myeditor is a JTextPane */
However, nothing shows up in the control.
When I close down the application and go to notepad I can paste the value into notepad.
How do I get the Paste function to use a specific clipboard?
Anthony

Thanks, I looked at the sample you have. I changed my
program from using the .Paste() to the
replaceSelection and it works nicely now. However, I
still wasn't able to get the paste working. It works OK here, for pasting plain text to that
component type, using the second data flavor
in the flavors list. I could not be bothered hard
coding it, and felt it more useful to demonstrate
that data has (many) flavors.
..i thought
it should work but your workaround ..Note they are not workarounds, but examples of
using the JNLP API. I would prefer that the JNLP
functionalities could be used 'seamlesly' with the
J2SE methods that do the same things, but I guess
that is not practical.
..(and the other
examples you have) are very useful.Glad to be of help.

Similar Messages

  • JTextPane cut,copy & paste with styles

    When you cut, copy & paste with JTextPane, it doesn't include the styles. Has anyone have an example of extending the DefaultEditorKit.CutAction class for example to include this extra behaviour?
    Thanks
    Abraham Khalil

    http://forum.java.sun.com/thread.jsp?forum=57&thread=197091Thats the thread I was think of. Look at the code found at the link of reply 4.

  • Copy/paste with original size and not 72 dpi

    Hello,
    With iPhoto, I used to copy/paste a photo to Photoshop in its original size.
    With Photos for Mac, the pasted image seems to be 72 dpi only.
    Do I have to move back to iPhotos or have I missed something ?
    (nota : I don't wan't to export / import files)
    ps : sorry for my english

    (nota : I don't wan't to export / import files)
    Try use the Media Browser in the Open dialogue of iPhoto.

  • Copied/pasted group of components lose many properties

    (Xcelsius 2008 SP1 FP1 5.1.1.0 (Build 12,1,1,344), Windows XP SP2)
    After copying/pasting 120 or so grouped components all at once, the Value, Check box and Toggle components seemed to lose most of their properties.  The main container within the group of copied objects is a panel container that included nested groups of labels, rectangles, values, check boxes and toggles.
    Specific example: All Value components originally had a title position of "Left" and specific font name/sizes.  They also had specific X axis offsets.  And of course, each was pointed to a specific spreadsheet cell.  The copies, however, reverted to the respective defaults for all properties minus the text of the titles.  (This is of course not an exhaustive list of the affected components/properties).
    I have already had experience copying smaller groups of components and did not see this effect, so I wonder if there is a threshold of some kind here.

    >
    NFN Purnima wrote:
    > There is no exact threshold for copy pasting components.When copy pasted in large numbers some components might lose their original bindings and may either experience cosmetic changes in label and title position offset or like you experienced would revert back to their original settings.I would recommend copy pasting in smaller groups to maintain consistency.
    > Thanks,
    > Purnima
    Thank you, Purnima.  Despite my fears, copying and pasting smaller groups within the larger nesting appears to be working out pretty well, so this may become a non-issue for me.  Nevertheless, it would be great if a future version of Xcelsius would support larger groups within a copy and paste.

  • How can I learn "Drag and Drop" with Swing components?

    Hello,
    Im using swing components, so using paint() to draw a "drag icon" doesnt seem acceptable. Im basically trying to move a JPanel image to be dragged/dropped over another JPanel in the same program/applet.
    I looked at Sun's Java Tutorial for information on doing drag and drop, but there was no trail completed yet.
    Does anyone know of any good resources to learn? Or can at least give me a general idea of how to do drag and drop?

    Did you see this?
    http://java.sun.com/docs/books/tutorial/dnd/index.html
    http://java.sun.com/docs/books/tutorial/reallybigindex.html

  • HT5797 produces this java update a issue with swing components?

    Hi folks
    actually my swing java programs doesnt work anymore. The swing ui doesnt start completly, some components like textbox, buttons, labels arent rendered. Also the system log contains nothing...
    Greetings
    Steffen

    Hi folks , hi Apple team
    this bugy update costs many hours to check this out and find a solution ...
    and now im read that the "great" apple distribute bugy updates with the same version 004, correct the bug in the background and do nothing to solve this problem for the affected users. Apple this was no great work. Im a developer and now im, asking me if a mac is the right developing platform
    here is what i mean:
    macsbod:soft sbode$ /usr/libexec/java_home -v 1.6 -exec java -version java version "1.6.0_51" Java(TM) SE Runtime Environment (build 1.6.0_51-b11-456-11M4508) Java HotSpot(TM) 64-Bit Server VM (build 20.51-b01-456, mixed mode)
    macsbod:soft sbode$ /usr/libexec/java_home -v 1.6 -exec java -version java version "1.6.0_51" Java(TM) SE Runtime Environment (build 1.6.0_51-b11-457-11M4509) Java HotSpot(TM) 64-Bit Server VM (build 20.51-b01-457, mixed mode)
    if you have the 4508 version, you have the bugy update and you must manually load and install the update with the correct java again :
    10.7
    http://support.apple.com/kb/DL1572?viewlocale=en_US&locale=en_US
    10.6
    http://support.apple.com/kb/DL1573
    Apple, why do you dont offer official over software updates a fix for this bugy update ???
    Cheers
    Steffen

  • GC doesn't seem to work properly with Swing components

    Well, I have a problem, and it's quite a big deal.
    I don't understand why the java GC refuses to free the memory.
    I have made a VERY LITTLE example, so that everybody will see what the problem is made with.
    a frame with 2 buttons. the first one make another frame appears, which contains a quite big Swing component. The other is here in order to try to free the memory of this frame.
    Here are the 2 classes :
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class FirstClass extends JFrame{
    private JButton jButton1 = new JButton("free memory");
    private JButton jButton2 = new JButton("load frame");
    private MyFrameColor frame;
    public FirstClass() {
    jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
    public void mouseClicked(MouseEvent e) {
    jButton1_mouseClicked(e);
    jButton2.addMouseListener(new java.awt.event.MouseAdapter() {
    public void mouseClicked(MouseEvent e) {
    jButton2_mouseClicked(e);
    this.getContentPane().add(jButton1, BorderLayout.NORTH);
    this.getContentPane().add(jButton2, BorderLayout.SOUTH);
    this.show();
    public static void main(String[] args)
    new FirstClass();
    import javax.swing.*;
    import java.awt.*;
    public class MyFrameColor extends JFrame {
    JColorChooser jColorChooser1 = new JColorChooser();
    public MyFrameColor() {
    this.getContentPane().add(jColorChooser1, BorderLayout.CENTER);
    the problem is that, according to the Windows task Manager the memory isn't freed after having pressed on "free memory" button.
    Moreover, in my real application, there are so much data that aren't freed this way, that, at the third launching of a frame, I have a Out of Memory exception !
    THank you for answering
    Have a good day :-)

    First, obviously you didnt include all the code. And the most important part(the references to the classes in question) are missing. How can we make a judgement?
    Second, the windows taskbar is no measure of how much memory your program is using, its a measure of how much memory the JVM is using. You didnt write the JVM so you really should not be concerned with that.
    1. Try using System.freemem() or some similar call to see what your program is actually using.
    2. Try making the GC verbose to see when it actually reclaims objects
    3. Try calling the GC to force a little GC before you check the memory.
    4. Try calling UpdateUI if it actually shows that your memory is really not being released.

  • Xterm copy / paste with mouse, and kbd shortcuts

    Any idea what options I need enabled/disabled in Xdefaults to let me copy and paste to/from an xterm using the mouse? Also, the same question for using keyboard shortcuts (like Ctrl-a to move to start of line)?

    xterm*faceName:         Bitstream Vera Sans mono
    xterm*faceSize:         10
    xterm*eightBitInput:    false
    xterm*boldMode:         off
    xterm.scrollBar:        false
    xterm*saveLines:        1000
    xterm*Foreground:       white
    xterm*Background:       #303430
    xterm*Border:           #303430
    xterm*TitleBar:         on
    xterm*TextUnderIcon:    on
    xterm*AllowIconInput:   on
    xterm*AutoRaise:        on
    xterm*termtype:         vt100
    xterm*ttyModes:         intr ^c erase ^h susp ^@ dsusp ^@ kill ^u eof ^d
    xterm*jumpScroll:       true
    xterm*multiScroll:      true
    xTerm*cutNewline:       False
    xterm*scrollTtyOutput:  false
    xterm*scrollkey:        true
    ! Xterm Colors
    !black
    xterm*color0:           #303430
    xterm*color8:           #CDB5CD
    !red
    !aterm*color1:          #dca3a3
    xterm*color1:           #bf7979
    xterm*color9:           #f4a45f
    !green
    xterm*color2:           #97b26b
    !aterm*color2:          #afc5af
    xterm*color10:          #c5f779
    !yellow
    xterm*color3:           #cdcdc1
    xterm*color11:          #ffffef
    !blue
    xterm*color4:           #86a2be
    xterm*color12:          #98afd9
    !magenta
    xterm*color5:           #d9b798
    xterm*color13:          #d7d998
    !cyan
    xterm*color6:           #a1b5cd
    xterm*color14:          #a1b5cd
    !white
    xterm*color7:           #ffffff
    xterm*color15:          #dedede
    Xft.dpi:                96
    ! Urxvt Colors
    !black
    urxvt*color0:           #505450
    urxvt*color8:           #505450
    !red
    !aterm*color1:          #dca3a3
    urxvt*color1:           #bf7979
    urxvt*color9:           #f4a45f
    !green
    urxvt*color2:           #97b26b
    !aterm*color2:          #afc5af
    urxvt*color10:          #c5f779
    !yellow
    urxvt*color3:           #cdcda1
    urxvt*color11:          #ffffaf
    !blue
    urxvt*color4:           #86a2be
    urxvt*color12:          #98afd9
    !magenta
    urxvt*color5:           #d9b798
    urxvt*color13:          #d7d998
    !cyan
    urxvt*color6:           #a1b5cd
    urxvt*color14:          #a1b5cd
    !white
    urxvt*color7:           #ffffff
    urxvt*color15:          #dedede
    ! Urxvt Settings
    urxvt*scrollTtyOutput:  false
    urxvt*scrollTtyKeypress:false
    urxvt*loginShell:       true
    urxvt*font:             xft:Bitstream Vera Sans mono:size=10
    urxvt*scrollBar:        false
    urxvt*foreground:       white
    urxvt*background:       #303430
    urxvt*geometry:         80x25
    urxvt*saveLines:        10000
    urxvt*inheritPixmap:    false
    urxvt*fading:           40
    Aterm*transparent: true

  • Handling images with swing components...

    im making a chat program and i have used a jTextArea object as message history display. now i want that whenever :-) is included in a string it is automatically replaced by a happy smiley. i have written the following code to capture the smiley GIF intoa file...
    File f = new File("c:/emoticons/yahoo/happy.gif");
    BufferedImage img = ImageIO.read(f);now, as we know, jTextArea can only show plain text. so instead of JTextArea, which component should i use for message histroy to display string along with smiley.

    while(!str.equals(""))
                    if(str.equals(":-)")||str.equals(":)"))
                        try
                            ImageIcon ico = new ImageIcon("c:/Emoticons/Yahoo/happy.gif");
                            ClientGUI.history.insertIcon(ico);
                        catch(Exception e)
                            System.out.println("Cannot load image!");
                    else
                        ClientGUI.history.setText(str);
                }hi. i tried this code. it does display the smilies but goes into an infinite loop and keeps flooding the textpane with the smiley!

  • Why do I have to insert someone else's resume into my profile to change my copy paste settings??

    I just want to use copy/paste with my mouse.
    Why can't you make it just a toggle in Firefox?
    Why do I have to enter someone else's resume in my user.js file??
    That makes even LESS sense.
    For Firefox:
    Quit Firefox. If you have Quick Launch running (in Windows, an icon in the toolbar), quit that too.
    Find your Firefox profile directory.
    Open the user.js file from that directory in a text editor. If there's no user.js file, create one.
    Add these lines to user.js:
    [edit: removed personal information]
    Note: The preference is site as well as protocol specific. For example:
    user_pref("capability.policy.allowclipboard.sites", "http://www.mozilla.org")
    is not the same as:
    user_pref("capability.policy.allowclipboard.sites", "https://www.mozilla.org")
    This is because the first uses HTTP while the second uses HTTPS.
    If you want to allow multiple URLs to access the Paste operation, separate the URLs with a space. For example:
    user_pref("capability.policy.allowclipboard.sites",
    "https://www.mozilla.org https://developer.mozilla.org")
    For more information about security policies, see http://www.mozilla.org/projects/security/components/ConfigPolicy.html.

    Sorry about that. You can find the addons by using:
    <br> Tools > Add-ons > Extensions
    <br> "Extensions" is under the "Get Add-ons" item
    Screenshot:
    <br> http://www.3drotator.com/support/JavaFirefox12AddOnsManagerExtensions.jpg
    I'm thinking maybe those sites use different text editors than other websites making copy and pasting outside of those webpages a PITA.
    This site tries to explain how to do what you were trying to do earlier.
    <br> http://www.infogears.com/cgi-bin/infogears/mozilla_firefox_copy_paste.html
    <br>Which is to enable access to the clipboard (the place where copied items are stored) for these sites.
    The addon [https://addons.mozilla.org/en-US/firefox/addon/allowclipboard-helper/ AllowClipboard Helper] tries to fix this on websites like the ones you go to. But it can be tricky to setup. There's a good tip from one of the reviewer's of that addon by the guy named '''pewe''' ([https://addons.mozilla.org/en-US/firefox/addon/allowclipboard-helper/reviews/351658/ Link to review]).
    So in Firefox, copying is blocked from certain text editors.
    <br> This article tries to explain why Firefox does this:
    <br> http://kb.mozillazine.org/Granting_JavaScript_access_to_the_clipboard
    It works in Internet Explorer because they are not strict about this "Javascript access to clipboard" feature but Firefox is b/c they think it's a security risk since the website can read and copy whatever you put into the clipboard.
    So long story short, certain websites use text editors that make it impossible to copy & paste stuff from them to other areas where you want to copy & paste. You could try all the stuff I mentioned above (although it's a bit nerdy) or you can save yourself the trouble/frustration and just use Internet Explorer when browsing these websites.
    If you hate switching between IE & Firefox just to check a few sites, try the [https://addons.mozilla.org/en-US/firefox/addon/ie-tab-2-ff-36/ IE Tab addon]. It lets you use Internet Explorer inside Firefox by opening it in a special tab. Don't ask me how they do it. :P But it works.

  • Unicode font for swing components

    Hi all,
    I'd like to set a Swing component (a JLabel) to a particular font so it will properly display Unicode Greek text. I've been reading all about physical vs. logical fonts, and I've read through the various Sun docs/faqs on Internationalization, Fonts, and Unicode, but I just can't get this to work. I think I'm missing something more basic here about selecting my font. My test word is the Greek "khairete," with an accent over the iota. Here is the Unicode:
    \u03c7\u03b1\u1f77\u03c1\u03b5\u03c4\u03b5
    The trick is that accented iota.
    I can launch an xterm that shows the characters I want like this:
    $ xterm -fn -misc-fixed-medium-r-normal--18-120-100-100-c-90-iso10646-1 &
    That tells me that if I can get Java to use that font, then I'm all set. I'm trying the following test program:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.io.*;
    public class GUI extends JFrame {
    public static final String MESSAGE = "\u03c7\u03b1\u1f77\u03c1\u03b5\u03c4\u03b5";
    public GUI() throws Exception {
    super();
    Font[] fonts;
    Container container;
    JLabel label;
    fonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
    for (int j=0;j<fonts.length;j++) {
    System.out.println(fonts[j]);
    container = getContentPane();
    container.setLayout(new GridLayout(0, 1));
    // try with the default font
    label = new JLabel(MESSAGE);
    container.add(label);
    printFont(label.getFont());
    // see what the default font looks like when PLAIN (to compare with fonts below)
    label = new JLabel(MESSAGE);
    label.setFont(label.getFont().deriveFont(Font.PLAIN, 12));
    container.add(label);
    printFont(label.getFont());
    // this looks the same as the default font, meaning we didn't find what we asked for.
    label = new JLabel(MESSAGE);
    label.setFont(new Font("-misc-fixed-medium-r-normal--18-120-100-100-c-90-iso10646-1", Font.PLAIN, 12));
    container.add(label);
    printFont(label.getFont());
    // this also falls back to the default.
    label = new JLabel(MESSAGE);
    label.setFont(Font.getFont("-misc-fixed-medium-r-normal--18-120-100-100-c-90-iso10646-1"));
    container.add(label);
    printFont(label.getFont());
    // this (of course) falls back to the default.
    label = new JLabel(MESSAGE);
    label.setFont(Font.getFont("not a font name"));
    container.add(label);
    printFont(label.getFont());
    // try every font we've got!
    for (int j = 0; j < fonts.length; j++) {
    label = new JLabel(fonts[j] + ": " + MESSAGE);
    label.setFont(fonts[j].deriveFont(Font.PLAIN, 12));
    container.add(label);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    pack();
    show();
    public static void printFont(Font f) {
    System.out.println(f);
    if (f != null) {
    public static void main(String[] args) throws Exception {
    GUI me = new GUI();
    But nothing in this code succeedings in printing \u1f77. As I've said, the plain old xterm can do it. I think my problem is that I haven't successfully referenced the desired font in the Java code. But how do I do this? These are the fonts available to me, according to the code above:
    java.awt.Font[family=Bitstream Charter,name=Bitstream Charter,style=plain,size=1]
    java.awt.Font[family=Bitstream Charter,name=Bitstream Charter Bold,style=plain,size=1]
    java.awt.Font[family=Bitstream Charter,name=Bitstream Charter Bold Italic,style=plain,size=1]
    java.awt.Font[family=Bitstream Charter,name=Bitstream Charter Italic,style=plain,size=1]
    java.awt.Font[family=Courier,name=Courier,style=plain,size=1]
    java.awt.Font[family=Courier 10 Pitch,name=Courier 10 Pitch,style=plain,size=1]
    java.awt.Font[family=Courier 10 Pitch,name=Courier 10 Pitch Bold,style=plain,size=1]
    java.awt.Font[family=Courier 10 Pitch,name=Courier 10 Pitch Bold Italic,style=plain,size=1]
    java.awt.Font[family=Courier 10 Pitch,name=Courier 10 Pitch Italic,style=plain,size=1]
    java.awt.Font[family=Courier,name=Courier Bold,style=plain,size=1]
    java.awt.Font[family=Courier,name=Courier Bold Italic,style=plain,size=1]
    java.awt.Font[family=Courier,name=Courier Italic,style=plain,size=1]
    java.awt.Font[family=Cursor,name=Cursor,style=plain,size=1]
    java.awt.Font[family=Lucida Bright,name=Lucida Bright Demibold,style=plain,size=1]
    java.awt.Font[family=Lucida Bright,name=Lucida Bright Demibold Italic,style=plain,size=1]
    java.awt.Font[family=Lucida Bright,name=Lucida Bright Italic,style=plain,size=1]
    java.awt.Font[family=Lucida Bright,name=Lucida Bright Regular,style=plain,size=1]
    java.awt.Font[family=Lucida Sans,name=Lucida Sans Demibold,style=plain,size=1]
    java.awt.Font[family=Lucida Sans,name=Lucida Sans Demibold Oblique,style=plain,size=1]
    java.awt.Font[family=Lucida Sans,name=Lucida Sans Oblique,style=plain,size=1]
    java.awt.Font[family=Lucida Sans,name=Lucida Sans Regular,style=plain,size=1]
    java.awt.Font[family=Lucida Sans Typewriter,name=Lucida Sans Typewriter Bold,style=plain,size=1]
    java.awt.Font[family=Lucida Sans Typewriter,name=Lucida Sans Typewriter Bold Oblique,style=plain,size=1]
    java.awt.Font[family=Lucida Sans Typewriter,name=Lucida Sans Typewriter Oblique,style=plain,size=1]
    java.awt.Font[family=Lucida Sans Typewriter,name=Lucida Sans Typewriter Regular,style=plain,size=1]
    java.awt.Font[family=Luxi Mono,name=Luxi Mono Bold,style=plain,size=1]
    java.awt.Font[family=Luxi Mono,name=Luxi Mono Bold Oblique,style=plain,size=1]
    java.awt.Font[family=Luxi Mono,name=Luxi Mono Oblique,style=plain,size=1]
    java.awt.Font[family=Luxi Mono,name=Luxi Mono Regular,style=plain,size=1]
    java.awt.Font[family=Luxi Sans,name=Luxi Sans Bold,style=plain,size=1]
    java.awt.Font[family=Luxi Sans,name=Luxi Sans Bold Oblique,style=plain,size=1]
    java.awt.Font[family=Luxi Sans,name=Luxi Sans Oblique,style=plain,size=1]
    java.awt.Font[family=Luxi Sans,name=Luxi Sans Regular,style=plain,size=1]
    java.awt.Font[family=Luxi Serif,name=Luxi Serif Bold,style=plain,size=1]
    java.awt.Font[family=Luxi Serif,name=Luxi Serif Bold Oblique,style=plain,size=1]
    java.awt.Font[family=Luxi Serif,name=Luxi Serif Oblique,style=plain,size=1]
    java.awt.Font[family=Luxi Serif,name=Luxi Serif Regular,style=plain,size=1]
    java.awt.Font[family=Utopia,name=Utopia Bold,style=plain,size=1]
    java.awt.Font[family=Utopia,name=Utopia Bold Italic,style=plain,size=1]
    java.awt.Font[family=Utopia,name=Utopia Italic,style=plain,size=1]
    java.awt.Font[family=Utopia,name=Utopia Regular,style=plain,size=1]
    java.awt.Font[family=dialog,name=dialog,style=plain,size=1]
    java.awt.Font[family=dialog,name=dialog.bold,style=plain,size=1]
    java.awt.Font[family=dialog,name=dialog.bolditalic,style=plain,size=1]
    java.awt.Font[family=dialog,name=dialog.italic,style=plain,size=1]
    java.awt.Font[family=dialoginput,name=dialoginput,style=plain,size=1]
    java.awt.Font[family=dialoginput,name=dialoginput.bold,style=plain,size=1]
    java.awt.Font[family=dialoginput,name=dialoginput.bolditalic,style=plain,size=1]
    java.awt.Font[family=dialoginput,name=dialoginput.italic,style=plain,size=1]
    java.awt.Font[family=monospaced,name=monospaced,style=plain,size=1]
    java.awt.Font[family=monospaced,name=monospaced.bold,style=plain,size=1]
    java.awt.Font[family=monospaced,name=monospaced.bolditalic,style=plain,size=1]
    java.awt.Font[family=monospaced,name=monospaced.italic,style=plain,size=1]
    java.awt.Font[family=sansserif,name=sansserif,style=plain,size=1]
    java.awt.Font[family=sansserif,name=sansserif.bold,style=plain,size=1]
    java.awt.Font[family=sansserif,name=sansserif.bolditalic,style=plain,size=1]
    java.awt.Font[family=sansserif,name=sansserif.italic,style=plain,size=1]
    java.awt.Font[family=serif,name=serif,style=plain,size=1]
    java.awt.Font[family=serif,name=serif.bold,style=plain,size=1]
    java.awt.Font[family=serif,name=serif.bolditalic,style=plain,size=1]
    java.awt.Font[family=serif,name=serif.italic,style=plain,size=1]
    javax.swing.plaf.FontUIResource[family=Dialog,name=Dialog,style=bold,size=12]
    java.awt.Font[family=Dialog,name=Dialog,style=plain,size=12]
    java.awt.Font[family=dialog,name=-misc-fixed-medium-r-normal--18-120-100-100-c-90-iso10646-1,style=plain,size=12]
    javax.swing.plaf.FontUIResource[family=Dialog,name=Dialog,style=plain,size=12]
    javax.swing.plaf.FontUIResource[family=Dialog,name=Dialog,style=plain,size=12]
    Apparently, I need to use the correct "name" to specify the font. So my next try was this:
    $ xlsfonts -ll -fn -misc-fixed-medium-r-normal--18-120-100-100-c-90-iso10646-1
    name: -misc-fixed-medium-r-normal--18-120-100-100-c-90-iso10646-1
    direction: left to right
    indexing: matrix
    rows: 0x00 thru 0x30 (0 thru 48)
    columns: 0x00 thru 0xff (0 thru 255)
    all chars exist: no
    default char: 0x0000 (0)
    ascent: 14
    descent: 4
    font type: Character Cell
    bounds: width left right asc desc attr keysym
    min 9 0 0 -3 -13 0x0000
    max 9 8 9 14 4 0x0000
    properties: 23
    FONTNAME_REGISTRY
    FOUNDRY Misc
    FAMILY_NAME Fixed
    WEIGHT_NAME Medium
    SLANT R
    SETWIDTH_NAME Normal
    ADD_STYLE_NAME
    PIXEL_SIZE 18
    POINT_SIZE 120
    RESOLUTION_X 100
    RESOLUTION_Y 100
    SPACING C
    AVERAGE_WIDTH 90
    CHARSET_REGISTRY ISO10646
    CHARSET_ENCODING 1
    COPYRIGHT Public domain font. Share and enjoy.
    XMBDFEDINFO 654
    CAP_HEIGHT 10
    X_HEIGHT 7
    FONT -Misc-Fixed-Medium-R-Normal--18-120-100-100-C-90-ISO10646-1
    WEIGHT 10
    RESOLUTION 138
    QUAD_WIDTH 9
    name: -misc-fixed-medium-r-normal--18-120-100-100-c-90-iso10646-1
    direction: left to right
    indexing: matrix
    rows: 0x00 thru 0x30 (0 thru 48)
    columns: 0x00 thru 0xff (0 thru 255)
    all chars exist: no
    default char: 0x0000 (0)
    ascent: 14
    descent: 4
    font type: Character Cell
    bounds: width left right asc desc attr keysym
    min 9 0 0 -3 -13 0x0000
    max 9 8 9 14 4 0x0000
    properties: 23
    FONTNAME_REGISTRY
    FOUNDRY Misc
    FAMILY_NAME Fixed
    WEIGHT_NAME Medium
    SLANT R
    SETWIDTH_NAME Normal
    ADD_STYLE_NAME
    PIXEL_SIZE 18
    POINT_SIZE 120
    RESOLUTION_X 100
    RESOLUTION_Y 100
    SPACING C
    AVERAGE_WIDTH 90
    CHARSET_REGISTRY ISO10646
    CHARSET_ENCODING 1
    COPYRIGHT Public domain font. Share and enjoy.
    XMBDFEDINFO 654
    CAP_HEIGHT 10
    X_HEIGHT 7
    FONT -Misc-Fixed-Medium-R-Normal--18-120-100-100-C-90-ISO10646-1
    WEIGHT 10
    RESOLUTION 138
    QUAD_WIDTH 9
    (Yes, xlsfonts prints two entries.)
    Here is a bit more data:
    [pjungwir@mccurdy unicode_gui]$ uname -a
    Linux mccurdy.nfic.com 2.4.18-14 #1 Wed Sep 4 13:35:50 EDT 2002 i686 i686 i386 GNU/Linux
    [pjungwir@mccurdy unicode_gui]$ cat /etc/redhat-release
    Red Hat Linux release 8.0 (Psyche)
    [pjungwir@mccurdy unicode_gui]$ java -version
    java version "1.4.2_01"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_01-b06)
    Java HotSpot(TM) Client VM (build 1.4.2_01-b06, mixed mode)
    If anyone has any suggestions, I would really appreciate it. I'd like to find an answer that doesn't involve editing the font.properties file.
    Thanks,
    --Paul

    Hi Sojan,
    first up, forget the notion of even tinkering with the font.properties file if you can. It's an old, outdated method of setting up the fonts that Sun doesn't even support any more. Use setFont() where you can, and die trying in the process! ;-)
    One thing I would check is which font each AWT component currently thinks it has. It's easy enough to set the font system wide with Swing components, but I'm not sure if that capability extends to AWT components (I've certainly had trouble with it in various places in the past). While you've set up the Chinese font correctly, your AWT components might still be stuck with the Java default (Helvetica, or whatever it is, which is incapable of displaying Chinese), and hence displaying the rectangles because they don't know how to handle the foreign characters. You might need to set SimSun as the font for each of your AWT components individually at a worst-case scenario.
    Hope that helps,
    Martin Hughes

  • How to improve the Performance of Swing Components

    Hi
    I have developed a GUI Framework with Swing components. I observed that when number of components are more, the GUI is slow. Could anybody suggest me the ways to improve the performance of Swing Components
    Thanks

    Hi There - I haven't found issues so far with the speed of the GUI building, it seems fast when compared with .NET applications
    Are you doing any database querying on form load? This can slow down the loading of the GUI, I use persistence in an application and before the GUI is shown the persistence unit logs in to the database and registers itself - it does take 2/3 seconds to register and complete whatever it does before the form builds and shows
    Also check if you are loading/using any network based files on form load, this can also slow down the building considerably as well. Apart from that it's hard to say where your issue may lie apart from removing controls and checking build speed until you find the one that's slowing it down (not a good approach though) I sometimes had to load csv files from a network drive and if the file server is slow or LAN speed isn't great this can also cause a delay, hope you find it.....

  • Copy paste from Illustrator

    Would be also very nice to be able to do Copy-Paste from vector element in Illustrator. The workflow of creating .svg file from every elements is very long.
    Wish to be able to do a copy-paste with an automatic .svg conversion in Edge Animate....

    Hi Jonathan,
    This feature is now available in the latest Edge Animate CC 2014 release. You can try it out.
    Find more information @ Edge Animate Help | New features summary
    Regards,
    Dharmendra

  • InDesign CS4 & IDML & Copy & Paste Bug

    Hello,<br /><br />i have build an InDesign CS 4 document with javascript; like this<br /><br />//HelloWorld.jsx<br />//Create a new document.<br />var myDocument = app.documents.add();<br />//Get a reference to the first page.<br />var myPage = myDocument.pages.item(0);<br />//Create a text frame.<br />var myHelloTextFrame = myPage.textFrames.add();<br />//Specify the size and shape of the text frame.<br />myHelloTextFrame.geometricBounds = ["6p0", "6p0", "18p0", "18p0"];<br />//Enter text in the text frame.<br />myHelloTextFrame.contents = "Hello World!";<br />var myStory = myHelloTextFrame.parentStory;<br />myStory.trackChanges=true;<br />myStory.insertLabel("innerText1","dbkey2211");<br /><br />var myInnerTextFrame = myPage.textFrames.add();<br />//Specify the size and shape of the text frame.<br />myInnerTextFrame.geometricBounds = ["6p0", "30p0", "18p0", "42p0"];<br />//Enter text in the text frame.<br />myInnerTextFrame.contents = "ziemlich sinnfreier Text";<br />var myInnerStory = myInnerTextFrame.parentStory;<br />myInnerStory.trackChanges=true;<br />myInnerStory.insertLabel("innerText2","dbkey3322");<br /><br />//Save the document (fill in a valid file path).<br />var myFile = new File("/c/HelloWorld.indd");<br />var result = "saved to:  " + myFile.fullName;<br />if(!myFile.parent.exists && !myFile.parent.create()) {<br />     result = "Not saved.  Unable to create the folder:  " + myFile.parent.fullName;<br />} else {<br />     myDocument = myDocument.save(myFile);<br />}<br />//Close the document.<br />myDocument.close();<br /><br />result;<br /><br />so i get the "HelloWorld.indd" file ... so far so good. Now i load this in InDesign and export it as IDML.<br /><br />I get for example this story<br /><br /><?xml version="1.0" encoding="UTF-8" standalone="yes"?><br /><idPkg:Story xmlns:idPkg="http://ns.adobe.com/AdobeInDesign/idml/1.0/packaging" DOMVersion="6.0"><br />     <Story Self="ue0" AppliedTOCStyle="n" TrackChanges="true" StoryTitle="$ID/" AppliedNamedGrid="n"><br />          <Properties><br />               <Label><br />                    <KeyValuePair Key="innerText2" Value="dbkey3322"/><br />               </Label><br />          </Properties><br />          <StoryPreference OpticalMarginAlignment="false" OpticalMarginSize="12" FrameType="TextFrameType" StoryOrientation="Horizontal" StoryDirection="LeftToRightDirection"/><br />          <InCopyExportOption IncludeGraphicProxies="true" IncludeAllResources="false"/><br />          <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/$ID/NormalParagraphStyle"><br />               <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/$ID/[No character style]"><br />                    <Content>ziemlich sinnfreier Text</Content><br />               </CharacterStyleRange><br />          </ParagraphStyleRange><br />     </Story><br /></idPkg:Story><br /><br />so far so good ... now i package them with "package -c HelloWorld Hello.idml" and load this document in InDesign ...<br /><br />at following i do some copy & paste actions and export the result to IDML and get this story ...<br /><br /><?xml version="1.0" encoding="UTF-8" standalone="yes"?><br /><idPkg:Story xmlns:idPkg="http://ns.adobe.com/AdobeInDesign/idml/1.0/packaging" DOMVersion="6.0"><br />     <Story Self="u186" AppliedTOCStyle="n" TrackChanges="false" StoryTitle="$ID/" AppliedNamedGrid="n"><br />          <StoryPreference OpticalMarginAlignment="false" OpticalMarginSize="12" FrameType="TextFrameType" StoryOrientation="Horizontal" StoryDirection="LeftToRightDirection"/><br />          <InCopyExportOption IncludeGraphicProxies="true" IncludeAllResources="false"/><br />          <XMLElement Self="di3i8" MarkupTag="XMLTag/Root" XMLContent="u186"><br />               <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/$ID/NormalParagraphStyle"><br />                    <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/$ID/[No character style]"><br />                         <Content>ziemlich sinnfreier Text</Content><br />                    </CharacterStyleRange><br />               </ParagraphStyleRange><br />          </XMLElement><br />     </Story><br /></idPkg:Story><br /><br />what the hell ... and find 2 differences <br /><br /> TrackChanges="false" <--- in the original this was true<br /><br />and the label has lost.<br /><br /><Properties><br />    <Label><br />     <KeyValuePair Key="innerText2" Value="dbkey3322"/><br />    </Label><br /></Properties><br /><br />so i think InDesign CS 4 have a bug in the copy and paste facility; only the content will be copied but all additional infos are lo

    Hi Bjoern,
    I'm not sure that InDesign ever really copies a story, just the text in the story. Since the label and the track changes setting were associated with the story itself (and not with the text in the story), they didn't survive the transfer from one story to another.
    It may depend on how you copy/paste--I'd expect the above to be true if you copy/paste with the Type tool, but I'm not sure what happens if you copy/paste all of the text frames in a story using the Selection tool. It may be that the label is maintained in that case.
    Thanks,
    Ole

  • Swing components and the garbage collector

    How much care does one need to take with swing components, with reference to running out of stack space? I ask because I'm writing a system for an automotive parts company, and the company tends to not reboot the machines very often...
    Anyway... if a JFrame is closed, is it and all its components marked for GCing? Do I need to call the dispose method, or is this part of the default close behaviour? Or is there something else entirely?
    Cheers

    In class that calls for .setVisible(false) of one JFrame u MUST call
    for dispose() method.
    so
    myFrame.setVisible(false)
    myFrame.dispose()
    myFrame = null // to help the garbage collector
    If u have classes that becames from JFrame (or JDialog) u can
    invoke in its constructors:
    this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE)
    This makes uncecessary to call for dispose() method explicetly.
    If u do not have this kind of classes u can invoke this method
    after u have create your JFrame
    JFrame myFrame = new JFrame();
    myFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE)
    The most important thing is REMOVE ALL LISETNERS that u have added, so, if u have classes that becames from JFrame u can ovverride
    the dispose method to do that
    eg
    public void dispose()
    super.dispose()
    removeActionListener(.....)
    and so on
    If u do not have this kind of classes u must remove all listeners u have
    added before u invoke the setVisible(false) method.
    Regards

Maybe you are looking for

  • [iPhone] Darkening the screen like in an alert manually

    Hi, Is it possible to darken the screen manually? When an alert screen pops up, the background has a neat fade effect. Is it possible to use this effect without the alert screen? Thanks for any help!

  • Error while importing the Entries from Payroll

    Dear Guru's For the First time we are Import the Entries from Payroll , Request End with the Warning message when i check the Out Put file lot of Errors eriod Error Codes EP01 This date is not in any open or future enterable period. EP03 This date is

  • Access database using Java from HTML webpage

    Hi, I've got to create some online maths tests to be taken by students with their marks being stored in a database. I've wrote some simple java code which can add/remove and modify entries in a test mySQL database that I made. What I now need to do i

  • Snmp configuration for SG300

    Hi, Am trying to configure SNMP functionality for the first time on an SG300-28 switch so I can use mrtg to monitor it.  I've defined no users, 2 groups (mrtg and mrtg2 for SNMPv1 and SNMPv2 respectively), both with No authentication required.  Defau

  • Reg:Smart Form o/p options

    hi friends i need to design a smart form for which 2 pages of output is mandatory. it mean one page shows the taxable items and the other shows non-taxable items. so i need to print the 2 pages as common everytime . where i can set the option so that