How to hightlight the text in a component which is not derived from JTextCo

I have a swing componet, but it is not JTextComponent. I need to highlight the text in that compont when it gets the focus. How do I do that? Thanks,

Methods inherited from class versata.vfc.VSChoiceBase ::
addChoiceListener, addMissingChar, displayText, focusGained, focusLost, getBackground, getCodeTable, getDataFieldName, getDataFieldNumber, getDataSource, getDataSourceName, getDisabledForeground, getDisplayedText, getForeground, getForm, getFormat, getFormatter, getHelpURL, getMetaColumn, getNextFocusableComponent, getStatusText, getTabOrder, getTabStop, getTag, getTextComponent, getToolTip, grabFocus, initializeControl, isAllowMultipleValue, isDataDirty, isEditable, isFocusTraversable, isManagingFocus, keyReleased, keyTyped, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, paintComponent, postEvent, processEvent, removeChoiceListener, requestFocus, reshape, setAllowMultipleValue, setBackground, setCodeTable, setDataDirty, setDataFieldName, setDataFieldNumber, setDataSource, setDataSourceName, setDisabledForeground, setEditable, setEnabled, setFont, setForeground, setFormat, setFormatter, setHelpURL, setNextFocusableComponent, setStatusText, setTabOrder, setTabStop, setTag, setToolTip, setToolTipText
Methods in VSPickChoice
afterFormInitialize, afterPickFill, beforePickFill, CurrentComponentChanged, CurrentDataControlChanged, dataChanged, getDisplayMode, getPick, getPickName, getQueryText, getText, hasPick, hideChoiceWindow, keyPressed, queryModeChanged, setDisplayMode, setPick, setPick, setPickName, setText, updateNotify

