How to highlight drop destination

I have an application that allows the user to categorize items by dragging them to a list of categories, represented by simple textual labels. The drag and drop functionality works fine; but it's difficult for the user to see which category is the drop target, since there seems to be no faclity in Swing to highlight a drop target in real time.
Some of the buit-in objects do on the fly highlighting-- for example, you can see where your data will be dropped via a moving insertion point in a JTextField object-- but I don't see anything I can override or implement to provide this capability more generally.
I tried setting a MouseMotionListener on the drop targets, but you don't get mouse events during a drag (at least they were never called).
I can't believe there's no ability in Swing to do this. What am I overlooking?

I am not aware of anyhting, except maybe in Release 6 I think they might be adding stuff, but if you're implementing d'n'd yourself, you have the ability to register a DropTargetListener which can do the highlighting. Here are some of the methods of one I wrote a long time ago:     public void dragEnter(DropTargetDragEvent dtde) {
          ViewMediator.getInstance().highlightViewContainer(dtde.getLocation());
     public void dragOver(DropTargetDragEvent dtde) {
          ViewMediator.getInstance().highlightViewContainer(dtde.getLocation());
     public void dropActionChanged(DropTargetDragEvent dtde) {
     public void dragExit(DropTargetEvent e) {
          ViewMediator.getInstance().highlightViewContainer(null);
     }In general terms you highlight according to the location of the mouse pointer within your droptarget (via getLocation()).
Regards,
Tim

Similar Messages

  • How to highlight hyperlink destinations?

    I created a button in inDesign and once a user clicks it, it goes to a paragraph where I have inserted a Text Anchor. Since there are several other text blocks (paragraphs) on the page I layed out, is there anyway to highlight the paragraph where the Text Anchor is? I want users to know exactlty where to start reading.
    If this is possible, besides highlighting, is there any way to have a graphic element like a small red dor or arrow to appear next to the Text Anchored text block?
    Thank you for any help!
    Best,
    John

    Your best bet would be to view the text in the Story Editor. Choose Edit > Edit in Story Editor. Another window will open which just shows the text of the current story. The text anchor shows as a little target (circled below in the Story Editor window). There is a much more subtle indicator if you choose Type > Show Hidden Characters (the : [colon] in the same location in the normal dispay of the text.

  • How do you drop a still photo into a video?

    how do you drop a still photo into a video -- while continuing the audio track unchanded?

    by popular demand, Kelli Applies Lip Liner to Audrey's Lips has been completely re-mastered. (ok, it was just one person who asked, but she's a very intelligent and articulate observer of such matters.  she noted that the clip suggests "interesting possibilities", but that men probably would be unaware of that.  i explained that "men are pretty simple, so we don't see too many moves ahead."  she laughed.)
    i believe that in an earlier post i indicated that in the re-mastered version i would delete the in-camera audio and dub in the audio from the Zoom H4n audio recorder.  this i did.
    (syncing the video and audio continues to be a nightmare, though ).
    besides signifcantly improving the sound quality, using a separately recorded audio source allowed me to drop (2) still photos into the video track, and still preserve the continuity of the recorded conversation.
    dropping in the stills the correct way (unlike in the first re-mastered video) was easier than i thought it would be.  it's just a matter of dragging the Premiere Elements 7's red vertical timeline-cursor to the point on the timeline where you want the insert to begin, and then dragging and dropping the still photo alongside the red cursor.  the amount of time the still will appear can be shortened or lengthened by dragging with the mouse -- the same way any other file can be extended or contracted.
    the video coming out from the still was now running behind the soundtrack.  but, the timeline shows the exact duration of the still, so the video coming out was shortened with the mouse by that same duration, and then the audio and video were back in sync.
    to add the "sound effect" of the camera's shutter clicking (actually its mirror slapping) before each still appears, i found a point on the audio recording that had the click of my camera actually taking a still, and that had only a little audio from the models underneath it.  removing all the audio before and after the sound of the camera click was, again, just a matter of finding the start/stop points i wanted, moving the timeline's red cursor to those points, and using the mouse to drag the ends of the audio file alongside the cursor.
    because i wanted the sound of the camera click to merge with the converation anyway, i just put the audio file of the click on its own audio track (which allowed me to separately control its volume).
    however, when i tried to copy and paste the audio file of the camera click to the beginning of the second still photo, i was not able to copy and paste by the normal method of using the mouse to right-click-file/left-click-"copy"/left-click-"paste".  eventually, i tried doing so by clicking on "edit" on the menu bar at the upper left and then clicking on "copy" and "paste", and there was no problem.  (go figure.)
    as with the other re-mastered video, i brightened, increased contrast, made the hue a bit warmer, and added a little sharpening.  (this has to be done individually for each separate video file that makes up the whole piece -- at least that's what i did.)
    interestingly, the audio level can be tweaked directly on the timeline by using the mouse to drag up or down a horizontal yellow line running the length of the audio file.
    i again rendered in Adobe Flash Video (.flv).  (annoyingly, in XP at least, there's a default download destination that has to be reset everytime you want to save in a different location).  from a drop-down menu i selected "NTSC Flash Video 700k" (just in case) and left the file name as "Untitled" (since no matter what i change it to, it saves as "untitled.flv", so i have to rename it anyway once it's saved).
    i went into "Advanced..." and, to preserve the dimensions and the HD, i unchecked "Resize Video", chose "Same as source" for the frame rate, and checked 2 "Encoding Passes" (just in case).    
    for some reason, everytime i click the "save" button, it asks what i want to call these settings.  if i use the name i used for the same settings on the previous go-round, it says that that name is already used and (impliedly) can't be used again.  so, i add the new date, and yet another name for the same settings gets added to the drop-down menu (odd).
    once the compressed .flv file was saved, it was an easy upload to youtube.
    btw, it seems that the Elements 7's Audio Mix defaults to 0 dB, OR whatever the setting was in the prior saved version, unless i use the mouse to continuously "ride the slider pot".  that's ok for a 48-second video, but does anyone know of a way the dB can be set so that it just sits there, instead of moving back to where it previously was

  • Drag n Drop - Destination or MouseRelease Event?

    Hi, i wrote an Application which lists Files inside an archive-file.
    These files are displayed in a JTable and now I want to drag them to the lokal FileSystem.
    My problem is that these file not really exist, so i thought i create them temporarly with no content (0 Byte) and after the User completet the Drag i extract the complete Data to this files. But i cant find out how to get the Destination-Path of the dragged Files, is that possible?
    Or if i can get an Event between MouseReleased and COPY i could extract them than.
    Extract them while user drag is not possible cause the process is to slow :(
    Please, can someone help me?
    this is my actually TransferHandler-Class:
    public class DragEvent extends TransferHandler {
         private static final long serialVersionUID = 5646847570617617245L;
         private DataFlavor fileFlavor = DataFlavor.javaFileListFlavor;
         private HashMap<String, FileTableEntry> entryMap = new HashMap<String, FileTableEntry>();
         protected Transferable createTransferable(JComponent c) {
              if(c instanceof JTable) {
                   JTable table = (JTable)c;
                   List<File> files = new ArrayList<File>();
                   for(int row: table.getSelectedRows()) {
                        FileTableEntry entry = (FileTableEntry)table.getValueAt(row, 0);
                        File f = entry.getTempFile();
                        entryMap.put(f.getName(), entry);
                        files.add(f);
                   return new fileTransferable(files);
              return null;
         public int getSourceActions(JComponent c) {
              return COPY;
         public void exportDone(JComponent source, Transferable tr, int action) {
              super.exportDone(source, tr, action) ;
              try {
                   if(tr.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
                        // ===============================
                        // HERE I NEED THE NEW LOCATION :(
                        // ===============================
                        @SuppressWarnings("unchecked")     // damn Eclipse :p
                        List<File> fileList = (List<File>) tr.getTransferData(DataFlavor.javaFileListFlavor);
                        for(File f: fileList) {
                             FileTableEntry entry = entryMap.get(f.getName());
                             entry.completeFile(f);
              catch(Exception e) { e.printStackTrace(); }
         class fileTransferable implements Transferable {
              private List<File> files;
              fileTransferable(List<File> f) { files = f; }
              public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException {
                   if (!isDataFlavorSupported(flavor)) throw new UnsupportedFlavorException(flavor);
                   return files;
              public DataFlavor[] getTransferDataFlavors()  { return new DataFlavor[] { fileFlavor }; }
              public boolean isDataFlavorSupported(DataFlavor flavor) { return fileFlavor.equals(flavor); }
    }

    I ran over a chapter, Adding Drag-and-Drop Functionality, in a book, Pro Java Programming. I think it has been very helpful for my understanding so far. Even though I haven�t produced any code yet.
    At first, it is rather much you have to learn, but I think when all pieces come together, its quite straight forward.
    A question: My intent is to create a drag-and-droppable JTree. Have I understood things right if I say that I need to create some kind of Flavor-thingie, that is a TreeNode (DefaultMutableTreeNode) flavor to make it work?
    My own answer Yes if that is what I want to transfer between the drag and the drop.
    Another question related to the first:
    The following code is from an Image Viewer app where I think you shall be able to move images. Does every node need this or just the tree?
    My own answer This is at least what I do at the tree. And since a node isnt a component, it is pretty obvious it is the tree.
    protected void addNewComponent(Component comp, Point location) {
      DragSource source = DragSource.getDefaultDragSource();
      source.createDefaultDragGestureRecognizer(comp,
          DnDConstants.ACTION_COPY_OR_MOVE,
          new MyGestureListener());
      comp.setLocation(location);
      comp.setSize(comp.getPreferredSize());
      add(comp);
      repaint();
    }Message was edited by:
    sandsater

  • How to highlight/indicate particular tree Node in Tree UI element

    Hi All
    Can anybody let us know how to highlight/indicate specific node in a tree struture.
    currently i am able to display the tree struture with all the nodes & elements but it is always tasking firstnode as highlighted one or indicated one.
    if i want to highlight specific node in a tree struture...what was the procedure or any sample code then it would be great help to us.
    Thanks
    Trisha rani

    Hi Krishna
    Thanks for your reply
    I displayed the tree structure and i want to highlight specific parent node/child element , what was the sample code??
    for example my tree was displayed in the below struture and at the runtime specific child node i wanted to be highlighted i want to make selectable particular nodeType......
    Can you pls send sample codee code??
    my requirement
    A
    A1
       A2
       A3
    B
    B1      
       B2
       B3
       B4
       B5     
    now i want to make selectable or highlighted B4,B5 etc  or A2,A3 at runtime.
    The other guy who replied for this thread it is working for Parent nodes to make highlighted  like it is working for parent nodes which is have child nodes. i am able to hightlight at runtime for Nodes A,B etc .
    Now i want to highlight or make selected one for B4,A3 etc, pls provide sample code??
    it  would be great help to us
    Thanks
    Trisha Rani

  • Please give me idea how I highlight the gird row which have

    Sir
    I have gird with 5 column
    Vno
    Code
    Dept
    Date
    Amount
    Sir my need is which record have above 5000 amount that color read and other color blue
    It means above 5000 highlight in grid
    Please give me idea how I highlight the gird row which have above 5000 maount
    Thank
    aamir

    PROCEDURE pr_Set_VA (p_VA IN VARCHAR2) IS
    v_Feld VARCHAR2 (30);
    v_Item VARCHAR2 (61);
    v_Block VARCHAR2 (30);
    BEGIN
    v_Block := :SYSTEM.CURSOR_BLOCK;
    v_Feld := Get_Block_Property (v_Block, FIRST_ITEM);
    WHILE (v_Feld IS NOT NULL) LOOP
    v_Item := v_Block || '.' || v_Feld;
    Set_Item_Instance_Property (v_Item, CURRENT_RECORD, VISUAL_ATTRIBUTE, p_VA);
    v_Feld := Get_Item_Property (v_Item, NEXTITEM);
    END LOOP;
    END;

  • How to highlight the messages in the WDA?

    hi experts,
                     Iam new to Webdynpro.i just want to know how to highlight the texts displayed . like BOLD,italic etc and also colors.
    Regards,
    murthy.

    I dont think you have it via standard message area. Probably you can have a TextView UI element and use the properties Design and semanticColor to achieve this. If you have a contextNode , thats mapped to the texview and message manager writing text to this node. Solution should work.
    Greetings
    Prashant

  • How to put drop down in table control ?

    Hi All,
    I m writing one module pool program to edit table.
    I want dropdown to one field so that user can select the appropriate value. And also I want to save that record.
    So how to get the dropdown list and after editing that record how to save that in the database?
    Thanx in advance.
    -Umesh

    Hi Umesh,
    Please check this demo program RSDEMO_TABLE_CONTROL on how to add drop down list in table control. Also check this program DEMO_DYNPRO_TABCONT_LOOP_AT as well.
    To save to database you can code something like this in PAI.
    MODULE USER_COMMAND_0100 INPUT.
      SAVE_OK = OK_CODE.
      CLEAR OK_CODE.
      CASE SAVE_OK.
        WHEN 'SAVE'.
          MODIFY <database table> FROM TABLE <table control>.
          IF SY-SUBRC = 0.
          ELSE.
          ENDIF.
        WHEN OTHERS.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    Hope this will help.
    Regards,
    Ferry Lianto

  • How to highlight a text in Pqges?

    Hi, does anyone knows how to highlight a text in Pages for iPad??

    If you would like to see this very basic function added to Pages for iOS in the future, let the good folks at Apple know of your needs:
    http://www.apple.com/feedback/

  • How Do highlight text in the body of an email message in Mac Mail?

    Can anyone tell if IF and HOW I can highlight text in the body of an email message using Mac Mail (in Yosemite).  I do NOT mean MARKUP an attachment.  I want to highlight a word or phrase in the body of my email message.  I know I can change the font color, but can't seem to add a highlight!  Thanks!

    Hi,
    is is possible, - link is below. Works on Yosemite, btw.
    http://www.mihalick.us/how-to-highlight-text-in-yellow-using-apple-mail/

  • How to highlight the whole row of a particular line item of sale

    How to highlight the whole row of a particular line item of sales order depending on condition?
    Please help its urgent..
    Looking forward your reply.
    Moderator message: please do more research before asking, show what you have done yourself when asking, do not flag posts as "urgent".
    [Rules of engagement|http://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement]
    [Asking Good Questions in the Forums to get Good Answers|/people/rob.burbank/blog/2010/05/12/asking-good-questions-in-the-forums-to-get-good-answers]
    Edited by: Thomas Zloch on Aug 9, 2011 9:30 AM

    Any ideas on what would cause this NOT to work? I added this row right after the table is created and populated and it is still not highlighted when I enter the form. The snippet of code that does this is:
    MyTableModel modelS = (MyTableModel)dataModel.get("S");
    jTable1 = new JTable(modelS);
    jTable1.setRowSelectionInterval(0,0);MyTableModel is this:
    class MyTableModel extends DefaultTableModel {
      public MyTableModel(Object[] columnNames, int numRows) {
        super(columnNames, numRows);
      public boolean isCellEditable(int row, int column) {
        if (TableKey == 'S') {
          if (column == 6) {
            return false;
        if (TableKey == 'O') {
          if (column == 0 || column == 4 || column == 5) {
            return false;
        if (TableKey == 'P') {
          return false;
      return true;
    }Can anyone help? Thanks.
    Allyson

  • BI 7.0 infospoke - how to change standard destination path on appl. server

    Hello,
    I have the following problem:
    I need to extract large amounts of data from infocubes to flatfiles. I have created an infospoke to do this. However, in this infospoke, the destination path, when I choose application server, is fixed.
    In BW 3.x, there is a document "BW 3.1 Open Hub Extraction Enhancement Using Literal Filename and Path.pdf" that describes how to change the destination path for the application server.
    This solution does not work for BI 7.0, I get short dumps, probably due to ABAP OO.
    I need to extract the data to flat files on the application server, not on my local machine, nor into a table in SAP itself, so I need to change the destination path, because the amount of free storage is limited in the standard destination path.
    Has anyone encountered this problem in BI 7.0 and solved it?
    best regards
    Ting
    Edited by: Ting Kung on Jun 30, 2008 9:19 AM
    Edited by: Ting Kung on Jun 30, 2008 9:19 AM
    Sorry, wrong subforum, will close this

    Hi Ting.
      I never had a simmilar problem but, if you go to your InfoSpoke, right click --> "Change" you can see (and change... ) the following values:
    Destination Type: FILE  (the one you have choosen)
    Application Server: Check Box (I think this is your setting)
    Server name: (BW server)      
    Type of File Name: (Here you can choose Between "File Name" or "Logical File Name")
    Appl.Server File N: "MY_FILE.CSV" (for example)
    Directory: (The directory you want - take a look at the end of this post )         
    Separator: (The field separator)
    Note : If you are working with Linux or Unix you have to look if the BW system user has the corresponding rigths to write in the FileSystem.
    .          In the beginning I advice you to use something like this /usr/sap/<SID>/DVEBMGS<XX>/work
    Hope it helps.
    Regards.

  • How to highlight text in JTextField?

    Hi all, I know this is a very simple question but I just couldn't find its solution and I'm rushing for my project.
    My question is: how to highlight all the text in JTextField when it gets focus?
    Thanks a lot in advance!
    Janet

    You have to add a FocusListener in the JTextField and override the focusGained() method to select all the text with JTextField.selectAll().
    class MyFrame {
      JTextField text = new JTextField();
      // when creating the frame
      text.addFocusListener(new FocusAdapter() {
        public void focusGained(FocusEvent e) {
          doSelectAllText(); 
      void doSelectAllText() {
        text.selectAll();
    }Hope this help.

  • How to highlight text in the iCloud web app

    Hi,
    My computer recently broke so I had to use my mom's windows computer to do my homework. I had to use the iCloud web app Pages to do my homework. My assignment requires to be able to highlight stuff so does anyone know how to highlight text in the iCloud web apps?

    You can do this easily by using a "modify class" parameter in your web template.
    Following methods are of your interest to change char/KF headers.
    CAPTION_CELL          changes formats/values of characteristic headers
    STRUCTURE_CELL          changes formats/values of key figure headers
    Hope it helps.
    Hari Immadi
    http://immadi.com
    SEM BW Analyst

  • How to change archive destination folder

    Hi,
    Im using oracle 11g,
    when i run this cmnd, im seeing the following
    sql> archive log list
    archive log list
    Database log mode Archive Mode
    Automatic archival Enabled
    Archive destination /home/oracle/archivelog
    Oldest online log sequence 2277
    Next log sequence to archive 2279
    Current log sequence 2279
    the disk space is low on this destination folder
    So I need to change the archive destination new folder /u03/arch
    Please let me know how to change the destination
    Thank you
    Edited by: praveenb on Nov 3, 2011 6:22 AM
    Edited by: praveenb on Nov 3, 2011 6:24 AM

    Hi TYL,
    I run the command
    SQL> show parameter log_archive_dest
    NAME TYPE VALUE
    log_archive_dest string
    log_archive_dest_1 string location=/home/oracle/archivel
    og
    log_archive_dest_10 string
    log_archive_dest_2 string
    log_archive_dest_3 string
    log_archive_dest_4 string
    log_archive_dest_5 string
    log_archive_dest_6 string
    log_archive_dest_7 string
    log_archive_dest_8 string
    NAME TYPE VALUE
    log_archive_dest_9 string
    log_archive_dest_state_1 string enable
    log_archive_dest_state_10 string enable
    log_archive_dest_state_2 string enable
    log_archive_dest_state_3 string enable
    log_archive_dest_state_4 string enable
    log_archive_dest_state_5 string enable
    log_archive_dest_state_6 string enable
    log_archive_dest_state_7 string enable
    log_archive_dest_state_8 string enable
    log_archive_dest_state_9 string enable
    SQL>
    Im seeing      ORA-00257: archiver error. Connect internal only, until freed. (DBD ERROR: OCISessionBegin)
    Please let me know how to solve this issue
    Thanks
    Edited by: praveenb on Nov 3, 2011 7:31 PM

Maybe you are looking for

  • Vendor Open items

    Hi, I am trying to use "post with clearing" transaction (F-51) and using the "outgoing payments" option there to clear the open items of the vendor. But the system is giving the message as "No open items found" eventhough the vendor has open invoices

  • Interactive report: third screen not displaying

    Hi Experts, I am doing a interactive report in ALV grid...and my requirement is when the user clicks on SPMON which is displayed on the initial screen the first screen should display and in first screen when the user clicks LIFNR second screen should

  • Multiple email accounts in mac mail signatures

    My boss uses Mac Mail with five different email accounts, each with an associated email signature. When she composes an email, the "from" field defaults to whichever email account she used last, and its associated signature appears in the email. This

  • Where can I buy OECDs to install Sol2.6 on E220R?

    Hello I've been trying to purchase with no luck, the required OECDs to install Sol2.6 on an E220R. Would anyone recommend a vendor or be willing to sell/share/send me a copy of the required software ? OG Regarding: Operating Environment Installation

  • Native SQL to an external oracle database

    Hello experts,      I like to read some data from an external oracle database with native sql statements. Which prerequisites are neccessary to do so? In detail: which customizing must be performed? Wich authorizations are necessary on the local SAP-