How can I make a custom component focusable?

Hi all,
I'm using a custom made component that consists of a JLabel
and a JTextField. I want to make this component focusable,
and when it's in focus I want the JTextField to have the
focus so that the user can start typing immediately.
I've looked at the java tutorial
(http://java.sun.com/docs/books/tutorial/uiswing/misc/focus.html#focusable).
When my component gets the focus I request the focus to the
JTextField. The problem is: whenever i check if my custom
component has the focus, it hasn't because JTextField has it
(the focus, i mean :-) ) Which isn't strange i think, but
how can i solve this problem?

I want to make this component focusable, and when it's in focus I want the JTextField to have the focus
The problem is: whenever i check if my custom component has the focus, it hasn't because JTextField has it (the focus, i mean :-) So whats the problem the textField has focus as desired.
You don't need to make the containing panel focusable in order for the text field to receive focus. The FocusManager is smart enough to place focus on the first focusable component contained in the panel. If you make the panel focusable then you will need to use the tab key twice, once to move focus to the panel and a second time to move focus to the text field.

Similar Messages

  • How can I make a custom book size in iBooks Author

    How can I make a custom book size in iBooks Author?

    Book sizes (Landscape or Portrait) are fixed when using iBooks Author.
    Covers, however, can be square.

  • How can I make a custom domain email for my client?

    I have an Adobe Muse subscription, with hosting through Adobe, and the Domain name is also with Adobe. How can I make an email for a particular domain for my client so that it will use a "company email" (even if it just redirects to say a gmail or yahoo that is fine) to read "[email protected]?

    Hello,
    As I can see you have a WebBasic Creative Cloud site, I would suggest you to use GoogleApps for your e-mail services.
    Please have a look at the article which would help you achieve this : http://helpx.adobe.com/business-catalyst/partner/setting-google-apps-email-business.html
    Hope this helps.
    Regards,
    Sachin

  • How can I make non-inspectable component properties persist from design to runtime?

    Hey,
    I have two components (lets call them A and B) which have normal inspectable properties (e.g. NAME and AGE) which allow you to enter values via the component inspector. When I type the value for NAME in component B (via the component inspector) I communicate via a singleton class and store this value in a NON INSPECTABLE property located in component A.
    When I run the movie, I want to access this non inspectable property within component A; however, it is always null - the value will not persist from design time to runtime. I check that the value is set at design time by tracing the A's non inspectable property once component B has set it - and it does indeed work, so I know component B has managed to set the correct value in A.
    Basically, what I need to know is, how do you persist properties of a component from design to runtime, without having to make properties inspectable and having to manually type property values via the component inspector?
    Many thanks

    Hi
    I would think <componentInstanceOfB>.NAME would give you the current value of NAME in the component B. This can be accessed by any component (say A),  when A knows the instance name of the component on the stage. So probably all you need to know is tell the instanceOfA the name of instace of B and then instanceOfA can access the value as <instanceOfB>.NAME.
    Hope this helps.
    Cheers
    Karthik

  • How can I make a custom one-line-per-test rpt using TestStand?

    I have written a 1-line-per-test report in another LabView application.  How can I do the same within TestStand 4.0?  I would like to display the usual information:  Description, Measurement Reading & Units, Pass/Fail, Lower Limit, and Upper Limit all in a concise, one line rpt.  Isn't most of this data available within TestStand?

    I would have figured this to be a pretty common use case, so I was wondering if anyone has made/edited a report sequence that does this?
    For example, the default report text looks something like:
    UUT Report
    Serial Number:                MACADDRGoesHere
    Date:                         Monday, September 22, 2008
    Time:                         9:48:05 PM
    Operator:                     administrator
    UUT Result:                   Passed
    Begin Sequence: MainSequence
    (C:\Projects\Corventis\1-08-01641-Corventis-Gen1 PCBA Test System\Engineering\3 - Develop\Sandbox\Report Generation Demo\Report Generation Demo_Main.seq)
    V_CPU_2V5 (Device Off):        Passed
         Measurement:              0.3000
         Units:                    V
         Limits:
            Low:                   0.1000
            High:                  0.5000
         Comparison Type:          GELE (>= <=)
         Module Time:              0.0014
    Memory DataBus Test POST:      Passed
         Module Time:              0.0012
    V_BATT:                        Passed
         Measurement:              3.1200
         Limits:
            Low:                   3.0000
            High:                  3.2000
         Comparison Type:          GELE (>= <=)
         Module Time:              0.0009
    End Sequence: MainSequence
    End UUT Report
    whereas I'd love something like:
    UUT Report
    Serial Number:                MACADDRGoesHere
    Date:                         Monday, September 22, 2008
    Time:                         9:48:05 PM
    Operator:                     administrator
    Execution Time:               0.2188 seconds
    Begin Sequence: MainSequence
    (C:\Projects\Corventis\1-08-01641-Corventis-Gen1 PCBA Test System\Engineering\3 - Develop\Sandbox\Report Generation Demo\Report Generation Demo_Main.seq)
    Test Name        Result        Measurement        Units        Limit Low        Limit High        Comparison Type        Module Time
    V_CPU_2V5 (Device Off)        Passed        0.3000        V        0.1000        GELE (>= <=)        0.0014
    Memory DataBus Test POST        Passed        N/A        N/A        N/A        N/A        N/A        0.0012
    V_BATT        Passed        3.1200        3.0000        3.2000        GELE (>= <=)        0.0009
    End Sequence: MainSequence
    End UUT Report 
    Message Edited by crelf on 09-22-2008 10:19 PM
    Message Edited by crelf on 09-22-2008 10:19 PM
    Copyright © 2004-2015 Christopher G. Relf. Some Rights Reserved. This posting is licensed under a Creative Commons Attribution 2.5 License.

  • How can I make a custom widget--JSlider2D?

    Hello
    I need to control two values x and y on a GUI. I am using two perpendicular JSliders to do that, but it looks ugly and is hard to use. I dreamed of makeing a 2D Slider(!) which basically would be a square of a circle with a nub in the middle. User can replace the nub and programmer gets back getValueX(), getValueY(), etc. Could someone please tell me how (or whether) I could do that?
    Thanks a lot,
    Mehrdad

    Just create a component that does that. You can extend JComponent and make your own paintComponent() method to paint however you want your component to look like.
    You might also add a custom MouseMotionListener to your component and in its mouseDragged() method you can update the x and y values.
    If you plan to use a layout manager that takes the components' preferred size into consideration you should make your component return a suitable value in its getPreferresSize() method.
    - Marcus

  • How can I make a custom style look the same in both printed and online?

    My specs:
    RH 9.0.2.271
    Windows 7, 64-bit
    Word 2010
    The Background Info:
    So I created some custom css styles to try and mimic the look of a message box in our documentation. Here's the css code:
    .MsgBox {
        color: #000000;
        border-left-style: Solid;
        border-right-style: Solid;
        border-top-style: Solid;
        border-bottom-style: Solid;
        font-size: 10pt;
        background-color: #eeeeee;
        border-left-width: 4px;
        border-right-width: 4px;
        border-top-width: 4px;
        border-bottom-width: 4px;
        border-left-color: #cdcdcd;
        border-right-color: #cdcdcd;
        border-top-color: #cdcdcd;
        border-bottom-color: #cdcdcd;
        width: 350px;
        padding: 5px 5px 5px 5px;
        box-shadow: 10px 10px 5px #888888;
        margin-bottom: 7pt;
    .MsgBoxTitle {
        color: #000000;
        border-left-style: Solid;
        border-right-style: Solid;
        border-top-style: Solid;
        border-bottom-style: Solid;
        font-size: 10pt;
        background-color: #cdcdcd;
        border-left-width: 4px;
        border-right-width: 4px;
        border-top-width: 4px;
        border-bottom-width: 0px;
        border-top-color: #cdcdcd;
        border-bottom-color: #cdcdcd;
        border-left-color: #cdcdcd;
        border-right-color: #cdcdcd;
        width: 350px;
        padding: 5px 5px 5px 5px;
        box-shadow: 10px 10px 5px #888888;
    My HTML Code:
    <div class="MsgBoxTitle">
        PC-DMIS MESSAGE:
    </div>
    <div class="MsgBox">
        <p>Please do the following steps in the indicated order.</p>
        <p>1. Remove the current SH-1/2/3 stylus.</p>
        <p>2. Attach the SHSP (Stylus Holder Setting Piece).</p>
        <p>3. Jog the probe to a safe location with a clear line of approach
         to the port(s) being calibrated. </p>
        <p>4. Then click OK.</p>
        <p>After you click OK the machine will begin DCC measurement.</p>
    </div>
    The Expected Output:
    Here's how it renders in a browser (the title is MsgBoxTitle, the body is the MsgBox style). I'm happy with how it looks there, even if the box shadow doesn't always display:
    The Ugly Printed Output:
    And here's what it looks like in the printed output.
    Ugly. Are there any tricks to get the printable (doc) output to match the online? Ideally, on the printed output, I'd like to have all the white space in my pseudo message box removed so it looks just like the online.

    Hi Peter. Thanks for the reply.
    I assumed that if I used the project style sheet during the export, Word would convert the style so that it looked the same as in the HTML. Is that a bad assumption? I'm currently not mapping to any template equivalent for these message box styles. I did try it as one of my attempts, but I couldn't figure it out. It never seemed to take the style in the .dot.
    Anyway, if I use just 1 style, such as just the MsgBox, I obviously don't get the white paragraph between the title and message. That white paragraph comes from the first <p> tag in the MsgBox style. But I need to have the <p> tags in there because they're better for our localization process than line breaks.
    I did do some tweaks that made it look better. Basically I structured it so that the MsgBoxTitle div is now inside the MsgBox div. Something like this:
    <div class="MsgBox">
        <div class="MsgBoxTitle">PC-DMIS MESSAGE: </div>
        <p>Please do the following steps in the indicated order.</p>
        <p>1. Remove the current SH-1/2/3 stylus.</p>
        <p>2. Attach the SHSP (Stylus Holder Setting Piece).</p>
        <p>3. Jog the probe to a safe location with a clear line of approach
         to the port(s) being calibrated.</p>
        <p>4. Then click OK.</p>
        <p>After you click OK the machine will begin DCC measurement.</p>
    </div>
    And then I adjusted my styles borders, padding, and thickness. That helped it look more connected, but still doesn't look quite right:
    Would love to get rid of that white space after the title.
    If you have time, I would be interested in a more detailed example of how you did it.

  • How can I make firefox give the focus (the cursor) to the address bar when I open a new window - as it does when I open a new tab (to about:blank)?

    When I open a new tab using CTRL-T, the address/awesome bar has the focus.
    When I open a new window using CTRL-N, it does not.
    Can the behaviours be made consistent via setting a configuration option or key?
    Thanks in advance for any help!

    Hello wodow, please check it in [https://support.mozilla.org/en-US/kb/troubleshoot-firefox-issues-using-safe-mode#firefox:linux:fx27 safe mode], do you have the same behaviour ? DO NOT reset, select "Start in Safe Mode".
    thank you

  • How can I make a custom tone?

    I want to make a song from my itunes library into a tone without paying.

    There are free apps in the App Store such as Ringtone Maker to do this for you as well.

  • Adobe pro - print settings: How do i make a custom page size list, which i can copy to my other comp

    Adobe pro - print settings: How do i make a custom page size list, which i can copy to my other computers who have adobe pro installed?

    your right.. i ment acrobat pro :-)
    my problem is that i use the PDF printer to export CAD drawings as PDF´s.
    As it is now, there are some pre-defined page sizes in the print settings, and i know i can add custom pages manually one at a time.
    What i want is to copy the list of my danish standard page sizes, and use them on my other versions of acrobat.
    Its like 70 different sizes, and i have them made manually on my current computer, but i hope its possible to copy the list to other computers.
    Maby its some script where i can define the sizes, and then copy to another computer. Im just not that much of a computer genius :-)
    Hope i got through this without to many spelling mistakes...
    Thanks for helping.

  • How can I make a bullet item with a custom Bullet character such as a check mark ?

    Hi Everyone,
        I'd like to make a list with Bullets, but I can find a bullet character which I am looking for. Especially I'd like to make Bullet characters available in PowerPoint, such as check mark, and others. How can I make a bullet item with a custom Bullet character or picture such as a check mark ?
      Regards
      Cem

    Cem777 wrote:
    Hi Everyone,
        I'd like to make a list with Bullets, but I can find a bullet character which I am looking for. Especially I'd like to make Bullet characters available in PowerPoint, such as check mark, and others. How can I make a bullet item with a custom Bullet character or picture such as a check mark ?
      Regards
      Cem
    Search InDesign help for "change bullet characters" (without quotes,) and use the technique described there with the Zapf Dingbat font as suggested by Peter S.
    You can also use InDesign's glyphs panel (Window > Type & Tables > Glyphs) to scroll through all the character sets in all the fonts that InDesign has access to on your system, to look for check mark characters.
    After you have created a paragraph style that applies the customized check-mark-bullet that you want, every time you apply that paragraph style, the custom bullet appears. So, while it's a few steps to set up the style the first time, from then on it's automatic.
    If you really need a particular bullet that's not in any font you have, you'll need to search for fonts that have check mark characters and buy one or use a free one. Caution: free fonts aren't always created to the same strict standards that commercial fonts from reputable font foundries observe; free fonts sometimes cause problems when printing or exporting to PDF. You can search Google for "fonts with check mark" (without quotes.)
    HTH
    Regards,
    Peter
    Peter Gold
    KnowHow ProServices

  • How can I make the edges of the JSC component curved?

    It is a very common practice to make the edges curved in web development. Curved edge looks attractive and professional. (for example see blog.com)
    How can I make the edges of the JSC component curved? For example, consider Textfield component, how to make the the sharp edges smooth and curved?
    Thank you very much.

    Follow the steps below implement rounded edges for tabs in a tabset component:
    1)Create 2 images: level1_selected.jp and level1_deselct.jpg to be used as the background for these tabs. Thse images can be easily craeted using windows paint software. Just ceate a rectangular image of size 200X30 and draw a rounded rectangle on it.
    2) Redefine the following styles in your application stylesheet(originally defined in css_master.css)
    .Tab1Div td.Tab1TblSelTd {
         background-color:#EDF5F8;width: 200px;height:40px;background-image:url(images/level1_selected.jpg)
    .Tab1Div td.Tab1TblSelTd {
         background-repeat:repeat-x;background-position:left bottom;border-bottom:none
    .Tab1Div td {
         background-color:#EFEBEF;width: 200px;height:40px;background-image:url(images/level1_deselect.jpg);border:none
    .Tab1Div td {
         background-repeat:repeat-x;background-position:bottom left
    a.Tab1Lnk:link, a.Tab1Lnk:visited {
         display:block;padding:8px 15px 0px;font-weight:bold;text-align:center
    Results: By doing this you'll have the selected and unselected tabs show up with rounded egdes and also the selected tab will look bigger than the unselected tas making it more prominent.

  • I have created a spreadsheet on numbers for ipad with a list of customers as a drop down menu. How can i make their address appear underneath when i select the customer?

    I have created a spreadsheet on numbers for ipad with a list of customers as a drop down menu. How can i make their address appear underneath when I select the customer?
    iselect the customer?

    Hi bazza,
    We won't be able to put the address from a formula into the same cell that you enter the customer's name. We can put the address in the cell under the customers name.
    First let's take James advice and concatenate the address in the address table.
    Here is the formula in G2
    =CONCATENATE(B2&"
    ",C2&"
    ",D2&"
    ",E2)
    It shows this way because after I clicked on B2 and typed [&"] (no brackets) I typed option-return
    This gives you your new line. Then I typed the closing ". I repeated this for the rest of the address.
    Next we want to bring this to your order sheet. I prefer using the two formulas OFFSET and MATCH instead of VLOOKUP.
    base tells OFFSETwhere to start counting from. Click A1.
    row-offset is for the row. we will use MATCH() -1 to give us the row.
    What MATCH does is give you the row number where something is found and you can specify an exact match. I usually construct the MATCH formula first and then cut and paste it into OFFSET. MATCH looks like this: MATCH(A2,Table 1::A,0). A2 is what we are looking for, Table 1A::A is where we are looking (the entire column A), and 0 means we want an exact match. Can you see it inside the OFFSET formula? Notice that we had to subtract 1 from its result.
    column-offset tells OFFSET which column A=0 so we want 6.
    we ignore "rows", "colomns" we don't need them.
    If this seems like too much, just break it down into small pieces.
    quinn

  • How can i make requirement date in component take the actual day date??

    hello evry one >>>
    why requirement date in component ( service order ) dose not take the
    actual day date when we Withdrawn part from stock >>>> how can i make
    the requirement date take the day date automaticly without change it
    from offset field
    for example :
    when i withdrawn apart in (old service order) .. the requirement date
    take the old date or ( the service order date ) and it dosen't tack
    the day date ( day when i withdrawn part )
    please i whant help & thank you . good luck
    .... omar gamar ...

    Wrong forum:
    http://www.microsoft.com

  • How can i make custom login  and priviliges pages  depend on database ?

        Hi all,
       how can i make custom login page and custom security pages depend on oracle database tables.

    User, please tell us your Jdev version!
    Have you used the search field in the forum?
    This had been asked a couple of times.
    http://biemond.blogspot.in/2008/12/using-database-tables-as-authentication.html and
    http://biemond.blogspot.in/2008/12/using-weblogic-provider-as.html
    Timo

Maybe you are looking for

  • Creating New OS Language

    Greetings! I study many different languages, and I enjoy changing my computer's language in order to familiarize myself with technical terms in different tongues. I would greatly like to create a Latin language for my computer, but I have no idea how

  • My iTunes says there are 17 songs it cannot locate. How do I locate which songs these are without clicking on each song in my whole library?

    My iTunes says there are 17 songs it cannot locate. How do I locate which songs these are without clicking on each song in my whole library?

  • Subreport header on more than one page ?

    <p>Hi all,</p><p> </p><p>I need to create some reports with big subreport inside !</p><p> </p><p><font color="#000099">Main report </font></p><p><font color="#000099">subreport1  (10 pages and 9 columns)</font></p><p><font color="#000099">subreport2

  • Keyword Containing Count Missing in LR3

    In LR2 the keywords panel shows a count for the parent keywords, in LR3 this seems to be missing. For example I have a New Zealand keyword tag under Country which has a count of 17. Below this NZ keyword are North Island and South Island with counts

  • Replace CASE with DECODE

    Guys, I want to replace CASE statement with DECODE. How ? case when msg.is_swap = 'Y' and msg.buy_sell = 1 then 'SO' when msg.is_swap = 'Y' and msg.buy_sell = 0 then 'SI' else '' end As TransactionType How should i implement DECODE function to do the