SetBounds method is not working - settings change after Applet paint()

Hello,
I'm creating an applet with a scrollbar on it. I'm using Scrollbar.setBounds to set its position and dimension. These values are correct at the end of the init() method, but when the paint() method starts executing, these values have changed!
Here's my code :
import java.awt.Graphics;
import java.awt.Scrollbar;
public class testSetBounds extends java.applet.Applet {
  Scrollbar sb;
  public void init(){
    sb = new Scrollbar(Scrollbar.HORIZONTAL, 0, 1, 0, 270);
    sb.setBounds(10, 200,300,10) ;
    this.add(sb);
    System.out.println("sb.getWidth() " + sb.getWidth() );
    System.out.println("sb.getBounds().x " + sb.getBounds().x  ) ;
  public void paint(Graphics g){
    System.out.println("paint...") ;
    System.out.println("sb.getWidth (at start of paint()) " + sb.getWidth() );
    System.out.println("sb.getBounds().x " + sb.getBounds().x  ) ;
    System.out.println("sb.getMaximum() " + sb.getMaximum()) ;
<html>
<body>
<applet code="testSetBounds" codebase="classes" width="300" height="350">
</applet>
</body>
</html>
The output I get on the Java Console is:
sb.getWidth() 300
sb.getBounds().x 10
paint...
sb.getWidth (at start of paint()) 50
sb.getBounds().x 125
Can anyone tell me what's going on?
How to make my scrollbar remain in the position and with the dimensions I specified?
Thank you very much.

The layout manager is setting the bounds. If fo some obscure reason you want to do all the layout yourself then -
Hello,
I'm creating an applet with a scrollbar on it. I'm
using Scrollbar.setBounds to set its position and
dimension. These values are correct at the end of the
init() method, but when the paint() method starts
executing, these values have changed!
Here's my code :
import java.awt.Graphics;
import java.awt.Scrollbar;
public class testSetBounds extends java.applet.Applet
Scrollbar sb;
public void init(){
sb = new Scrollbar(Scrollbar.HORIZONTAL, 0, 1, 0,
, 0, 270);
sb.setBounds(10, 200,300,10) ;this.setLayout(null);
this.add(sb);
System.out.println("sb.getWidth() " +
" + sb.getWidth() );
System.out.println("sb.getBounds().x " +
" + sb.getBounds().x ) ;
public void paint(Graphics g){
System.out.println("paint...") ;
System.out.println("sb.getWidth (at start of
t of paint()) " + sb.getWidth() );
System.out.println("sb.getBounds().x " +
" + sb.getBounds().x ) ;
System.out.println("sb.getMaximum() " +
" + sb.getMaximum()) ;
<html>
<body>
<applet code="testSetBounds" codebase="classes"
width="300" height="350">
</applet>
</body>
</html>
The output I get on the Java Console is:
sb.getWidth() 300
sb.getBounds().x 10
paint...
sb.getWidth (at start of paint()) 50
sb.getBounds().x 125
Can anyone tell me what's going on?
How to make my scrollbar remain in the position and
with the dimensions I specified?
Thank you very much.

Similar Messages

  • REP-51018 -- cookie method is not working :(

    Trying to invoke a simple report from a simple form by using web.show_document()
    if I pass the userid=x/y@z then it work fine
    if I try to use the cookie method as defined in the OTN whitepaper "Secure Web.Show_Document() calls to Oracle Reports", I am bumping to the REP-51018 error.
    Tried the metalink and found primarily 2 documents, one (note#279938) is suggesting using
    SYNCHRONIZE; prior to invoking the WEB.SHOW_DOCUMENT(...), which I did - not worked,
    then I read the document (#309652.1) which tells that the cookie method will not work if not using fully qualified domain name -- I have a fully qualified domain name and I can see in the browser cookie settings that the domain is set correctly.
    I also edited the basejini.htm and basejpi.htm files and added the suggested entries as shown in the same OTN whitepaper (page #9). And recycled the entire iAS server after all the editing (reports.sh, formsweb.cfg, etc).
    I can see the cookie is saved on the client browser and the userid is displayed in the JInitiator control window.
    FrmReportsInteg0: Debugging true
    FrmReportsInteg0: Adding new userid string "zafer/mutlu@jtls5"
    FrmReportsInteg0: Default cookie domain: .rolands.com
    FrmReportsInteg0: set RW_AUTH10g
    FrmReportsInteg0: Arguments: encryptionKey=reports9i; Reports version=RW10g
    FrmReportsInteg0: Cookie value for RW10g is: zafer/mutlu@jtls5;1135302256455:30
    FrmReportsInteg0: Encoded cookie value is: W3zbSs88ClXKCO9kxqPbyQiyd120sKakxxmhtfgtZoUe4Q==
    FrmReportsInteg0: Complete cookie string is: userid=W3zbSs88ClXKCO9kxqPbyQiyd120sKakxxmhtfgtZoUe4Q==
    FrmReportsInteg0: Added domain ".rolands.com" to cookie
    FrmReportsInteg0: Generated Cookie String: userid=W3zbSs88ClXKCO9kxqPbyQiyd120sKakxxmhtfgtZoUe4Q==; domain=.rolands.com; path=/
    liveconnect: JSObject::eval(document.cookie="userid=W3zbSs88ClXKCO9kxqPbyQiyd120sKakxxmhtfgtZoUe4Q==; domain=.rolands.com; path=/")
    liveconnect: the url of the applet is http://raptus.rolands.com:7778 and the permission is = false
    FrmReportsInteg0: NS Cookie Set
    network: Connecting http://raptus.rolands.com:7778/forms/lservlet;jsessionid=0a0a0a2230d8a457f8e558fe43b4b3e5a9b908500738.e38Oc3aQc3ySci0TbheLaNuSah50n6jAmljGr5XDqQLvpAe with proxy=DIRECT
    network: Connecting http://raptus.rolands.com:7778/forms/lservlet;jsessionid=0a0a0a2230d8a457f8e558fe43b4b3e5a9b908500738.e38Oc3aQc3ySci0TbheLaNuSah50n6jAmljGr5XDqQLvpAe with cookie "userid=W3zbSs88ClXKCO9kxqPbyQiyd120sKakxxmhtfgtZoUe4Q=="
    network: Connecting http://raptus.rolands.com:7778/forms/lservlet;jsessionid=0a0a0a2230d8a457f8e558fe43b4b3e5a9b908500738.e38Oc3aQc3ySci0TbheLaNuSah50n6jAmljGr5XDqQLvpAe with proxy=DIRECT
    network: Connecting http://raptus.rolands.com:7778/forms/lservlet;jsessionid=0a0a0a2230d8a457f8e558fe43b4b3e5a9b908500738.e38Oc3aQc3ySci0TbheLaNuSah50n6jAmljGr5XDqQLvpAe with cookie "userid=W3zbSs88ClXKCO9kxqPbyQiyd120sKakxxmhtfgtZoUe4Q=="
    The only thing I can see is this line:
    liveconnect: the url of the applet is http://raptus.rolands.com:7778 and the permission is = false
    if this is the problem how can I fix it?
    What is wrong with this cookie method? What I am doing wrong?
    Any input is appreciated very much.
    Zaf.

    Here is the code I am using in a when-button-pressed trigger in the form to invoke the report.
    And yes, the javabean USERID_BEAN is created/defined under the CONTROL block, with all the properties as explained in the OTN whitepaper.
    thank you.
    =================================================
    message('Invoking the related report...', ACKNOWLEDGE);
    message(' ', NO_ACKNOWLEDGE);
    DECLARE
    rep_url varchar2(2000);     
    user_name varchar2(40);
    passwd varchar2(40) ;
    connectstring varchar2(20) ;
    BEGIN
    user_name := LOWER(get_application_property(username));
    passwd := LOWER(get_application_property(password));
    connectstring := LOWER(get_application_property(connect_string));
    rep_url:='/reports/rwservlet?&envid=jtlsDDS&&report=readme.rdf'
    ||'&desformat=htmlcss&destype=cache&userid=';
    -- Write log messages to the Forms JInitiator console. The next line must
    -- be disabled before running this code in any production environment
    set_custom_property('CONTROL.USERID_BEAN',1,'WRITE_LOGOUTPUT','true');
    -- set userid in encrypted cookie before calling Web.Show_Document()
    set_custom_property('CONTROL.USERID_BEAN',1,'ADD_USERID',
    user_name||'/'||passwd||'@'||connectstring);
    -- writing the cookie
    set_custom_property('CONTROL.USERID_BEAN',1,'WRITE_USERID_COOKIE','10g');
    -- Add the next line to correct REP 51018 error
    SYNCHRONIZE;
    WEB.SHOW_DOCUMENT(rep_url,'_blank');
    END;

  • HT5364 Adobe flash player not working on Safari after being installed, System OS X 10.9.2 has been just updated to Maverick

    Adobe flash player not working on Safari after being installed, System OS X 10.9.2 has been just updated to Maverick

        Enable Plug-ins
        Safari > Preferences > Security
        Internet Plug-ins >  "Allow  plug-ins"
        Enable it.
        Click "Manage Website Settings"
        Highlight "Adobe Flash Player", "Allow" and then "Done".

  • How do I print in B&W now that I have lion? The whole "open in preview" method is not working. Thanks

    Subject says it all.....The whole "open in preview" method is not working. Any ideas or solutions would be appreciated. Thanks

    What kind of printer do you have? Have you looked at their PDEs to see if there are any settings for color/b&w?
    How is the "open in Preview" not working? Please provide some details.

  • Instance Dependent Public Method is not working for Workflow

    Hello Experts,
    I have made Custom class for  a workflow. This class is triggering the WF fine but the problem is while trying to execute a WF task which contains a Instance Dependent & Public  method its not working , the WF task is not processing though I'm passing the instance of the class  properly from WF to WF task . When I'm changing the method to Static & Public then the workitem is executing perfectly. Can you please help & suggest the way to find the problem ?
    Thanks & Regards ,
    Jeet

    Are you absolutely sure that you have the instance of the object in the workflow container? Open the technical log the see if the object instance is there - or is the container element initial (or "not set")?
    yes it is instantiated properly no error over there.
    What about if you test the method directly in SE24 (as an instance method)? Is it working then? If you can make it work in SE24 as an instance method and you are sure that the instance exists in the workflow,
    I have checked the class in a stand alone run in this case also it runs fine as before.
    The obvious question of course is that have you implemented the IF_WORKFLOW interface methods (the two first ones).
    it is coded like below
    BI_PERSISTENT~FIND_BY_LPOR
      create object result
          type
            (lpor-typeid)
          exporting
            ip_key = lpor-instid.
    CONSTRUCTOR
       me->m_KEY    = ip_key.
       me->m_por-catid = 'CL'.
       me->m_por-typeid = CL_ZZZ'.
       me->m_por-instid = me->m_key
    BI_PERSISTENT~LPOR
    result =  me->m_por.
    Main confusion is Method is working only if declared STATIC & PUBLIC  but not for the INSTANCE DEPENDENT & PUBLIC.

  • Webmail is not working internet explore after installed sp3 exchange 2007 roll up 15

    webmail is not working internet explore after installed sp3 exchange 2007 roll up 15 but mozill firefox webmail is working fine

    Hi,
    Does the issue happen to all users? What’s your IE version? Is there any error when you access OWA 2007 in IE?
    Please click Compatibility View settings in your Internet Explorer. Then, add the OWA site to the list of sites to be viewed in compatibility view and check whether the issue persists.
    Regards,
    Winnie Liang
    TechNet Community Support

  • RSS not working in Mail after MobileMe instal

    The title pretty much says it all "RSS not working in Mail after MobileMe instal" The names of the RSS feeds are still there but all have the triangle error message beside them.

    you may have already tried this but in the mailbox menu at the top, try to take all accounts offline then take them all back online again. if that doesn't work you can always do a rebuild which is kind of a pain, but it usually does the trick.

  • ExportAsFDF javascript method is not working with Reader 10.1.1

    Hi,
    I have pdf document in which I have applied all Extendend Reader Rights. And now when I am trying to exports alll annotation in fdf with Reader 10.1.1 then it is faling to export. However it is working fine with Reader 10.0.0. Looks like this is broken in later version of 10.0.0.
    Please let me know if any alternative solution is there to export all annotation in fdf file thru code.
    Regards,
    Arvind

    I would open a formal support ticket with our developer support folks.
    From: Adobe Forums <[email protected]<mailto:[email protected]>>
    Reply-To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>>
    Date: Sun, 27 Nov 2011 22:48:35 -0800
    To: Leonard Rosenthol <[email protected]<mailto:[email protected]>>
    Subject: exportAsFDF javascript method is not working with Reader 10.1.1
    exportAsFDF javascript method is not working with Reader 10.1.1
    created by arvindg007<http://forums.adobe.com/people/arvindg007> in Acrobat SDK - View the full discussion<http://forums.adobe.com/message/4049525#4049525

  • Auto tab focus method is not working in iOS devices please share the ideas why its not working?

    Auto tab focus method is not working in iOS devices. Please share the idear i am facing this issue while developing code for devices.

    Hi there,
    I can confirm this bug.
    Not sure if this info is relevant, but this is my experience:
    I am on the FIDO network, and so are two other people I know.
    We all tried blocking numbers, and calls ring right through. Text messages are blocked successfully. (never tried facetime)
    I also tried a ROGERS device running IOS7, and was successfully able to block my phone call from ringing through. HOWEVER, my call was forwarded to their voicemail, I was able to leave a voicemail for the person, and they did get an alert that they had a new voicemail.
    I have not yet had a chance to test this on Bell, Telus, or any other carriers.
    Spoke to Apple, and they advised me to do a hard reset (hold both buttons to shut off and reboot the phone), and if that fails to do an iOS restore.
    I have yet to try this, but hopefully someone will have a better solution.

  • 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);
    --------------------------------------------------------------------

  • Draw method is not working

    Why the drawLine() is working only inside the paint method??
    BufferedImage image = new BufferedImage(800,500,BufferedImage.TYPE_INT_ARGB);
         Graphics2D g = (Graphics2D)image.getGraphics();
    public void paint(Graphics g)
                   g.setColor(Color.black);
                             //Here, the drawLine() method works
                   g.drawLine(50,0,50,150);
    public void paintX(Graphics g,Point c)
                        //Here, the drawLine() method does not work
                        g.setColor(Color.black);
                   g.drawLine(0-e,0-e,50-e,50-e);
                   g.drawLine(0-e,50-e,50-e,0-e);
                   repaint();
         }

    er, unless you're using JDK 1.5 and it introduces methods I know nothing about, as far as I know
    public void paintX(..) is not a AWT or Swing method. Thus it will never be invoked unless you call it.

  • The forward, back, refresh, and stop buttons are not working. Even after installing the latest version. Anyone else having this issue?

    The forward, back, refresh, and stop buttons are not working. Even after installing the latest Firefox update. Also my home page stopped loading upon startup even tho I have it setup to do so. Anyone else experiencing these issues? This is my second request for help and of course, Firefox on-line support is always closed.

    Those are all symptoms of a problem with the places.sqlite file, for details see http://kb.mozillazine.org/Locked_or_damaged_places.sqlite

  • Send & Recieve functionality not working with  WebDav after installing Acrobat XI

    Send & Recieve functionality not working with  WebDav after installing Acrobat XI for PDF.  Acrobat XI is complete installations(Trial Version).

    Hi Kiro ,
    Did you try opening that file in any other browser ?If not ,please try doing that once and see if that  works for you.
    Try Repairing Acrobat once and see if  that helps.
    Launch Acrobat>Navigate to Help>Repair Acrobat Installation.
    Regards
    Sukrit Dhingra

  • [Bug?] Defer Panel Update not working when changing scale property

    Hi,
    I found that Defer Panel Update [when True] does not work properly when changing the scale fit property of an intensity graph.
    Try the VI.
    When Defer Panel Update is True, and you change the Numeric controls, the Intensity graph is not updated (as expected).
    But now change the "Z Scale.Scale Fit" button and.... the Intensity graph is updated (only the Z-color, not the axis).
    This looks to be a bug to me!
    Nicolas
    Attachments:
    [Bug] Defer Panel Update not working when changing scale property.vi ‏27 KB

    Hi Nicolas,
    This indeed looks like a bug. I will do more research on it and file a bug report if it's not already filed.  Thank you for posting this information!
    Yi Y.
    Applications Engineer
    National Instruments
    http://www.ni.com/support

  • How does one do a two way contacts sync between an iphone and outlook? Most of the community has answered as this to be "always so", but it does not work! Changes made on outlook get done in my iPhone, but it does not work the other way around!

    How does one do a two way contacts sync between an iphone and outlook? Most of the community has answered as this to be "always so", but it does not work! Changes made on outlook get done in my iPhone, but it does not work the other way around!

    Close the tab the web page is loaded in (command - W).

Maybe you are looking for

  • How do I use my deactivated Droid 2 as a media player?

    I know it's possible, because I used it for a while after I got my iphone and then my son used it with his number temporarily  when he broke his phone, I've restored it to factory settings but can't get past the activation screen. Can't I use the dev

  • Safari 2.0.4 Suddenly Quits  :-(

    Hi, Can anyone help? While on line and surfing on the web my Safari suddenly quit... I didn't think it was a big deal because it has happened a few times and I just restarted it and no problem. This last time it suddenly everytime I try to restart it

  • Windows 10 Start menu cannot be resized

    The start menu can no longer be resized and it only looks weird when removing/uninstalling all the tiles. This was optional in the earlier developer preview and should remain optional. This may or may not be the wrong channel to submit this feedback

  • Function module to Read DATA from HRP1001

    Hi All ,     I am fetching sobid by writing the following Select Query, <b>      SELECT sobid FROM hrp1001 INTO TABLE it_sobid          WHERE otype = c_objtyp_o          AND   objid = pr_ounit          AND   plvar = c_plnvrsn          AND   rsign = c

  • Goods movement in IS OIL

    Hi, I am using BAPI 'BAPI_GOODSMVT_CREATE' to create goods receipt. I want to make goods movement for IS OIL materials - meaning those materials that carry a UoM group in the oil-specific view in the material master data, MARA-CMETH = 1 or 2. I have