Internationalization AWT Button, Labels

Hi
I was just wondering Internationalization of an awt button and label. I was reading the java trails and it is still abit confusing, i was wondering is can anyone exaplain with an example.
Thanks

You have a resource bundle. The bundle is usually a properties file. You have one properties file that is the default and one other for each language you want to support.
MyRes.properties
MyRes_es.properties // spanish
MyRes_fr.properties // french
In each, you have key=value pairs for the text you want to have...
// default
button.yes.text=Yes
// spanish
button.yes.text=Si
// french
button.yes.text=Oui
You load this for a given locale:
Locale loc = new Locale("es", "ES"); // spain
// or Locale loc = Locale.getDefault(); // system locale
ResourceBundle res = ResourceBundle.getBundle("MyRes", loc);
It'll load the appropriate file, or if not found, it'll load the default.
You then create a button like so:
Button b = new Button(res.getString("button.yes.text"));

Similar Messages

  • Build buttons/labels on a Displayed Image

    Hi,
    I have a small Java applet program that displays an Image.
    I want to build buttons/labels/text on this Image. How do I do this?
    Here is what I have so far:
    import java .applet.Applet;
    import javax.swing.*;
    import java.awt.*;
    public class Golf extends JApplet
    private Image pic;
    public void init()
    pic = getImage(getDocumentBase(), ("GolfGif.gif"));
    public void paint(Graphics g)
    g.drawImage( pic, 0, 0, this);
    Thanks
    Regards
    Geir

    Hi
    I want to develope an applet whit sirten buttons/labels etc, but I also want to show a picture as the background, how do I do this?
    Seems to me what I have started on does not work, it must be other ways...
    Thanks

  • Changing button label

    this is my program. i have created a grid of 20 * 20 and randomly assigned integers 0 to 4 into the cells (and colors corresponding to them).
    Now i need to put this program into a loop...i.e. the labels of the button should change with every loop....such that we can watch each transition for 5 seconds (hence there has to be some kind of pause, and some kind of dissolve older applet function). I should be able to change the button label by specifying the particular button (lets say [3][4]), finding the current value/label of the button, and then assigning a new label of the button.
    Can somebody help.
    import java.awt.*;
    import java.lang.*;
    import java.applet.*;
    import java.util.Random;
    <applet code="GridDemo" width=600 height=600>
    </applet>
    public class GridDemo extends Applet{
    static final int n = 20;
    static final int t = 10;
    Random r = new Random();
    public void init(){
    setLayout(new GridLayout(n,n));
    Color[] cols = {Color.WHITE, Color.YELLOW, Color.CYAN, Color.BLUE, Color.RED};
    for(int i=0; i<n; i++){
    for(int j=0;j<n; j++) {
    Button[][] myArray = new Button[n][n];
    int k=r.nextInt(5);
    Button b = new Button("" +k);
    b.setBackground(cols[k]);
    myArray[j] = b;
    add(b);

    I'm not sure if this is really what you want, make your class run a thread, that changes your labels after 5 second pauses. public class GridDemo extends Applet implements Runnable {
    public void init() {
       new Thread(this).start();  // starts the thread running.
    public void run() {
      while (someCondition) {
        // your for loops here..
        Thread.sleep(5000); // pause 5 seconds before running for loops again
    }

  • Trying to assign an XML attribute value to a button label

    I have a Flex app (developed in FLEX 2) that reads from
    multiple XML files and populates datagrids with element values.
    What I'm trying to do now, is to create a second column with a
    button, enabling users to view archived versions for each current
    report.
    My problem is: I can't get the <mx:Button> label to
    accept the attribute "name". I've tried atleast 10 - 20 different
    syntax.
    My XML file looks like this:
    <metrics>
    <report name="test">
    <link>test Report 10/28/2008</link>
    <url>test-10_28_2008.zip</url>
    <status>active</status>
    </report>
    </metrics>
    The mxml looks like this:
    <mx:Button buttonMode="true" useHandCursor="true"
    click="handleClick()" label="{data.@name}" width="80">
    <mx:Script>
    <![CDATA[
    public function handleClick():void{
    var url:URLRequest = new
    URLRequest([L=http://new.test.com/pages/r_archive_apps/"+data.link+".html");[/L]]http://n ew.test.com/pages/r_archive_apps/"+data.link+".html");[/L][/L]
    navigateToURL(url,"_blank");
    ]]>
    </mx:Script>
    </mx:Button>
    When I try to label a button with an element it works fine.
    Some of the other sytax I've used are:
    - label="{data.report.@name}"
    - label="{data.report.(@name=='test')}"
    - label="{data.report.(@name='test')}"
    - label="{data.@name}"
    - label="{data.metrics.report.@name}"
    - label="{data.metrics.report.(@name=='test')}"
    - label="{data.metrics.report.(@name='test')}"

    quote:
    Originally posted by:
    rtalton
    Can you post some code so we can see how you are using the
    button? I think you may be using the button within a datagrid
    itemRenderer, which might make a difference.
    You're right, the button is in a datagrid itemRenderer. I've
    pasted more dataGrid code below - thanks again.
    <mx:DataGrid id="dgCatalog" dataProvider="{_xlcCatalog}"
    rowCount="4" editable="false" sortableColumns="false"
    left="148" top="65" bottom="42" borderStyle="solid"
    alternatingItemColors="[#ecf8ff, #ffffff]"
    themeColor="#ffff80" alpha="1.0" cornerRadius="0"
    dropShadowEnabled="true" dropShadowColor="#000000" width="549"
    creationCompleteEffect="{glow3}">
    <mx:columns>
    <mx:Array>
    <mx:DataGridColumn editable="false" headerText="Daily -
    Report Names" dataField="link" textAlign="left" width="200">
    <mx:itemRenderer>
    <mx:Component>
    <mx:LinkButton click="handleClick()" label="{data.link}"
    >
    <mx:Script>
    <![CDATA[
    public function handleClick():void{
    var url:URLRequest = new URLRequest("
    http://test.new.com/test/"+data.url);
    navigateToURL(url,"_blank");
    ]]>
    </mx:Script>
    </mx:LinkButton>
    </mx:Component>
    </mx:itemRenderer>
    </mx:DataGridColumn>
    <mx:DataGridColumn editable="false" headerText="Daily -
    Report Archives" dataField="link" textAlign="left" width="80">
    <mx:itemRenderer>
    <mx:Component>
    <mx:Button buttonMode="true" useHandCursor="true"
    click="handleClick()" label="{data.report.@name}" width="80">
    <mx:Script>
    <![CDATA[
    public function handleClick():void{
    var url:URLRequest = new URLRequest("
    http://test.new.com/pages/test_apps/"+data.link+".html");
    navigateToURL(url,"_blank");
    ]]>
    </mx:Script>
    </mx:Button>
    </mx:Component>
    </mx:itemRenderer>
    </mx:DataGridColumn>
    <!--mx:DataGridColumn headerText="URL" dataField="url"
    width="350"/>
    <mx:DataGridColumn headerText="Status" dataField="status"
    width="70"/-->
    </mx:Array>
    </mx:columns>
    </mx:DataGrid>

  • How to change Boardercolor of awt.Button???

    Can someone Help me? (I am new and i do not know if in an other thread is an answer posted)
    I want to make a Button display in my own colors. As I know in awt.Button there is just the possibility to change the backgroundcolor. But I also need to change the Boarder in thickness and above all in color.
    And in addition im not able to use the javax.Swing-Package (If that would help me).
    Thx for any help...
    Ramon

    It is more complex!
    When painting a button you usually want to paint it differently according to what I call the state of the button:
    Is it enabeled or not?
    Is it currently pushed?
    Does it have currently have focus?
    Is the mouse pointer above it?
    The different combination of awnsers to these questions should give you something like 2 to 5 different states that you want to show when painting.

  • How to add image as radio button label instead of text

    In a pure AS3 project, is there a way to add use an image placed in the library/ Flex/AIR SDK compiler path instead of text as a radio button label?
    I've tried substituting character may unicode like:
    rb1.label = String.fromCharCode("0x2592");
    But how this displays is dependent on the device, font character availability. Displays unpredictably.
    Would prefer anyway to use an image that I can create in AI.
    Any help appreciated.

    OK. I tried this, and it works.
    (Hopefully, the image will display in the same location, next to the radio button, on different devices.)
    Thank you.

  • Background image in extended awt.Button doesn't show.

    Hi all
    I have an applet that has only an awt.Button visible on the page. Because of layout requirements I need to style that button with a background image. I have extended the java.awt.Button like this:
         class ImageButton extends Button {
              public void paint(Graphics g) {
                   super.paint(g);
                   g.drawImage(getImage(getDocumentBase(), "../img/loadSertificate.jpg"),
                             0, 0, null);
         }and use the extended:
         public void init() {
              mSignButton = new ImageButton();
              mSignButton.setLocation(0, 0);
              Dimension appletSize = this.getSize();
              mSignButton.setSize(appletSize);
              mSignButton.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e) {
                        signSelectedFile();
              this.setLayout(null);
              this.add(mSignButton);
         }Now everiting is ok but when the applet is loaded the background image doesn't show and only a plain gray button is visible. The interesting part is that the image does show after I click somewhere in the browser's window and later on it's always visible as expected.
    Below is part from the log from the java console:
    basic: Applet started
    basic: Told clients applet is started
    Loaded image: http://ip:8080/UserManagement/img/loadSertificate.jpg
    network: Cache entry found [url: http://ip:8080/UserManagement/img/loadSertificate.jpg, version: null]
    network: Connecting http://ip:8080/UserManagement/img/loadSertificate.jpg with proxy=DIRECT
    network: Connecting http://ip:8080/UserManagement/img/loadSertificate.jpg with cookie "JSESSIONID=8A0936441BDA3215A10D9798742C4685"
    network: CleanupThread used 39850 us
    network: ResponseCode for http://ip:8080/UserManagement/img/loadSertificate.jpg : 304
    network: Encoding for http://ip:8080/UserManagement/img/loadSertificate.jpg : null
    network: Disconnect connection to http://ip:8080/UserManagement/img/loadSertificate.jpg
    Loaded image: http://ip:8080/UserManagement/img/loadSertificate.jpgAny suggestions how to fix this issue?!
    Edited by: factor5 on Nov 12, 2009 1:27 AM
    Edited by: factor5 on Nov 12, 2009 1:28 AM

    xmm sry but this was a forgotten repaint() :
              public void paint(Graphics g) {
                   // call super's paint method
                   super.paint(g);
                   g.drawImage(getImage(getDocumentBase(), APPLET_BUTTON_IMAGE_URL),
                             0, 0, null);
                   repaint();
              }Now it seems to work fine.
    Edited by: factor5 on Nov 12, 2009 1:44 AM

  • Special characters not displaying in button label

    My production environment is: Oracle Forms 6i connecting to an Oracle 8i database. Forms are Windows client/server. In a form there is a layout of buttons like a QWERTY keyboard. And in the property palette information for each data block, the item is of type "Push Button" and the default Label is set to a specific number which correlates to what that number translates into a special character (i.e. Portuguese, or Spanish characters). So example: CHR196 label = "196". So when at runtime. The following command is executing upon seeing this canvas:
    Set_Item_Property('CHR196', LABEL, CHR(196));
    So in Forms6i the CHR(196) comes out to be a letter in the alphabet from either Spanish or Portuguese and shows up perfectly.
    But NOT in 11g. That environment I'm in is:
    Oracle Fusion Middleware Forms 11g on RHEL5 (Red Hat Enterprise Linux version 5) on a 32-bit platform
    connecting to
    Oracle Database 11g on RHEL5 (Red Hat Enterprise Linux version 5) on a 64-bit platform
    using a
    Windows based browser (IE7 - Internet Explorer 7).
    Could it be due to the forms being in a JVM (Java Virtual Machine)? All I see is a small "square" and this shows up on ALL the button labels. Could it be the NLS_LANGUAGE format of the database? Because when I run the query : SELECT CHR(196) FROM dual on 8i or 11g, the proper character shows up in TOAD or SQL+.
    Thanks,

    Hello Paul,
    I once used hexadecimal coded characters like &xnnn; and they were not transformed. When coding them in decimal, everthing worked fine.
    Hth
    J�rg

  • Button label positioning

    Hi,
    I am new to Flex 2 world but even my question seems a bit
    funny to me. I'm trying to create a square button (width=200 by
    height=200) and I want the label inside the button to be in one of
    the top corners. At this point I don't care if it's in the left or
    right top corner.
    I've tried everything and I was only able to get the label to
    be left aligned using the TextAlign property but I can't seem to
    figure out how to Vertically align it to the top.
    any help you be greatly appreciated.
    Incase someone needs to see the mxml code to understand what
    I'm doing, here it is: (LOL)
    <mx:Button label="topleft" width="200" height="200"
    textAlign="left"/>
    Also, I've tried to put a <mx:Label> right after this
    button and using the x/y co-ordinates, place it on TOP of the
    button and that works but then when I mouseover the label it looses
    the mouseover the button (which is obvious).
    HELP! :)

    The paddingTop worked. I just had to set it top a negative
    value :) I feel like I had to "cheat" to get this working :)
    Thanks a lot!

  • LSO content player Button Label

    Hi,
      In LSO content player, I would like to customize the button label " End Test".
    I have gone through the jsp and html pages and did not find any reference to it.
    Please suggest.
    Thanks,
    Vasudha Reddy

    Did you check in the following XML file?
    jspstrings_en.xml file : You can find it in the J2EE 630 under the following path: \server0\apps\sap.com\com.sap.hcm.ls.webapps\servlet_jsp\lms\WEB-INF\xml
    Please let me know if this helps.

  • The button labels in my folders are reading as numbers

    The button labels in my folders are reading as numbers

    First, please stop posting your email address. That will only get you on spam lists.
    I suggest you erase your boot volume and restore from the backup. Check that the issue is resolved, then (and only then) change every password you have and check all your online financial accounts for unauthorized activity. Consider canceling all credit cards and requesting new ones.
    When that's done, you need to learn the basics of safe computing.
    Mac OS X versions 10.6.7 and later have built-in detection of known Mac malware in downloaded files. The recognition database is automatically updated once a day; however, you shouldn't rely on it, because the attackers are always at least a day ahead of the defenders. In most cases, there’s no benefit from any other automated protection against malware.
    The most effective defense against malware is your own intelligence. All known Mac malware takes the form of trojans that can only operate if the victim is duped into running them. If you're smarter than the malware attacker thinks you are, you won't be duped. That means, primarily, that you never install software from an untrustworthy source. How do you know a source is untrustworthy?
    Any website that prompts you to install software, such as a “codec” or “plug-in,” that comes from that same site, or an unknown site, is untrustworthy.
    A web operator who tells you that you have a “virus,” or that anything else is wrong with your computer, or that you have won a prize in a contest you never entered, is trying to commit a crime with you as the victim.
    “Cracked” versions of commercial software downloaded from a bittorrent are likely to be infected.
    Software with a corporate brand, such as Adobe Flash, must be downloaded directly from the developer’s website. No intermediary is acceptable.
    Follow these guidelines, and you’ll be as safe from malware as you can reasonably be.
    Never install any commercial "anti-virus" products for the Mac, as they all do more harm than good. If you need to be able to detect Windows malware in your files, use ClamXav -- nothing else.

  • How to localize button labels of a genuine NI VI?

    Some days ago I asked how to manage the translation of button labels of the
    genuine "file dialog VI" from NI (i.e. German label "Wahlen"-> English label
    "Select", German label "Abbruch"->English label "Cancel" etc.) for the
    finished application (I need to have a german and an English version).
    Someone suggested to select English from the Windows country selection and
    someone else suggested to use the string export/import function.
    However, nothing succeeded so far.
    I even bought WIN 2000 in English, since I thought LV perhaps refers to some
    standard/library Windows labelling names during compilation.
    Regarding the string export/import function: This should work if one is able
    to get into the VI, but with the genuine "
    file dialog VI" from NI I cannot
    enter the VI.
    Do I really have to program my own VI for such a simple localizing thing?
    So far, heavily disappointed....
    Thanks
    Klaus

    Klaus,
    Sorry to hear about your problems. Have you tried contacting NI about this? They are usually very good about supporting issues such as this.
    I am going to try a few things for you to see if I can help. If I don't post a followup, assume I had no luck. If you go to ni.com/ask you can start a formal support question. The NI tech support guys will help you fairly quickly (usually within a day or less!)
    Good luck.

  • Changing button label;JSP; input type="submit" name="jboEvent" value="Search"

    Hello everybody,
    I try to develop a multilanguage application in which the button labels will change accordingly with the browser's regional settings.
    The line in the generated DataQueryComponent.jsp file is the following:
    <input type="submit" name="jboEvent" value="Search">
    If I want to change the value like value="Rechercher" the application will not execute the query.
    In fact the section
    <jbo:ViewCriteriaIterate datasource="dsQuery" >
    </jbo:ViewCriteriaIterate>
    is not executed.
    I tried to generate the button with:
    <input type="submit" name="jboEvent" value="Rechercher" onClick="this.value='Search'"> ,
    but for a long query the name Search will remain as button label on the screen.
    Any new solutions, please?
    Thanks in advance.

    Visit that Jakarta web site. There is an i18n tag library that you will find useful.
    http://jakarta.apache.org/taglibs/doc/i18n-doc/intro.html

  • Fade button label

    Hi, plase help me!
    I've applied a fade effect to a component that contains a
    button and some other children. All the component fades correctly
    and the button fades too, but not its label. I think that it's an
    embedded fonts problem. So I've embedded a font:
    @font-face {
    src:local("Arial");
    font-family: ArialEmbedded;
    advanced-anti-aliasing: true;
    Button
    embedFonts: true;
    font-family: ArialEmbedded;
    font-size: 13;
    After this operation the font-size of the button label
    matches, but not the font-family! The system default font-family
    persists!
    How can I embed fonts in button components? If I cannot fix
    this issue, I think that I cannot fade the button together with its
    label!
    Thanks

    Fixed, I had to embed the bold version of the font, because
    button labels are bold!
    So, the finally code is:
    @font-face {
    src:local("Arial");
    font-family: ArialEmbedded;
    advanced-anti-aliasing: true;
    font-weight:bold;
    @font-face {
    src:local("Arial");
    font-family: ArialEmbedded;
    advanced-anti-aliasing: true;
    font-weight:normal;
    Button
    embedFonts: true;
    font-family: ArialEmbedded;
    font-size: 13;
    All buttons will use the bold ArialEmbedded to render their
    label!
    Byez

  • Change dynamic button label

    Hi,
    In apex 3.0 can I have a button which changes dynamic? e.g. if an item is null then the button label to be 'tes' else button label 'ok'?
    Thank you

    Hi,
    Maybe easiest way is create 2 buttons and set condition for those.
    Use condition when item in expression 1 value is / value is not in expression 2
    Regards,
    Jari
    http://dbswh.webhop.net/dbswh/f?p=BLOG:HOME:0

Maybe you are looking for

  • I am ready to dump mountain lion and go back to snow leopard

    Can someone stop me? I am so frustrated with lion and now mountain lion that I am actually looking at dumping the OS X 10.8 and reverting back to snow leopard. I have a small office with three mac machines. I have been a fan of the macs for many year

  • How to kill Forms Runaway Process using 95% CPU and running for 2 hours.

    We had a situation at E-Business Suite customer (using Oracle VM server) where some of Form processes were not being cleared by form timeout settings automatically. Also when user exits the form session from front end, the linux form process (PID) an

  • Help - my photo xml photo album's on fire...:)

    Hello there, I have recently completed the tutorial on how to make a slideshow with thumbnails. It is found here: http://www.kirupa.com/developer/mx2004/thumbnails.htm . I figured this would be a great way to show off a friends photogallery. The site

  • Users & Groups not in Get Info options

    When opening a Get Info window to change Sharing & Permissions, adding a new entry to the list shows maybe 4 options when the OS has dozens of users & groups. Why are standard options like "staff" not showing up?

  • No audio or sound in After Effects CC

    I have imported footage that works fine in Prelude but not at all well in AE. There is always a problem with the imported footage. But mainly there is never any audio or sound. I have read a few other post and tried the recommended solutions to no av