TransferHandler text "cut" action

Hello,
I've searched about these forums a bit, and haven't found any threads with answers; hopefully this one will be more successful!
When installing a custom TransferHandler on a JTextComponent, the component's default behavior for Cut/Copy/Paste is overridden.
I'm doing something special with Cut/Paste, so that's fine... But I would like to retain the standard "cut" action. In the TransferHandler, I find this method, which shows an action of MOVE on cut actions... Is this what I should capture?
public void exportToClipboard(JComponent comp, Clipboard clip,
                   int action) throws IllegalStateException {
              super.exportToClipboard(comp, clip, action);
              if( action == MOVE ){
                   // cut the text here?
         }Is that where I should tap into the handler to remove the text? If so, what's the cleanest way to remove selected text from a JTextPane?
Cheers.
Alex

-> When installing a custom TransferHandler on a JTextComponent, the component's default behavior for Cut/Copy/Paste is overridden.
Do you write the TransferHandler from scratch or do you extend some other class. If so which class do you extend?
-> I'm doing something special with Cut/Paste, so that's fine...
ok
-> But I would like to retain the standard "cut" action.
but you just said you are doing something special with "cut"
Maybe if you gave us your requirement we can suggest whether you are approaching the problem correctly. Is this strictly a "drag and drop" question. Or is this also a "cut" feature that is required when you use the Ctrl+X.

Similar Messages

  • New Text File Action Does Not Output Correctly (Corrupts)

    I posted this in here by accident. I reposted it in the 10.5 Automator forum...
    I have a simple automator script that uses "Get Specified Text" that contains some arbitrary shell script text, and I pass that to "New Text File" which has the location selected from a variable called "Temporary path" of value "/tmp". The output of 'New Text File" will not contain the text I specified. Here are steps to recreate:
    New automator script
    Get specified text action with the following text:
    #!/bin/sh
    cd "`dirname \"$0\"`"
    if [ true ]; then
    echo 1
    fi
    New variable called "Temporary path" with the value "/tmp"
    New text file action
    --- Save as: test.txt
    --- Where: "Temporary path" (drag Temporary path to the drop down box)
    --- Replace existing file: checked
    I run the script. New text file result shows "/private/tmp/test.txt". Then from the "Terminal" I try to view it ("cat /tmp/test.txt") and the contents are:
    if [ true ]; then\"`"
    fi echo 1
    So the specified text was corrupted. If I create the new file in Desktop or Documents (tried those) it works correctly. What is so special about /tmp? Is there a reason why this shouldn't work?
    Regards,
    John
    Message was edited by: techiejohn

    Alas, my example does work... In hopes of narrowing the problem I tried to narrow the text.
    Anyway below is the full "script" that I'm trying to write to the file that does not work, although if you copy it from here directly, it does work. So to reproduce, I can copy it from here to TextWrangler (that will fix the extra blank lines) then from TextWranger to Automator and the issues remains. The result of "Get specified text" looks correct, but the output still is not.
    <pre>
    #!/bin/bash
    cd "`dirname \"$0\"`"
    clear
    \# display output from a previous run
    if \[ -e "$0".txt \]; then
    cat "$0".txt
    /bin/echo -n "Run again? "
    read run
    if \[ "$run" = "n" -o "$run" = "N" -o "$run" = "no" -o "$run" = "No" -o "$run" = "NO" \]; then
    run=""
    else
    run="Yes"
    fi
    else
    run="Yes"
    fi
    if \[ "$run" \]; then
    date
    echo "Running unison for $USER..."
    if \[ -e "/Users/$USER" -a -e "/Volumes/$USER" \]; then
    /opt/local/bin/unison \
    "/Users/$USER" "/Volumes/$USER" \
    -auto \
    -rsrc false \
    -terse \
    -logfile /dev/null \
    -ignore "Name .DS_Store" \
    -ignore "Name .Spotlight*" \
    -path "Desktop" \
    -path "Documents" \
    -path "Downloads" \
    "$@"
    exit=$?
    case "$exit" in
    0) echo "Successful synchronization; everything is up-to-date now.";;
    1) echo "Some files were skipped, but all file transfers were successful.";;
    2) echo "Non-fatal failures occurred during file transfer.";;
    3) echo "A fatal error occurred, or the execution was interrupted.";;
    esac
    else
    echo "/Users/$USER or /Volumes/$USER does not exist."
    exit=255
    fi
    else
    exit=0
    fi
    \# wait for error acknowledgement
    if \[ "$TERM" -a "$TERM" != "dumb" -a "$exit" -gt 0 \]; then
    /bin/echo -n "Error #$exit; press enter or return to continue: "
    read
    fi
    \# close the terminal window
    termpid=`/opt/local/bin/pstree -p $PPID | grep Terminal.app | grep -v grep | awk '{print $2}'`
    if \[ "$termpid" \]; then
    kill "$termpid"
    fi
    exit $exit
    </pre>

  • HT202159 Tried restarting download from the "Purchases" tab but the app comes out with "an error ocurred " message and I the button next to it is grey without any text or action. Please help, cannot dowload bad piggies game

    Tried restarting download from the "Purchases" tab but the app comes out with "an error ocurred " message and I the button next to it is grey without any text or action. Please help, cannot dowload bad piggies game

    Hi aaronvilla,
    Sorry to hear you are having issues with your iTunes Store purchase.   The following information should help you with this:
    How to report an issue with your iTunes Store, App Store, Mac App Store, or iBookstore purchase
    To report an issue with your iTunes Store, App Store, Mac App Store, or iBookstore purchase, follow these steps:
    Find the email receipt for your purchase.
    Click Report a Problem under the app that is having the issue.
    When prompted, enter the Apple ID and password you used to purchase the item, then click Report a Problem.
    Click Report a Problem next to the item you are having an issue with.
    From the Choose Problem dropdown menu, choose the appropriate issue.
    Follow the onscreen instructions and—if prompted—type a description of the problem into the text field.
    Click Submit to have your issue reviewed.
    Hope this helps ....
    - Judy

  • How to avoid text cutting on iBooks?

    Dear All,
    In epub 3 when multicolumn text used means text cuts on the top and bottom margin, flows on the next page. Kindly suggest me how to avoid these type of errors in iBooks.
    Thanks,
    Muzammil

    Hi Sreevidhya,
    In the collection renderer that you are using in the layout, there are 2 collection renderer.
    One for display on the tab and the other for display inside the tab content.
    Edit the one for display on the tab, for the parameter Style Safe = Yes
    Check the layout now.
    Check this link [Collection renderer settings|http://help.sap.com/saphelp_nw70/helpdata/EN/87/3d48475ee8bd448c4031aa98d90524/content.htm] for the section, Additional Parameters of the Collection Tab Renderer Settings Group
    Regards
    BP

  • E-Rec: Create Requistion - *Text CUT*

    Hi All,
    Requistion request - content/text is getting CUT in Objectives, Competencies and Responsibilites after clicking on SAVE & SEND in Manager role via Mss.
    Can any one share releated SAP note to rectify this - Text Cut.
    Thanks,
    Asha...

    Hello Asha,
    This you need to  check from the Process and Form side, how you defined te fields and thir properties. I dont think we have any note in the Standard to correct this.
    Best Regards,
    Deepak..

  • Text cut of on very bottom of page when I print - Photosmart 6520; Macbook Pro

    I don't know what's going on, but when I print two-sided from a word doc on my mac, the the lower half of the text at the very bottom of each page cuts off.  Can anyone help me fix this problem?  I'd really appreciate it.

    Hi bkflores32,
    Thank you for visiting the HP Support Forums! I see when you print a 2 sided document from Word to your HP Photosmart 6520 it cuts off the lower half of text on the bottom of each page. I would first like us to make sure it is not the hardware, please print out the 2 page document as single pages, now I want you to make a 2 sided copy. Does this cut off the bottom text or does this come out with no print quality issues?
    If the copy comes out fine, please let me know the following:
    1. What is your current Mac OS X?
    2. Did you recently upgrade your Mac OS X?
    3. Are all Apple updates installed and up to date?
    I look forward to hearing from you.
    HevnLgh
    I work on behalf of HP
    Please click “Accept as Solution” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos Thumbs Up" to the left of the reply button to say “Thanks” for helping!

  • Gallery title text cut off and cover image not updating

    Hello,
    I've been struggling with this for a couple of weeks now, and it's driving me mad. I've been making a book in iBook Author on my iMac (10.10.2). When I preview it in iBooks on the mac it all looks fine, but when I send it to my iPad2 (iOS 8.2), which I do via dropbox, the front cover image reverts to the default for the template I choose, and gallery and interactive widget title text gets cut off (see attached pic) regardless of the size I make it, or the indent I specify.
    I've tried deleting the book several times, restarted the iPad, and whatever I do it still appears the same.
    I'd be grateful for any suggestions.
    Cheers,
    Kev.

    Hi Christine,
    When you say " It's not there when viewed outside of Cp/swf. Using v5.5.l", does that mean this problem only occurs in a specific output?
    Try this -- Go to preferences-- SWF Size and Quality and under customer, uncheck Advance Project Compression, republish the course and check the results.
    Thanks,
    Anjaneai

  • IPhone e-Mail bug: Text cut off below a picture

    Hi Guys,
    Just discovered a very annoying bug in iPhone's mail client: If you are creating a new e-mail and paste a picture into it, the text below the picture will be cut off completely. So if you have a mail: "text before [PICTURE] text after" then it will only send: "test before [PICTURE]" and the "text after" will be dissapeared to the thin air.
    This is rather annoying and I would consider it as a serious bug.
    Tamas
    PS: I use iPhone 5 and iOS 6.1 and use Exchange mail settings for accessing Gmail (to get push notifications from Gmail)

    Hi 1980LND,
    Thanks for your help, I am not convienced if backup and restore would help. In the meanwhile I have found few discussions about this from 2010 -- Apple blames Microsoft Outlook protocol for this, but in my opinion this is wrong. If that is a known bug Apple should really warn their customers about losing data if they try to do that. Or just fix it even if Microsoft broke some RFCs. But yeah, with a message box with the warning "Due to a bug in Outlook protocol you are going to lose your text below the picture. Do you really want to continoue and lose the text below your picture? [I am Dumb Yes] [God No!]" would be sufficient, just do not let me hang and wonder where my text evaporated.
    Thanks again
    Tamas

  • Bottom half of text cut off

    My printer: Photosmart C6280 All-in-one. The printer connects to my wireless router via Ethernet cable. Two computers use this printer on a wireless home network. The problem has occurred with both computers. Both computers (an HP desktop and a Gateway laptop) run Windows Vista Home Premium. The problem I describe occurs when printing text from Microsoft Word 2007.
    From time to time, the last line of text in a document or a label comes out with the lower half of the entire bottom line cut off. The odd thing is that sometimes (but not always), I can resend the print job and get good results. For example, on one occasion after encountering this problem two consecutive times with a particular document, I re-sent the print job and used the back side of a used sheet. It printed correctly, so I put a new sheet of paper into the tray and tried a fourth time. This time, I got the same unacceptable result! Tried a fifth time and got a good print.
    One important point: The problem has never once occurred when I print photos. The problem seems to occur only when printing text.

    We were also having this problem but after researching around on the net and finding some other people with the same issue, we found the following fix worked (based on a Windows 7/Vista Machine):
    Click Start > Devices and Printers
    Right click 'HP Photosmart C7200 series' and click Printer Properties
    Click the Ports tab
    Uncheck Enable Bidirectional Support
    For XP users, you can get to the same thing by finding your printer in the "Printers" area of Control Panel. Following this, opening the properties for your printer from there either by right clicking directly on the printer, or by double clicking the printer and then in that window selecting Printer > Properties.
    We found that the above worked for us so I hope it works for some of you too.

  • Texts cuts off when I open a pdf document

    I bought an ebook and whenever I open it in Adobe Reader the text on the right side is partially cut off.  I thought it was a page size thing, but that didn't work at all.  I've opened it in other formats so I know nothing is wrong with the file.  I just find it weird as I've never had this issue with Adobe and can't figure out what to do. 

    Yeah.  I thought it was because the zoom was so high.  It was at like 300% but when i zoomed out to 100 the document itself just shrank so it was a page in the middle of a grey background, but the text was totally uneffected.

  • Calendar (iCal) bottom of text cut off

    Hi all. Just recently, the top of all event title text in Calendar is cut off. And the words up on top has shifted up, I believe it used to be centered in its boxes.  I'm referring to what I see on the screen of my MacBook Pro Retina, NOT in printed documents. Here's a sample. Any suggestions? Thanks in advance.

    Bob,
    Have you attempted to eliminate duplicates using Font Book?
    Do you have Lucida Grande enabled? If not, it should be.

  • Calendar - Top of Text Cut Off

    Hi all. Just recently, the top of all event title text in Calendar is cut off. And the words up on top has shifted up, I believe it used to be centered in its boxes.  I'm referring to what I see on the screen of my MacBook Pro Retina, NOT in printed documents. Here's a sample. Any suggestions? Thanks in advance.

    Oops, I mean that the BOTTOM of the text is cut off.

  • Credit Scroll - Title Effect - Cannot Adjust Border - Text Cut Off

    QUESTION:
    How can I insert 2 - 3 paragraphs into the credit scroll text effect, format it so the sides of it are not cut off, and prevent Final Cut Pro from reverting back to the default text that comes with the video effect?
    SUMMARY:
    I am trying, in vain, to copy and paste 2 - 3 paragraphs that I want to scroll across the page as if they were credits. Furthemore, I am trying to justify the whole thing to the left. The left and right edges of the paragraphs are cut off when I render the video using compressor. There is some kind of white box that holds the text. It appears to be the boundary of the text effect.The text bumps up against the boundary, but I cannot easily tell the text to give itself some space between it and the white boundary. If I double click the text effect I bring up a few difficult-to-use formatting tools. There are little white circles and triangles that appear to represent left tab, center tab, and right tab. Everything I do with these circles and triangles seems to have no impact or screws it up. To further complicate matters it seems when anytime I interact with this rudimentary formatting tool set I cause the entire text effect to default to its original form. I have to quit out of Final Cut Pro and reopen it and repeat the process by repasting the text.

    I gave up and just made an image in photoshop. I then keyframed the image to scroll across as the credit scroll effect should have done.

  • Menu page image and text cut off on burned DVD

    I burned a DVD using the travel theme. The project looks fine on my Intel iMac, but when I put the disc into my home DVD player, the menu page, which is not in letterbox format like the rest of the project, has the outer edges cut off and the text and images don't fit the television screen. The rest of the disc looks fine. Any suggestions as to why this happened?
    Thanks!

    Hi DrumRunner:
    iDVD: How to Determine TV Safe Area
    http://docs.info.apple.com/article.html?artnum=50151
    iDVD: Creating widescreen DVDs for standard size televisions
    http://docs.info.apple.com/article.html?artnum=303030
    Then there is:
    Old Toad's recipe for:
    Masking Movies to the TV Safe Area for iDVD
    The mask should be 640 x 480 pixels and the movie 514 x 386 (I arrived at this figure by making a snapshot of the TV save area of an iDVD project with Snapz). You can set this size after you’ve joined it with the mask movie with Quicktime Player Pro.
    Import the black mask jpg file into iMovie and and export it as a .mov file at the same length as your movie (there may be a way to not have to create a specific length mask for each movie but I haven't found it. If the times do not match the movie file will be synced to the length of the mask movie).
    Open the mask movie in QT Player Pro and then open your regular movie and make it the front window of the two. Now you'll need to run a QT Player AppleScript titled "Merge Movie 1 into Movie 2". You can get it from this Apple site: Quicktime Player Scripts.
    Then run the script. You can then run the merged movie to check it out. Your movie will be located in the upper lefthand corner of the window when played.
    When you open the Movie Properties window from the Window menu for the combined file you’ll see the following:
    Video Track 1: the black mask
    Video Track 2 : your movie file
    Tween track: Have no idea what this is.
    Sound track: self explanaotry
    Black mask.
    To set the size of your movie to the correct size select it in the Properties window and click on Visual Settings pane. Then enter 514 in the first field and hit enter. With the Preserve Aspect Ration box checked the other size will automatically be set.
    To center the video track in the center of the mask select the Video Track 2 item and plug in a offset of about: 60 & 40. You'll probably have to play with that to fine tune the centering. Doing the math and subtracting the movie dimensions from the mask dimensions and dividing by two just didn't get it perfectly centered. I'm sure I'm missing something here.
    Now save as a new self contained movie after checking the High Quality box at the bottom right.
    You can not import it into iDVD for preview and burning. One drawback is that you can't invoke the TV save area for a movie in iDVD to check it out. But you can mark it on the monitor screen while viewing a menu or slideshow and then play the movie to see how close you came.
    Since I made this workflow I've found that iDVD NTSC likes 720 x 540 pixels for standard video in NTSC format so you might want to make the black mask that size and adjust the video accordingly. As I said it takes some fiddling.
    Does that help?
    Sue

  • How do I retain Jbutton text for action event & set img icon on Jbutton

    I need to retain the text on my button as I use this to identify the action event in actionPerformed method when the button is pressed.
    Hoe do I add an image icon to the Jbutton without effecting this?
    [/b]
    class CalcPanel extends JPanel
        implements ActionListener, CurrencyVals
    //currency panel data members
        JButton[] cb = new JButton[4];
    JPanel cbkeys = new JPanel(new GridLayout(4,1));
    //Toolkit tk = Toolkit.getDefaultToolkit();
        //Image img = tk.getImage("D:/temp/ausflag.jpg");
    public CalcPanel(){
    ImageIcon b = new ImageIcon("D:/temp/ausflag.jpg","AUS");
        cb[AUS]= new JButton(b);  //cb[AUS]= new JButton("AUS");
          cbkeys.add(cb[AUS]);
          cb[AUS].addActionListener(this);
    setLayout(new BorderLayout());
        add(display, BorderLayout.NORTH);
        add(keys, BorderLayout.CENTER);
        add(cbkeys, BorderLayout.EAST);
        add(label, BorderLayout.SOUTH);
        public void actionPerformed(ActionEvent evt){
          Object source = evt.getSource();
          int id;
          if (keyBoard) {
            if (source instanceof JButton) {
              String s = ((JButton)source).getText();
    [/b]Regards
    Synfield

    if(keyBoard) { ??! [/b]... do have cause to feel flattered?
    Copy and paste this and save a small eg;- 25px high x 50px wide Jpeg image in the same file and call it "new.jpg", then study it, this posted program (again?) to see where your code went astray.
    THEN, figure out what you want to do with your code ...keep at it!
    Sue x
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class ButtonIcon extends JFrame implements ActionListener {
    String []str ={"abc","def","ghi","jkl","mno","pqr","st","uvw"};
    JButton b[] = new JButton[str.length];
       JButton on = new JButton("ON");
       JButton off = new JButton("OFF");
       JButton picture;
       JPanel panel;
       String str2="";
       Font font = new Font("Comic Sans MS" ,0, 14);
       boolean keyBoard;
       ImageIcon icon = new ImageIcon("new.jpg");
    public ButtonIcon(){
       Container c = getContentPane();
       panel = new JPanel();
       panel.setLayout(new FlowLayout());
       picture = new JButton(icon);
       for (int j=0; j<=str.length-1; j++){
             b[j]= new JButton(str[j]);
             b[j].setFont(font);
             panel.add(b[j]);
             b[j].addActionListener(this);
       on.addActionListener(this);
       off.addActionListener(this);
       panel.add(on);
       panel.add(off);
       panel.add(picture);
       c.add(panel);
       public void paint (Graphics g) {
          super.paint (g);
          Graphics2D G = (Graphics2D) g;
          G.setColor(Color.red);
          G.setFont(font);
          G.drawString(str2, 25, 150);
    public void actionPerformed(ActionEvent evt){
        String command = evt.getActionCommand();
        if (keyBoard) {
           if (evt.getSource() instanceof JButton ) {
               str2 += command;
           if (evt.getActionCommand().equals("OFF")) str2 = "";
        if(command.equals("ON")) keyBoard = true;
        if(command.equals("OFF")) keyBoard = false;
    repaint();
    public static void main (String []args){
       ButtonIcon boo = new ButtonIcon();
       boo.setSize(300,200);
       boo.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE );
       boo.setVisible(true);

Maybe you are looking for

  • IPod won't restore, format, or update

    I received this iPod as a Christmas gift 2005. I received another one Christmas 2006 so I gave the first one to my 12 year old daughter (right after warranty expired). She has used it for a month, and now all these problems. At first I thought she ma

  • Icantget my web cam to load whyor work

    when i install the drive for my web cam all i get is there it cannot be installed because of an error why == This happened == Not sure how often == i loaded the drive for my web cam

  • New batteri for iphone 3?

    Hi How much does a batteri cost for an Iphone 3 in DKK? Best Regards, Sezaneh

  • Problem in downloading an html page that contains images

    Hi, This is surekha I am facing a problem in downloading an html page that contains images The file is downloading , but when I access the the downloaded file it displays X marks in the place where images r present.... How can i download a html file

  • LR 4 Gradiation & Spot tool adjustments

    LR 4 Gradiation & Spot tool adjustments are the same as in LR 3. In other words, no WB adjustment available. Only the same adjustments that were available in LR 3.