Marquee function for JTextField?

Hi,
currently I'm working on a group project to do a media player. I have a JTextField that will display the file name and duration of it. And this text should change when another media file is being played. I am now able to just set the text by using .setText(String text) method.
It is okay if the text does not exit the length of the JTextField. However, if the text is too long, it is cut off halfway. I am thinking of implementing it in such a way that when the text length exceeds the JTextField's length, the text will move from right to left like what marquee does...
Do I have to use applet? Or thread? Or neither? Thanks...
Cozel

This should get you started:
* @(#)TextFieldMarquee.java 1.00
package de.behr.gui;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
* <code>TextFieldMarquee</code>
* @author Thomas Behr Nov 30, 2002
public class TextFieldMarquee extends JTextField implements Marquee
     private final Animater animater;
     private final Timer timer;
     private String buffer2;
     private String delimiter;
     private char[] buffer1;
     private int maximumDisplayedCharacters;
     private int scrollDirection;
     private boolean useDelimiter;
      * Constructor
     public TextFieldMarquee()
          animater = new Animater();
          timer = new Timer(200, animater);
          delimiter = " +++ ";
          maximumDisplayedCharacters = 512;
          scrollDirection = RIGHT_TO_LEFT;
          useDelimiter = false;
          setHorizontalAlignment(scrollDirection);
          setText("");
          setEditable(false);
          setBorder(BorderFactory.createEmptyBorder());
     public String getText()
          return buffer2;
     public void setText(String t)
          buffer2 = t;
          buffer1 = (useDelimiter)
                              ? (t + delimiter).toCharArray()
                              : t.toCharArray();
          animater.reset();
          _setText("");
     public void setDelay(int milliseconds) {
          timer.setDelay(milliseconds);
     public void setDelimiter(String delimiter)
          this.delimiter = delimiter;
     public void setMaximumDisplayedCharacters(int maximumDisplayedCharacters)
          this.maximumDisplayedCharacters = maximumDisplayedCharacters;
     public void setScrollDirection(int scrollDirection)
          this.scrollDirection = scrollDirection;
     public void setUseDelimiter(boolean useDelimiter) {
          this.useDelimiter = useDelimiter;
     public void startAnimation() {
          timer.start();
     public void stopAnimation() {
          timer.stop();
     private void _setText(String t)
          super.setText(t);
     private String _getText()
          return super.getText();
     private class Animater implements ActionListener {
          private int offset;
          public Animater() {
               offset = 0;
          public void actionPerformed(ActionEvent e) {
               if (TextFieldMarquee.this.scrollDirection == RIGHT_TO_LEFT) {
                    scrollRightToLeft();
               } else {
                    scrollLeftToRight();
          public void reset() {
               offset = 0;
          private void scrollLeftToRight() {
               final int length = TextFieldMarquee.this.buffer1.length;
               final String text =
                                   TextFieldMarquee.this.buffer1[length - offset - 1] +
                                   TextFieldMarquee.this._getText();
               int end = text.length();
               if (end >= TextFieldMarquee.this.maximumDisplayedCharacters) {
                    end--;
               TextFieldMarquee.this._setText(text.substring(0, end));
               offset++;
               offset %= length;
          private void scrollRightToLeft() {
               final int length = TextFieldMarquee.this.buffer1.length;
               final String text =
                                   TextFieldMarquee.this._getText() +
                                   TextFieldMarquee.this.buffer1[offset];
               final int textLength = text.length();
               int start = 0;
               if (textLength >= TextFieldMarquee.this.maximumDisplayedCharacters) {
                    start++;
               TextFieldMarquee.this._setText(text.substring(start, textLength));
               offset++;
               offset %= length;
}

Similar Messages

  • Key and action binding for JTextField

    when JtextField is focused I need to bind a combined key command to execute a function. For example when user presses ctrl+n and action will be executed. How can I do this for JTextField?

    Use following method:
    public void addKeyBoardAction(JComponent comp, String name, KeyStroke keyStroke,
                                      Action action) {
            comp.getInputMap(JComponent.WHEN_FOCUSED).put(keyStroke, name);
            comp.getActionMap().put(name, action);
        }Call the method as:
    JTextField text=new JTextField();
    addKeyBoardAction(text, "MyTask", KeyStroke.getKeyStroke(
         KeyEvent.VK_SPACE,
         KeyEvent.CTRL_MASK), new MyAction());Thanks,
    Mrityunjoy
    Edited by: mrityunjoy on 17 Mar, 2009 6:40 PM

  • BI IP --- Planning function for File Upload

    Hai All,
    In BI IP , When I am trying to load the data (text file) by using Planning function for File Upload. I am getting an error message When I am clicking on Update .
    Error Message : Inconsistent input parameter (parameter: <unknown>, value <unknown>).
    In Text file I am using Tab Separation for each value
    Anyone help me out.
    Thanks,
    Bhima

    Hi Bhima
    Try one of these; it should work:
    1. If you are on SP 14 you would need to upgrade to SP 15. It would work fine
    2. If not, then -
         a] apply note 1070655 - Termination msg CL_RSPLFR_CONTROLLER =>GET_READ_WRITE_PROVIDS
         b] Apply Correction Instruction 566059 [i.e: in Object - CL_RSPLFR_CONTROLLER GET_READ_WRITE_PROVIDS,
    delete the block: l_r_alvl = cl_rspls_alvl=>factory( i_aggrlevel = p_infoprov ).
    and insert block - l_r_alvl = cl_rspls_alvl=>factory( i_aggrlevel = i_infoprov ).
    Goodluck
    Srikanth

  • Is there any functionality for AVERAGE in ALV, like do_sum, subtot?

    Hi Experts,
    In my_alv report, am doing sub/totals for prices, by using do_sum, subtot functions.........fine. But, I need to do/display the AVERAGE value for Discount % column?
    Is there any functionality for AVERAGE in ALV, like do_sum, subtot?
    thanq

    hi
    check these links out
    http://www.sapfans.com/forums/viewtopic.php?t=20386
    http://www.sapfans.com/forums/viewtopic.php?t=85191
    http://www.sapfans.com/forums/viewtopic.php?t=88401
    http://www.sapfans.com/forums/viewtopic.php?t=17335
    regards
    vijay
    reward points if helpful

  • Crash on search function for HTML Help file (.chm) when connected to a Visual C++ application

    Crash on search function for HTML Help file (.chm) when
    connected to a Visual C++ application
    I use the RH_ShowHelp API command to connect a HTML Help file
    (.chm file generated by RoboHelp Word X 5) to my Visual C++
    application. My application is able to call up this HTML help file
    in context-sensitive mode and everything is working great in the
    Contents and Index panels EXCEPT when I click on List Topics (after
    I enter a KEYWORD for search) in the Search panel.
    I got an error that said “Unhandled exception in
    xxxx.exe.(HHCTRL.OCX):0xC00000FD: Stack overflow”
    I am able to execute this .chm file by itself and the search
    function works well in this case. I am using HHActiveX.dll that is
    created on 2/23/04. Is this the correct version?? Any advice what
    to do here??

    Hi agschin and welcome to the RH forums. The hhactivex.dll
    file is not used by the search function so you can rule that our.
    Have you tried recompiling and seeing if the problem still happens?
    You can also start the Bug Hunter feature in RH - View > Output
    View and then select the Bug Hunter button - and see if that throws
    up any clues.

  • How can i use RTFEditorKit for JTextField.

    hi all,
    how can i use RTFEditorKit for JTextField.
    thanks in advance
    daya

    Don't cross post. This is a Swing related question and you have already posted in the Swing forum:
    http://forum.java.sun.com/thread.jspa?threadID=619619&tstart=0

  • How to Use the language function for assignment and validation

    Hi All,
    If anyone can explain me in details with example ,how to use the language function for assignments and validations?
    Thanks
    Arnab

    Hi Arnab,
    The expression is checked only for the current MDM session.
    If u login with the ABC language it will always show the ABC language no matter how many times u execute it.
    Try connecting to the DM with the XYZ language.
    It should go to the if part rather than else.
    Hope it helps.
    Thanks,
    Minaz

  • Error "You cannot enter a partner function for output NEU"

    Hi Experts,
    I'm having these error "You cannot enter a partner function for output NEU" (message VN041) when I tried to assign a partner function (e.g OA)  in the conditions records for application "EV" (Purchase outline agreement). The system do not allow me to do this for any doc type (LP, LPA, MK, OA, etc). I'm using t-code NACE or MN08.
    I want to assign partner for key combination "Document Type". The conditions is already there but with no value, so I want to assign partner function "OA" or "VR".
    I already check all the configuration and looks fine. For example, define possible partner functions for output type "NEU" for application "EV" (Purc outline agree).
    Hope you can help me to find the problem.
    Thanks,
    Mairo.

    I have the error in NACE or using tcode MN08.
    As soon I executed those transaction the system shows the condition records created for varios Doc Type (e.g LP, LPA, MK, etc) but with no partner function assigned. For example:
    Doc. Type /  Name                     /             Funct  /   Partner     /            Medium  /  Date/time  /   Language
    LP        /       Scheduling Agreement     /  blank  / blank  /                                          2      /          3   /              EN
    LPA      /      Scheduling Agreement                              / blank    / blank   /                1        /       3         /        EN
    For example, I try to assign function "OA" for Doc. Type "LP", choose value from quickpick. Then when I press enter, the system give me the error "You cannot enter a partner function for output NEU", message no. VN041. Do not allow me to continue, so I have to leave this field blank, with no change.
    Thanks,

  • Down payment functionality for PO with account assignment K Cost Center

    QUESTION: Is there a way to turn-on down payment functionality for cost centers?
    When a vendor down payment is posted via tcode F-47 against a PO line item with INTERNAL ORDER as the account assignment, SAP posted the following documents from the payment run (tcode F110):
    1. Accounting Document
    dr  vendor / GL= downpymt clearing / internal order = IO1234 / cost center = CC5678
         cr  bank           
    2. Controlling Document
    dr internal order IO1234
    However, when a vendor down payment is posted against a PO line item with COST CENTER as the account assignment, SAP does not post any Controlling document, just the accounting document:
    dr  vendor / GL= downpymt clrg / cost center = CC5678
            cr bank
    From my research, it appears that the down payment functionality applies to internal orders and projects only. Then settlement is run to move the values from internal order to AUC assets and/or cost centers. Perhaps I'm missing a configuration step for the cost center piece?
    Your prompt response will be much appreciated. Thanks in advance!

    system wont generate any controlling document for noted items  downpayment and normal payments.
    Because all are balance sheet accounts. Controlling documents will generated for only P&L accounts.
    Your analysis correct.

  • How do I delete documents from my iPad that were added when it ran regular Acrobat, now that it has switched to DC?  The docs are not on the cloud, and DC does not seem to have a delete function for non-cloud docs.

    I use an iPad.  It automatically switched me from old-fashioned Acrobat to DC.  How do I delete docs that were put on my iPad with the old Acrobat?  They are not in the cloud, and DC does not seem to have a delete function for them.

    Hi,
    By default, Acrobat DC for iOS displays recently viewed files.  You need to switch to other file location (such as Local, Document Cloud, Creative Cloud) to delete, rename, move, or duplicate files.
    You can switch to Local, if you would like to see the files and folders that are locally stored on your iPad.
    Would you take a look at the following document to see how you can switch to other file location and delete files?
    How to manage files in Acrobat DC for iOS
    Please let us know if you have additional questions.  Thank you.

  • Partner functions for a specific customer not seen in XD03 but appears in XD02

    Hello SAP Gurus,
    I have a situation where a partner functions for a specific customer not seen in XD03 but appears in XD02, In XD03 only one partner function (Ship to) appears but in XD02 (Sold to, Ship to, Bill to and payer appears), from the customer master I can see that account group for this customer has been changes to Sold to (Z001) from Ship to (Z002).
    I checked in settings for OB20 transaction for display customer centrally, it is in Display mode as required and not suprresed would like your inputs as to why this is happening and what can be done to fix this.
    Thanks and Regards
    Mohammed Roshan

    Hi ROshan,
      Open customer master in XD02  sales view and save it then check in XD03 it should display the partner functions.
    As you said the account group has been changed I think the records needs to be saved again.

  • Multiple Partner Functions for a Sales document Item

    Hi,
    Can you please advise on modeling scenario for showing multiple partner functions for a given sales document in BI Report ..
    Because Key figure values should not be distributed for multiple records just becos of multiple partner functions but users want to see them in the reports along with sales doc and key figure
    I am explaining bit more clearly...
    I can achieve above requirement by having below model ..
    SDOC     ITEM  PF1  PF2  PF3  AMOUNT
    1000       10      AB    CD   EF    50000
    PF : Partner Function
    but as I feel it is a complicated task  to add more and more columns fro partner functions as and when new partner functions have been added or requested to show by users at sales doc level...
    So Can you please advise a better solution to meet the same requirement.
    Thanks & Regards,
    BRK
    Please advise me on this scenario
    Thanks & Regards,
    BRK
    Edited by: BRK on Jul 22, 2008 9:19 AM
    Edited by: BRK on Jul 22, 2008 9:29 AM

    SalesDoc______Item_______PartnerFunction________Amount
    80000_________10_____________A1_______________$1000
    80000_________10_____________A2_______________$1000
    80000_________10_____________A3_______________$1000
    This will be the normal display in the cube if there is only one Partner Function.
    But what we need is
    SalesDoc______Item_______PartnerFunction________Amount
    80000_________10_____________A1_______________$1000
    80000_________10_____________A2_________________' '
    80000_________10_____________A3_________________' '
    The Amount (KF) should be populated only for the first record for a SalesDoc / Item combo.
    You load data from source to the ODS, say delta.
    Suppose that the below record is already available in the ODS.
    SalesDoc______Item_______PartnerFunction________Amount
    80000_________10_____________A1_______________$1000
    And you get the following data as DELTA in the Data_Package from the source.
    SalesDoc______Item_______PartnerFunction________Amount
    80000_________10_____________A2_______________$1000
    80000_________10_____________A3_______________$1000
    If you populate the Amount again for these 2 records, then the total would sum to $3000, which is wrong.
    So what we do is,
    Write a Select stmt for ALL ENTRIES in Data_Package and fetch the records from the target ODS. Have it in an Internal table, say t_ODS1
    Take the SalesDoc / Item from the Data_Package and chk if it is present in the internal table t_ODS1.
    If it is present, then populate the Amount as ' ' (Blank)
    Else populate the Amount as $1000.
    Say, you are getting 3 new records, which is not present in the ODS1.
    In that case, your internal table t_ODS1 will be blank.
    Now again, we need to populate the Amount only for the first record among the 3 records.
    So, here comes the "Flag".
    Set the Flag as X, when we populate the Amount.
    Everytime chk the Flag <> X.
    Only if it is <> X, populate the Amount.
    Else Leave it Balnk.
    Hope I have explained in detail
    Regards,
    Balaji V

  • Creation of new partner function for VENDOR

    Hi,
    I've a requirement to create some Partner functions for vendors while creation of vendor. Some Partner functions are available by default and some we need to add. but while doing a BDC we are not able to find how many of them are available or where to put the new Partner function?
    Please let me know, if there is any BAPI availble..
    Regards,
    Anupam

    Try below LSMW batch input method its very esay to upload data
    Object               0040   Vendor master
    Method               0001   Standard
    Program Name         RFBIKR00
    Program Type         B   Batch Input

  • What is the need of creating partner functions for sales document type.

    Hi SAP (SD-GURUS),
    Actually we create partner functions  before creating customer ex: sold to party, ship to party, bill to party, and payer.
    These partner functions are going to be copied into sales order while processing sales order.
    Again what is the need of creating partner functions for sales document type.
    Thanks&Regards
    sreenivas peruru

    There are some Partners you could enter at Sales ORder Level. E.g. Sales Person, Employee Responsible, Forwarding Agent, Broker, etc.
    Thus these partner Determination need to be carried out at Sales Order Level & not at Customer Master level.
    So we have to configure partner Determination for various levels e.g. Customer Master, Sales Order, Delivery level etc...
    Hope this helps...
    THanks,
    Jignesh Mehta

  • Classic Scenario PO has multiple OA Partner Functions for Vendor

    Hi,
    I have a 'design' issue. My R/3 Vendor has many OA Partner Functions for the different Branches they have and the PO needs to be Faxed to the OA Partner Function number, but the PO needs to be created against the VN Partner Function.
    So, how do i do this in SRM? I was going to have a seperate Catalog link for each OA Partner function, but this is not creating the R/3 PO with VN Partner Function of the 'core' Vendor number.
    Does anyone have any advice for this?
    regards Adam
    Using SRM 5.0 (Server 5.5) SP 8 and R/3 4.6C in Classic Scenario - my catalogs are external vendor.

    Hi
    Please see these links, which might help ->
    Partner function missing in backend PO
    Re: Error in transmission while PO cration
    "Multiple" partner data at PO header
    Partner functions in plan driven MM-SUS
    Re: Partner function not found
    Number range for business partner
    Re: Problem with BP. Assignment: Business partner person to user not unique
    Error in creation of Employee for Business Partner
    Re: enter exactly one partner of type vendor
    Re: Business partner as Vendor and Invoicing Party
    Partner functions in EBP for extended Classic Scenario
    Regards
    - Atul

Maybe you are looking for

  • Can't Drag Folders into Photos App?? Import only presents 100 photos!

    So I tried importing my Aperture library with no luck - seems that I must unlock a folder every time I want to edit a photo. Now I'm simply trying to create a New Photo Library and I drag a folder (with subfolders) into the app and nothing happens. S

  • How to inform purchasers about differences between POs and PORs

    Hello all! We are using SRM 5.0 on Server 5.5 and ECC 6.0 - plan driven procurement. It's possible to create purchase order responses and they arrive in ECC, but how can I inform the purchasers about differences? I’ve found transaction ME2A, but it j

  • Problem upgrade 7.6 a 8.0.x WLC

    Hello after performing an upgrade from 7.6 to 8.0 to the WLC started making randomly reboot happens every 30 minutes sometimes every 40 or 1 hour and I have no way of knowing that. after that perform donwgrade 7.6 and runs smoothly anyone have any id

  • Regarding Migration to Adobe Forms

    Hi Friends    I am working on adobe print forms. I have one doubt that is  If SAP itself providing the option <b>migrate smartform to Adobe Interactive form,</b> what's the necessity to create the forms from scratch i.e why we have to create Interfac

  • Screen update lag

    I've got a 2.4Ghz Macbook Pro with 2Gb of memory which I bought last Jan so I guess it's the late 2008 model. The issue I have is that, although under all other conditions it performs perfectly, when there's a lot happening on screen such as a mast m