ButtonField in the form of html link - paint correctly when you press.

I tried to look like an html link in an application (JDE 5.0.0) ButtonField.

I managed to paint correctly when it is developed and not well centered. However,.

When the user clicks the button, it is painted as a normal operated button.

What Miss me? Is there another method that I need to replace to control how it is painted

When you click on it?

public class LinkButton extends ButtonField {

    String name;

    public LinkButton(String name) {
        super(name, ButtonField.CONSUME_CLICK);
        this.setBorder(BorderFactory.createSimpleBorder(new XYEdges(2,2,2,2), Border.STYLE_TRANSPARENT));
        this.setBackground(BackgroundFactory.createSolidTransparentBackground(Color.WHITE, 0));
        this.name = name;
    }

    protected void paint(Graphics g) {
        g.setColor(Color.BLUE);
        g.setFont(Font.getDefault().derive(Font.UNDERLINED));
        g.setBackgroundColor(Color.WHITE);
        g.drawText(name, 0, 0);
    }

    protected void drawFocus(Graphics g, boolean on) {
        g.clear();
        g.setColor(Color.GREEN);
        g.setFont(Font.getDefault().derive(Font.UNDERLINED));
        g.setBackgroundColor(Color.WHITE);
        g.drawText(name, 0, 0);
    }

}

What you see is the image VISUAL_STATE_ACTIVE in the ButtonField.  I don't know exactly how to avoid this with ButtonField. Since you are using the package set, anyway, take a look at these setBorder and setBackground with additional visual state parameter and specify those separately for VISUAL_STATE_NORMAL, VISUAL_STATE_ACTIVE and VISUAL_STATE_FOCUS.  You can also analyze those paint and set the colors accordingly, although it wouldn't be enough.

I can honestly say that I never extended ButtonField. However, when you want a predictable behavior, ButtonField is one of the worst: he does a lot of good things for you, but there are so many things happening behind the scenes that you will be better off extending field, implementing your own layout and painting/paintBackground, as well as navigationClick/navigationUnclick and keyDown/keyUp (verification of entry and perhaps space). You must also call fieldChangeNotify (FieldChangeListener.PROGRAMMATIC) in all the appropriate places (probably uncheck and keyUp). Decide if you want a specific to the context menu. If so, substitute makeContextMenu.

The reward will be your own hyperlink customized with behavior controlled by you, that you will be able to use in several projects.

Tags: BlackBerry Developers

