Insertion of icons into JTextPane

Hello!
I am trying to insert icons into JTextPane object, and I got a problem.
My partial code is as follows...
StyleConstants.setIcon(s, icnIcons);
doc.insertString(doc.getLength(), "I", doc.getStyle("icon"));
doc.insertString(doc.getLength(), "I", doc.getStyle("icon"));
In the above code, s is an object of Style, and icnIcons is an object of ImageIcon, and doc is an object of StyledDocument.
And the style, s, is registered with a name, "icon".
If I execute the above code, then only one icon is displayed. But the length of the text is increased by 2.(I check this using doc.getLength() method.)
So, I make a little change to the above code like the following:
StyleConstants.setIcon(s, icnIcons);
doc.insertString(doc.getLength(), "I\n", doc.getStyle("icon")); //changed
doc.insertString(doc.getLength(), "I", doc.getStyle("icon"));
I just add "\n". And the second code is working, and displays two icons.
But the two icons are on the separate line.
And if I use two different icons, that is, two different styles, in the first code segment, then it works and shows the two icons on the same line, though I didn't use the "\n".
Why does this happen?
I am so confused. Please help me.
Thanks for every body!
Regards

import java.awt.*;
import java.awt.event.*;
import java.awt.image.BufferedImage;
import java.io.*;
import javax.imageio.ImageIO;
import javax.swing.*;
import javax.swing.text.*;
public class IconPane {
    private void showTest(BufferedImage[] images) throws IOException {
        JTextPane textPane = new JTextPane();
        // Add some content.
        File file = new File("IconPane.java");
        BufferedReader br = new BufferedReader(
                            new InputStreamReader(
                            new FileInputStream(file)));
        textPane.read(br, file);
        br.close();
        // Make up a couple of styles.
        int pos1 = 875, pos2 = 876;
        StyledDocument doc = textPane.getStyledDocument();
        Style style = textPane.addStyle("icon1", null);
        StyleConstants.setIcon(style, new ImageIcon(images[0]));
        // Set  icons.
        doc.setCharacterAttributes(pos1, 1, style, false);
        style = textPane.addStyle("icon2", null);
        StyleConstants.setIcon(style, new ImageIcon(images[1]));
        doc.setCharacterAttributes(pos2, 1, style, false);
        // Add the icons again with the insertString method.
        addContent(doc);
        // Show me.
        JScrollPane scrollPane = new JScrollPane(textPane);
        scrollPane.setPreferredSize(new Dimension(500,400));
        textPane.addMouseMotionListener(mouseInput);
        JOptionPane.showMessageDialog(null, scrollPane, "",
                                      JOptionPane.PLAIN_MESSAGE);
    private void addContent(StyledDocument doc) {
        int pos1 = 1667, pos2 = 1669;
        try {
            // Try inserting icons with insertString.
            doc.insertString(pos1, " ", doc.getStyle("icon1"));
            doc.insertString(pos2, " ", doc.getStyle("icon2"));
        } catch(BadLocationException e) {
            System.out.printf("bad location error: %s%n", e.getMessage());
    public static void main(String[] args) throws IOException {
        String[] ids = { "--g--", "---h-" };
        BufferedImage[] images = new BufferedImage[ids.length];
        for(int j = 0; j < images.length; j++)
            images[j] = ImageIO.read(new File("images/geek" + ids[j] + ".gif"));
        new IconPane().showTest(images);
    private MouseMotionAdapter mouseInput = new MouseMotionAdapter() {
        public void mouseMoved(MouseEvent e) {
            int pos = ((JTextComponent)e.getSource()).viewToModel(e.getPoint());
            System.out.println(String.valueOf(pos));
}

Similar Messages

  • Insert SAP ICONS into from SAP into Word document (OLE)

    Hi ,
    I want to Insert SAP ICONS into from SAP into Word document (OLE) .
    Please let me know how can I do it? I would really appreciate it.
    Regards,
    Sanjeev

    Hello,
    Try this out:
    (1) Copy program DD_ADD_PICTURE into your own version called ZDD_ADD_PICTURE. Make sure
    you select all the checkboxes (including GUI Status and screens).
    (2) Paste the modified code at the end of this reply into your ZZ_ADD_PICTURE program.
    (3) Run ZZ_ADD_PICTURE for a range of Icons (e.g. enter Icon name ICON_IN* on the selection screen)
    (4) When you get the result list, type in ok-code EXPO directly in the ok-code
    field (you could also add a button for this function in the GUI status).
    (5) Download all the displayed icons as .gif files into a Windows folder
    that you have created to hold the icon .gif files (e.g. C:SAPICONS)
    (6) Now you can work with the icon files as you would any .gif file. (e.g. In a Word doc, use menu path
    Insert -> Picture -> From file.)
    Here is the code:
    REPORT dd_add_picture.
    TYPE-POOLS: sdydo.
    DATA: do TYPE REF TO cl_dd_document.
    DATA: is_displayed.
    TABLES: icont.
    DATA: BEGIN OF icontab OCCURS 0.
            INCLUDE STRUCTURE icon.
    DATA: END OF icontab.
    select-options: s_icon for icontab-name obligatory.
    SELECT * FROM icon INTO TABLE icontab WHERE locked NE 'X'
                        AND name in s_icon.
    * Event Handler Definition, handling changes of GUI fonts, colors,...
    CLASS cl_my_event_handler DEFINITION.
      PUBLIC SECTION.
        METHODS:
          use_new_resources FOR EVENT resources_changed OF cl_gui_resources.
    ENDCLASS.
    DATA: my_handler TYPE REF TO cl_my_event_handler.
    CREATE OBJECT my_handler.
    * Call Screen
    CALL SCREEN 100.
    *&      Module  STATUS_0100  OUTPUT
    MODULE status_0100 OUTPUT.
      IF is_displayed IS INITIAL.
        SET PF-STATUS 'BRP'.
        SET HANDLER my_handler->use_new_resources.
    * create document
        CREATE OBJECT do.
    * fill document
        PERFORM dd_add_icon USING do.
    * merge document
        CALL METHOD do->merge_document.
    * display document .
        CALL METHOD do->display_document
                           EXPORTING  container          = 'HTML'
                           EXCEPTIONS html_display_error = 1.
                                           " do some exception handling ...
        is_displayed = 'X'.
      ENDIF.
    ENDMODULE.                             " STATUS_0100  OUTPUT
    MODULE user_command_0100 INPUT.
      CASE sy-ucomm.
        WHEN 'BACK'.                       "Beenden
          LEAVE PROGRAM.
        WHEN 'PRN'.
          CALL METHOD do->print_document
                  EXPORTING reuse_control = 'X'.
        WHEN 'PRN_NEW'.
          DATA text TYPE sdydo_text_element.
          CALL METHOD do->initialize_document.
          text = 'Dies Dokument wurde speziell fürs Drucken erstellt!' &
                            ' Druckdatum: '(500).
          CALL METHOD do->add_text EXPORTING
                               text         = text
                               sap_fontsize = cl_dd_area=>large.
          WRITE sy-datum TO text DD/MM/YYYY.
          CALL METHOD do->add_text EXPORTING text = text .
          CALL METHOD do->new_line EXPORTING repeat = 2.
          PERFORM dd_add_icon USING do.
          CALL METHOD do->merge_document.
          CALL METHOD do->print_document.
        WHEN 'EXPO'.
          CALL METHOD do->export_document EXPORTING to_filesystem = 'X'.
      ENDCASE.
      CLEAR sy-ucomm.
    ENDMODULE.                             " USER_COMMAND_0100  INPUT
    *&      Form  DD_ADD_ICON
    *       text
    FORM dd_add_icon USING p_do TYPE REF TO cl_dd_document.
      DATA ta TYPE REF TO cl_dd_table_element.
      DATA col1 TYPE REF TO cl_dd_area.
      DATA col2 TYPE REF TO cl_dd_area.
      DATA col3 TYPE REF TO cl_dd_area.
      DATA text TYPE sdydo_text_element.
    * set Heading
      text = ' Bilder in Dynamischen Dokumenten'(001).
      CALL METHOD p_do->add_text EXPORTING text = text
                                      sap_style = 'heading'.
      CALL METHOD p_do->new_line.
      CALL METHOD p_do->new_line.
      CALL METHOD p_do->add_table EXPORTING with_heading    = 'X'
                                          no_of_columns     = 3
                                          width             = '100%'
                                          IMPORTING table   = ta.
    * set columns
      text = 'Ikone'(011).
      CALL METHOD ta->add_column EXPORTING heading  = text
                                 IMPORTING column   = col1.
    * fill table
      LOOP AT icontab.
        SELECT SINGLE * FROM icont WHERE langu = sy-langu
                                   AND   id    = icontab-id.
        CALL METHOD col1->add_icon EXPORTING sap_icon = icontab-name
                                             sap_color = 'LIST_GROUP'.
      ENDLOOP.
    ENDFORM.                               " DD_ADD_ICON
    * CLASS cl_my_event_handler IMPLEMENTATION.
    CLASS cl_my_event_handler IMPLEMENTATION.
      METHOD use_new_resources.
        IF is_displayed EQ 'X'.
    * initialize document
          CALL METHOD do->initialize_document.
    * fill document
          PERFORM dd_add_icon USING do.
    * merge document
          CALL METHOD do->merge_document.
    * display document
          CALL METHOD do->display_document
                              EXPORTING reuse_control        = 'X'
                                        reuse_registration   = 'X'.
        ENDIF.
      ENDMETHOD.
    ENDCLASS.
    Regards,
    Vasanth

  • How to insert Glyphs symbol into JTextPane's document

    Hi all,
    I m creating an application in which i want to insert symbol of "Symbol", "Webdings", "Wingdings" etc's fonts into JtextPane's document. How can i do that? can nebody help me.
    Its urgent.
    Thanks in advance,
    Regards,
    Danish Shaikh.

    textPane().getDocument().insertString(...)

  • Insert HTML table into JTextPane

    hi people!
    I'm inserting htmltable in JTtextPane.
    The problem is, that borders aren't shown.
    they are shown in browser, the code in source view is also valid, but in JTextPane they ar invisible. Can anyone tell me Why?
    Here is a piece of code:
    public class HtmlTable {
    public static String insertTableString(int rows, int columns) {
    String tableString="<TABLE Width=100% Border=1>";
    for (int i=0; i<rows; i++) {
    tableString+="<TR>";
    for (int j=0; j<columns; j++)
    tableString+="<TD> </TD>";
    tableString+="</TR>";
    tableString+="</TABLE>";
    return tableString;
    call of this method:
    HTMLEditorKit kit;
    HTMLDoc=(HTMLDocument)editorTextPane.getStyledDocument();
    kit=(HTMLEditorKit)editorTextPane.getEditorKit();
    kit.insertHTML(HTMLDoc,editorTextPane.getCaretPosition(),HtmlTable.insertTableString(HtmlTable.getRowNumber(), HtmlTable.getColumnNumber()),0,0,HTML.Tag.TABLE);

    no Java code involved, just HTML and CSS
    <HTML>
    <HEAD>
    <style type="text/css">
    td {border-top-width:1pt; border-style:solid; }
    </style>
    </HEAD>
    <BODY>
    <p>
    Your Table goes here
    </p>
    <table>
    <tr>
    <td><p>Row 1 Col 1</p></td>
    <td><p>Row 1 Col 2</p></td>
    </tr>
    <tr>
    <td><p>Row 2 Col 1</p></td>
    <td><p>Row 2 Col 2</p></td>
    </tr>
    </table>
    </BODY>
    </HTML>

  • Insert flash media into JTextPane??

    can anyone teach me how to do it? Thanks :)

    It cannot be done (atleast as far as I know). Googling your post title didn't produce any useful links in the first ten results, so this means it aint available yet.
    You could however search for embeddable browser components that can display the system browser within swing. Check out the JDIC Project which has a browser component that does just that. https://jdic.dev.java.net/
    ICE

  • A Simple Question... inserting image into JTextPane...

    Well my problem is very simple (but not for me). Before I explain it, please take a look at a simple class...
    public class Window extends JTextPane {
        Window() {
            super();
        }// Window
        public void appendText(String s,Color col) throws BadLocationException {
            StyledDocument sd = getStyledDocument();
            SimpleAttributeSet attr = new SimpleAttributeSet();
            StyleConstants.setForeground(attr,col);
            sd.insertString(sd.getLength(),s,attr);
          *     THE POINT - what should I write here, please consult description followed by the class.
        } //appendText
    } //classThe appendText method simply appends the text in text pane with desired color. Now I want to know what should I write at point THE POINT so that at end of appended string an icon (suppose end.gif) is added and is displayed in text pane. Simple?
    Stay happy,
    fadee

    Dear Fadee,
    here is a small programe for inserting images into JTextPane;
    find this comment and start
    /*All Code In this Button Action*/if you need any thing feel free to tell me,
    i'm with you brother, i'll do my best :O)
    -Best regards
    mnmmm
    * Fadee.java
    * Created on June 7, 2002, 1:13 AM
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.color.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.text.*;
    * @author  Brother Mohammad, Cairo, Egypt.
    * @version
    public class Fadee extends javax.swing.JFrame {
        JTextPane   tp;
        JButton     b;
        StyledDocument sd;
        SimpleAttributeSet attr;
        public Fadee() throws BadLocationException {
            b = new JButton("Press");
            tp = new JTextPane();
            b.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    /*All Code In this Button Action*/
                    try {
                        sd = tp.getStyledDocument();
                        attr = new SimpleAttributeSet();
                        /*get default style*/
                        Style def = StyleContext.getDefaultStyleContext().
                                            getStyle(StyleContext.DEFAULT_STYLE);
                        /*add style for text default style*/
                        Style regular = tp.addStyle("regular", def);
                        StyleConstants.setFontFamily(def, "SansSerif");
                        StyleConstants.setAlignment(def, StyleConstants.ALIGN_CENTER);
                        StyleConstants.setForeground(def, Color.RED);
                        /*add style for icon create as many as icons you have
                         and don't forget to resize the photo at small size
                         to fit with font size*/
                        Style s = tp.addStyle("icon", regular);
                        StyleConstants.setAlignment(s, StyleConstants.ALIGN_JUSTIFIED);
                        StyleConstants.setIcon(s, new ImageIcon("d:\\My Photo.GIF"));
                        /*here is what user will see*/
                        sd.insertString(sd.getLength(), "Allah Akbar ", tp.getStyle("regular"));
                        sd.insertString(sd.getLength(), " ", tp.getStyle("icon"));
                    } catch (BadLocationException x) {
                        x.printStackTrace();
            getContentPane().setLayout(new BorderLayout());
            getContentPane().add(b, BorderLayout.NORTH);
            getContentPane().add(tp, BorderLayout.CENTER);
            setSize(500, 500);
            setVisible(true);
        public static void main(String args[]) {
            try {
                Fadee f = new Fadee();
            } catch (BadLocationException x) {
                x.printStackTrace();
    }

  • Inserting HTML into JTextPane

    Hi,
    I am trying to insert HTML into JTextPane.
    I am using the following code for the same.
    JTextPane jedit = new JTextPane();       
    jedit.setContentType("text/html");
            HTMLDocument doc = (HTMLDocument)jedit.getDocument();
            String text = "<a href=\"???\">hyperlink</a>asd<a href=\"???\">hyperlink123</a>";
            HTMLEditorKit editorKit = (HTMLEditorKit)jedit.getEditorKit();
            editorKit.insertHTML(doc, doc.getLength(), text, 0, 0, null);
            doc.insertString(doc.getLength(),"Hi testing",null);
            text = "<a href=\"???\">hyperlink123</a>";The problem is that the HTML gets inserted into new line. I do not want the new line.
    I know there is an API like insertBeforeEnd(...) but do not know how to use that.
    Any help for the above problem will be of great use.
    Thanks.

    look I have got the answer ... I guess this would be the root cause of the problem of new line.
    when ever you want the text to be inserted
    -at new line provide the last argument  of HTMLDocument.insertHTML as null
    - at same line provide the last argument as the HTML tag you are inserting into the JtextPane's document.thats it !!!
    ENJOY :-)

  • Inserting text into JTextPane

    I have a requirement where I need to insert some text into a JTextPane within its DocumentListener. I read somewhere that this is not a good practice. What would be the right way of doing this?
    Basically, I'm listening to what user is typing and helping him by inserting some text automatically based on user choice.
    Please provide code samples.

    Hmmm - not knowing anything about the document listener - maybe they were talking about some kind of loop, where you insert text and then it triggers the listener to insert text which triggers the listener to insert text.... etc.
    Maybe there are some other user input listeners, such as the keyListeners which might be better?
    I haven't even had a look at the JTextPane API at the moment, so I don't know what I'm talking about.
    Cheers,
    Rene

  • Inserting Icons in JTextPane with setEditable=false

    Aloha!
    I'm working on this for years now, but i haven't found an acceptable solution yet.
    The problem: I have a JTextPane, where the user shall not be able to edit anything by clicking onto the JTextPane. So I have to setEditable=false. Now I want to insert an icon with insertIcon and therefore i have to setEditable = true. But for short time it's now possible for the user to click onto the screen and change the caretPosition, which must be prevented at all costs (because I'm working with the expected caretPosition of course)! This only happens when I try the brute force testing method, but it happens sometimes...
    So can someone give me a better solution than:
    setEditable = true;
    insertIcon(blahblah);
    setEditable = false;
    Thanks a lot for your attention,
    Holm

    To use HTML, you must use javax.swing.text.html.HTMLDocument instead of StyledDocument,
    Instead of StyleConstants, you must use javax.swing.text.html.HTML$Tag and javax.swing.text.html.HTML$Attribute.
    And you can use an HTMLEditorKit instead of DefaultEditorKit.
    this is an example of initialization:
    javax.swing.text.html.HTMLEditorKit htmlEditorKit = new javax.swing.text.html.HTMLEditorKit();
    javax.swing.text.html.HTMLDocument htmlDoc = (javax.swing.text.html.HTMLDocument)htmlEditorKit.createDefaultDocument();
    yourJTextPane.setEditorKit(htmlEditorKit);
    yourJTextPane.setDocument(htmlDoc);
    yourJTextPane.setEditable(true);
    yourJTextPane.setContentType("text/html");and you can use it by yourJTextPane.setText(HtmlCodeString)
    HTMLDocument and HTMLEditorKit allow you main modifications.
    thanks for duke dollars :)

  • Getting inserted icons from JTextPane

    I have inserted some text including icons in JTextPane. Now i want to copy all contents as such in second Jtextpane. Plz help me

    http://liquidaurum.imgur.com/all/
    This is what's happening, and same thing for terminal

  • Is there a way of inserting symbols into JTextPane?

    Hi there folks. Is there a way of inserting symbols like greek letters in a standard way into JTextPane?

    use getDocument(). insertString(offs,str, attributes);
    str should contain proper unicode chars and attributes must contain proper font family to show the chars.
    use StyleConstants.setFontFamily()
    regards,
    Stas

  • Inserting a Value into otherTable using an App. Proc. from a Date Picker

    I'm trying to call an Application Process that will insert an Attribute of a Row, into another table, after selecting a date from a Date Picker cell.
    I don't know why this shouldn't be possible. I think I've got all of my "Ducks in a Row", so to speak,
    but the Value that is being inserted into the other table is this:.. [object HTMLTableCellElement]
    (Ultimately, I'd like my Application Process to include Page element values with the insert as well, but I'm trying to handle one problem at a time)
    Here's a list of all the steps I've covered:
    1. I've Created an Application Process, (popDevices). The Process Point is "On-Demand". The Type is "PL/SQL Anonymous Block".
    The Process is defined as such:
    BEGIN
    Insert into P_DEVICES
    NAME,
    IP_ADDRESS,
    MODEL
    ) values
    'Unassigned',
    'Unassigned',
    :P153_MODEL
    COMMIT;
    END;
    2. I've Included the Javascript in the Page HTML Header.
    The Javascript is written as such: (minus the tags)
    function popDevices(PART_NO)
    var get = new htmldb_Get(null,$x('pFlowId').value,'APPLICATION_PROCESS=popDevices',0);
    get.add('P153_MODEL',PART_NO);
    gReturn = get.get();
    get = null;
    3. I've included the following in the "Element Attributes" field of the Date-Picker Item (Date_Delivered).
    The Region Type is "SQL Query (Updatable Report)"
    onChange="javascript:popDevices(PART_NO);"
    THE RESULTS
    A. A row does get inserted into the other (P_Devices) table,
    But the value of the Attribute from the Page Region is not valid.
    The Inserted value is this: [object HTMLTableCellElement]
    B. I have tried Every conceivable combination of characters in the "Element Attributes" field, such as:
    ...(PART_NO), (#PART_NO#), (||PART_NO||), (+PART_NO+)
    C. The Javascript in the Page HTML Header appears to be correct, since I have written it this same way for other applications without any problems.
    D. If this simply cannot be done by referencing the "onChange" Javascript from the "Element Attributes" field,
    Then can you help me to write the code into the Select statement of the region.
    Thanks for any help you can give me.
    -Gary

    This may not be the most direct approach to the solution. But, none the less, it is a solution.
    For those other novices, like myself, I hope this can be useful at some point in your development:
    MY DESIRED RESULT:
    A. To Insert into another tablle values derived from both; Page Item (i.e. P153_x) and Attributes of a Row in an Updatable Report from which I have selected the Date-Picker.
    B. I want the insert to occur automatically after the user Selects the date from the Date-Picker.
    SOLUTIONS:
    1. I usea Javascript prompt window to prompt for information and store the information in Pre-Created Page Items.
    This is the Javascript as I've entered it into the Page HTML Header region: (Minus the Tags)
    function received_javaprompt () {
    var Serial_Number = prompt("Enter the Serial Number");
    var Bldg_Id = prompt("Enter the Bldg_Id");
    var Clst_Id = prompt("Enter the Clst_Id");
    $x('P153_SERIAL_NO').value = Serial_Number;
    $x('P153_BLDG_ID').value = Bldg_Id;
    $x('P153_CLST_ID').value = Clst_Id;
    2. I needed to identify the (Manufacturer and Part_No) Column Attribute in the Row from which I selected the Date-Picker.
    A. To do this, I enumerated the Columns in the order they were listed in the Select Statement of the region (Click on the Region Definition Tab).
    B. Then (Click on the Report Attributes Tab). Count, In the numerical order which these columns are selected, ONLY the columns that are Editable.
    C. When I counted down as far as the Column I wanted to capture the value of, Then I made a mental note of that number and used it in the following (2) Javascripts (findMaker and findModel).
    3. findMaker (Minus the tags)
    function findMaker (pThis) {
    var vRow = pThis.id.substr(pThis.id.indexOf('_')+1);
    var Maker = html_GetElement('f15_'+vRow).value
    $x('P153_MAKER').value = Maker;
    4. findModel (Minus the tags)
    function findModel (pThis) {
    var vRow = pThis.id.substr(pThis.id.indexOf('_')+1);
    var Model = html_GetElement('f16_'+vRow).value
    $x('P153_MODEL').value = Model;
    5. I added one more Javascript, to the Page HTML Header, that references the Application Process which will Insert the values into the "Other" table:
    function popDevices(P153_SERIAL_NO,P153_BLDG_ID,P153_CLST_ID,P153_MAKER,P153_MODEL)
    var get = new htmldb_Get(null,$x('pFlowId').value,'APPLICATION_PROCESS=popDevices',0);
    get.add('P153_SERIAL_NO',P153_SERIAL_NO);
    get.add('P153_BLDG_ID',P153_BLDG_ID);
    get.add('P153_CLST_ID',P153_CLST_ID);
    get.add('P153_MAKER',P153_MAKER);
    get.add('P153_MODEL',P153_MODEL);
    gReturn = get.get();
    get = null;
    6. I added the "onChange" process to the Element Attributes field of the Table item which utilizes the Date-Picker:
    A. Click on the Report Attributes Tab of the Region.
    B. Click on the Edit icon of the column which utilized the Date-Picker
    C. I added this "onChange" reference to the Element Attributes field, which is found in the Tabular Form section.
    onChange="javascript:received_javaprompt();findModel(this);findMaker(this);popDevices((P153_SERIAL_NO).value,(P153_BLDG_ID).value,(P153_CLST_ID).value,(P153_MAKER).value,(P153_MODEL).value);"
    7. The Application Process which inserts the collected data into the table is as follows:
    (Name= popDevices: Process Point= On-Demand: Type= PL/SQL Anonymous Block)
    BEGIN
    Insert into P_DEVICES
    BLDG_ID,
    CLST_ID,
    NAME,
    IP_ADDRESS,
    SERIAL_NO,
    MAKER,
    MODEL
    ) values
    :P153_BLDG_ID,
    :P153_CLST_ID,
    'Unassigned',
    'Unassigned',
    :P153_SERIAL_NO,
    :P153_MAKER,
    :P153_MODEL
    COMMIT;
    END;
    Well, I hope this may help someone else like me.
    I usually arrive at my solutions by getting help here on the Discussion Forum and also Google. Google inevitably points me to a previous Apex Discussion Forum session.
    Edited by: garyNboston on Mar 15, 2010 10:55 AM

  • How to insert a query into a NEW workbook ?

    Hi Friends,
    Could some one tell me how to insert a query into a new workbook? i am trying to run query in NW2004S BEx Query Designer, which always open the query on web when executed. i want to run the query in NW2004S BEx Query Designer and want it to open the result in Excell.
    If i am not wrong then to do the same, i need to embed the query into workbook. Correct me if i am wrong. If i am right then plzz tell me the steps to insert the query into workbook.
    Ur help will be rewarded in terms of points.
    Thanks,

    Hello,
    If you open the BEx Query Designer from the desktop, you cannot execute the query directly to the BEx Analyzer for an Excel view. You can only execute it directly to the Web. This is true for the SAP BW 3.x version as well as the SAP NetWeaver 2004s version.
    If you open the BEx Query Designer from within BEx Analyzer, once you select (or create) your query, you will have a green check mark icon that will then allow you to deploy the query directly to the BEx Analyzer for the Excel view.
    However, this would only make sense if you are creating or modifying the query. If not, you would simply open BEx Analyzer and use the Open Query option in this tool to see your query in an Excel format, as has been previously suggested by the other respondents to this posting.
    Regards,
    Katie Beavers
    SAP NetWeaver Product Management

  • Inserting an ImageIcon into a JLabel

    Hello.
    I'm trying to insert an ImageIcon into a JLabel
    component which includes text.
    I want this JLabel to be a cell in a JTable,
    so i'm trying to add the ImageIcon inside the method
    public Component getTableCellRendererComponent
    (JTable table, Object value, boolean isSelected,
    boolean hasFocus, int row, int column)
    of class
    public class ClientCellRenderer extends
    DefaultTableCellRenderer
    the code regarding the ImageIcon is:
    JLabel label = new JLabel((String)value, icon, CENTER);
    return label;
    this code resides inside getTableCellRendererComponent.
    for some reason i don't see the ImageIcon in the JTable,
    although i see the text (which is (String)value).
    i hope someone could help me.
    thanks,
    Topa.

    Assuming that your image icon is being loaded correctly, the following will solve your problem.
    Replace these lines:
    JLabel label = new JLabel((String)value, icon,
    CENTER);
    return label;with these:
    super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
    setIcon(icon);
    return this;
    This works because DefaultTableCellRenderer extends JLabel, and returns itself as the renderer component.

  • Cannot open PDFs inserted as objects into Excel.

    Two-part question.  I know this has been addressed before, but the solutions are not working for me.
    I have Adobe Acrobat 9 Pro and Adobe Reader XI.  When inserting a PDF document as an object into Excel, it will not allow me to insert the icon/object from the "Create New" option.  I get one of two error messages: 'Cannot insert object'  or 'Cannot start the soruce application for this object'.  I am able to insert the PDF icon/object if I insert from the "Create from file" option. (Please note I cannot always link to the PDF, as some spreadsheets are sent out externally and will not have access.)
    Once I am finally able to insert the document as an object, I can open and view the PDF.  However, when I close the spreadsheet and re-open it, if I try to open the PDF document again, I get this error message again: 'Cannot start the soruce application for this object'.
    I have changed my preference to disable the Protected Mode at startup and this issue is still happening.  VERY frustrating.  I never encountered this is past versions of Adobe and all previous suggestions are not fixing the issue.  Does anyone have any insight or know of an update to fix this issue?  Is this an Adobe issue or a Microsoft Office issue?

    Hi Jerry,
    Can you check the similar thread
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/d554e88c-d72f-46b0-8b1a-2f2024fcb9c0/i-e-8-browser-wont-open-pdf-file-returned-from-sharepoint-2010-search?forum=sharepointadminprevious
    My Blog- http://www.sharepoint-journey.com|
    If a post answers your question, please click Mark As Answer on that post and Vote as Helpful

Maybe you are looking for