Component repaint() method changed?

Did the Component repaint() method used to clear the Component pane as well as painting it again?
I ask because I think my textbook is assuming that repaint() clears the pane and then paints again but when I implement the code that I've written, I see all previously painted objects.
Thanks.

The job of repaint is just to queue a request for the repainting of the object. It sounds like the problem is in your actual painting code. You also haven't said what framework you are using? AWT? Swing? SWT?
In Swing, you typically override paintComponent like so:
@Override protected void paintComponent(Graphics g) {
     super.paintComponent(g);
     //do you painting here:
}The call to super.paintComponent is what clears the component.
In future, Swing questions should go tot the Swing forum: [http://forums.sun.com/forum.jspa?forumID=57]

Similar Messages

  • Problem using repaint() method from another class

    I am trying to make tower of hanoi...but unable to transfer rings from a tower to another...i had made three classes....layout21 where all componentents of frame assembled and provided suitable actionlistener.....second is mainPanel which is used to draw the rods n rings in paintComponent.....and third is tower in which code for hanoi is available...i had made an object of mainPanel at layoout21 n tower but i m not able to call repaint from tower..gives an error : cannot find the symbol....method repaint in tower.
    code fragments od three classes are:
    LAYOUT21
    class layout21 extends JFrame implements ActionListener
    { private Vector rod1 = new Vector();
    private Vector rod2 = new Vector();
    private Vector rod3 = new Vector();
    private String elem; //comment
    public String r22;
    public boolean in=false;
    public int count=0; //no of times the transfer to other rods performed
    private int r3,rings; // current no of rings
    private JComboBox nor,col;
    private JLabel no;
    private JLabel moved;
    private JLabel no1;
    private JButton start;
    private JButton ref;
    private AboutDialog dialog;
    private JMenuItem aboutItem;
    private JMenuItem exitItem;
    private tower t;
    final mainPanel2 p =new mainPanel2();
    public layout21()
    { t = new tower();
         Toolkit kit =Toolkit.getDefaultToolkit();
    Image img = kit.getImage("java.gif");
    setIconImage(img);
    setTitle("Tower Of Hanoi");
    setSize(615,615);
    setResizable(false);
    setBackground(Color.CYAN);
         JMenuBar mbar = new JMenuBar();
    setJMenuBar(mbar);
    JMenu fileMenu = new JMenu("File");
    mbar.add(fileMenu);
    aboutItem = new JMenuItem("About");
    aboutItem.addActionListener(this);
    fileMenu.add(aboutItem);
    exitItem = new JMenuItem("Exit");
    exitItem.addActionListener(this);
    fileMenu.add(exitItem);
    Container contentPane =getContentPane();
    JPanel bspanel = new JPanel();
    JPanel bnpanel = new JPanel();
    setBackground(Color.CYAN);
         //JComboBox
    nor = new JComboBox();
    nor.setEditable(false);
    nor.addItem("3");
    nor.addItem("4");
    nor.addItem("5");
    nor.addItem("6");
    nor.addItem("7");
    nor.addItem("8");
    nor.addItem("9");
    bspanel.add(nor);
    col = new JComboBox();
    col.setEditable(false);
    col.addItem("BLACK");
    col.addItem("GREEN");
    col.addItem("CYAN");
    bspanel.add(col);
    JLabel tl = new JLabel("Time");
    tl.setFont(new Font("Serif",Font.BOLD,12));
    bspanel.add(tl);
    JTextField tlag = new JTextField("0",4);
    bspanel.add(tlag);
    start =new JButton("Start");
    bspanel.add(start);
    ref =new JButton("Refresh");
    bspanel.add(ref);
    JButton end =new JButton("End");
    bspanel.add(end);
    start.addActionListener(this);
    nor.addActionListener(this);
    col.addActionListener(this);
    ref.addActionListener(this);
    end.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    dispose(); // Closes the dialog
    contentPane.add(bspanel,BorderLayout.SOUTH);
    JLabel count = new JLabel("No of Transfer reguired:");
    count.setFont(new Font("Serif",Font.BOLD,16));
    bnpanel.add(count);
    no = new JLabel("7");
    no.setFont(new Font("Serif",Font.BOLD,16));
    bnpanel.add(no);
    JLabel moved = new JLabel("Moved:");
    moved.setFont(new Font("Serif",Font.BOLD,16));
    bnpanel.add(moved);
    no1 = new JLabel("0");
    no1.setFont(new Font("Serif",Font.BOLD,16));
    bnpanel.add(no1);
    contentPane.add(bnpanel,BorderLayout.NORTH);
    contentPane.add(p,BorderLayout.CENTER);
         String r = (String)nor.getSelectedItem();
    rings = Integer.valueOf(r).intValue();
    p.draw(rings,1) ;
    public void actionPerformed(ActionEvent evt)
    {  Object source = evt.getSource();
    if(source == start)
    r3 = Integer.valueOf((String)nor.getSelectedItem()).intValue();
    p.transfer(false);
    t.initialise(rod1,rod2,rod3,0);
    t.towerOfHanoi(r3);
         //repaint();
         if(source == ref)
    { rod1.removeAllElements() ;
    rod2.removeAllElements() ;
    rod3.removeAllElements() ;
    count=0;
              r3 = Integer.valueOf((String)nor.getSelectedItem()).intValue();
              p.draw(r3,1);
    p.transfer(true);
    no1.setText(""+0);
    p.trans_vec(rod1,rod2,rod3);
    t.initialise(rod1,rod2,rod3,0);
              System.out.println("");
              repaint();
    if(source == nor)
    { JComboBox j = (JComboBox)source;
    String item = (String)j.getSelectedItem();
    int ring1 = Integer.valueOf(item).intValue();
    int a=1;
    for(int i=1;i<=ring1;i++)
    { a = a*2;
    a=a-1;
    no.setText(""+a);
    p.draw(ring1,1);
    repaint();
    if(source == aboutItem)
    {  if (dialog == null) // first time
    dialog = new AboutDialog(this);
    dialog.setVisible(true);
    if(source == exitItem)
    {  System.exit(0);
         if (source==col)
         { JComboBox j = (JComboBox)source;
    String item = (String)j.getSelectedItem();
              repaint();
    TOWER
    class tower extends Thread
    { private Vector rod1 = new Vector();
    private Vector rod2 = new Vector();
    private Vector rod3 = new Vector();
    private int count ;
    private String elem;
    final mainPanel2 z =new mainPanel2();
    public void initialise(Vector r1,Vector r2,Vector r3,int c)
    { rod1 = r1;
    rod2 = r2;
         rod3 = r3;
         count =c;
    public void towerOfHanoi(int rings)
    for(int i=0;i<rings;i++)
    rod1.add(" "+(i+1));
    System.out.println("rod1:"+rod1.toString());
    hanoi(rings,1,2);
    public void hanoi(int m,int i, int j)
    if(m>0)
    { hanoi(m-1,i,6-i-j);
    if(i==1 && j==2 && rod1.isEmpty()==false)
    { count++;
    //no1.setText(""+count);
    elem = (String)rod1.remove(0);
    rod2.add(0,elem);
         //z.trans_vec(rod1,rod2,rod3);
    repaint(); //NOT ABLE TO USE METHOD HERE...WHY??
    //z.hanoi_paint();
    try
              this.sleep(2000);      
              catch (Exception e) { e.printStackTrace() ;  }
    System.out.println(count+". ROD 2:"+rod2.toString());
    if(i==1 && j==3 && rod1.isEmpty()==false)
    { count++;
         //no1.setText(""+count);
         elem = (String)rod1.remove(0);
    rod3.add(0,elem);
    //z.trans_vec(rod1,rod2,rod3);
    repaint();//
    // z.hanoi_paint();
                   try
              this.sleep(2000);      
              catch (Exception e) { e.printStackTrace() ;  }
    System.out.println(count+". ROD 3:"+rod3.toString());
    if(i==2 && j==1 && rod2.isEmpty()==false)
    { count++;
         //no1.setText(""+count);
         elem = (String)rod2.remove(0);
    rod1.add(0,elem);
    //z.trans_vec(rod1,rod2,rod3);
    repaint();
    //z.hanoi_paint();
    try
              this.sleep(2000);      
              catch (Exception e) { e.printStackTrace() ;  }
    System.out.println(count+". ROD 1:"+rod1.toString());
    if(i==2 && j==3 && rod2.isEmpty()==false)
    { count++;     
         //no1.setText(""+count);
         elem = (String)rod2.remove(0);
    rod3.add(0,elem);
    //z.trans_vec(rod1,rod2,rod3);
    repaint();
    //z.hanoi_paint();
    try
              this.sleep(2000);      
              catch (Exception e) { e.printStackTrace() ;  }
    System.out.println(count+". ROD 3:"+rod3.toString());
    if(i==3 && j==1 && rod3.isEmpty()==false)
    { count++;
         //no1.setText(""+count);
    elem = (String)rod3.remove(0);
    rod1.add(0,elem);
    //z.trans_vec(rod1,rod2,rod3);
    repaint();
    //z.hanoi_paint();
         try
              this.sleep(2000);      
              catch (Exception e) { e.printStackTrace() ;  }
    System.out.println(count+". ROD 1:"+rod1.toString());
    if(i==3 && j==2 && rod3.isEmpty()==false)
    { count++;
         //no1.setText(""+count);
    elem = (String)rod3.remove(0);
    rod2.add(0,elem);
    //z.trans_vec(rod1,rod2,rod3);
    repaint();
    //z.hanoi_paint();
    try
              this.sleep(2000);      
              catch (Exception e) { e.printStackTrace() ;  }
    System.out.println(count+". ROD 2:"+rod2.toString());
    hanoi(m-1,6-i-j,j);
    MAINPANEL
    class mainPanel2 extends JPanel //throws IOException
    public Vector line = new Vector();
    public Vector rod11= new Vector();
    public Vector rod22= new Vector();
    public Vector rod33= new Vector();
    public int no_ring;
    public int rod_no;
    String pixel;
    StringTokenizer st,st1;
    int x,y;
    public boolean initial =true;
    public void paintComponent(Graphics g)
    { System.out.println("repaint test");
    bresenham(100,60,100,360);
         bresenham(101,60,101,360);
    bresenham(102,60,102,360);
    bresenham(103,60,103,360);
    bresenham(104,60,104,360);     
    g.setColor(Color.BLUE);
    while(line.size()>0)
    { pixel = (String)line.remove(0);
    st = new StringTokenizer(pixel);
    x = Integer.valueOf(st.nextToken()).intValue();
    y = Integer.valueOf(st.nextToken()).intValue();
    g.drawLine(x,y,x,y);
    bresenham(300,60,300,360);
    bresenham(301,60,301,360);
    bresenham(302,60,302,360);
    bresenham(303,60,303,360);
    bresenham(304,60,304,360);     
    while(line.size()>0)
    { pixel = (String)line.remove(0);
    st = new StringTokenizer(pixel);
    x = Integer.valueOf(st.nextToken()).intValue();
    y = Integer.valueOf(st.nextToken()).intValue();
    g.drawLine(x,y,x,y);
    bresenham(500,60,500,360);
    bresenham(501,60,501,360);
    bresenham(502,60,502,360);
    bresenham(503,60,503,360);
    bresenham(504,60,504,360);     
    while(line.size()>0)
    { pixel = (String)line.remove(0);
    st = new StringTokenizer(pixel);
    x = Integer.valueOf(st.nextToken()).intValue();
    y = Integer.valueOf(st.nextToken()).intValue();
    g.drawLine(x,y,x,y);
    bresenham(0,361,615,361);//used to get a pixel according to algo.. . func not provided
    bresenham(0,362,615,362);
    bresenham(0,363,615,363);
    bresenham(0,364,615,364);
    bresenham(0,365,615,365);     
    while(line.size()>0)
    { pixel = (String)line.remove(0);
    st = new StringTokenizer(pixel);
    x = Integer.valueOf(st.nextToken()).intValue();
    y = Integer.valueOf(st.nextToken()).intValue();
    g.drawLine(x,y,x,y);
    if(initial==true)
    g.setColor(Color.RED);
    for(int i = no_ring;i>0;i--)
    { g.drawLine(100-(i*8),360-(no_ring - i)*10,100+(i*8)+5,360-(no_ring - i)*10);
    g.drawLine(100-(i*8),359-(no_ring - i)*10,100+(i*8)+5,359-(no_ring - i)*10);
    g.drawLine(100-(i*8),358-(no_ring - i)*10,100+(i*8)+5,358-(no_ring - i)*10);
    g.drawLine(100-(i*8),357-(no_ring - i)*10,100+(i*8)+5,357-(no_ring - i)*10);
    g.drawLine(100-(i*8),356-(no_ring - i)*10,100+(i*8)+5,356-(no_ring - i)*10);
    // draw for each rod
    //System.out.println("rod11:"+rod11);
    //System.out.println("rod22:"+rod22);
    //System.out.println("rod33:"+rod33);
         int r1 = rod11.size();
         int r2 = rod22.size();
         int r3 = rod33.size();
    String rd1,rd2,rd3;
    int r11,r12,r21,r22,r31,r32;
    if(initial == false)
         { g.setColor(Color.RED);
         while(rod11.size()>0)
    { r12 = rod11.size()-1;
              rd1 = (String)rod11.remove(r12);
    r11 = Integer.valueOf(rd1).intValue();
    g.drawLine(100-((r11+1)*8),360-(r1 - (r11+1))*10,100+((r11+1)*8)+5,360-(r1 - (r11+1))*10);
    g.drawLine(100-((r11+1)*8),359-(r1 - (r11+1))*10,100+((r11+1)*8)+5,359-(r1 - (r11+1))*10);
              g.drawLine(100-((r11+1)*8),358-(r1 - (r11+1))*10,100+((r11+1)*8)+5,358-(r1 - (r11+1))*10);
              g.drawLine(100-((r11+1)*8),357-(r1 - (r11+1))*10,100+((r11+1)*8)+5,357-(r1 - (r11+1))*10);
              g.drawLine(100-((r11+1)*8),356-(r1 - (r11+1))*10,100+((r11+1)*8)+5,356-(r1 - (r11+1))*10);
         while(rod22.size()>0)
    { g.setColor(Color.RED);
              r22 = rod22.size()-1;
         System.out.println("TEST *************************:"+r22);
              try
         // e.printStackTrace();      
              InputStreamReader isr = new InputStreamReader(System.in);
         BufferedReader br = new BufferedReader(isr)      ;
         br.readLine() ;
         }catch(Exception f) {}
              rd2 = ((String)rod22.remove(r22)).trim();
    r21 = Integer.valueOf(rd2).intValue();
    g.drawLine(300-((r22+1)*8),360-(r2 - (r22+1))*10,300+((r22+1)*8)+5,360-(r2 - (r22+1))*10);
    g.drawLine(300-((r22+1)*8),359-(r2 - (r22+1))*10,300+((r22+1)*8)+5,359-(r2 - (r22+1))*10);
              g.drawLine(300-((r22+1)*8),358-(r2 - (r22+1))*10,300+((r22+1)*8)+5,358-(r2 - (r22+1))*10);
              g.drawLine(300-((r22+1)*8),357-(r2 - (r22+1))*10,300+((r22+1)*8)+5,357-(r2 - (r22+1))*10);
              g.drawLine(300-((r22+1)*8),356-(r2 - (r22+1))*10,300+((r22+1)*8)+5,356-(r2 - (r22+1))*10);
         while(rod33.size()>0)
    { g.setColor(Color.RED);
              r32 = rod33.size()-1;
              rd3 = (String)rod33.remove(r32);
    r31 = Integer.valueOf(rd3).intValue();
    g.drawLine(500-((r32+1)*8),360-(r3 - (r32+1))*10,500+((r32+1)*8)+5,360-(r3 - (r32+1))*10);
    g.drawLine(500-((r32+1)*8),359-(r3 - (r32+1))*10,500+((r32+1)*8)+5,359-(r3 - (r32+1))*10);
              g.drawLine(500-((r32+1)*8),358-(r3 - (r32+1))*10,500+((r32+1)*8)+5,358-(r3 - (r32+1))*10);
              g.drawLine(500-((r32+1)*8),357-(r3 - (r32+1))*10,500+((r32+1)*8)+5,357-(r3 - (r32+1))*10);
              g.drawLine(500-((r32+1)*8),356-(r3 - (r32+1))*10,500+((r32+1)*8)+5,356-(r3 - (r32+1))*10);
    why i m not able to use repaint() method in tower class? from where i can use repaint() method

    i can't read your code - not formatted with code tags
    I have no chance of getting it to compile (AboutDialog class?? p.draw() ??)
    here's a basic routine - add a couple of things to this to demonstrate what is not
    being redrawn
    (compare the readability of below code (using tags) to yours)
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    class Testing extends JFrame
      public Testing()
        setSize(400,300);
        setLocation(400,300);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        final DrawPanel dp = new DrawPanel();
        JButton btn = new JButton("Change Text Location/Repaint");
        getContentPane().add(dp,BorderLayout.CENTER);
        getContentPane().add(btn,BorderLayout.SOUTH);
        btn.addActionListener(new ActionListener(){
          public void actionPerformed(ActionEvent ae){
            dp.x = (int)(Math.random()*300);
            dp.y = (int)(Math.random()*150)+50;
            repaint();}});
      public static void main(String[] args){new Testing().setVisible(true);}
    class DrawPanel extends JPanel
      int x = 50, y = 50;
      public void paintComponent(Graphics g)
        super.paintComponent(g);
        g.drawString("Hello World",x,y);
    }

  • In base component when user change the serial number we need to set date time in Extra attribute filed

    HI Team,
    In ibase component when user change the serial number we need to set date time in Extra attribute filed..if we click edit ,User change serial number after save we need to set date time in  Extra Attribute 4 field .
    Component - PRDGENSET
    In this component there is no attributes,so where we need to implement and how to implement please help.
    Thanks
    kalpana

    Hi Abi,
    Thanks for your reply..see i debugged..i have put break point in method SET_S_STRUCT method if press enter in serial number ,debuggeris triggered..in SET_S_STRUCT method value getting serial number..so how to write the logic here...
    In GET_S_STRUCT method iam getting all attributes  but serial number is not filled..So could you please help here what to do..
    in set_S_STRCUT method value iam gettin serial number...in collection wrapper iam geting zrealtions if i open attributes_ref -if i pass Attribute value in run time its getting displayed.so how to write the logic based on serial  number please help some coding.
    Thanks
    kalpana

  • Component repaint

    I have a custom component in which I have overwritten the update() function to look somthing like this:
    public void update(Graphics g) {
    paint(g);
    this function works fine but everytime the components container(Frame) is resized the screen is cleared. what other function do I have to overwrite to stop this happening?

    yes, but when the frame resizes it somehow clears the Graphics of each component and then repaints them. This method is not the repaint method of the component as I have overwritten the update method and every time I call repaint it doesnt clear the screen. do you know what method the frame calls to clear the graphics of the component when it resizes?

  • The row key or row index of a UIXCollection component is being changed outside of the components context ????

    Hello Guys,
    I'm working at this moment on implementing GANTT functionality via the <dvt:projectGantt> in my Web App :
    Rather than using data binding technology, I use a managed bean in this way :
    @ManagedBean(name="myBeanController")
    @ViewScope
    public class MyBeanController implements Serializable{
    private List<InternalTask> internalTasks;
    @EJB
    private InternalTaskDao internalTaskDao;
    //Root for tree component
    private List<TreeNode> root;
    private transient TreeModel model;
    public MyBeanController(){
         this.internalTasks = new ArrayList<InternalTask>();
    @PostConstruct
    public void init(){
         //Here I construct my TreeModel
         this.model = new ChildPropertyTreeModel(root,"collection");
    //getters and setters
    And my Component in my JSF page would be :
    <dvt:gantt value="#{myBeanController.model}></...>
    In my Browser the component seems to work properly without any problems but if I expand each node then I can see in my log :
    "<org.apache.myfaces.trinidad.component.UIXCollection> <BEA-000000> <The row key or row index of a UIXCollection component is being changed
    outside of the components context. Changing the key or index of a collection when the collection
    is not currently being visited, invoked on, broadcasting an event or processing a lifecycle method, is not valid.
    Data corruption and errors may result from this call...>"
    What's going on here ? Something with rowKeySet ?
    Thanks,
    Remy

    Hi,
    I made my tree model variable non transient and the warning message appears again.
    I implement the gantt in the same way as you did in the demo
    1st) populate ArrayList (As far as I'm concerned, it's populated via @EJB)
    2nd) create TreeModel with a helper class as in the demo which extends ChildPropertyTreeModel and implements TaskKey
    In my browser all the stuff is running fine except this warning message.
    I use for info JDev 12c
    Thanks,

  • Simple repaint() method doubt

    Hi Friends,
    I have a simple program in which I need to print 2 strings at the same time.So,I pass the string and the location to the paint method,but the second repaint() method erases the first
    string and only the second string is displayed.So,how can i make both the strings display at the same time.Here's a part of my code.
    doPaint("String one",200,200);
    validate();
    doPaint("String two",200,250);
    validate();
    public void doPaint(String str,width x,height y){
                                this.x = x;
                                this.y = y;
                this.str=str;
               repaint();
    public void paint(Graphics g){
                            super.paint(g);
            g.setColor(Color.BLUE);
            g.drawString(str,x,y);
         }Thanks

    repaint()clears the component and fills it from the scratch, so when you call your function for the second time it clears first string and draws only the second.
    I advise to use two variables if you want them painted together.
    And override paintComponent() not paint()

  • My repaint() method flickers

    Hi, can someone help me enhance my GUI so that it won't flicker? I tried to use BufferStrategy but it still flickers. I used the code below to override the repaint method of the Canvas that I am trying to draw. Also, I'm not really sure if the repaint() method was the right method to override.
    public void repaint() {
              super.repaint();
              this.createBufferStrategy(2);
              BufferStrategy bufferStrategy = this.getBufferStrategy();
              Graphics g = bufferStrategy.getDrawGraphics();
              g.setColor(Color.BLACK);
                    //x and y are changed by a different Thread every 1 millisecond
              g.drawOval(x, y, 20, 20);
              g.dispose();
              bufferStrategy.show();
         }I also have another Thread that repaints my Canvas.
    public class Painter implements Runnable {
         private LandAreaCanvas area;
         public Painter(LandAreaCanvas area) {
              this.area = area;
         public void run() {
              while (true) {
                   area.repaint();
    }So in summary, my application has 3 Threads running
    1. Main class with main method that initializes all GUI components
    2. Painter class that repaints forever
    3. Calculator class that changes the value of x and y in the repaint method of the Canvas class.
    Thanks a lot!

    Actually you should do your custom painting by overriding paintComponent(Graphics). Which should not flicker since Swing uses double buffering by default.
    See [the tutorial|http://java.sun.com/docs/books/tutorial/uiswing/painting/].
    On edit looks like you might be using AWT, so above advice might not be relevant. [The linked article|http://java.sun.com/products/jfc/tsc/articles/painting/] in the tutorial still can be of help though.
    Edited by: WalterLaan on May 7, 2009 2:13 AM

  • ITunes is updated and works fine and I am able to log onto my account. When I go to purchase a song, I get the error message "Your Apple ID has been disabled". I've tried different methods: changing passwords, making a new account with another email addre

    iTunes is updated and works fine and I am able to log onto my account. When I go to purchase a song, I get the error message "Your Apple ID has been disabled". I've tried different methods: changing passwords, making a new account with another email address, and emailing itunes tech support. I am curious as to how many others have been experiencing the same issue. When I googled the error, it seemed like it was happening extremely often with many people.
    We all love their products, but they always come with a lot of issues and horrible customer support.
    My apple Id is [email protected]

    My Iphone 4 is telling me the same thing and I believe I figured out what the problem is.  I had some fraudulent charges on my itunes account, so I call my bank and disputed the charges.  Right after I did that, I started getting the message "Your apple ID has been disabled."  I just realized today that the charges are not fraudulent, they are "in app purchases."  One of my daughters downloaded the game Top Girl which is FREE, but in the game Top Girl you use money in the game to purchase things.  It just so happens that the money you use to purchase things is real money MY Money!!!.  My daughter thought she was using play money in the game and had no idea she was using real money.  She spent $106.00 buying stuff.  Now I have to call the bank and tell them to release the hold and pay Itunes.  I'm hoping this solves the problem.  Here is the link to learn how to disable "in app purchase" on your iphone or ipad.
    http://www.ikidapps.com/2010/12/parents-avoid-accidental-app-purchases-how-to-tu rn-off-in-app-purchasing.html

  • Calling repaint method from another class

    My question in a very simple form :
    how do I call repaint mathod from another class.
    e.g: Let's say class "A.java" is a JFrame .
    Class "B.java" is a JPanel which is added to the JFrame above.
    Class "C.java" is a JDialog containing some JButtons.
    How do I call the repaint method from the class "C.java".
    Thank you in advance!!

    My question in a very simple form :
    how do I call repaint mathod from another class.
    e.g: Let's say class "A.java" is a JFrame .
    Class "B.java" is a JPanel which is added to the JFrame above.
    Class "C.java" is a JDialog containing some JButtons.
    How do I call the repaint method from the class "C.java".
    Thank you in advance!!

  • Problem in testing UI add-on after login method changes

    Dear All Experts/Gurus,
    I have changed login method to a new one of a UI Add-on (because I just have SDK implementation version license). Using add-on identifier generator, I generate the add-on identifier string and put on the source code :
    Public Sub GetApplication()
        Set oSboGuiApi = New SAPbouiCOM.SboGuiApi
        oSboGuiApi.Connect Command
        oSboGuiApi.AddonIdentifier = "4CC8B8ACE0273A61489738C94047855DE8768CDD37F64D4F11E82759A542BD545D5A6E4D50A39B9E9FB20FA944FF35C5B60FE779"
        Set SboApplication = oSboGuiApi.GetApplication
    End Sub
    After recompile it, I want to prove it by sending it to other friend's (work mate) PC/notebook with different license and hardware key. The error message when installing/starting the add-on is :
    Runtime error '-7200 (ffffe3e0)':
    Connection - Connection string doesn't match UI development work mode.
    If the error happened, I just guessed that the login method change is success. I also read the SAP new license mechanism states that if the add-on is developed using SDK implementation version, it will only be able to install/use in the customer network PC and so on, ....etc.
    The problem is that I am not fully sure if my guess is correct. I want to conduct some testing. I tried to request new temprary license with compatibility license is over within 2 days, but unsuccessful. Would you please to tell me if there is another way to prove/test that  the add-on will be able to start after the compatibility license for add-on expires ?
    I appreciate your answer so much. TIA
    Rgds,

    Hi Steve,
    The AddOnIdentifier you obtain by selecting Development or Implementation options while creating the AddOnIdentifier depends on the license manager.
    If you change the license manager to another machine or someone connected to a different license manager try to run your code you it will not work.
    It is quite clear in the <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/13d67f3c-0e01-0010-eba2-cab13a5979c2">License Guide</a>:
    <b>Development License</b>
    This license is required for partners developing add-ons and the only license allowing distribution. <i><u>In Development license, the license key is shared by all developers connected to the same License Service</u></i>. The License Service allocates licenses on the basis of first-come, first-served.
    <b>Implementation License</b>
    This license is required for customers intending to develop small modifications or add-ons for their own use using only the UI API.
    <i><u>Add-ons developed under the Implementation license cannot run with a different License Service other than the one that was used for their development</u></i>. The Implementation license does not allow
    distribution to third-parties.
    Regards
    Trinidad

  • Update Contract Account in Background - BOR "ISUACCOUNT" Method "Change"

    Hi Experts,
    We are trying to update the "Dispatch Control" & "Alternative Bill Recipient" fields on the Contract Account in background.
    We are using BOR - "ISUACCOUNT" and Method - "Change". The Method is unable to update the field values but not giving any error or exception.
    Please sussest if someone has worked on such scenario before.
    Thanks,
    Ankur

    Hi ,
    Is it tiggering ur BADI implementation or not ? If yes then whats ur logic to update ?
    regards
    Prabhu

  • How to call Custom or Component Controller methods from View Controller

    Hy Guys,
    how do I call Custom Controller or Component controller methods from a View or Context Controlller?
    thanks in advance
    Jürgen

    Hi Juergen
    Yes it is possible, pls follow the below approach to access the component controller in context node class
    1) since the standard component controller class is protect variable , declare a variable of type component controller in your controller class.
    say for example the public variable you declared is  g_comp_controller
    2)  now redefine the controller class method WD_CREATE_CONTEXT  and add the below lines of code
       g_comp_controller ?= me->comp_controller.
    3) go to context node class  (CNXX)  there declare the varaible which of type controller class (IMPL)  as public variable, for example g_owner
    4) redefine the method  IF_BSP_MODEL~INIT  and write the below code
         CALL METHOD super->if_bsp_model~init
        EXPORTING
          id    = id
          owner = owner.
      g_owner ?= owner.
    5) now the variable   g_owner  that is declared in  (CNXX)   contains reference to your controller class
    6) in  on_new_focus  method access your component controller in the below manner and access the entities also.
    DATA: lv_owner                    TYPE REF TO xxxxx_impl,  " Implementation class
                 lr_comp_cont                TYPE REF TO xxxx_bspwdcomponen_impl, " component controller class
                 lv_entity type ref to cl_crm_bol_entity.
    lv_owner ?= g_owner.
    lr_comp_cont    ?= lv_owner->g_comp_controller.
    IF lr_comp_cont IS BOUND.
       lv_entity ?= lr_comp_cont->typed_context->mdfcampaign->collection_wrapper->get_current( ).
    now lv_entity contains the value of component controller context node.
    Thanks & Regards
    Raj
    Edited by: bmsraj on Sep 27, 2011 3:28 PM

  • Repaint() method is not being called?

    Hi...experts
    I have appended the unicode characters to the StringBuffer .and i draw it on canvas.
    now i want to delete these unicode characters from last index of StringBuffer with the command "Clear" .
    i m using the following code for doing this....
    StringBuffer sb=new StringBuffer();
    sb.append('\u093E');
    sb.append('\u093F');
    sb.append('\u0940');
    sb.deleteCharAt(sb.length()-1);But the StringBuffer is as it is.
    please suggest me how repaint() method works.
    Edited by: RavindraDiwakar on Sep 25, 2008 7:46 AM

    {color:#ff0000}{size:20px}CROSS POSTED{size}{color}
    [http://forums.sun.com/thread.jspa?threadID=5334750]
    [http://forums.sun.com/thread.jspa?threadID=5334748]
    Cross posting is rude.
    db

  • Repaint() method is not working in MAC IE

    Hi All
    why repaint method is not working in MAC IE ? What i am doing is in one class which is inheriting Canvas class getting the keybord input then adding it to main applet.
    Please help me i am trying it for whole week and i couldn't find any solution. I didn't put my code but if anyone is willing to help me i can post it.
    Thanks in advancs
    Shan

    Hi
    Thanks for your reply. Actually i wrote simple applets and those are working well.
    So i did debug the code and i found that when i am running the following code in Apple MAC IE, nothing is happening in handleEvent method. Especially it is not going into the if statement (if (evt.id==401)). here i am checking for KEY_PRESS. I also tried with keyDown method but same problem in MAC IE.
    I am pasting the code that is giving me problem.
    import java.awt.*;
    import java.applet.*;
    public class testApplet extends Applet
    public void init()
    setLayout(new BorderLayout());
    editableArea = new EditableArea();
    editableArea.setBackground(Color.yellow);
    add("Center", editableArea);
    EditableArea editableArea;
    import java.awt.*;
    public class EditableArea extends Canvas
    String s = "";
    public boolean handleEvent(Event evt)
    if (evt.id==401)
    if(evt.key >= 32 && evt.key <= 255)
    char c = (char)evt.key;
    s = s + c;
    repaint();
    return super.handleEvent(evt);
    public void paint( Graphics g )
    g.setColor(Color.blue);
    g.drawString( s,5,15);
    --------------------------------------------------------------------

  • Error in Component Api  Method

    Hi ,
    I getting a error in component Api method.
    Error : The method WDGetContext() is undefined for the type IPrivateDCFAppView
    SO, any body help me out in this regard why this one is happening.
    Thanks,
    William

    Hi,
    Are you trying to access the component controller's context from your view? check if you have added the component controller reference in the "properties" tab of the view.
    Regards,
    Poojith MV

Maybe you are looking for

  • How do I move my music from an old iTunes account to a new one?

    I want to start a new itunes account for my daughter now that she is a teen so that we dont get all each others music. How do I get her 500  songs onto her own new itunes account without having to repurchase them all?

  • SAP CRM AET- Tool - NAV_OBJECT( Application Reference)  error

    I am trying to create a new DB Table using  AET tool , while creating  Prodcut ID(GUID)   Field with NAV_OBJECT( Application Refernce) I am getting length always as 1 byte instead of 16 bytes (RAW 16)  and this is causing problem . Any  suggestion pl

  • A definitive answer? : Can you use Audition on a Mac??!

    I have heard all sorts of conflicting views on this and I thought someone here would be able to set the record straight! I wanted to get a Mac, because I like them, but I use Audition all the time for my work. Is a Mac a good idea? If not, could anyo

  • G4 15" seems to work, but won't boot Install CD or run Hardware Test

    Hello all, I have an odd one here. I have a 15" Powerbook G4 1.67Ghz with Tiger 10.4.10 that works generally OK, but I want to run Repair Disk on it because Console keeps popping up with what seem to be disk-related problems. When I boot with Install

  • Quiz default labels in English

    Hello, Could you please send me the whole default labels in English ? I have Captivate 7 in another language and should translate it in English. I mean the 6 messages and the 6 buttons. Or just send a shotscreen with the default labels under Captivat