Similar Questions

  • HP EliteBook 8560p: can not turn on WiFi: the button is orange, and nothing happens when you press

    Hello

    I have a problem with my wifi. The button always orange and nothing happens when I press on it: no errors, no message, no reaction at all. This is why I can't use WiFi.

    The laptop is a little new: I use only 2 months.

    1. number and product name

    HP EliteBook 8560p
    НР LQ589AW

    2 operating system installed (if applicable)

    Windows 7 Professional 64 bit

    3. error message (if any)

    No error message

    4. all changes made to your system until the problem occurred

    My windows crashed and I got it from archive created a few days ago. Archive includes all data from hard drives, the system has been restored exactly as it was before the accident. I still don't know if this caused the problem (or if the problem occurred after that): it happened a month ago, and I had no WiFi available at the time and only tried to turn it on a few days ago.

    Additional details:

    In device manager wireless card is appearing as functioning normally. In the management of the adapter Wi - Fi is on but says "no connection available. If I run diagnostic tests, he asks me to activate WIFI with a button on my laptop, which I can't do. In Mobility Center, it says "connection Wi - Fi is turned off". Activate the button is gray and impossible to click on.

    I already tried things:

    1. Reinstalled all the HP drivers from original CD.
    2. Card WiFi removed in the windows Device Manager (remove device), restarted windows, installed new drivers for it, rebooted again;
    3. Checked the mobility Center as suggested in one of the threads available on this forum;
    4. Do a hard reset for HP laptop (battery removed, push the button and hold for a minute).

    Thanks for any help!

    Anatoliy.

    I managed to solve the problem...

    Turns out that the problem was (apparently) caused by HP Power Assistant tool shipped with my laptop. Default profile has been showing the gray bluetooth and WiFi, and it was not possible to turn them on. I created a new profile, and even if all the parameters are identical to the default profile, it allows me to turn the BT and WiFi and turn off without any problems. Button is working fine now as well and goes from blue to orange when I press it. Active WiFi and it works.

    I hope this helps.

  • Trying to open the message box appears 'lightroom has encountered an error when reading the preview cache and needs to stop smoking' Lightroom "Lightroom will try to solve this problem, the next time that it launches" OK when you press closed Lightroom an

    Trying to open 5 Lightroom, a message appears 'Lightroom has encountered an error when reading the preview cache and needs to quit' "Lightroom will attempt to solve this problem, the next time he throws" when OK key Lightroom quit unexpectedly and the computer returns to the office.  This persisted for 2 days and it has not set itself.  help please.

    Click OK close Lightroom.

    You must manually go to the location of your Lightroom by Finder catalogue / file Explorer and get rid of the Previews.lrdata folder

    By default, the location would be in Pictures\Lightroom folder

  • Why Satellite Pro A300 does not start when you press the power button?

    Suddenly my new Satellite Pro A300 does not start correctly when you press the power button. The situation is the following: when I press the power button is displayed the opening of Toshiba (Leading Innovation) and the disappers image quickly. Then there is a black screen for about 30 seconds. There is a rectangular frame with the text Microsoft Corporation under. And nothing happens however long wait.

    In order to get with the trial starting I then shut down the computer by pressing the power button until the computer turns off. ("The hard way to close")
    Now, I press the power button shortly to turn on the computer. Then, the computer starts normally with the photo to open Toshiba and after a few seconds, I wonder to open the computer in safe mode or in normal mode. I now choose to open in normal mode and the computer opens normally and is ready to work.

    What should I do to get a normal departure procedure?

    When the laptop starts normally (after choosing normal mode) stop your laptop properly using START > shut down option. Next launch should be normal.

    When the OS is moving towards the low irregularly will always ask you how to start this new (secure or normal mode).
    The same thing happen on my Satellite A300.

  • Change the State of the button when you press another button

    Hi all

    I have a simple enough question, but just does not know how I can do this... I'm trying to switch between the two types of waveforms (sine and square) on a graph using buttons and a box structure.

    I currently have two buttons A and B. When I press A, it turns into real and displays the waveform 1. When I press B, B turns into real and displays the waveform 2. However, when B is true, I still have a permit as true (hurry)

    I can't figure out how to change the status of a return to false when you press B and vice versa.

    I am fairly new to Labview so if anyone can refer to a position where it is already the answer or point to the right direction, that would be appreciated

    Thank you

    Rather than clutter up the code with the event hidden cases (!), controls (!), value properties (!) and variable (!) local (as suggested above but not recommended at all!) In addition, it does not even work correctly!), all you need is a control radiobutton that allows also to "no selection". See attached (LabVIEW 2013). You could also add a third Boolean value for the sine wave and not dismiss "no selection" to make the code even more if auto-documentent.

    I made the transparent container radiobutton to match your existing style.

  • Alienware 15 'K' key crashes when you press any of the line

    Howdy,

    I have a little problem with my new laptop Alienware 15. Two weeks after getting it, I noticed that the key K tends to get stuck when you press any of the line. Basically, it remains in the pressed position and not coming back to the top unless I force it by inserting something like a needle under it.

    In the limited time, I used the laptop I have not stressed that special touch at all (just looked on the key combinations of the games that I've played so far and the K key was not used).

    Advice on what to do? I was thinking to get one of these cans of compressed air and blow air under the key and see if that solves nothing. A little scared to take a screwdriver and remove since who knows what I'm going to spoil. I would not have to send the laptop back just because one key is stuck and I hope it doesn't come to that.

    Thanks for any help.

    compressed air is a good choice, you can use a clean brush also (in my case I use both to clean my knees)

  • all my emails are coming in the form of html documents

    all my emails are coming in the form of html documents

    Check under Tools | Options | Read and see if it is configured to read messages in plain text only.

    Steve

  • ALL my downloads come in the form of HTML files. What have I done?

    Whenever I have download any file, it opens on my computor in the form of HTML files and I can't change it to the TEXT.  What can I do to change this setting?

    What browser you use, and how you download to use? Do you have any download managers installed on your PC?

  • I can't use the link 'Check the seats' on Delta when I use Firefox, but Safari works fine. I get the message "not available at this time" when you use Firefox, but when I go on Safari it works just fine.

    I can't use the link 'Check the seats' on the website of Delta Airlines when I use Firefox, but Safari works fine. I get the message "not available at this time" when you use Firefox, but when I go on Safari it works just fine. I love Firefox but it sucks!

    This problem may be caused by corrupted cookies.

    Clear the cache and cookies from sites that cause problems.

    "Clear the Cache":

    • Firefox > Preferences > advanced > network > storage (Cache) offline: 'clear now '.

    'Delete Cookies' sites causing problems:

    • Firefox > Preferences > privacy > Cookies: "show the Cookies".
  • In the latest Version of FireFox 9 Page Starup of Mozilla Firefox, pls which is the default home page no longer works, when you click it says invalid link, look at this and fix it...

    In the latest Version of FireFox 9 Page Starup of Mozilla Firefox, pls which is the default home page no longer works, when you click it says invalid link, look at this and fix it...

    Can be caused by a corrupt installation of Visual C++ (several versions can be installed-by-side; SxS) it lacks certain runtime components (Redistributable Package).

    See:

  • Printer Hp6700: unable to connect to the router wireless D - Link DI-514 when SSID Broadcast is set to no.

    HP6700 printer: unable to connect to the router wireless D - Link DI-514 when the router Broadcast SSID is set to no. My MAC laptop and HP laptop both work with the set SSID on no. If I change the router Wireless SSID Broadcast is YES, then the printer HP6700 can connect to the wireless router. I set up the printer it saying that the SSID and password have been, the same as both of my laptops, but it connects ever, unless I have change the router to broadcast the SSID. Help!

    Have you tried to update the firmware on the DI-514?

    You can also try to set a static IP address on the printer, and then assign the printer to the list of DHCP static in the interface of the router.
    To give a static IP address to your printer:
    -Print a the front of the printer Network Setup Page. Note the IP address of the printer.
    -Enter the IP address in a browser to reveal the internal settings of the printer.
    -Choose the network tab, then wireless along the left side, then on the IPv4 tab.
    -On this screen, you want to set a manual IP address. You must assign an IP address outside the range that the router sets automatically (called the DHCP range). If you do not know the range, change the last set of numbers (those after the last '.') 250
    -Apply the subnet 255.255.255.0 (unless you know it's different, if so, use it)
    -Enter the IP of your router (on the Page of the Network Config) for the gateway.
    -Enter for the first DNS 8.8.8.8 and 8.8.4.4 for second DNS. It's Google DNS. You can choose a different external DNS if you wish.
    -Click 'apply '.
    Now, stop the router and printer, start the router, wait, and then start printing.

    After that you remove and re - add the printer to your Mac.

    Show support by clicking on the blue Kudos star in the post that solved your problem. Doing so will help the other members of the forum their solutions also.

  • I recently created a form to complete for the app e-business of the company. When you press the button submit, he only sent to our Inbox to project and not sent to the e-mail provided in the URL. Can someone help us to program the key to help explain why.

    I recently created a form to complete for the app e-business of the company. When you press the button submit, he only sent to our Inbox to project and not sent to the e-mail provided in the URL. Can someone help us to program the key to help explain why / tell us step by step what we should do?

    OK, I re-read your question. It's actually expected behavior. The user must manually send the email.

    If you want it to be a silent process, then you must either install a script on the local computer of the user who will do this, or use any email but something as a service web to which you directly submit the form data.

  • Why information from individual PDF files that were created by using the form to fill out is changing when I try to combine the files?

    I have several pdf documents created using a form to fill out.  When I try to create a combined PDF information either is removed from all pages after the first page or all the pages after the fact look page 1 as duplicate page 1.  what I am doing wrong?

    The problem is that these files have fields with the same name in them, thus

    When you merge them they become copies of each other and of all their

    the values are the same.

    To avoid it you must either rename the fields before you merge the files

    or flatten, converting them to static content.

    The game, March 24, 2016 at 22:00, peggyp13342216, [email protected]>

  • A font I need is not available in italics. Corel Paint Shop Pro produces the police in italics when you press the Italic button in the software, but I don't see any way to do this in Illustrator. Help, please.

    A font I need is not available in italics. Corel Paint Shop Pro produces the police in italics when you press the Italic button in the software, but I don't see any way to do this in Illustrator. Help, please.

    Select the text and use the Warp tool to give a fake italic.

  • drop off the list when you press the button

    Hello

    I use Apex4.2

    How can I view drop-down list when you press the button?


    environment or is it a solution to create the same interface as the apex dev

    Thank you

    Probably a lot of ways to do this, but I would just give the combo a hidden CSS class.

    Put this in your page inline CSS:

    . Hidden {}

    visibility: hidden;

    }

    and then on your issue in the HTML drop-down list box form element classes simply add this: hidden

    Then, create a dynamic action on click of a button using JavaScript to remove this class:

    $("#P10_YOUR_ITEM").removeClass ("hidden");

    See this example: http://apex.oracle.com/pls/apex/f?p=32581:2

    username: guest

    PW: app_1000

    Click the Show Drop Down List button and the menu drop-down element is displayed.

Maybe you are looking for

  • Can I start Satellite M70 from USB

    Is it possible to boot a USB key PSM70e?

  • SSD drive in dv7 - 1273cl

    I inherited this laptop with a defective cooling and no hard drive fan. I would use an SSD instead of a normal HARD drive, with Windows 7 Ultimate 64-bit edition. I think that SSDS are SATA, so should hook up OK, but the Assembly is different? Will t

  • Analysis of the bootsector in Security essentials?

    I have some problems with my system running as in 15 seconds to IE slow loading SLOW. I have other issues as well, leadign I think that having a virus is not see and try a boot sector scan before loadign XP. is there a way to make this happen?

  • E2000

    I have correctly configured my wireless connection. I am now trying to establish a wired connection to a PC via a switch. It worked on my old G 54 but does not connect with the E2000. What can I do to alleviate this problem?

  • How to register for an event when the device is connected to the PC in USB mode or sync

    I develop application on blackberry with phonegap. I want to hear event when the BlackBerry device is connected to the PC by USB MODE or sync.I saw mediagallery and applications Filemanager showing the dialogue that the application cannot be used whe