Graphics2D: How to determine current stroke width?

I am trying to do something that sounds like it should be easy: I need to determine the current width of the stroke that is currently in effect in a Graphics2D. Graphics2D has a method called getStroke() which returns a Stroke. This in turn is an interface to BasicStroke which does have a getLineWidth() method.
I don't seem to be able to conect the two. I don't know how to call a method in an object to which I only have an interface. Any advice on how to do this?

Thanks Kaj. That is the right answer. I was screwing it up by having the cast nested inside a bigger expression. Made me doubt my own knowledge. All is OK now.

Similar Messages

  • How to determine current period start and end dates

    Hi All,
    If given previous period start date and end date, how to determine current period start date and end date?
    Suppose if given previous period start and end dates are 12/28/08 - 01/30/09, then current period start date and end date will be 01/30/09 - 02/27/09. (where 12 is the previous period, 28 is the day, 08 is the year......)
    Can you please suggest an FM to determine the current period dates?
    Thanks & Regards
    Gowthami

    >
    gowthami karunya wrote:
    > If given previous period start date and end date, how to determine current period start date and end date?
    > Suppose if given previous period start and end dates are 12/28/08 - 01/30/09, then current period start date and end date will be 01/30/09 - 02/27/09. (where 12 is the previous period, 28 is the day, 08 is the year......)
    Hello,
    I am assuming you have the Company Code with you & proposing this solution.
    TABLES: bkpf.
    PARAMETERS:
    p_bukrs TYPE bukrs.
    SELECT-OPTIONS:
    s_date FOR bkpf-budat.
    DATA :
    l_perio LIKE bkpf-monat,
    l_poper TYPE poper,
    l_year  LIKE bkpf-gjahr,
    l_spmon TYPE spmon,
    l_periv TYPE periv,
    l_date1 TYPE datum,
    l_date2 TYPE datum.
    CALL FUNCTION 'BAPI_COMPANYCODE_GET_PERIOD'
      EXPORTING
        companycodeid = p_bukrs
        posting_date  = s_date-high
      IMPORTING
        fiscal_year   = l_year
        fiscal_period = l_perio.
    CONCATENATE l_year l_perio INTO l_spmon.
    * Get the next period
    IF l_perio < 12.
      l_perio = l_perio + 1.
    ELSE.
      l_perio = '01'.
      l_year = l_year + 1.
    ENDIF.
    MOVE l_perio TO l_poper.
    SELECT SINGLE periv INTO l_periv
    FROM t001
    WHERE bukrs = p_bukrs.
    IF sy-subrc = 0.
      CALL FUNCTION 'FIRST_DAY_IN_PERIOD_GET'
        EXPORTING
          i_gjahr        = l_year
          i_periv        = l_periv
          i_poper        = l_poper
        IMPORTING
          e_date         = l_date1
        EXCEPTIONS
          input_false    = 1
          t009_notfound  = 2
          t009b_notfound = 3
          OTHERS         = 4.
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CALL FUNCTION 'LAST_DAY_IN_PERIOD_GET'
        EXPORTING
          i_gjahr        = l_year
          i_periv        = l_periv
          i_poper        = l_poper
        IMPORTING
          e_date         = l_date2
        EXCEPTIONS
          input_false    = 1
          t009_notfound  = 2
          t009b_notfound = 3
          OTHERS         = 4.
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      WRITE: / l_date1, l_date2.
    ENDIF.

  • How to determine current ORACLE XE db has been used

    I installed the BPA Architect, and it seems all right.
    during stalling process, I've choiced using XE db, but can't find any schema throug XE admin tools.
    how to determine which db is been used in Architect?

    Hi,
    Lockservice.cfg file in your config folder contains the details of Database being used by your Business Process Repository.
    Regards
    ashish

  • 11i: How to determine current CU level?

    I'm new to 11i and would like to know how to determine if we are running 11.5.10 CU2?
    I was hoping to find a SQL statement or some configuration file somewhere that would provide definitive information about the installed "consolidated update".
    Thx.
    Don

    903322 wrote:
    I'm new to 11i and would like to know how to determine if we are running 11.5.10 CU2?
    I was hoping to find a SQL statement or some configuration file somewhere that would provide definitive information about the installed "consolidated update".SQL> select release_name
    from fnd_product_groups;
    https://forums.oracle.com/forums/search.jspa?threadID=&q=RELEASE_NAME+AND+fnd_product_groups&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
    From the application: Help > About
    Thanks,
    Hussein

  • How to determine the fixed width I can use to generate html columns in java

    I have a jsp where I dynamically generate menus for a web page.
    Table's cells are generated with different width, making the menus look differently.
    When clicking on menus, cells changing sizes.
    What is the best way to implement that, so I have a fixed width for every column?
    Thank you

    That's what I do.
    The code determines the width of the column now.
    The only drawback is that I manually assign values to the width depending on the menu item length.
    Is there any way how to do it dynamically, by determining how many px width will be by having the menu item lenght?
    <TABLE cellspacing=0 cellpadding=0 border=0 width="100%">
                   <!--<TR>-->
                        <!--<td width="251"><img src="images/Menu1L.gif" width="8" height="25"></td>-->
                   <%
                        int gs = menu.getSelectedGroupNum();
                        MenuGroup menuGroup = menu.getMenuGroup(gs);
                        int is = menu.getSelectedItemNum();
                        int maxScr = 10; //10 screens buttons per line
                        int totScr = menuGroup.getSize(); //total number of screens for the selected menu
                        int rowsNum = 0;
                        rowsNum = (int)Math.ceil((double)totScr/maxScr);
                        System.out.println("Num of scr per line: " + maxScr +
                                                 " Num of scr/menu: " + totScr +
                                                 " Num of rows: " + rowsNum);
                   for(int     screenRow = 0; screenRow < rowsNum; screenRow ++){
                        //for (int item = 0; item < menuGroup.getSize(); item++)%>
                   <tr><td>
                        <table border="0" cellspacing="0" cellpadding="0" height="20">
                         <tr>
                           <td width="251"><img src="images/Menu1L.gif" width="8" height="25">
                        <%
                        for(int item = screenRow*maxScr; item < (screenRow + 1)*maxScr && item < totScr; item ++)
                             MenuItem menuItem = menuGroup.getMenuItem(item);
                             String title = menuItem.getDisplay();
                             String link = null;
                             String cssClass = null;
                             System.out.println(title + ":" + title.length());
                             if(!menu.isDisabled())
                                  link = "<A href=\"Menu.do?top=" + gs + "&side=" + item + "\">";
                             %>
                             <%
                             else{
                                  link = "";
                                  title = "<i>" + title + "</i>";
                             MenuItem subMenuItem = null;
                             boolean isSubMenu = menuItem.containsSubMenuItem();
                             String subText = null;
                             //determine the width of the column
                             int width = 0;
                             if(title.length() > 5 && title.length()<20)
                                  width = 158;
                             if(title.length() > 20)
                                  width = 193;
                             if(title.length() <=5)
                                  width = 60;
                             if (is == item){
                                  //link = "<A href=\"Menu.do?top=" + gs + "&side=" + item + "\">";
                                  cssClass = "ScreenItemSel A";
                             else
                                  cssClass = "ScreenItem";
                             %>
                             <TD align = "center" nowrap class = "<%= cssClass%>"  background ="images/Menu1F.gif" width="<%=width%>"> <%=link%><%=title%></TD>
                             <TD class="Screen" nowrap><img src="images/Menu1Sep.gif" height=25 width=16></TD>
                        <%                         
                        }%>
                                  <TD width="100%" valign=top align=right class="ScreenName" background="images/Menu1F.gif"><%--<%=mode%>--%></TD>
                                  <TD><IMG src="images/Menu1R.gif" width="8" height="25"></TD>
                             </td>
                        </tr>
                        </table>
                   </td>
                   </tr>
                   <%}
                   %>
                   <!--</TR>-->
    </TABLE>

  • How to determine height and width of a JScrollPane client

    Hi,
    I wish to display a webpage in a JScrollPane and wish to determine the height and width of the HTML content so that I can use the information to generate PDF and control the content on each page. Can anybody let me know how I can do this?
    Thanks in advance
    Prashant Baj

    JEditorPane and getSize()?

  • How to determine current tax configuration owner (content_owner_id)

    I am attempting to query zx_rates_b to find a record where tax_rate_code = '6X' to find only the record for the current configuration owner. In 11i, we used the organziation id to identify the correct record.
    The following query returns too many records and need to be limited by content_owner_id.
    SELECT zrat.tax_rate_id, zrat.tax_rate_code --atco.tax_id, atco.tax_rate
    INTO v_tax_code_id, v_ap_tax_rate
    FROM --ap_tax_codes_all atco,
    po_vendor_sites_all pvsi, zx_rates_b zrat
    WHERE pvsi.vendor_site_id = r_ooli.execute_vendor_site_id
    --AND atco.name = pvsi.vat_code
    AND zrat.tax_rate_code = pvsi.vat_code
    --AND atco.org_id = r_ooli.debited_org_id
    --AND atco.enabled_flag = 'Y';
    AND zrat.active_flag = 'Y'
    AND trunc(sysdate) between zrat.effective_from and zrat.effective_to;
    How should I determine the content_owner_id?
    This code is executed during a concurrent request

    ZX_TAXES_B, ZX_STATUS_B and ZX_RATES_B tables contain content Owner Id column... you have to first find out the relevant content owner id from the complete list of options that are available, then hardcode the same to your SQl query to narrow down on unique record ...
    Regards,
    Ivruksha

  • How to determine current used ip address is from company wifi

    Hello guys, currently doing an attendance app (ios / android) for user to check in / out (will capture location coordinate, current used IP and etc, then send back to the server). Besides will use C# web as back-end reporting.
    At back-end reporting how do I determine or check the IP address being used is from company WiFi or not ?
    The purpose of this is because ensure the user check in / out within the office area. On the other hand, sometimes user will outstation at client side and check in / out by using the app (ios / android).
    Besides, any better ways to do this ?
    Thanks

    Hi loonloon,
    Based on your description, your case related to ios / android app. Both of them are third-patry mobile product. I am afraid this is out of our support. Thanks for your understanding and effort.
    Best regards,
    kristin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to determine current state of resource group?

    Good morning!
    I'm in the process of creating a monitoring policy which would alert if a specific resource group is in a state other than "online". Is there a command line executable available that I could utilize which would return the current status of a resource group? I know that the status is written to the /var/adm/messages file, but parsing that would be my last resort.
    Thanks!

    Check out:
    man -M /usr/cluster/man scha_resourcegroup_get
    in particular the options:
    -O RG_STATE
    and
    -O RG_STATE_NODE
    Tim
    ---

  • How to make different stroke widths like CSS can?

    With CSS, it's easy to specify border-top, border-right, etc. Is there a way to do this (on basic rectangles) with InDesign? I think it could be a very useful feature. I realize this might require a wholly separate panel than the existing Stroke panel.

    LynnZee wrote:
    This **is** possible in Final Cut Pro X, isn't it? Or will I need to buy some sort of add-on to do this?
    If you want DIY, edit a still into the timeline. Option drag (to duplicate) the clip to the layer immediately above the primary storyline; repeat 3 more times so you have 4 identical clips connected to the original clip on the primary storyline.
    For each clip, select, and resize with the transform function. Reposition as necessary. Either keyframe the moves into the correct position in the frame or keyframe the opacity if you want them to appear sequentially.
    If you want to do it with a plug-in you might look art this or this.
    Russ

  • How to determine current SIMMs installed in 2801?

    Hi,
    I have a remote 2801 with 128MB DRAM installed, but need to know if it exists of 1 x 128MB SIMM or 2x 64MB SIMM. Is there any way to determine this remotely (like you can with the 3640 series)?
    If not, any one happen to know what is the default (1 or 2 banks) for the CISCO2801?
    Thanks,
    Leo

    Hi Leo
    Cisco 2801 routers have 128 MB of SDRAM soldered onto the system board.. You can install an additional DIMM in the DIMM connector to expand system memory to a maximum of 384 MB.
    For more info:
    http://www.cisco.com/en/US/products/ps5854/products_installation_guide_chapter09186a00802c5ad8.html#wp1026137
    HTH

  • How to edit stroke width after line is drawn?

    In Flash CS4, I'm trying to change the stroke width of my line or shape, with it selected, but the stroke width slider is greyed out (thus, unadjustable). Is it possible to edit a stroke width after something has been created? If so, how can this be done? I've tried selecting the line in all kinds of crazy ways, but still can't edit it.

    I don't have CS4, but in CS3, as long as you're selecting the raw drawn object, you can use either the slider or enter a new value in the box.  When you select the shape and line, does it appear all cross-hatched/speckled or is it a blue line surrounding it all?  If it's the blue line, then you're not down to the raw graphic yet.  You might also want to check to be sure the layer isn't locked.

  • How to select paths with the same stroke width

    I would like to know how to select all the paths inside a document whose stroke width are equal to 0.361 points
    I will appreciate any help.

    here you go
    #target illustrator
    // script.name = selectPathsThisSize.jsx;
    // script.description = selects pathItems that have the same supplied stroke width; limited to 3 decimals;
    // script.required = a document with at least one path item;
    // script.parent = CarlosCanto // 6/5/11;
    // script.elegant = false;
    var idoc = app.activeDocument;
    var strokewidth = prompt ("Enter Stroke Width in points of paths to be selected", 0.361, "Select Paths this size:___");
    for (i=0 ; i< idoc.pathItems.length; i++)
              var ipath = idoc.pathItems[i];
                   if ( (ipath.strokeWidth).toFixed(3) == Number(strokewidth).toFixed(3))
                             ipath.selected = true;
    app.redraw();

  • When drawing with the shape tool in Flash how can I vary the stroke width?

    I created an oval shape and I'd like to vary the stroke width so it's not all just one uniform thickness. However in the Properties window I can only find the uniform stroke width and style options (solid, dotted, hashed, etc...). How can I add some tapering?
    Thank you for your help.
    Sarah

    You probably need to convert the line to a fill and then change the shape of it. .. Modify -> Shape -> Convert Lines to Fills

  • How do I determine current firmware version for WRT54G

    I've been poking around the site a bit, and note that there are mandatory upgrades to various firmware versions. I'd like to upgrade if necessary, but have no idea how to determine what firmware version I have right now.Message Edited by shelmart on 12-17-200605:36 AM

    What is the excact hardware version # of your router? U can find that underneath the router itself, there's a sticker there & its just right below the Linksys Logo. If its version 5 or 6, u can go to this website: www.linksys.com/connect . Download  & save Easylink Firmware Tool & then before u run that file after saving, disable first all your internet security like firewalls & anti- virus coz it will block the connection of this software from running properly. That EFL will automatically upgrade the firmware of your router.

Maybe you are looking for

  • Templates in DVD SP4?

    I'm going to purchase DVD Studio Pro 4 pretty soon. I'd like to know if there are some templates in there to get me (a newbie) started? I think I've graduated from iDVD and its frustrating lack of flexibility.

  • How to extract ddl

    Hi, someone to know how to extract ddl database oracle lite, using some tool or program native. Thanks Fabrício

  • Matrox and CS4-CS5

    I'm using a Matrox P650 for CS3 and it's wonderful. Great color fidelity and image quality. Dual LUTs, 10 bit analog pipes (useless with DVI, but still...). Now, with CS5 on the way, I find that Matrox has apparently abandoned the Photoshop market. A

  • HT2491 move desktop icon

    i am setting up a mac book air and one program has put itself in the middle of my desk top and will not move. I would have put a version in launch pad, where i want it, but one icon stays on my main opening desktop page. The program is vlc media play

  • Masterdata upload - Add string after conversion

    Hi experts, I upload masterdata from BW using transformationfile and conversionfile. To create a BPC specific ID I need to remove the leading zeros first (using js:parseInt in conversion) and afterwards I need to add a string (VK) at the end of the I