Similar Messages

  • How to get the text in a label which is imbeded in a JTextPane

    I have created a JTextPane that has 5 JLabels inserted in the text. I have attempted to get the text with the following code snippet.
    Component[] lbl = new Componennt[DisplayLetterPane.getComponentCount()];
    //         JTextPane DisplayLetterPane; is defined previously
             lbl = DisplayLetterPane.getComponents();
             int componentIndex = 0;
             String lblText = new String(((JLabel)lbl[componentIndex]).getText());I have run a dump of the sytledDocument of the JTextPane and I see the JLabel listed as a component.
    When this snippet is executed I get the following:
    Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: javax.swing.text.ComponentView$Invalidator
    When I check the character where the component for the JLabel is located in the styled document it does not find an instanceof JLabel.
    How can I get the text from the labels.
    Thank you in advance!

    JTextPane jtp = new JTextPane();
              for (int i = 0; i <5; i++) {
                   jtp.add(new JLabel("labelText"+i));
              Component[] lbl = new Component[jtp.getComponentCount()];
    //      JTextPane DisplayLetterPane; is defined previously
          lbl = jtp.getComponents();
          int componentIndex = 0;
          for (int i = 0; i < lbl.length; i++) {
               System.out.println(((JLabel)lbl).getText());
    When I do like the above, it just works fine. Can u share a little bit more of your code?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to change the Text of Dropdown by Key Dynamically thats coming from RFC

    HI All,
    I need an urgent help . I have a parameter coming from RFC -> YYTEXT with a value Range and I am binding this parameter in my DROPDOWN BY KEY .Now I have a requirement that two values coming from this parameter i need to change it
    .Can you please tell me how to get the values from this YYTEXT attribute which is in NODE1 and then set the two new texts to this attribute so that it shows different text in the droodown .
    Thank you in Advance .
    Naaz

    Will appreciate any comments on the question ?

  • How to find the datasource of an ODS which is not activated yet in Metadata

    Through SAP Help, we find a useful ODS that we want to use to build up queries, but it's not easy to locate the Infosource and Datasource of it through the SAP Help.  I remember there is a functionality in the Metadata Repository that the data flow of an InfoCube or ODS can be shown there.  I get to the Metadata Repository and locate the ODS already, but can't find the functionality any more that can show the data flow of the ODS.   If I can see the data flow, then I think I can find the corresponding infosource and datasource of it.  Anyone's input is greatly appreciated!

    hello Bhanu,
    From SAP Help, find the known Infosource help document, I copy part of the documentation below (see in between two dashed lines):
    Document History (Item Level)
    Technical name: 0BBP_DOC_ITM_1
    Based on DataSource: Customer-specific name space, for example ZBBP_TD_DOC_I
    The help uses the datasource name starting with Z, does it mean there is no datasource on R3 side that we need to manually create it?
    Thanks

  • How to get the server name/hostname on which JVM is running?

    How to get the server name/hostname on which JVM is running from the Servlet or normal class?

    InetAddress.getLocalHost()

  • How to Hightlight the Data in Jsp Page

    How to Hightlight the Data in Jsp Page,
    I am doing doing search page,based on values given search page those are sent to servlet,in servlet based on some conditions if particuler id i am getting then i am redirecting to Respective jsp page with highlight the data from database..
    Thanks in advance...

    "Highlighting data in JSP sounds strange".
    Without looking at your search specific algorithms I feel you are finally going to display a page (HTML content) to user which contains highlighted text. Highlighting is not directly related to server side language you use (JSP, ASP, PHP etc.). This is purely HTML and CSS. However, server side script (such as JSP) should generate HTML content for getting highlight effect.
    Following HTML shows highlighted text using background-color property on span element.
    <html>
      <head>
        <title></title>
        <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
      </head>
      <body>
          <p style="font-size:1.1em">This is a long paragraph which contains <span style="background-color: yellow;">highlighted text</span> and non highlighted text.</p>
      </body>
    </html>Thanks,
    Mrityunjoy
    Edited by: mrityunjoy on 14 Jun, 2010 3:30 AM

  • How to maintained the Text  language for CKF keyfigure

    Dear All,
    Please let me know how to maintained the text language for CKF I am using only keyfigures in CKF.
    Issue is text is not showing in Spain language when user exeuted the report (longin Spain) for CKF keyfigures .
    As per report design there are formuals and direct keyfigures and CKF has defined and we keep it under in Row struture in the report.
    After exeuted the report (Login Spain)Text has converted in all languages along with spain except for CKF keyfigures.
    Issue in text CKF's:
    There is a main  CKF (Cost) under this again we defined two sub CKF's those are total cost and average cost. We able to see the text in Spain language for Main CKF(cost) and also cheked in RSZELTTXT(Texts of reporting component elements) for the same.
    We can able to see the text in all languages for main CKF(cost) and enteries are there in RSZELTTXT table.
    We can see only  the text in english for  total cost and average cost and also enteris are there only in EN in RSZELTTXT table.
    It would help to me if any one can answer my question.
    Thanks in advance .
    Regards,
    MQ

    U can fetch the texts for the items using
    Read_text.
    Example:
        g_f_tdname = xvttp-vbeln.
        g_f_obj = p_obj.
        g_f_langu = 'DE'.
        REFRESH g_t_lines.
        CLEAR g_t_lines.
        CALL FUNCTION 'READ_TEXT'
             EXPORTING
                  id                      = p_var
                  language                = g_f_langu
                  name                    = g_f_tdname
                  object                  = g_f_obj
             TABLES
                  lines                   = g_t_lines
             EXCEPTIONS
                  id                      = 1
                  language                = 2
                  name                    = 3
                  not_found               = 4
                  object                  = 5
                  reference_check         = 6
                  wrong_access_to_archive = 7
                  OTHERS                  = 8.
        IF sy-subrc <> 0.
         MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    The Required fields are,
    Text-id ,language,name,object.
    Let me know if you further require help.
    Regards

  • How to center the text displayed in a JList

    Hi,
    The width of the JList display area is wider than the text displayed. I tried to center the text displayed to make it look nicer. I had tried using "setAlignmentX(Component.CENTER_ALIGNMENT)" in my own ListCellRenderer class but did not work. Any idea how to center the text?
    Fai.

    Yes, I am using JLabels in my renderer and the following is the code:
    public class MyCellRenderer extends JLabel implements ListCellRenderer {
         private static final Color HIGHLIGHT_COLOR = new Color(0, 0, 128);
         public MyCellRenderer() {
              setOpaque(true);
              setIconTextGap(12);
         public Component getListCellRendererComponent(
              JList list,
              Object value,
              int index,
              boolean isSelected,
              boolean cellHasFocus)
              String entry = (String)value;
              setText(entry);
              setFont(new Font("Ariel", Font.BOLD, 18));
              setAlignmentX(Component.CENTER_ALIGNMENT);
              if(isSelected) {
                   setBackground(HIGHLIGHT_COLOR);
                   setForeground(Color.white);
              } else {
                   setBackground(Color.white);
                   setForeground(Color.black);
              return this;
    Can you point out where to implement the centering logic?
    Thanks,
    Fai.

  • How to aling the text in a JTable???

    I use this code to make a vertical header like in excel. The thing is that i want to aling the text in that column but i couldn´t. I try to set the render, but i loose the header render in the column. Anyone know how to aling the text in that column with out loosing the header effect????
    i post a code that i use as model for my project.
    package com.chuidiang.ejemplos;
    import javax.swing.JFrame;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.WindowConstants;
    import javax.swing.table.DefaultTableModel;
    * Ejemplo de cómo hacer una "cabecera" lateral en un JTable. Idea original de
    * Leunamal en
    * http://foro.chuidiang.com/java-j2se/tabla-de-referencias-cruzadas-en-java/
    * Básicamente consiste en hacer que la primera columna: - No sea editable. - No
    * sea seleccionable. - Tenga el mismo render que el JTableHeader superior.
    * @author chuidiang
    public class CabeceraLateral {
          * Crea y visualiza una ventana con un JTable que tiene cabecera en la parte
          * superior y en la columna izquierda
          * @param args
         public static void main(String[] args) {
              // Un modelo de datos que hace la primera columna (la de
              // la cabecera lateral) no editable.
              DefaultTableModel tm = new DefaultTableModel(10, 5) {
                   @Override
                   public boolean isCellEditable(int row, int column) {
                        if (0 == column)
                             return false;
                        return super.isCellEditable(row, column);
              // Titulos para la cabecera superior. El primero es vacio,
              // puesto que corresponde
              tm.setColumnIdentifiers(new String[] { "", "A", "B", "C", "D" });
              // Valores para la primera columna, que es la cabecera lateral.
              for (int i = 0; i < 10; i++)
                   tm.setValueAt(i + 1, i, 0);
              // JTable al que se le pasa el modelo recien creado y se
              // sobreescribe el metodo changeSelection para que no permita
              // seleccionar la primera columna.
              JTable t = new JTable(tm) {
                   @Override
                   public void changeSelection(int rowIndex, int columnIndex,
                             boolean toggle, boolean extend) {
                        if (columnIndex == 0)
                             super.changeSelection(rowIndex, columnIndex + 1, toggle,
                                       extend);
                        else
                             super.changeSelection(rowIndex, columnIndex, toggle,
                                                 extend);
              // Se pone a la primera columna el render del JTableHeader
              // superior.
              t.getColumnModel().getColumn(0).setCellRenderer(t.getTableHeader().getDefaultRenderer()); //here i set the render for the column. But when i try to aling the text, this column loose the effect.
              // Creación y visualización de la ventana completa.
              JFrame v = new JFrame("Cabecera lateral");
              JScrollPane sp = new JScrollPane(t);
              v.getContentPane().add(sp);
              v.pack();
              v.setVisible(true);
              v.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    }

    The word is "align" not aling.
    To right-align the first column, you can do this in a prepareRenderer override.    JTable t = new JTable(tm) {
          @Override
          public void changeSelection(int rowIndex, int columnIndex,
                  boolean toggle, boolean extend) {
            if (columnIndex == 0) {
              super.changeSelection(rowIndex, columnIndex + 1, toggle,
                      extend);
            } else {
              super.changeSelection(rowIndex, columnIndex, toggle,
                      extend);
          @Override
          public Component prepareRenderer(TableCellRenderer renderer, int row, int column) {
            Component c = super.prepareRenderer(renderer, row, column);
            if (column == 0) {
              ((JLabel) c).setHorizontalAlignment(JLabel.RIGHT);
            return c;
        };You can find other alternatives to your approach by searching the net for "[JTable row header|http://www.google.com/search?q=JTable+row+header]"
    db

  • How to transport the text elements in  Reports?

    need answer to this question.
    how to transport the text elements in the reports?
    Edited by: venkata kumar on Feb 18, 2008 1:33 PM

    Hi Venkata,
    Text Elements are a component/part of the SAP script and are not individual ABAP objects within the SAP environment hence they cannot be transported independently.
    You would need to make changes in your text elements in the SAP script which would result in the SAP script being saved under a transport and moving the transport across the landscape would result in the text elements also getting transported.
    In short: Move SAP script - to move text elements.
    Cheers,
    Aditya

  • How can Modify the Text of a MessageArea in a Application WD ABAP Standard?

    Dear Experts.
    How can Modify the Text of a MessageArea in a Application WD ABAP Standard?
    I found the following link in the helpsap, but in this moment I don't know How found this text? and Modify this text with a new text.
    http://help.sap.com/saphelp_nw70/helpdata/en/3a/f6ba42a950da11e10000000a155106/frameset.htm
    The text of a MessageArea are in a table of configuration or can do the system for get this text and show in the application in the portal? How can get this and modify by a new text.
    Please help me with a suggestions.
    Thanks
    Regards
    Carmen G.

    Dear Kranthi..
    The datas of the Application is the following:
    General Information About the Application and Component
    Application: FITE_REQUEST
    Web Dynpro Component: FITV_FPM
    Window Information: FPM_WINDOW
    View Information: Layout_view
    Information on Field
    Field ID: HELPTEXT
    Type of UI Element : Explanation
    Attributes of UI Element
    TEXT_DOCUMENT_NAME: FITE_FPM_REQUEST_GENERAL_DA
    I dont found this method L_MESSAGE_MANAGER->REPORT_T100_MESSAGE.
    Please can give more suggestions for found the method
    Thanks in advance
    Regards
    Carmen G.

  • How to get the caret position of component embedded in JTextPane?

    Hi great java developers ;-)
    I want to get the caret position of component which is embedded in StyledDocument / JTextPane.
    How has it to be done?
    Thank you very much!!!

    The Document doesn't know which textPane it belongs to. (It could even be shared by mulitple textPanes).
    You get the caret position of a any text component by using:
    textComponent.getCaretPosition();

  • How to print the text in points wise in sap script

    hi friends,
    how to print the text in points wise in sap script.
    ex: if suppose paragraph consists of 15 lines. then according to one sentence or one fullstop (.) it should give point 1. like that...
    1. hai how ru.
    2. what r  u doing.
    3.where r u.
    like this i want numbering.. waiting for ur replys.
    thanks,
    kiran

    declare a counter
    data : cnt type char 4.
    print :
    cnt = cnt + 1.
    &cnt& &text&
    cnt = cnt + 1. and so on.
    or.
    if the data is in an internal table
    loop at internal_table.
    cnt = cnt + 1.
    write form.
    in script -&cnt& &text&
    endloop.
    Edited by: NIKHILKUMAR POOJARI on Nov 17, 2008 11:18 AM

  • How to print the text in only last but one page in sapscripts

    hiiiiiiiiiii,
             explian how to print the text in only last but one page in sapscripts? wher to write the code? plz if possible explain in detail with an example?

    Hello,
    The total no pages is given by &SAPSCRIPT-FORMPAGES& command.
    So u can handle the situation in ur form like this
    /: if &PAGE&  = &SAPSCRIPT-FORMPAGES&
    p1 TEXT
    /: endif
    Try in this way it may help u.
    Regards

  • Did you know how to link the text in two or more text boxes?

    Did anyone know how to link the text in two or more text boxes in Pages 5.0? Thanks for your answer.
    Qualcuno sa come collegare il testo in due o più caselle di testo nella versione 5.0 di Pages. Grazie per le vostre risposte.

    It's just one of the many, many features that have been eliminated or changed. Leave feedback for the Pages team using the link in the Pages menu and review & rate the new versions in the Mac App Store.
    If you previously had iWork '09, those apps are still in your Applications folder in a folder named iWork '09. You can continue to use them to get things done.

Maybe you are looking for

  • Tabs disappear and open a new window when editing files in Wordpress

    When editing files in Wordpress built-in code editor, if I highlight and try to copy/paste to another file or even within the same file the tab I am on will often abruptly close and then reopen itself in a whole new window. This is extremely disrupti

  • How do I find out if my mac's airport card supports 802.11n ?

    It just says Airport Extreme in System profile and it also says that on my wife's iBook - wondering about maximising our network speeds with an upgrade to AEBS and TV. thanks

  • RSA3 - 2LIS_11_VAHDR

    Hello, I have a record that posted into BW a long time ago.  It is sales document 10000181.  It is from datasource 2LIS_11_VAHDR. I go to RSA 3 and use that sales document as a selection criteria against datasource 2LIS_11_VAHDR. I do not get any res

  • List, which contains the tax code of Cash dicount

    hello, does anyone know how I can create a list which contains following information. specific posting  period 1-5 tax code 16% or 19% plus their specific cash discount amount. e.g. period 1   tax code 16%   116€ period 1   tax code 19%   119€ I shou

  • Macbook doesn't want to recognize the cd rom

    We bought my daughter a macbook before she left for college in September. It has the intel core2duo, 2.16 ghz, and 2 gig of memory. For some reason when she pops in a disk, the macbook doesn't recognize it and doesn't do anything. You can hear it is