Allow focus after disabling JTextField

I have a form with several textfields. Two textfields are mutually exclusive; you can modify one or the other, but not both. Upon edit of one, I disable the other. This works perfectly. My problem is the tab order disappears upon disabling the textfield. If I edit fieldA, fieldB is appropriately disabled upon focusLost of fieldA. I can use the tab key multiple times, but focus is never set to another component on the form. How can I get around this?
Here's the sample code:
      fieldA.addFocusListener(
            new FocusAdapter()
               public void focusLost(FocusEvent focusEvent)
                     JTextField field = (JTextField)focusEvent.getSource();
                     // if the value was changed, disallow editing in trade field
                     String newValue = field.getText();
                     if (!newValue.equalsIgnoreCase(original))
                        fieldB.setEnabled(false);
                     // need else block in case the user changes the value, then changes it back to the original value
                     else
                        fieldB.setEnabled(true);
         );

public void focusLost(FocusEvent e)
     if (textField2 == e.getOppositeComponent())
          textField2.transferFocus();
     textField2.setEnabled( false );
}

Similar Messages

  • JFileChooser in Applet keeps focus after selection of a directory

    I have spent several days on the following issue, but haven't found any solution so far...
    When I open a JFileChooser out of an Applet and select a Directory, the FileChooser closes as expected, but a text field located on the main applet pane cannot be selected any more (the mouse pointer goes to "text cursor" style when hovering over it, but the text field does not get the focus when clicked). Strangely, the other button on the same pane still reacts to mouse clicks. This happens only when I select a directory, but not when I choose a file. Also, it does not happen, when I click "Cancel" instead of "Open". Furthermore, the problem occurs only using the Firefox plugin, not in the AppletViewer. I even tried to remove the text field from the root pane and add a new one after the file chooser execution, but still it won't regain focus.
    Here's the stripped-down code:
    import java.awt.BorderLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JApplet;
    import javax.swing.JButton;
    import javax.swing.JFileChooser;
    import javax.swing.JPanel;
    import javax.swing.JTextField;
    public class TestApplet extends JApplet {
        private static final long serialVersionUID = 1L;
        @Override
        public void init() {
            final JPanel rootPanel = new JPanel();
            rootPanel.setLayout(new BorderLayout());
            getContentPane().add(rootPanel);
            final JButton fileChooserButton = new JButton("Start");
            fileChooserButton.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    JFileChooser fc = new JFileChooser();
                    fc.setAcceptAllFileFilterUsed(false);
                    fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
                    fc.setMultiSelectionEnabled(false);
                    fc.showOpenDialog(rootPanel);
            JTextField textField = new JTextField();
            rootPanel.add(fileChooserButton, BorderLayout.CENTER);
            rootPanel.add(textField, BorderLayout.SOUTH);
    }And this is the applet.html:
    <applet code="TestApplet.class" codebase="file://home/administrator/workspace/Test/bin" width=100 height=50></applet> This concerns: Ubuntu 9.04 / Firefox 3.6.9 / JVM 1.6.0_20
    Any help or ideas for a workaround would be much appreciated...

    AndrewThompson64 wrote:
    JWS was available as a separate download since Java 1.2. It became bundled with the JRE around 1.4.2, not sure of the micro-version, but it was in the 1.4 era. 1.4 has been relegated to the 'obsolete' pile now, so I think you are safe expecting the end user to be prepared to update to 1.5+ if needed.You don't know my grandma: she isn't prepared to anything, but she wants things to just work ;-)
    For ensuring the user has a minimum of 1.5, see the [Java&#153; Rich Internet Applications Deployment Advice|http://download.oracle.com/javase/6/docs/technotes/guides/jweb/deployment_advice.html] for details of the deployJava.js script. It is useful for both applets and apps. deployed using JWS.
    Yes, I already use this script for my Applet, but I hadn't realized that it worked for JWS as well.
    Do you mean like a corporate intranet?Exactly. Another example could be centrally managed laptops connecting over Internet to your application (like the traveling salesman connecting to his task planner)
    ... Can you do a search of the bug DB and if nothing shows up, submit one? The only chance these things will get fixed is if they are reported.I agree with you on that question and I've already had a look (didn't find anything so far)
    Embedded applets are a PITA. I wouldn't disagree, but again, if you want to bring a rich client to the masses, sometimes that's the way to do it (unless you go for ActiveX, which is definitely not an option for me). Anyway, I'll give JWS a try.. and then I'll ask the customer help desk if it was a good idea...
    For example, is there any programmatic way to determine if the embedded applet is not acting as expected? If so, monitor that and on detection, pop a dialog to the user explaining the situation and offering the free floating version from a button click.Well, I have to think a bit more about this. Probably I will just to check if the text field gets the focus after a mouse click, by adding some kind of test inside a MouseListener. If it doesn't get the focus, I would be quite sure that there's a problem... I'll look into this.
    On the other hand, to work around the whole problem, I have found some Open Source Directory Chooser (http://sourceforge.net/projects/jfolderchooser), which looks nice at a first glance, but I didn't have the time to go into it in more detail. I'll just quote you here:
    I cannot say if this will fix the problem. Or perhaps it will fix the problem in that browser/JRE combo., but break it in another. ;)Words full of truth :)

  • Does GPU acceleration in Illustrator CC still work after disabling 'GPU Preview' and enabling 'CPU Preview' (on a workstation gpu)?

    I'm using a workstation graphics card that allows for GPU acceleration in Illustrator CC.
    Selecting 'GPU Preview' instead of 'CPU Preview' under the 'View' toolbar in Illustrator CC results in a more choppy experience.
    Which leads me to wonder:
    Does GPU acceleration in Illustrator CC still work after disabling 'GPU Preview' and enabling 'CPU Preview' (on a workstation gpu)?
    Does GPU acceleration for my gpu actually improve the performance for my work?

    If you disable the GPU acceleration in preferences then you'll be unable to enable GPU preview under the view menu. It will automatically go into CPU preview as the GPU is no longer enabled.
    If you're experiencing choppy performance when you do have the GPU preview selected, something is amiss because any GPU that can support GPU acceleration should be able to do it without a performance hit.
    What is the video card that's in the workstation?

  • FF crashing immediately. FF updated, admin mode allowed, hardware acceleration disabled, add-ons disabled

    FF crashing immediately in regular mode-- ID: 132f75b1-9f3e-46b7-9b43-74e4b2121121. FF updated, admin mode allowed, hardware acceleration disabled, add-ons disabled.
    FF opens in Safe Mode, but otherwise crashes repeatedly upon opening. FF was working for up to half hour, but today (especially since FF v.17 update) crashes immediately. Along with repeated FF crashes, Win 7 crashes (less often) with a variety of notes on each crash.
    (email removed by mod)

    Thanks for your response, cor-el. I had already unchecked the "Use hardware acceleration when available," yesterday, before posting here.
    I had also selected ''Run as administrator,'' but I see that is now unchecked. A skilled friend tried to help overnight & may have unchecked it. She also appears to have "unchecked" the "Use hardware hardware acceleration when available," so I have, again, unchecked it.
    My friend wearily said I would be unable to open the browser this morning, but it worked fine for ~10 minutes... and then Windows crashed. Firefox is working fine in Win7 Safe-Mode & fortunately did not crash before Win7-itself in regular-mode.
    I'll try Win7 regular-mode, again. After working awhile, my browser froze (cursor wouldn't move). Signing back into Win7 regular-mode, FF quickly crashed twice.
    Last FF crash reports submitted:
    bp-af22bc09-7b64-41fe-ace1-f920f2121122 11/22/2012 2:04pm bp-0d817514-c14c-43f2-baf0-7f23a2121122 11/22/2012 2:02pm bp-4899223a-d95b-4d9c-b30c-7ba112121122 11/22/2012 2:02pm d3b3c038-6c31-426a-9bdb-761b85041433 11/22/2012 1:40pm 4324916f-1b5d-4a20-aaf2-d84f02121122 11/22/2012 1:39 PM

  • Problem while adding both Key And Focus Listeners to JTextField

    Hi!
    I have something peculiar while adding Key and Focus Listener to JTextField. Suppose i add just Key Listener then everything's fine and i could keep track of keys being pressed. But as soon as i add a Focus Listener to it with the code to select full text in focusGained() method, it starts reponding wrongly to arrow keys pressed and does not perform desired actions. For let arrow key it moves caret by one for the first time after that it does not resond to that unless caret is changed by using mouse. If right arrow key is pressed the it moves the caret to last position from wherever it is. For UP and DOWN it selects the full text(This should be done when it gets focus)
    public void focusGained(FocusEvent fe)
    setCaretPosition(0);
    moveCaretPosition(getDocument().getLength());
    Can someone help me out on this?
    thanks and regards,
    Amit.

    None of those things will cause your JFrame to resize itself. And this is probably a good thing, because your JFrame shouldn't change size once you have created it. Why not create your JPanel so that it has enough space for you to add the component later? Or why not just add the component to start with and then enable it or make it editable when you decide that's necessary?

  • Simple Program Help - Start allowing focus requirement

    Hello,
    how do I Start allowing focus requirement: (eg: constructor). I am not sure what you mean by this.
    I did what was recommended to complete this as follows:
    public void start () {
         hoursInput.requestFocus();}     
    public void init ()     {
    hoursInput = new JTextField ( 4 );
         hoursInput.setRequestFocusEnabled(true);
         c.add (hoursInput );
    I'm not sure where I can put this at though in my program:
    add FocusListener (
    new FocusAdapter()
    Any suggestions?

    Here is all of my code. I basically want to allow the insertion point to be placed in the jtextfield hoursInput. I have tried to code it, b ut I need to someone to take a look if possible at what i am doing wrong.
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    import java.text.*;
    import java.util.Locale;
    public class calculatedCharges extends JApplet implements ActionListener {
         JTextField hoursInput, RunnTotal, CustCharge;
         JLabel hoursPrompt, RunnTotalL, CustChargeL;
         double fee = 0, total;
         String Fees, RunnTotals;
    public void init ()     {
         Container c = getContentPane ();
         c.setLayout ( new FlowLayout () );
         hoursPrompt = new JLabel ( "Enter number of hours:" );
         c.add (hoursPrompt);
         hoursInput = new JTextField ( 4 );
         addFocusListener (
         new FocusAdapter() {
         hoursInput.setRequestFocusEnabled(true);
         c.add (hoursInput );
         CustChargeL = new JLabel ("Current Charge: " );
         c.add ( CustChargeL );
         CustCharge = new JTextField ( 4 );
         CustCharge.setEditable ( false );
         c.add ( CustCharge );
         RunnTotalL = new JLabel ("Running Total: " );
         c.add ( RunnTotalL );
         RunnTotal = new JTextField ( 8 );
         RunnTotal.setEditable ( false );
         c.add ( RunnTotal );
         hoursInput.addActionListener ( this );
    public void start () {
    hoursInput.requestFocus();          }     
    public void actionPerformed ( ActionEvent e ) {
    NumberFormat moneyFormat = NumberFormat.getCurrencyInstance ( Locale.US );
         double hours = Double.parseDouble ( e.getActionCommand () );
              fee = calculateCharges ( hours );
              String Fee = moneyFormat.format ( fee );
              CustCharge.setText ( Fee );
              showStatus ( "Processing Complete" );
         public double calculateCharges ( double hours ) {
              double charge = 0.0;
    NumberFormat moneyFormat = NumberFormat.getCurrencyInstance ( Locale.US );
         if ( hours <= 3.0 && hours > 0.0 )
              charge = 2.0;     
         else if ( hours > 3.0 && hours <= 19.0 )
              charge = 2.0 + 0.50 * Math.ceil ( hours - 3.0 );
         else if ( hours > 19.0 )
              charge = 10.0;     
         total = total + charge;
         String RunnTotals = moneyFormat.format ( total );
         RunnTotal.setText ( RunnTotals );
         return charge;
         }

  • Change the background color of a disabled JtextField

    Hi,
    How can I change the background of a disabled JTextField ? When a JTExtField is disabled it becomes grey but I would like to change to another color. you can change the background of a disabled combobox (UIManager.put("ComboBox.disabledBackground, new Color(...)) but you cannot do it for a JTextField.
    Any help ? Thanks !

    Hi My Friend
    I dont know whether this is the one you want ...
    change( )
    Container Cp;
    Cp = getContentPane();
    Cp.setLayout(new BorderLayout());
    Cp.add(jb,BorderLayout.NORTH);
    jb.addActionListener(this);
    Cp.add(jtxt,BorderLayout.CENTER);
    jtxt.addPropertyChangeListener(this);
    setVisible(true);
    setSize(new Dimension(200,200));
    public void actionPerformed( ActionEvent e)
    if( jtxt.isEnabled() == false )
         jtxt.setEnabled(true);
    else
         jtxt.setEnabled(false);
    public void propertyChange( PropertyChangeEvent e)
    if( jtxt.isEnabled() == false )
         jtxt.setBackground(Color.red);
    else
    jtxt.setBackground(Color.white);

  • Issues After Disabling IPv6 on Your NIC on SBS 2008

    If you uncheck the IPv6 protocol from your network interface card on your Windows SBS 2008 server you may see the following issues after a reboot:
    Microsoft Exchange services fail to start
    Server hangs at “Applying Computer Settings…” (can eventually logon after 30 – 60 minutes)
    Network icons show as offline
    Some or all of the following events
    Application Log Events
    Source: MSExchange ADAccess
    Event ID: 2114
    Task Category: Topology
    Level: Error
    Description:
    Process MAD.EXE (PID=2088). Topology discovery failed, error 0x80040a02 (DSC_E_NO_SUITABLE_CDC). Look up the Lightweight Directory Access Protocol (LDAP) error code specified in the event description. To do this, use Microsoft Knowledge Base article 218185,
    “Microsoft LDAP Error Codes.” Use the information in that article to learn more about the cause and resolution to this error. Use the Ping or PathPing command-line tools to test network connectivity to local domain controllers.
    Source: MSExchange ADAccess
    Event ID: 2601
    Task Category: General
    Level: Warning
    Description:
    Process MSEXCHANGEADTOPOLOGY (PID=952). When initializing a remote procedure call (RPC) to the Microsoft Exchange Active Directory Topology service, Exchange could not retrieve the SID for account <WKGUID=DC1301662F547445B9C490A52961F8FC,CN=Microsoft Exchange,CN=Services,CN=Configuration,…>
    – Error code=80040a01.
    The Microsoft Exchange Active Directory Topology service will continue starting with limited permissions.
    Source: MSExchange ADAccess
    Event ID: 2102
    Task Category: Topology
    Level: Error
    Description:
    Process MAD.EXE (PID=2088). All Domain Controller Servers in use are not responding: SBS.sbs2008.local
    Source: MSExchange ADAccess
    Event ID: 2105
    Task Category: Topology
    Level: Warning
    Description:
    Process MAD.EXE (PID=2088). Exchange Active Directory Provider failed to obtain DNS records for domain sbs2008.local. DNS Priority and Weight for the Domain Controllers in this domain will be set to the default values 0 (priority) and 100 (weight).
    Source: MSExchange ADAccess
    Event ID: 2114
    Task Category: Topology
    Level: Error
    Description:
    Process MSEXCHANGEADTOPOLOGYSERVICE.EXE (PID=952). Topology discovery failed, error 0x80040a02 (DSC_E_NO_SUITABLE_CDC). Look up the Lightweight Directory Access Protocol (LDAP) error code specified in the event description. To do this, use Microsoft Knowledge
    Base article 218185, “Microsoft LDAP Error Codes.” Use the information in that article to learn more about the cause and resolution to this error. Use the Ping or PathPing command-line tools to test network connectivity to local domain controllers.
    Source: MSExchangeFBPublish
    Event ID: 8197
    Task Category: General
    Level: Error
    Description:
    Error initializing session for virtual machine SBS. The error number is 0x80040a01. Make sure Microsoft Exchange Store is running. Also, make sure that there is a valid public folder database on the Exchange server.
    Source: MSExchangeTransportLogSearch
    Event ID: 7005
    Task Category: General
    Level: Error
    Description:
    Microsoft Exchange couldn’t read the configuration from the Active Directory directory service because of error: Failed to load config due to exception: Microsoft.Exchange.Data.Directory.NoSuitableServerFoundException: The Exchange Topology service on server
    localhost did not return a suitable domain controller.
    System Log Events
    Source: Service Control Manager
    Event ID: 7044
    Task Category: None
    Level: Warning
    Description:
    The following service is taking more than 16 minutes to start and may have stopped responding: Microsoft Exchange System Attendant
    Source: Service Control Manager
    Event ID: 7022
    Task Category: None
    Level: Error
    Description:
    The Microsoft Exchange Transport service hung on starting.
    Source: Service Control Manager
    Event ID: 7024
    Task Category: None
    Level: Error
    Description:
    The Microsoft Exchange Information Store service terminated with service-specific error 0 (0×0).

    Hi,
    Based on your description, it seems to be the same as the following blog.
    Issues
    After Disabling IPv6 on Your NIC on SBS 2008
    Did you mean that encounter the same issue? If so, there is a resolution in that blog, please check if can
    help you solve the issue.
    If any other issue exists or any update, please don’t hesitate to let me know and provide more details. It
    will help me understand clearly.
    Best regards,
    Justin Gu

  • Dynamic Action on "Get Focus" After Closing a Popup Window

    Hi,
    From one of APEX Application Pages I am calling a Popup Window where users can create a new record. In the Popup Window once the record is created and window is closed, I want to refresh the region on the main page to show the record created in the popup window.
    How do I create a dynamic action which will fire when the main APEX window gets the focus (after the popup window is closed). ?
    Any pointers will be greatly appreciated.
    Thanks & Regards,
    Ashish Agarwal
    http://www.asagarwal.com

    Assuming that you have a dynamic action in the parent page which refreshes the region
    <li> Make a note of the event which triggers your dynamic action, lets call this event A.
    <li> Create a JS function in parent page which triggers event A when called.
    For example if your Dynamic Action trigger is a button(id ="P100_REFRESH") press event
    Your JS function could be
    function Trigger_refreshRegion()
      $('#P100_REFRESH').click();
    The way in which you simulate the Dynamic action deoends on the firing event that you have used, so modify it appropriately.
    <li>Now in the pop up page, if you are closing the page in JS using smthing like window.close() or so,
    just call the parent page's refresh JS function there using the
      opener.Trigger_refreshRegion(); //whatever was the name of the function that you created.

  • AMD GPU fan runs constantly even after disabling DGPU

    I have a HP-Pavilion dv6 6121TX, with AMD 6770m gpu.
    The fan of the gpu runs constantly even after disabling it using the following command
    echo OFF > /sys/kernel/debug/vgaswitcheroo/switch
    the output for "cat /sys/kernel/debug/vgaswitcheroo/switch" is as follows
    0:DIS: :Off:0000:01:00.0
    1:IGD:+:Pwr:0000:00:02.0
    It shows that the DGPU is off and yet the fan for the same runs continuously at full speed.
    Would be really grateful for any suggestions.
    Thank you.

    You might also try a different battery if you have access to one. Unfortunately, many of the replacement batteries being shipped by Apple are defective. They don't fit properly into the battery bay. I suspect that if the quality control is this poor, then it seems likely that other problems will arrise as well. Check carefully that the battery itself is not overheating. Another possibility which also happened to me is that after installing the last upgrade to the operating system, one or more of the third party widgets became problematic, causing the same problem you describe. After removing all third party widgets, the problem stopped. Good Luck

  • CONTAINS clause still works after disabling fulltext index on a table

    I disabled the fulltext index on a table using the below query:
    USE <dbname>;
    GO
    ALTER FULLTEXT INDEX ON <table_name> DISABLE
    Per BOL, "The table will not support full-text queries while the index is disabled.", I would expect the CONTAINS clause to stop working but I can still return rows from the <table_name> as before.
    SELECT top 10 * 
      FROM [dbo].[table_name]
      WHERE CONTAINS(<column>, N'test');
    The above returns 10 rows before and after disabling the index.
    Do i need to do something else?
    I even tried DENY permissions:
    DENY CONTROL, TAKE OWNERSHIP, ALTER, REFERENCES, VIEW DEFINITION ON FULLTEXT CATALOG::<catalog_name>
    TO <some_database_roles including public>
    Please help.
    Thanks
    Thanks

    Charles,
    Do you have any DDL Triggers on your server that might affect whether the full text index could be disabled?
    Any Policies that might likewise affect your results?
    RLF

  • Smpatch analyze gives different result after disabling Sun Connection Host

    Hi all,
    after disabling the Sun Connection Hosted functionality due to the EOL announcement I get a smaller number of patches from 'smpatch analyze' for a brand new jumpstarted server (227 patches before vs. 106 patches after).
    Trying e.g. a individual analysis for 126651-01 (Synopsis: SunOS 5.10: tar patch) results in
    Error: One or more of the updates specified do not have entitlement permissions.
    BTW: I ran the analysis for patch 126651-01 before without any problem.
    The entitlement file
    /var/sadm/spool/cache/entitlement/https%3A%2F%2Fgetupdates1.sun.com%2F%2Fentitlement_client
    looks like
    ----START-ENTITLEMENT-TOKENS----
    Solaris10Security
    SolarisSecurityUpdates
    SolarisDataIntegrityUpdates
    SolarisHardwareUpdates
    SolarisUtilityUpdates
    Public
    -----END-ENTITLEMENT-TOKENS-----
    And we do have a service plan!
    Any ideas?
    Kind Regards
    Marco

    Hi Shen,
    thanks for your reply. I tried this procedure from your thread
    Try re-registering the patch server after running these commands:
    # cacaoadm stop
    # cacaoadm status
    # rm -r /var/sadm/spool/cache/*
    # /usr/lib/cc-ccr/bin/eraseCCRRepository
    # rm /var/scn/persistence/SCN*
    # cacaoadm start
    # /usr/sbin/sconadm register -a -r registrationprofile.properties
    But unfortunately the problem persists. The entitlement file looks the same as before. The registrationprofile.properties files looks like
    userName=<username>
    password=<pw>
    hostName=<hostname>
    subscriptionKey=<key>
    portalEnabled=false
    proxyHostName=
    proxyPort=
    proxyUserName=
    proxyPassword=
    We use a direct connection to sun's update server without a SunUC proxy. (I disabled the proxy, because I had some trouble with it in the past).
    'smpatch get' gives
    patchpro.backout.directory - ""
    patchpro.baseline.directory - /var/sadm/spool
    patchpro.download.directory - /var/sadm/spool
    patchpro.install.types - rebootafter:reconfigafter:standard
    patchpro.patch.source - https://getupdates1.sun.com/
    patchpro.patchset - current
    patchpro.proxy.host - ""
    patchpro.proxy.passwd **** ****
    patchpro.proxy.port - 8080
    patchpro.proxy.user - ""

  • After disabling failover can't configure interfaces

    I had a pair of ASA 5510s in failover and needed to move one so I disabled failover. Now I can't configure any of the interfaces. When I put an IP on an interface and then show interface ip brief, it shows as unassigned.
    What else do I have to do after disabling failover to be able to configure the interfaces again?

    Hi,
    Are you not able to assign ip address on both the devices? If i am not wrong, you should be able to assign the ip address to the active one but not to the stand by one. There are two ways to assign ip address to the standby device. One is to reload the stand by so that it comes out of the stand by state.
    Second way is to configure the standby ip address on the interface. For ex on the interface configure:
    ip address 172.16.1.1 255.255.0.0 standby 172.16.1.2
    The stand by device will take the standby ip address.
    Rahul

  • Custom focus rectangle in JTextField

    I'm trying to change my theme/look & feel to show a focus rectangle for JTextField, somewhat like this: [http://www.macvswindows.com/index.php?title=GUI_Customization|http://www.macvswindows.com/index.php?title=GUI_Customization] (second image down, or direct [http://www.macvswindows.com/images/thumb/f/f2/osx_aqua_colors.png/500px-osx_aqua_colors.png|http://www.macvswindows.com/images/thumb/f/f2/osx_aqua_colors.png/500px-osx_aqua_colors.png] ) I don't want to make it exactly like MacOS, but a similar idea.
    For now I'm just trying to do it on the inner part of the field. I can get it to paint with the code below, but then the caret painting messes things up as I tab through the fields or move the caret around inside the fields.
    So it seems I'm headed down the wrong path, what should I be doing? Extending DefaultHighlighter or DefaultCaret, or something else?
    Thanks,
    Jim
    package testui;
    import javax.swing.*;
    import javax.swing.plaf.metal.DefaultMetalTheme;
    import javax.swing.plaf.metal.MetalLookAndFeel;
    public class ThemeTest extends JFrame {
        public class TestMetalTheme extends DefaultMetalTheme {
            public void addCustomEntriesToTable(UIDefaults table) {
                UIManager.put("TextFieldUI", "customui.CustomTextFieldUI");
            public String getName() {
                return "TestMetalTheme";
        public static void main(String[] args) {
            ThemeTest testFrame = new ThemeTest();
            testFrame.setVisible(true);
        public ThemeTest() {
            try {
                MetalLookAndFeel.setCurrentTheme(new TestMetalTheme());
                UIManager.setLookAndFeel(new MetalLookAndFeel());
            } catch (Exception e) {
                e.printStackTrace();
            setSize(500, 500);
            setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
            JPanel panel = new JPanel();
            add(panel);
            panel.add(new JTextField("test"));
            panel.add(new JTextField("test"));
            panel.add(new JTextField("test"));
            panel.add(new JButton("button"));
    package testui;
    import javax.swing.*;
    import javax.swing.plaf.ComponentUI;
    import javax.swing.plaf.metal.MetalTextFieldUI;
    import java.awt.*;
    public class CustomTextFieldUI extends MetalTextFieldUI {
        private Color focusColor = Color.cyan;
        private JComponent component;
        public CustomTextFieldUI(JComponent c) {
            if (c == null) {
                throw new IllegalArgumentException("component must be specified");
            this.component = c;
        public static ComponentUI createUI(JComponent c) {
            return new CustomTextFieldUI(c);
        protected void paintSafely(Graphics g) {
            super.paintSafely(g);
            if (component.hasFocus()) {
                Dimension size = component.getSize();
                Graphics2D g2d = (Graphics2D) g;
                System.out.println(g2d.getClip());
                System.out.println(g2d.getClipBounds());
                g2d.setColor(focusColor);
                g2d.setStroke(new BasicStroke(2f));
                g2d.drawRect(1, 1, size.width - 3, size.height - 3);
    }

    Why not just combine the two approaches?
    import java.awt.*;
    import java.awt.event.FocusEvent;
    import java.awt.event.FocusListener;
    import javax.swing.*;
    import javax.swing.border.BevelBorder;
    import javax.swing.border.Border;
    import javax.swing.plaf.ComponentUI;
    import javax.swing.plaf.metal.MetalTextFieldUI;
    public class CustomTextFieldUI extends MetalTextFieldUI {
         private Color focusColor = Color.cyan;
         private JComponent component;
         private Border normalBorder;
         private Border focusedBorder;
         private FocusListener focusListener;
         public CustomTextFieldUI( JComponent c ) {
              if ( c == null ) {
                   throw new IllegalArgumentException( "component must be specified" );
              this.component = c;
              focusListener =  new FocusListener() {
                   public void focusGained( FocusEvent fe ) {
                        if ( normalBorder == null ) {
                             normalBorder = component.getBorder();
                             focusedBorder = new BevelBorder( BevelBorder.LOWERED ) {
                                  @Override
                                  public Color getHighlightInnerColor() { return focusColor; }
                                  @Override
                                  public Color getHighlightOuterColor() { return focusColor; }
                                  @Override
                                  public Color getShadowInnerColor() { return focusColor; }
                                  @Override
                                  public Color getShadowOuterColor() { return focusColor; }
                        component.setBorder( focusedBorder );
                   public void focusLost( FocusEvent fe ) {
                        component.setBorder( normalBorder );
         public static ComponentUI createUI( JComponent c ) {
              return new CustomTextFieldUI ( c );
         @Override
         protected void installListeners() {
              super.installListeners();
              component.addFocusListener( focusListener );
         @Override
         protected void uninstallListeners() {
              super.uninstallListeners();
              component.removeFocusListener( focusListener );
    }

  • Error : FRM-41316: cannot set insert allowed property of disabled item

    Hi Forum,
    I have a requirement to making the following field non editable Ship Confirm Rule+ in Order Management-->"Release Sales Orders"-->"Shipping" tab
    I tried to achieve this using form personalization using the below condition and action
    Trigger Event - WHEN-NEW-ITEM-INSTANCE
    Trigger Object - RELEASE.DOC_NAME
    Condition - :RELEASE.PICKING_RULE is not NULL
    Processing Mode - Both
    Action Type - Property
    Object Type - Item
    Target Object - RELEASE.SHIPCONFIRM_RULE_NAME
    Property Name - ENABLED
    Value - FALSE
    I could see the field becomes non editable but when i navigate to "Release Sales Orders"-->"Shipping" tab and press tab button on the field "Trip" I am getting the below error
    FRM-41316: cannot set insert allowed property of disabled item RELEASE.SHIPCONFIRM_RULE_NAME
    Even i have tried with the following Property Names set to " FALSE " but still the field is able to editable
    ENTERABLE
    ENTERABLE(APPLICATIONS COVER)
    INSERT_ALLOWED
    INSERT_ALLOWED(ITEM-INSTANCE)
    UPDATE_ALLOWED
    UPDATE_ALLOWED(ITEM-INSTANCE)
    Please help me to resolve this issue.
    Thanks in advance
    Regards,
    CSK

    Hi Francoiq,
    Thanks, As you advised I will post this in E-Business Suite
    Regards,
    CSK

Maybe you are looking for

  • F110 - Pmt Method in Vendor Master not carried over

    Hi SAP Experts, Am relatively new to SAP-FI and would like to ask for your invaluable tips on my problem. Am using F110 where my payment method is "C" and all of my vendor open items don't have any payment method for each invoice. When I run F110, th

  • Premiere Pro CS4 CRASHING ON START UP

    When I start premiere pro it will begin loading and then open the window. In the window the screen is white with an hourglass loading symbol. If I click anywhere in the window Premiere stops responding.  I can't end the task in Windows Task manger, o

  • MS SQL Server License has expired

    Hi Guys,                  We have installed CRM 5.0 Development and Production servers and these server were working  fine for few months. Suddenly Our MS SQL database server evaluation period has got expired already . Can anyone suggest me to how to

  • Pop Us Mesage for Customer Texts

    Hi all, The requirement is as below, Customer wise want to maintain special instructions, to be flown sales order as a pop up message & at header text in S.O Then while creating delivery & billing the same pop up message should appear. For ex- the in

  • F.81 picking documents without Reversal Reason

    Hello gurus, We are posting the provisional entries using a BAPI and then for reversal we use the T-Code --> F.81. When we are executing F.81, a list of documents are getting picked for reversal, which were posted using the BAPI. Please note that the