Paint from different method

Hi,
I have class which extends JPanel. I want to draw a string from a public method in the same class which is different from paint(Graphics g) method.
But, the string does not appear when I do:
g2.drawString("hello",50,50);
I had declared Graphics2D g2 in the class and I have in paint(Graphics g)
g2 = (Graphics 2D)g
I also used repaint(); validate() after drawString, but no help..
Am I missing anything ?
Thanks,
Dhiman

You can use JLabel and do your painting using BufferedImage
For eg.,
JLabel label = new JLabel("", JLabel.CENTER);
BufferedImage buff = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
Graphics g = buff.getGraphics();
//Draw the Image
g.drawImage(img, 0, 0, null);
//Draw the String
g.drawString("Hello Java!!", 10, 10);
//Now draw the Image on the Label
label.setIcon(new ImageIcon(buff));

Similar Messages

  • Differentiating between same exception thrown from 2 different methods

    Suppose I have a class CodeDAO which has 2 methods who both throw SQLException
    public int getLocationCode(String locationName) throws SQLException;
    public int getDepartmentCode(String departmentName) throws SQLException;Now I have a business method in which I have to use both of the above DAO methods.
    public int process() {
       try {
          CodeDAO codeDAO = new CodeDAO();
          int locationCode = codeDAO.getLocationCode("NJ");
          int departmentCode = codeDAO.getDepartmentCode("Sales");
       catch (SQLException e) {
    }If SQLException is thrown how will I know if it is thrown by the getLocationCode method or getDepartmentCode method?
    What are the different choices I have in differentiating between same exception thrown from different methods? And which choice do you guys prefer?
    Thanks

    srhcan wrote:
    maheshguruswamy wrote:
    srhcan wrote:
    gimbal2 wrote:
    baftos wrote:
    Put each method invokation in its own try/catch block.Or in fact not use SQLException, but exceptions that are unique.So each DAO method has its own exception?
    public int getLocationCode(String locationName) throws GetLocationCodeException;
    public int getDepartmentCode(String departmentName) throws GetDepartmentCodeException;would not that means I have to create a lot of exception classes?
    Edited by: srhcan on Aug 9, 2012 2:54 PMLet me ask you this, what do you plan to do in the catch block? Do some sort of recovery? rollback? If it is just for logging purposes, I am pretty sure the exception message will give you enough information to find out where the error was.* I would like to give user a specific message based on which method fails. So if getLocationCode("NJ") fails the message can be: Unable to find code for Location "NJ". And if getDepartmentCode("Sales") fails the message can be: Unable to find code for Department "Sales".
    * I would like to print the exception's stacktrace in the log file.
    * I may do a rollback depending on if its an INSERT/UPDATE/DELETE statement.Well, in that case why not log it in the DAO methods themselves...inside getLocationCode and getDepartmentCode. Instead of trying to do the recovery/logging in the process method, do it in the individual dao methods. The calling classes should not be responsible for logging/recovery etc. It should be done in the DAO classes themselves and the DAO method should return an appropriate message/code to the consumer tier classes indicating the status of the transaction. Just my 0.02$.

  • Paint from a paint(Component) method? Is it possible?

    Hi all
    Here's my deal: I'd like to make a Paint (http://java.sun.com/javase/6/docs/api/java/awt/Paint.html) out of a component or even better, just something with a paint(Graphics) method. I looked into implementing my own Paint, but it looks very foreboding, esp the requirement to be able to get the Raster in the PaintContext object which I think I'd have to implement too.
    Any advice?

    Here's my attempt at it...
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.Paint;
    import java.awt.PaintContext;
    import java.awt.Rectangle;
    import java.awt.RenderingHints;
    import java.awt.geom.AffineTransform;
    import java.awt.geom.Rectangle2D;
    import java.awt.image.BufferedImage;
    import java.awt.image.ColorModel;
    import java.awt.image.Raster;
    import javax.swing.JComponent;
    import javax.swing.JFrame;
    import java.lang.reflect.Method;
    public class ImagePaint implements Paint {
        Object paintable;
        Method paintMethod;
        BufferedImage paint;
        public ImagePaint(Object paintable) {
            this.paintable = paintable;
            try{
                paintMethod =
                        paintable.getClass().getMethod("paint",Graphics.class);
            }catch(java.lang.NoSuchMethodException e) {
                throw new IllegalArgumentException("Paintable object does " +
                        "not have paint method!");
        public java.awt.PaintContext createContext(ColorModel cm,
                                                   Rectangle deviceBounds,
                                                   Rectangle2D userBounds,
                                                   AffineTransform xform,
                                                   RenderingHints hints) {
            /*the bounds being passed to this method is the bounding rectangle
             *of the shape being filled or drawn*/
           paint = new BufferedImage(deviceBounds.width,
                                     deviceBounds.height,
                                     BufferedImage.TYPE_3BYTE_BGR);
               /*note: if translucent/transparent colors are used in the
                *paintable object's "paint" method then the BufferedImage
                *type will need to be different*/
            Graphics2D g = paint.createGraphics();
                /*set the clip size so the paintable object knows the
                 *size of the image/shape they are dealing with*/
            g.setClip(0,0,paint.getWidth(),paint.getHeight());
            //call on the paintable object to ask how to fill in/draw the shape
            try {
                paintMethod.invoke(paintable, g);
            } catch (Exception e) {
                throw new RuntimeException(
                   "Could not invoke paint method on: " +
                        paintable.getClass(), e);
            return new ImagePaintContext(xform,
                                         (int) userBounds.getMinX(),
                                         (int) userBounds.getMinY());
        public int getTransparency() {
            /*Technically the transparency returned should be whatever colors are
             *used in the paintable object's "paint" method.  Since I'm just
             *drawing an opaque cross with this aplication, I'll return opaque.*/
            return java.awt.Transparency.OPAQUE;
        public class ImagePaintContext implements PaintContext {
            AffineTransform deviceToUser;
            /*the upper left x and y coordinate of the where the shape is (in
             *user space)*/
            int minX, minY;
            public ImagePaintContext(AffineTransform xform, int xCoor,
                                                            int yCoor){
                try{
                    deviceToUser = xform.createInverse();
                }catch(java.awt.geom.NoninvertibleTransformException e) {}
                minX = xCoor;
                minY = yCoor;
            public Raster getRaster(int x, int y, int w, int h) {
                /*find the point on the image that the device (x,y) coordinate
                 *refers to*/
                java.awt.geom.Point2D tmp =
                        new java.awt.geom.Point2D.Double(x,y);
                if(deviceToUser != null) {
                    deviceToUser.transform(tmp,tmp);
                }else{
                    tmp.setLocation(0,0);
                tmp.setLocation(tmp.getX()-minX,tmp.getY()-minY);
                /*return the important portion of the image/raster in the
                 * coordinate space of the device.*/
                return paint.getRaster().createChild((int) tmp.getX(),
                                                     (int) tmp.getY(),
                                                     w,h,x,y,null);
            public ColorModel getColorModel() {
                return paint.getColorModel();
            public void dispose() {
                paint = null;
        public static void main(String[] args) {
            /*as of java 1.6.10 d3d is enabled by default.  The fillRect
             * commands are significantly slower with d3d.  I think this is
             * a known bug.  Also, with d3d enabled I get all sort
             * weird painting artificats for this particular demonstration*/
            System.setProperty("sun.java2d.d3d","false");
            final ImagePaint paint = new ImagePaint(new Object() {
                public void paint(Graphics g) {
                    Rectangle r = g.getClipBounds();
                    g.setColor(Color.white);
                    g.fillRect(r.x,r.y,r.width,r.height);
                    //draw a red cross
                    g.setColor(Color.red);
                    g.fillRect(r.width/2-20,0,40,r.height);
                    g.fillRect(0,r.height/2-20,r.width,40);
                    g.dispose();
            JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            JComponent p = new JComponent() {
                public void paintComponent(Graphics g) {
                    Graphics2D g2d = (Graphics2D) g;
                    g2d.setPaint(paint);
                    g2d.fillOval(getWidth()/3,getHeight()/3,
                                 getWidth()/3,getHeight()/3);
                    g2d.dispose();
            p.setPreferredSize(new Dimension(500,500));
            f.setContentPane(p);
            f.pack();
            f.setVisible(true);
    }I don't think the unresponsiveness from larger areas is necessarily due to your code. For all of my GUI applications, resizing an
    already large frame tends to be prety sucky while resizing an already small frame tends to be pretty smooth.

  • Choosing different methods from switch statement

    I've written 3 different methods that solve the same problem (a Fibonacci sequence) and want to combine them. So, first user inputs the n as number of Fibonacci numbers, and then chooses m as either 1-recursion, 2-iteration, or, 3-constant.
    int m = ... //user input
    int[] method = new int[11]; // array holding for 0<=n<=10
    if (m>=1 && m<=3) {
        switch(m) {
         case 1: method[m] = recursion(n);
                             break;
         case 2: method[m] = iteration(n);
                             break;
         case 3: method[m] = constant(n);
                             break;               
    for (int i=0; i <= n; i++) {
         System.out.print(":");
         for (int j=1; j <= method[m]; j++) { // how to put "i" into chosen method's parameter ("n")
              System.out.print("*");
         System.out.println();
         Edited by: courteous on Nov 9, 2008 2:35 AM

    I've written 3 different methods that solve the same problem (a Tribonacci sequence: 0,1,1,2,4,7,13,24,44,... sum of previous three numbers) and want to combine them. So, first user inputs the n as number of Tribonacci numbers, and then chooses m as either 1-recursion, 2-iteration, or, 3-constant.
    Either of these three methods outputs ":" and then the number of "*" that represent the Trib. number. For example:
    :                     //Tribonacci(0)=0
    :*                     //Tribonacci(1)=1       
    :*                     //Tribonacci(2)=1
    :**                     //Tribonacci(3)=2
    :****                     //Tribonacci(4)=4
    :*******                     //Tribonacci(5)=7
    :************                     //Tribonacci(6)=13Here is the relevant part of code:
    int n = ... //user input
    int m = ... //user input
    int[] method = new int[11]; // array holding for 0<=n<=10
    if (m>=1 && m<=3) {
        switch(m) {
         case 1: method[m] = recursion(n);
                             break;
         case 2: method[m] = iteration(n);
                             break;
         case 3: method[m] = constant(n);
                             break;               
    for (int i=0; i <= n; i++) {
         System.out.print(":");
         for (int j=1; j <= ??? ; j++) { // how to put "i" into chosen method's parameter ("n")
              System.out.print("*");
         System.out.println();
         The problem is with the inner for loop, that I don't know how to formalize the condition part. If, instead of "???", you would write "method[m]",
    for (int j=1; j <= method[m] ; j++) and the user input would be "n=2" (two Trib. numbers, starting with 0; thus, the outer for loop prints ":" three times) and "m=2" (method "2-iteration"), output would be:
    :        //missing star (*)
    How to write condition that would, while using chosen method, simultaneously insert "i" as (chosen) method's parameter. That would make the condition for (int j=1; j <= ??? ; j++) increasing, and producing the right amount of stars (*)?
    /* Sorry, for lengthy post, but I must make it as clear as possible*/
    Peter, method would just invoke non-existing methods (there is only one full, either method[1] (recursion), or method[2] (iteration), or method[3] (constant)), so this won't work (I guess).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Different methods of creating an XML Publisher report

    Hi All,
    Can anyone please advice me on different methods of creating an XML Publisher report.
    The method which we us is as follows -
    1. Create an RDF file and upload the same in the /REPORTS/US path.
    2. create a concurrent program, give output as XML.
    3. Create a data definition, but here we do not upload any data definition.
    4. Create a template and upload the RTF template.
    But I have heard that there is a method wherein we do not have to create the RDF and simply adding the query to the XML file works.
    But in that case do we upload anything in tht Data defition also ?
    Can anyone please provide me any link or some place where I can read about different methods to create an XML report without the use of an RDF.
    Regards,
    Shruti

    Hi Shruti,
    There is a method where we need not to create RDF as data defination. You need to write a xml file which we upload as data defination. The short name for this data defination used as short name as concurrent program having executable XDODTEXE.
    Sample XML data template :
    <?xml version="1.0" encoding="UTF-8" ?>
    <dataTemplate name="EmpData" description="Employee Details" version="1.0">
    <dataQuery>
    <sqlStatement name="Q1">
    <![CDATA[select business_group_id, business_group_name
                   from hrfv_business_groups
                   where date_to is null
                     and business_group_id not in (0, 82)
                         order by business_group_id]]>
    </sqlStatement>
    <sqlStatement name="Q2">
    <![CDATA[select employee_number,
                         title ,
                         full_name,
                         sex ,
                         date_of_birth,
                         email_address
                 from per_all_people_f
                 where business_group_id = :business_group_id
                   and current_employee_flag ='Y'
                   and trunc(sysdate) between effective_start_date and effective_end_date
                   and rownum<11]]>
    </sqlStatement>
    </dataQuery>
    <dataStructure>
    <group name="G_BG" source="Q1">
    <element name="BusinessGroupId" value ="business_group_id"/>
    <element name="BusinessGroupName" value ="business_group_name"/>
    <group name="G_EMP" source="Q2">
    <element name="EmpNumber" value ="employee_number"/>
    <element name="Title" value ="title"/>
    <element name="FullName" value ="full_name"/>
    <element name="Sex" value ="sex"/>
    <element name="DateOfBirth" value ="date_of_birth"/>
    <element name="EmailAddress" value ="email_address"/>
    </group>
    </group>
    </dataStructure>
    </dataTemplate>
    This data template generates xml data which prints output on rtf template.
    Hope this will help. Let me know for more info.

  • Sharing the same iTunes library from different Macs/Pcs to Time Capsule

    Hello everybody,
    I have just bought a new Time Capsule (2TB) internal storage and an external 2TB Western Digital that i have also connected to the time capsule just fine.
    The Time capsule is supplying internet to a ps3, apple tv, sony bluray player and a satelite reciever (equivalent to Sky in UK). It is actually setup on the second floor and is acting as a extension for the main network and is working perfectly.
    Now I have about 5 Pcs at home with different users and 2 mac laptops (Kids wife etc.. so different users).
    My ultimate goal is to setup one itunes library on all the laptops that are present on the TC.
    What I did was I copied the Itunes folder (my main precious itunes library) and pasted it on the TC hard drive.
    Then i tried opening it from an itunes of one of the laptops (a macbook), I opened itunes while holding options button and choose the library to the wirelessly shared itunes file and it showed up perfectly like the exact itunes with everything in it including play counts etc..
    but when i want to open a song it doesnt find it and i have to pinpoint location in order to play the song.
    Its just not possible to do that to every single song as my library is about 120 gigs of music. It would take years to do tht for every song.
    When i usually find one folder itunes asks to find all of them automatically and when i press yes itunes stops working.
    PS. Im trying this on one laptop now as a trial in order to see how this works. The main library is backed up and all safe n sound. Also i would like to say i changed the itunes library folder to the time capsule on preferences of itunes.
    Is there anyway anyone could help me? Any different methods to do it? Please we can discuss whatever ideas ud like to include.
    Thank you

    Check this article for advice about sharing iTunes libraries.

  • How ATTACH multiple files from different folders in one ATTACH 'session'?

    Hi,
    In Mac Mail, I often have to attach 2 or 3 separate files, all from different folder locations on my hard drive.
    This requires clicking attach, selecting file 1 and clicking OK, which closes the Attach dialog.
    Then I have to do it again 2 times for each other file. oy.
    Is there a way to Highlight multiple files in different directories (ala Command-Select...which doesn't work) before selecting OK?
    OR
    I've found that I can DRAG a file from the Attach dialog into the email and the dialog will remain open, only the file is HIGHLIGHTED in the email and , hence, gets replaced by the next file I drag into the email (or select by the normal method)....
    Is there a way to drag that file#1 into the email and have it NOT remain highlighted, so that I can pick another file to add in addition to that one?
    Thanks!

    ShizzleFizzle wrote:
    Is there a way to Highlight multiple files in different directories (ala Command-Select...which doesn't work) before selecting OK?
    Have you tried dragging files from Finder windows into the mail message window?

  • How to read the attribute in another context node from setter method

    Hi,
    As part of the  requirement
    i need to read the STRUCT.E_MAIL ( attribute ) present  in  INDEPENDANTEMAIL context node  from  the SET_S_SRUCT method of the context node  HEADER.
    I tried th following but it didnt work out....
    Get the Custom Controller Path
    *lr_cuco ?= controller->get_custom_controller( controller_id = 'BP_HEAD/IndComm').
    *IF lr_cuco IS BOUND.
    Get the Entity
    *lr_entity ?= lr_cuco->typed_context->independantemail->collection_wrapper->get_current( ).
    *ENDIF.
    *CHECK lr_entity IS BOUND.
    Get the Trade Event Type.
    *lv_email  = lr_entity->get_property_as_string( 'E_MAIL' ).
    also i tried ...
    data:
    *lv_value type string,
    *lr_property type ref to if_bol_bo_property_access.
    *lr_property = collection_wrapper->get_current( ).
    *lv_value = lr_property->GET_PROPERTY_AS_STRING( importing iv_attr_name = 'E_MAIL'
                                                returining  ev_result    = lv_email ).
    but it didnt workout ......
    Any suggestions   ...................
    Regards,
    Sijo...

    Hi,
    Both Context node are available in view then refer this link.
    Reading Attributes from different context nodes in the same view
    Relationship name for context node INDEPENDENTMAIL is 'BuilIndependantEmailRel'
    Regards
    Gaurav

  • How to store data in hashmap so that it can be used by different methods.

    Hello,
    I have an ADF/JSF application and the database is DRM. The program gets data from DRM into this hashmap. Program needs this data frequently. Getting this HashMap is very resource intensive due to a lot of data it has.
    I want to get the data in HashMap once ( I can do this - no problem).  But where/how do I keep it so that different methods can just use this and not make individual trips to DRM? It may be a very basic java question but I seem to be stuck :)
    I am not very concerned about the HashMap part, it can be any collection - the question is of storing it so that it can be used over and over.
    Thanks,

    User,
    If I understand you correctly, you have a JSF application that needs to store data in a HashMap such that it can be accessed over and over? You could put the hashmap into an appropriately-scoped managed bean and access it from there. I'm not sure what a "DRM" is (a digital rights management database, perhaps, in which case it's a "database"), so there is something special about a "DRM" that we need to know, please share.
    John

  • HT201263 My ipod Touch does not want to turn on. I've tried all the different methods and I'm stuck and dont know what to do now. What else can I try?

    My ipod Touch does not want to turn on. I've tried all the different methods and I'm stuck and dont know what to do now. What else can I try?

    JesusDGZ wrote:
    My ipod Touch does not want to turn on. I've tried all the different methods and I'm stuck and dont know what to do now. What else can I try?
    I have no clue what you mean by "all the different methods."  Here are my suggestions.
    First, try a system reset.  It cures many ills and it's quick, easy and harmless...
    Hold down the on/off switch and the Home button simultaneously until you see the Apple logo.  Ignore the "Slide to power off" text if it appears.  You will not lose any apps, data, music, movies, settings, etc.
    If the Reset doesn't work, try a Restore.  Note that it's nowhere near as quick as a Reset.  It could take well over an hour!  Connect via cable to the computer that you use for sync.  From iTunes, select the iPad/iPod and then select the Summary tab.  Follow directions for Restore and be sure to say "yes" to the backup.  You will be warned that all data (apps, music, movies, etc.) will be erased but, as the Restore finishes, you will be asked if you wish the contents of the backup to be copied to the iPad/iPod.  Again, say "yes."
    At the end of the basic Restore, you will be asked if you wish to sync the iPad/iPod.  As before, say "yes."  Note that that sync selection will disappear and the Restore will end if you do not respond within a reasonable time.  If that happens, only the apps that are part of the IOS will appear on your device.  Corrective action is simple -  choose manual "Sync" from the bottom right of iTunes.
    If you're unable to do the Restore, go into Recovery Mode per the instructions here.

  • How to get only column names from different tables as single table columns

    Hi All,
       I have one requirement in which we want only column names from different tables.
    for example :
     I have three tables T1 ,T2, T3 having
      col1 clo2 clo3 -->  T1 , 
      col3 col5 ,clo6 --> T2 ,
      Clo6 col8 col9 --> T3
    columns i want to get only all  Column names from all table as single Resultset not any data from that how can i get that empty resultset 
    because this empty result i want to bind in datagridview(front end) as Empty resultset 
    Please tell me anyways to do this
    Niraj Sevalkar

    If I understand you want an empty result set, just with metadata. SET FMTONLY do the trick:
    SET FMTONLY ON
    SELECT Col1, Col2, Col3, ....., Coln
    FROM
    T1 CROSS JOIN T2 CROSS JOIN T3
    SET FMTONLY OFF
    Another alternative is to include an imposible contition
    SELECT Col1, Col2, Col3, ....., Coln
    FROM
    T1 CROSS JOIN T2 CROSS JOIN T3
    WHERE 1 = 0
    If you are using a SqlDataAdapter in your client application. You can use the FillSchema method. the select command may be any select statement that returns the columns you want. Under the covers FillSchema will call SET FMTONLY ON.
    If you are using SqlCommand.ExecuteReader you can pass SchemaOnly to CommandBehavior argument. SET FMTONLY ON is called under the covers. Again the select command may be any select statement that returns the columns you want.
    "No darás tropezón ni desatino que no te haga adelantar camino" Bernardo Balbuena

  • Hi can someone tell me if it is possible to have two accounts (from different countries) in the same laptop?

    Hi can someone tell me if it is possible to have two accounts (from different countries) in the same laptop?

    Hi...
    The issue is that your credit or debit card credentials must be associated with the same country where you reside to make purchases.
    "Although you can browse the iTunes Store in any country without being signed in, you can only purchase content from the iTunes Store for your own country. This is enforced via the billing address associated with your credit card or other payment method that you use with the iTunes Store, rather than your actual geographic location."
    From here >  The Complete Guide to Using the iTunes Store | iLounge Article
    Billing policy is the same for both the iTunes as well as Mac App Stores.

  • What are the different methods to find the user-exit for any requirement?

    Hi Everybody,
    What are the different methods to follow to find the user-exit for any requirement?
    Thanks & Regards,
    Nagaraju Maddi

    The following program search all the user exits involved with a T-code:
    Selection Text: P_TCODE: Transaction Code to Search
    Text Symbols: 001 - Enter the Transaction Code that you want to search through for a User Exit
    REPORT z_find_userexit NO STANDARD PAGE HEADING.
    *&  Enter the transaction code that you want to search through in order
    *&  to find which Standard SAP® User Exits exists.
    *& Tables
    TABLES : tstc,     "SAP® Transaction Codes
             tadir,    "Directory of Repository Objects
             modsapt,  "SAP® Enhancements - Short Texts
             modact,   "Modifications
             trdir,    "System table TRDIR
             tfdir,    "Function Module
             enlfdir,  "Additional Attributes for Function Modules
             tstct.    "Transaction Code Texts
    *& Variables
    DATA : jtab LIKE tadir OCCURS 0 WITH HEADER LINE.
    DATA : field1(30).
    DATA : v_devclass LIKE tadir-devclass.
    *& Selection Screen Parameters
    SELECTION-SCREEN BEGIN OF BLOCK a01 WITH FRAME TITLE text-001.
    SELECTION-SCREEN SKIP.
    PARAMETERS : p_tcode LIKE tstc-tcode OBLIGATORY.
    SELECTION-SCREEN SKIP.
    SELECTION-SCREEN END OF BLOCK a01.
    *& Start of main program
    START-OF-SELECTION.
    * Validate Transaction Code
      SELECT SINGLE * FROM tstc
        WHERE tcode EQ p_tcode.
    * Find Repository Objects for transaction code
      IF sy-subrc EQ 0.
        SELECT SINGLE * FROM tadir
           WHERE pgmid    = 'R3TR'
             AND object   = 'PROG'
             AND obj_name = tstc-pgmna.
        MOVE : tadir-devclass TO v_devclass.
        IF sy-subrc NE 0.
          SELECT SINGLE * FROM trdir
             WHERE name = tstc-pgmna.
          IF trdir-subc EQ 'F'.
            SELECT SINGLE * FROM tfdir
              WHERE pname = tstc-pgmna.
            SELECT SINGLE * FROM enlfdir
              WHERE funcname = tfdir-funcname.
            SELECT SINGLE * FROM tadir
              WHERE pgmid    = 'R3TR'
                AND object   = 'FUGR'
                AND obj_name = enlfdir-area.
            MOVE : tadir-devclass TO v_devclass.
          ENDIF.
        ENDIF.
      * Find SAP® Modifications
        SELECT * FROM tadir
          INTO TABLE jtab
          WHERE pgmid    = 'R3TR'
            AND object   = 'SMOD'
            AND devclass = v_devclass.
        SELECT SINGLE * FROM tstct
          WHERE sprsl EQ sy-langu
            AND tcode EQ p_tcode.
        FORMAT COLOR COL_POSITIVE INTENSIFIED OFF.
        WRITE:/(19) 'Transaction Code - ',
        20(20) p_tcode,
        45(50) tstct-ttext.
        SKIP.
        IF NOT jtab[] IS INITIAL.
          WRITE:/(95) sy-uline.
          FORMAT COLOR COL_HEADING INTENSIFIED ON.
          WRITE:/1 sy-vline,
          2 'Exit Name',
          21 sy-vline ,
          22 'Description',
          95 sy-vline.
          WRITE:/(95) sy-uline.
          LOOP AT jtab.
            SELECT SINGLE * FROM modsapt
            WHERE sprsl = sy-langu AND
            name = jtab-obj_name.
            FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
            WRITE:/1 sy-vline,
            2 jtab-obj_name HOTSPOT ON,
            21 sy-vline ,
            22 modsapt-modtext,
            95 sy-vline.
          ENDLOOP.
          WRITE:/(95) sy-uline.
          DESCRIBE TABLE jtab.
          SKIP.
          FORMAT COLOR COL_TOTAL INTENSIFIED ON.
          WRITE:/ 'No of Exits:' , sy-tfill.
        ELSE.
          FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
          WRITE:/(95) 'No User Exit exists'.
        ENDIF.
      ELSE.
        FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
        WRITE:/(95) 'Transaction Code Does Not Exist'.
      ENDIF.
    * Take the user to SMOD for the Exit that was selected.
    AT LINE-SELECTION.
      GET CURSOR FIELD field1.
      CHECK field1(4) EQ 'JTAB'.
      SET PARAMETER ID 'MON' FIELD sy-lisel+1(10).
      CALL TRANSACTION 'SMOD' AND SKIP FIRST SCREEN.

  • Problem with image returned from getGeneratedMapImage method

    I'm a newbie as far as map viewer and Java 2D goes....
    My problem is the java.awt.Image returned from the getGeneratedMapImage method of the MapViewer API. The image format is set to FORMAT_RAW_COMPRESSED. The image returned is of poor quality with colors not being correct and lines missing. I'm painting the Image returned from this method onto my own custom JComponent by overriding the paint() method...
    public void paint( Graphics g )
    Image image = map.getGeneratedMapImage();
    if ( image != null )
    g.drawImage( image, getLocation().x, getLocation().y, Color.white, this );
    If I take the xml request sent to the application server and paste it into a "sample map request" on the map admin website (along with changing format to PNG_STREAM) my image renders exactly how I expect it to.
    Anyone have any idea what I need to do to get the java.awt.Image with format set to FORMAT_RAW_COMPRESSED to render correctly. I was hoping to get back a BufferedImage or a RenderedImage from the getGeneratedMapImage call but I'm getting back a "sun.awt.motif.X11Image".
    Will downloading the JAI (java advanced imaging) from sun help me at all?

    Joao,
    Turns out it is related to colors. I'm dynamically adding themes, linear features and line styles. I ran a test where I changed the color being specified in the line style from magenta (ff00ff) to black. When I changed the color the linear feature would show up. It was being rendered as white on a white background when I was specifying it to be magenta. I'm specifying another linear feature to be green and it is showing up in the java image as yellow. This doesn't happen when I take the generated XML from the request and display it as a PNG_STREAM.
    Any clue what is going on there?
    Jen

  • To launch MS paint from SAP

    I have a requirement to launch MS paint from SAP.
    On pressing a button in SAP screen, MS paint has to be launched for the end-user.
    Thanks in advance.
    Locking this thread, Please search before posting any thread
    Edited by: Vijay Babu Dudla on Jan 9, 2012 7:00 AM

    There are several ways to do that.
    Just check the method EXECUTE of CL_GUI_FRONTEND_SERVICES class. pass APPLICATION as "mspaint"
    Regards
    -V

Maybe you are looking for

  • Can I Re-install 10.6 on iMac hard drive without erasing drive?

    My OSX based spell check for mail, text edit, and other programs that use the system spell check no longer have any spell or grammer check functions.  I have isolated it to know it's the OS spell checking function, so now want to re-install my system

  • Payment Due Date selection in F110

    Hi Experts, We have defined a payment term with 2% discount in 30 days time. We take the baseline date form the shipping date via substitution. We execute the payment run two times in a week. Now say if the shipping date is 03.08.2010 then due date f

  • Report to show order blocked due to customer credit limit

    Hi, We can set customer credit limit and if the orders exceed the limit, the order will be blocked. I need to know is there any standard SAP report showing the orders blocked (due to credit limit) and unblocked?

  • A few cross browser questions

    Hello, I have been searching for results for sometime and decided to come here to ask my question. Now, I know these questions have been asked alot of times but I have no good results. My question: Why does every website I make look Good in IE and ba

  • How to lock a Particular Scenario

    Hi, I would like to lock a particular scenario. The situation is like this: I have 2 cubes MTHCLS and MTHDEF, All my numbers and scenarios are on MTHCLS. MTHCLS is an ASO cube. I have given the read access to all the groups for this cube. MTHDEF is a