The user interface of a JComboBox extended definition

Hello

I have an AutoCompleteComboBox which works very well. Now for the only reason of
change the background color of the popup, I put the UI from the drop-down list - but then the car
completion no longer works, which means that insertString() method of the document
never takes place.
To see the desired automatic completion, compile and run the code and enter its name
un. Uncomment the in the constructor, and then try again.
An explanation or a workaround?
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.plaf.basic.*;
import javax.swing.plaf.metal.*;
import javax.swing.text.*;

class AutoCompleteCmbDemo extends JFrame {
  final String[] ITEMS= {"apple", "orange", "papaya"};

  public AutoCompleteCmbDemo() {
    setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    setLayout(null);
    setSize(170,200);
    AutoCompleteComboBox cmb = new AutoCompleteComboBox(ITEMS);
    cmb.setBounds(20,20,100,20);
    cmb.setSelectedIndex(-1);
/*
    cmb.setUI(new MetalComboBoxUI() {
      protected ComboPopup createPopup() {
     BasicComboPopup popup= (BasicComboPopup)super.createPopup();
     popup.getList().setBackground(new Color(240,250,250));
     return popup;
      }
    });
*/
    add(cmb);
    setVisible(true);
  }

  public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
      public void run() {
     new AutoCompleteCmbDemo();
      }
    });
  }


  class AutoCompleteComboBox extends JComboBox {
    public AutoCompleteComboBox(String[] items) {
      setEditable(true);
      setModel(new DefaultComboBoxModel(items));
      final JTextField tf= (JTextField)getEditor().getEditorComponent();
      tf.setDocument(new PlainDocument() {
     public void insertString(int offset, String str, AttributeSet a)
                              throws BadLocationException {
       System.out.println("Entering insertString()");
       if (str==null) return;
//     For the sake of the SSCCE the auto-completion code is a short fake one.
       if (offset>0) {
         super.insertString(offset, str, a);
         return;
       }
       String buf;
       if (str.equals("a"))
         buf= ITEMS[0];
       else if (str.equals("o"))
         buf= ITEMS[1];
       else if (str.equals("p"))
         buf= ITEMS[2];
       else {
         super.insertString(offset, str, a);
         return;
       }
       super.insertString(offset, buf, a);
     }
      }); // end document
    }
  }

}

the only reason to change the background color of the popup, I put the user interface of the combo

You can do with without changing the user interface. Something like:

Object comp = comboBox.getUI().getAccessibleChild(comboBox, 0);
BasicComboPopup basic = (BasicComboPopup)comp;
JList list = basic.getList();
list.setBackground(...);

Tags: Java

Similar Questions

  • Background image on the User Interface

    I'm trying to place a background behind my screen of the application image. So instead of the usual white, there would be a "background.png". I am following this thread with the blackberry API set

    http://supportforums.BlackBerry.com/T5/Java-development/drawing-bitmap-in-mainScreen-background/m-p/...

    So far, I tried to apply it within my own application, with the code to start as follows:

    final class UserInterfaceScreen extends MainScreen {
        HorizontalFieldManager _fieldManagerTop;
        VerticalFieldManager _fieldManagerMiddle;
        HorizontalFieldManager _fieldManagerBottom;
        BitmapField _bitmap;
        Bitmap _canadaImage, _ukImage, _usImage, _backgroundBitmap, _fieldBitmap;
        LabelField _label;
        BasicEditField _input;
        String _canadaCapital, _ukCapital, _usCapital, _capital;
        int displayed = 0;
    
        public UserInterfaceScreen() {
            super();
            LabelField title = new LabelField("User Interface Sample",
                    LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH);
            setTitle(title);
    
            HorizontalFieldManager _horizontalFieldManager = new HorizontalFieldManager(HorizontalFieldManager.USE_ALL_WIDTH | HorizontalFieldManager.USE_ALL_HEIGHT){
    
                //Override the paint method to draw the background image.
                public void paint(Graphics graphics)
                {
                    //Draw the background image and then call paint.
                    graphics.drawBitmap(0, 0, 640, 900, _backgroundBitmap, 0, 0); //240
                    super.paint(graphics);
                }            
    
            };
            _backgroundBitmap = Bitmap.getBitmapResource("background.png");
            _fieldManagerTop = new HorizontalFieldManager();
            _fieldManagerMiddle = new VerticalFieldManager();
            _fieldManagerBottom = new HorizontalFieldManager();
    
                add(_horizontalFieldManager);
                add(_fieldManagerTop);
                add(new SeparatorField());
                add(_fieldManagerMiddle);
                add(new SeparatorField());
                add(_fieldManagerBottom);
    

    Basically, I'm trying to combine the thread above with the user interface tutorial.

    http://supportforums.BlackBerry.com/T5/Java-development/user-interface/Ta-p/442781

    The question is when I run the code, I just get the background image, none of the other content is displayed in the foreground. I am this approach correctly?

    I'm not sure the solution you received one will work - it may well do, but the approach is different from what I do.  I based my image of background processing around comments in this article:

    http://supportforums.BlackBerry.com/T5/Java-development/MainScreen-explained/Ta-p/606644

    But if you look at what you said your screen, you will see why you don't see all your real fields.

    The first thing that you add to your screen is as follows:

    HorizontalFieldManager _horizontalFieldManager = HorizontalFieldManager(HorizontalFieldManager.USE_ALL_WIDTH | nouveau HorizontalFieldManager.USE_ALL_HEIGHT) {}

    You said this Manager to use the full height and width.  Then what place is left for any other Manager/field.

    You only add this option to provide abackground.  So actually, to do this, you must you add all your fields and managers in this HFM.  Otherwise that will expose after this one (which, as noted way they have no space to display in). I think you'll see something, if you replace this:

    Add (_horizontalFieldManager);
    Add (_fieldManagerTop);
    Add (new SeparatorField());
    Add (_fieldManagerMiddle);
    Add (new SeparatorField());
    Add (_fieldManagerBottom);

    with

    Add (_horizontalFieldManager);
    _horizontalFieldManager.Add (_fieldManagerTop);
    _horizontalFieldManager.Add (new SeparatorField());
    _horizontalFieldManager.Add (_fieldManagerMiddle);
    _horizontalFieldManager.Add (new SeparatorField());
    _horizontalFieldManager.Add (_fieldManagerBottom);

    But it probably won't be good, so you should follow the advice given in the previous Post or see the KB article.

  • Need help with this code to update the user interface example

    I'm triying to understand the differences between the three methods to manage UI interactions.
    I'm really confused with these three terms when triying them figure out in a real case.
    Basically, I know that I should use invokeLater, invokeAndWat, or getEventLock() to avoid
    This exception: java.lang.illegalStateException: engine access UI without holding the lock on the event

    The code below illustrates the function of the invokeAndWait method, but if I replace it with
    invokeLater or getEventLock() the program will work exactly the same way.
    Could you please change the code to show the differences between the three
    methods of updating the user interface?

    / public final class HelloWorldMainScreen extends form {}

    private LabelField labelField;
    public HelloWorldMainScreen() {}
    labelField = new LabelField ("Hello World");
    Add (labelField);
    Thread MainScreenUpdaterThread = new MainScreenUpdaterThread (this);
    thread. Start();
    }

    {} public void appendLabelText (String text)
    labelField.setText(labelField.getText()+"\n"+text);
    }

    }

    SerializableAttribute public class MainScreenUpdaterThread extends Thread {}
    HelloWorldMainScreen screen;

    public MainScreenUpdaterThread (screen HelloWorldMainScreen) {}
    this.mainScreen = screen;
    }

    public void run() {}
    for (int i = 0; i)< 10;="" i++)="">
    try {}
    Thread.Sleep (5000);
    } catch (InterruptedException ex) {};
    UiApplication.getUiApplication () .invokeAndWait (new Runnable() {}
    public void run() {}
    mainScreen.appendLabelText ("Update");
    }
    });

    }
    }
    }

    These three concepts are very confusing for a lot from people so all explanatory source code
    describing their functions will be highly useful for everyone, I think.

    Thanks in advance!

    With respect to the effect, there is no difference between methods.  The difference is the way in which the result is achieved.  So we can't change the code to show you the difference.

    As we are unable to demonstrate the difference, you have to do with an explanation.  To understand the explanation, you'll need to understand the thread of events, so if you have not already, please consider this:

    http://supportforums.BlackBerry.com/T5/Java-development/what-is-the-event-thread/Ta-p/446865

    If the three options are differentiated by the processing order:

    (a) invokeLater executes the update on the thread of events.  The transformation takes place at a later stage and the code which is in order after the invokeLater will actually run before the code within the invokeLater.

    (b) invokeAndWait also manages the update on the thread of events, which means that all other events that await on the thread of events will be run before this code.  But any code after the invokeAndWait will not be executed.

    (c) the synchronized option, like invokeAndWait, runs the update of the UI before moving on to the following code.  The difference is that the code to run on the event Thread is not executed before code in the synchronized block.

    If this is meaningless, so that probably does not matter too much.  in general, you should use invokeLater, except if you need to update the user interface occur in the order with your background processing.  If so, use invokeAndWait. It has synced are very few occasions where you must use the block, and it should be very small updates to the user interface and you should understand the implications this could have on the wire events.

  • How to intercept the sockettimeout exception message and display in the user interface of the view?

    Hi my jdev - 11.1.1.7 version

    I ask a socket connection in my AM and I want to catch the exception of the sockettimeout of t and display the error message in the user interface of the view layer.

    I use customException class that extends DCErrorHandlerImpl, but if we use try catch, then exceptions doesnot reach customclass.

    How to catch exceptions and return to view the layer if we use the operation binding. ?

    Because you call the operation via the link layer, which is perfectly fine, you do not get an exception at all. Exceptions thrown in methods called via the link layer are captured by the framework and transferred to the appellant in the operation binding.

    For that, you get the list of errors after the call returns and add them as messages of faces

    execute the method

    Method.Execute ();

    List errors = method.getErrors ();

    If (! errors.isEmpty ()) {}

    handle errors errors here is a list of exceptions!

    We only get the first

    E receive = errors.get (0);

    FacesMessage msg = new FacesMessage (FacesMessage.SEVERITY_ERROR, e.getMessage (), "");

    FacesContext.getCurrentInstance () .addMessage (null, msg);

    }

    no error return to normal work

    Timo

  • doubt Doc ID 1618305.1 how to install and configure the user interface for content with WebCenter content 11.1.1.8.0

    doubt Doc-ID 1618305.1 How to install and configure the user interface with WebCenter content 11.1.1.8.0 content

    The portal_domain field contains;

    AdminServer (admin) and Enterprise Manager, (port 7001)

    IBR_server1, (port 16250)

    UCM_server1, (port 16200)

    WC_Spaces1, (port 8888).

    On the same machine, I have another weblogic, admin and for the ITS.

    The case is that continued to develop for the upgrade to the new skin WebCenter content.

    That's my goal.

    Then I did some research and came to the following notes in support.

    1 - how to install and configure the UI content with WebCenter content 11.1.1.8.0 and 11.1.1.9.0 (Doc ID 1618305.1()

    https://support.Oracle.com/epmos/faces/DocContentDisplay?_afrLoop=290841671406625 & ID = 1618305.1 & _afrWindowMode = 0 & _adf. CTRL-State = c7eq7vwdt_216

    and

    2 - update of the 11.1.1.8.0 UI content after you apply the Patch of Bundle WebCenter content 3 (MLR 3) or higher (Doc ID 1617477.1()

    https://support.Oracle.com/epmos/faces/DocContentDisplay?_afrLoop=291485823387355 & ID = 1617477.1 & _afrWindowMode = 0 & _adf. CTRL-State = c7eq7vwdt_245

    The UCM_server1 has the following House / app / oracle / Middleware / Oracle_ECM1 /.

    And the list of patches;

    ===================================================================================================

    Installed products of higher level (1):

    Oracle WebCenter content management install 11.1.1.8.0

    There are 1 products in this House of Oracle.

    Installed products (40):

    Cloning of the 11g Application Server 11.1.1.8.0 component

    Enterprise Manager Application Server Integrator Plugin - Management Service Support11.1.1.7.0

    FMW Control Plugin for Oracle inbound refinery 11.1.1.8.0

    FMW Control Plugin for Oracle WebCenter Capture 11.1.1.8.0

    Component install SDK 11.1.0.9.0

    Oracle Application Server Configuration 11.1.1.7.0

    Part of Oracle 11.1.1.7.0 Bali

    Oracle 11.1.1.8.0 capture

    Common files Oracle WebCenter content management 11.1.1.8.0

    Oracle Content Server 11.1.1.8.0

    Content of Oracle 11.1.1.8.0 Server component

    Content access Content Server Oracle 11.1.1.8.0

    Access to the contents of the Oracle Content Server 11.1.1.8.0 files

    Oracle Content Server Core 11.1.1.8.0

    Oracle 11.1.1.8.0 server content distribution

    Oracle extended Windowing Toolkit 11.1.1.7.0

    Oracle Fusion Middleware Admin Config 11.1.1.6.0

    Oracle Help for Java 11.1.1.7.0

    Oracle Help for the Web - UIX 11.1.1.7.0

    Oracle Help for the Web Shared Library 11.1.1.7.0

    Oracle Help share library 11.1.1.7.0

    Ice browser Oracle 11.1.1.7.0

    Oracle IRM                                                           11.1.1.6.0

    Oracle extended JFC Windowing Toolkit 11.1.1.7.0

    One-time correction of Oracle 11.1.0.9.9 installer

    Oracle outside in technology 8.4.0.0.0

    Oracle Remote Client of Intradoc 11.1.1.8.0

    Component of Oracle 11.1.1.7.0 rules

    Oracle SOA 11.1.1.7.0 workflow

    Universal Oracle install 11.1.0.9.0

    Oracle Upgrade Wizard 11.1.1.8.0

    Oracle Upgrade Wizard 11.1.1.8.0

    Upgrade Oracle WebCenter content management 11.1.1.8.0 Assistant

    Oracle WebCenter Capture 11.1.1.8.0

    Oracle Webcenter content - rights 11.1.1.7.0 documentalist

    Oracle WebCenter content - Universal Content Manager 11.1.1.8.0

    Oracle WebCenter content management install 11.1.1.8.0

    Oracle WebCenter content 11.1.1.8.0 management product suite

    Oracle WebCenter content: Imaging 11.1.1.8.0

    OracleAS Documentation 11.1.1.8.0

    There are 40 products installed in this House of Oracle.

    Interim plates (2):

    Patch 18188143: applied the sea Mar 19 17:37:32 BRT 2014

    Patch ID: 17263162

    Created February 5, 2014, 12:56:41 pm

    Bugs fixed:

    15872313, 17184457, 17515691, 16633496, 14317920, 15991141, 16892410

    14071471, 17929776, 13414481, 16042293, 17018964, 17627211, 16768600

    16037162, 14521663, 17768056, 14738077, 16460053, 17567819, 17806416

    15905591, 16080297, 17569908, 17043756, 18139768, 17211093, 17805499

    16418434, 16828356, 16671687, 17039391, 16698130, 17943394, 17632731

    17560900, 14246603, 15941347, 16045712

    Location of patch in the inventory:

    / app/Oracle/middleware/Oracle_ECM1/Inventory/oneoffs/18188143

    Patch location in the storage area:

    /app/Oracle/middleware/Oracle_ECM1/.patch_storage/18188143_Feb_5_2014_12_56_41

    Patch 18088049: applied the sea Mar 19 17:35:58 BRT 2014

    Patch ID: 17182855

    Created February 16, 2014 20:35:48 hrs PST8PDT

    Bugs fixed:

    17919101, 17894065, 17884570, 17883868, 17883112, 17854549, 17835742

    17832305, 17819213, 17812338, 17789722, 17783376, 17778867, 17761746

    17740542, 17733871, 17698852, 17658821, 17642431, 17636186, 17622384

    17616664, 17616611, 17616489, 17613656, 17608703, 17589960, 17581458

    17574153, 17567413, 17565564, 17558210, 17558068, 17546505, 17545841

    17540480, 17528590, 17514070, 17511368, 17511271, 17511089, 17501678

    17500375, 17475733, 17449617, 17421368, 17417817, 17416821, 17416807

    17416771, 17416377, 17416343, 17402732, 17401071, 17401052, 17397875

    17393920, 17393892, 17369286, 17368525, 17368096, 17362858, 17362130

    17354877, 17353764, 17352746, 17335303, 17335290, 17330493, 17324707

    17323595, 17323038, 17317268, 17314494, 17313064, 17313052, 17313000

    17312990, 17312933, 17312863, 17312366, 17298386, 17295962, 17290804

    17285105, 17270986, 17261952, 17255019, 17219134, 17216119, 17206903

    17201035, 17200854, 17199763, 17187804, 17185539, 17171852, 17171818

    17164502, 17160600, 17153780, 17074852, 17050451, 17049175, 17026301

    17008220, 17007746, 17007534, 17006378, 16999307, 16999291, 16991380

    16980256, 16980207, 16980196, 16979042, 16961904, 16958142, 16954858

    16941623, 16936055, 16936048, 16936036, 16936020, 16936006, 16935987

    16935976, 16921682, 16908287, 16858148, 16815976, 16796213, 13931337

    17424037, 17006115, 17171834

    OPatch succeeded.

    ==============================================================================================

    And contains the following configurations in config.cfg

    ==============================================================================================

    SocketAddressHostSecurityFilter = 127.0.0.1 | 0:0:0:0:0:0:0:1 | 192.168.1. * | 10.62.1.79

    xPortalSecurityPropagate = true

    Web server = javaAppServer

    AllowUpdateForGenwww = 1

    SearchIndexerEngineName = OracleTextSearch

    IndexerDatabaseProviderName = SystemDatabase

    AdditionalEscapeChars = -: #.

    FileEncoding = UTF8

    MaxQueryRows = 2000

    DisableAuthorizationTokenCheck = true

    IntradocServerPort = 4444

    SchemaPublishInterval = 604800

    SSAllowDelayedProjectWrites = true

    IdcServerThreadQueryTimeout = 120

    DisableQueryTimeoutSupport = false

    MaxSearchConnections = 20

    #Cache

    UseSearchCache = false

    #

    #AdditionalEscapeChars = _: #, -: {-}, has: A, GOLD: GOLD, CAN: CAN, AND: AND at the END:

    # Accesing a content item on a mapped Web URL (WebUrlMap) fails with the error: "unable to retrieve the content. Security access denied» (Doc ID 1639028.1()

    MaxAccountsInSecurityClause = 300

    # end (Doc ID 1639028.1()

    #Search fails for external users in WCC after upgrade to 11.1.1.8.0 (Doc ID 1676468.1()

    DoCaseInsensitiveAcctSearch = false

    # end (Doc ID 1676468.1()

    #MigrationFormatForfApplicationGUID = dCollectionName:dCollectionGUID

    ==============================================================================================

    To my UCM_Server1 content WebCenter.

    As I already have a WebCenter content I have to follow the second part of the note

    How to install and configure the UI content with WebCenter content 11.1.1.8.0 and 11.1.1.9.0 (Doc ID 1618305.1).

    Install and configure content WebCenter ADF WebUI against WebCenter Content Server

    Step 1) install the MDS schema

    (Step 2), install the Weblogic Server

    11 GR 1 material step 3) DOWNLOAD and install Oracle Application Development Framework (11.1.1.6.0) in the new WebUI WLS Middleware House, found here

    Step 4) Download and apply Patch 16, 546 129.

    Step 5) Download and apply Patch 16, 546 157.

    Step 6) download and apply the Patch and then 19,469,801, 18,102,108 Patch

    Step 7) copy the wccadf files in the field of user interface

    Step 8) Oracle on demand services (MDS) metadata registry

    Step 9) Place the WebCenter content domain user interface model

    Step 10) run the Setup Wizard on the new home of Middleware WebUI to create the new domain

    Step 11) updated the Oracle ADF of shared libraries

    Step 12) start the domain WebUI administration server

    Step 13) Save target Managed Server with the MDS repository and create the metadata partition

    Step 14) start the server managed WebUI.

    Step 15) associate UI WebCenter content to Content Server.

    Step 16) reboot the WebUI ADF server managed.

    Step 17 access the WebUI

    Step 18) complete the Configuration of the workflow

    Step 19) apply the latest Patch Bundle content UI of WebCenter

    MY DOUBT IS:

    To read the steps that I understood, to 19, with success, in the end, I will have an another WebLogic with a domain name and its respective EM.

    I have two servers weblogic?

    portal_domain (explained above) and a new wccui_domain wls and domain.

    This fix it?

    Two WLS to keep WebCenter portal and content, and other elements.

    Because I'm not able to do with the WLS even where I UCM_server1 today?

    Thanks for all suggestions and criticism.

    To read the steps that I understood, to 19, with success, in the end, I will have an another WebLogic with a domain name and its respective EM.

    I have two servers weblogic?

    portal_domain (explained above) and a new wccui_domain wls and domain.

    This fix it?

    Two WLS to keep WebCenter portal and content, and other elements.

    Because I could not do with the WLS even where I UCM_server1 today?

    Yes, up to 11.1.1.9.0, you will need to install a new wls House (new wls server admin) and then configure WCC ui there. User interface and COE will not work in the same field. You can have the portal and content under the same House of wls and install a new one for the user interface.

    This is due to a problem with ADF and WCC libraries.

    With 12 c, this dependence is not there, and you can install / configure all 3 (Portal, content and adf ui) applications on the same domain.

  • Extension of the user interface - javascript does not come to the top


    Hello

    I'm on PLM6.1.1.5 and EP 3.11. I followed the implementation of measures to extend the user interface:

    Step 1. copy the files:

    Copy the Utilities\UIExtensions\config\Core\UIExtensionScripts directory and its contents in the \config\Core < PLM4P_Home > directory

    Copy the Directory of Utilities\UIExtensions\config\Extensions\UIExtensionScripts and its content in the directory of \config\Extensions < PLM4P_Home >

    Copy the following assemblies to the SharedLibs folder of the the Pack of extensibility in the \Web\scrm\bin < PLM4P_Home >, < PLM4P_Home > \Web\gsm\bin or < PLM4P_Home > \Web\npd\bin directories:

    • PLM4PExtensionUtils.dll
    • ScriptingUtils.dll
    • UserInterfaceExtensions.dll

    Step 2: Insert the following lines in CustomPluginExtensions.xml, in the FormatPlugins section

    < name of the Plugin = "UIExtensionGSM."
    FactoryURL = "class: Oracle." Agile.PlmProcess.UserInterfaceExtensions.Java
    scriptLoaderFormatPluginFactory, UserInterfaceExtensions$ NameValuePair: FormatPluginNames = GSMSpecJavaScriptPlugin & amp; ScriptFiles=config\\Core\\UIExtensionScripts\\static\\UIExtensionsCore.js,config\\Extensions\\UIExtensionScripts\\static\\GSM_Variables.js ".
    / >

    < Plugin
    name = "GSMSpecJavaScriptPlugin" FactoryURL = "class: Oracle." Agile.PlmProcess.UserInterfaceExtensions.GSMSpecJava
    scriptFormatPluginFactory, UserInterfaceExtensions$false"/ > ".

    Step 3: update the \config\Extensions\UIExtensionScripts\UIExtensionsConfig.xml file to enable the specific extension points.

    UIExtensionGSM default has been activated.

    4:go to step < PLM4P_HOME > \config\Extensions\UIExtensionScripts\Static, has used the sample for customization 2147.js.

    None of my javascript are applied to the page. I tried simple javascript like this:

    ($(window) .load)

    function() {}

    Alert ("hello world");

    }

    );

    in 2147.js, 1004.js, 1009.js. Nothing came

    All the steps that I missed

    Thank you

    Church

    You said that by default uiextensiongsm has been activated. But I have to manually turn on UseInEditMode and UseInReadMode. Please check this.

  • a reminder of the user interface will have a function with arguments?

    some ScriptUI quirks... I have a function (cut in this example) that I can call very well by itself of the extendScript window or if I set directly to the onClick callback, but when I try and call the function from a reminder and analyze arguments, the onClick is not working and the service runs once when the script runs first? what I am doing wrong?

    It works using the extend script window

    Nudge (23,77)


    function nudge (offset, distance) {}

    var L = app.project.activeItem.selectedLayers [0];

    L.startTime = (shift * distance);

    Alert ("Done")

    }

    This works when the button is clicked in the user interface


    myButton.onClick = function() {

    var L = app.project.activeItem.selectedLayers [0];

    L.startTime = (23 * 77);

    alert("done")

    }

    This also works when the button is clicked in the user interface


    myButton.onClick = boost


    function nudge() {

    var L = app.project.activeItem.selectedLayers [0];

    L.startTime = (23 * 77);

    alert("done")

    }

    but when I try and pass arguments (kind of functions) that does not


    myButton.onClick = nudge (23,77)


    function nudge (offset, distance) {}

    var L = app.project.activeItem.selectedLayers [0];

    L.startTime = (shift * distance);

    Alert ("Done")

    }

    OK, in the case where someone is interested... the solution with the permission of Mr. Lloyd Alvarez is to nest the function in another function call, why, I have no idea, but it works a treat...

    myButton.onClick = function() {nudge (23,77)}

    function nudge (offset, distance) {}

    var L = app.project.activeItem.selectedLayers [0];

    L.startTime = (shift * distance);

    Alert ("Done")

    }

  • Try to update the user interface with another thread

    Hello

    Start a class JavaFX from another application, and then I want to change the UI of it components. I tried to use Platform.runLater to do.

    But the GUI crashes at the start (does not display anything) for the first 5 seconds (sleep time) changes and shows.

    I want to display the GUI at first, and then after 5 seconds the GUI should be updated with the message, but with the code it hangs just first and screens below everything after 5 seconds.

    Here sampleGUI is a an application javafx with inside text fields.

    + / public class StartGame extends Application {+
    +@Override+
    + public void start (steps) riser Exception {+
    final sampleGUI gui = new sampeGUI();
    GUI. Start (training);

    + Platform.runLater (new Runnable() {+)
    +@Override+
    + public void run() {+
    + try {+
    System.out.println ("sleep now...");
    Thread.Sleep (5000);
    System.out.println ("sleep above!");
    gui.updateText ("new message");
    +} catch (InterruptedException ex) {+
    System.out.println ("exception" ex); +
    +}+
    +}+
    +});+
    +}+
    +}+
    Platform.runLater(new Runnable() {
      @Override
      public void run() {
       // ...
      }
    });
    

    causes the run method of the executable to run on the Thread of the FX Application. Since you put Thread.sleep (5000) inside the run method of your executable, sleep occurs on the Thread of the FX Application.

    The call to runLater (...) can be called from any thread, including the Thread of Application FX.

    So, if you are not in the FX Application thread, you want to:

    // any long-running task, for example
    System.out.println("Sleeping now");
    Thread.sleep(5000);
    System.out.println("Sleep over");
    Platform.runLater(new Runnable() {
      @Override
      public void run() {
        // update UI:
        gui.updateText("New Message");
      }
    });
    

    If you are on the thread of the Application of FX, which is the case in your Application.start (...) method, you must create a new thread to run your code of long duration. You can do this "manually", creating a Thread and a workable for it to run, but it is probably best to use the simultaneity of JavaFX API, which has many hooks useful for updating the user interface on the Thread of the FX Application.

    In this case, the code would look like this:

    public class StartGame extends Application {
      @Override
      public void start(Stage stage) throws Exception {
        final SampleGUI gui = new SampleGUI();
        gui.start();
        final Task waitingTask = new Task() {
          @Override
          public String call() throws Exception {
            System.out.println("Sleeping");
            Thread.sleep(5000);
            System.out.println("Sleep over!");
            return "New Message" ;
          }
        };
    
        waitingTask.setOnSucceeded(new EventHandler() {
          @Override
          public void handle(WorkerStateEvent event) {
            gui.updateMessage(waitingTask.getValue());
          }
        });
    
        ExecutorService executor = Executors.newSingleThreadExecutor();
        executor.submit(waitingTask);
      }
    }
    

    There are (probably of dozens of) other ways to use a task to do. See the API documentation [url http://docs.oracle.com/javafx/2/api/javafx/concurrent/Task.html] for the task for more information.

  • Offset of the user interface after update of El Capitan

    Hello. Since I upgraded my Macbook Pro late 2013 to El Capitan retina, I've known GAL of the user in function, mainly opening animation of safari and switching between desktop computers. These issues are only to make my user base, I created a test user and concluded that the test user was not the offset of the user interface. I have reinstalled the operating system, as well as talked to apple. Apple had me reset the Pram so that delete files, including:

    / Library/LaunchAgents

    ~/Library/LibraryAgents

    / Library/LaunchDaemons

    / Library/Caches

    ~/Library/caches

    and many other files like these.

    None of that helped, my UI lag is still there and fine. Also, I'm not sure if this is relevant; However, my recovery HD (available from start by pressing the alt/option key) is not an option. I'm not sure if the files I deleted with apple support caused it or reinstalling the operating system has done this. IM thinking delete files because I reinstalled the operating system using the HD recovery.

    Does anyone know how to fix the lag in the UI? I know other people have this problem, google search and this forum but no clear answer has not developed.

    Thank you

    Caulin Bloom

    Please launch the Console application in one of the following ways:

    ☞ Enter the first letters of his name in a Spotlight search. Select from the results (it should be at the top).

    ☞ In the Finder, select go utilities ▹ of menu bar or press the combination of keys shift-command-U. The application is in the folder that opens.

    ☞ Open LaunchPad and start typing the name.

    The title of the Console window should be all Messages. If it isn't, select

    SYSTEM LOG QUERIES ▹ all Messages

    in the list of logs on the left. If you don't see this list, select

    List of newspapers seen ▹ display

    in the menu at the top of the screen bar.

    Click on the clear view icon in the toolbar. Then take an action that does not work the way you expect. Select all of the lines that appear in the Console window. Copy to the Clipboard by pressing Control-C key combination. Paste into a reply to this message by pressing command + V.

    The journal contains a large amount of information, almost everything that is not relevant to solve a particular problem. When you post a journal excerpt, be selective. A few dozen lines are almost always more than enough.

    Please don't dump blindly thousands of lines in the journal in this discussion.

    Please do not post screenshots of log messages - text poster.

    Some private information, such as your name or e-mail address, can appear in the log. Anonymize before posting.

    When you post the journal excerpt, an error message may appear on the web page: "you include content in your post that is not allowed", or "the message contains invalid characters." It's a bug in the forum software. Thanks for posting the text on Pastebin, then post here a link to the page you created.

    If you have an account on Pastebin, please do not select private in exposure menu to paste on the page, because no one else that you will be able to see it.

  • WIN8 registers touch but no reaction from the user interface?

    Anyone having problems with Win8 button when your fingers are clearly registered (Windows gives this feedback from the spherical ripple effect) but the user interface under your finger does nothing? No not the button and so on.

    I live it with some Chrome for example, with the small button tab when it is near the top edge of the screen.

    If I drag the window to the center of the screen, I have no problem with getting keys recorded. Hit the button new little tab gives no trouble.

    When user interface elements are close to the edge, no reaction, even if the wave indicator appears.

    Cannot know if it is a driver or a HW problem. I use X220T.

    Example screenshot

    May be a problem with Chrome, in fact. Tried with Firefox and the new tab button is a lot easier to hit. ---> will give Chrome devs a hint

    EDIT: what you know! The new beta version has already dealt with this issue:

    https://www.Google.com/chrome/browser/beta.html

  • Flatten to a string to send arbitrary objects by messages from the user interface?

    Hi people,

    I am trying to send arbitrary data by messages from the user interface defined by the user to my labview interface. Something funny happens then: if I send the data through the message of ui, it seems I have something strange. There is only one character or nothing in the message of the user interface that reached my reminder.

    It seems that flatten channel also creates control characters that are interpreted by NI TestStand and Labview not as members of the chain, and for this reason I only get incomplete data. within the action of testand, which creates the flattened data, I put a dialog box to display the string data, and it seems that at least up to 255 (ascii) characters are used.

    Is there something like uuencode/uudecode to avoid this problem?

    Thanks in advance

    Okidoki, found.

    His «binary"produced by «Flatten the string» string Apparently I thought, the LabVIEW data type is incompatible with the API of TestStand from LabVIEW. In conclusion I would classify this as a bug (sorry people, at least there should be documentation) API for LabVIEW TestStand 2014.

    As a solution, I use flatten it in XML, which is a printable and human readable 'normal' string.

    It was trial and error, and I'm not enjoying this.

  • How to get TS::SequenceContextPtr to customize the user interface

    I want the file of the custom, user interface sequence value therefore need to take stock of the TS:equenceContextPtr, anyone know how to get this point.

    Is there a reason that UIMessages are not enough?

    Just off the top of my head, here are a few concerns with the not not using UIMessages:

    1. How the user interface is unknown when the file of the sequence is developed to set the value.  Without an event or some sort of synchronization you can do exactly that.  UIMessages not only to ensure the right information, but they help also with synchronization.

    2. The engine does not know this information, and view of execution manager knows that the information for the current execution it is linked to (which changes throughout the life of a series of tests).  Basically, recall of front end, model, and other factors may spawn short executions briefly related to the Manager view of execution.  So if you take the context of the sequence of the current run is perhaps not the right one.

    3. Writing a user interface will be couple the user interface to your specific sequence file.  At this point, you can use the network variables or global variables or global queues as well.  It might even be better options.

    The situation you describe is exactly why the UIMessages were created.  Maybe you can help me understand why you are set on the use of pointers, you already have?  There might be a better solution for your case if I'm misunderstanding you.

    Thank you

  • Why me disables the user interface click on another button, while it performs a scan?

    Hello

    When I run the user interface and click on a button that is sweeping the voltage for a period of time, I can't press any other button that sits on my Panel, lets say the Abort button that would prevent the action.

    So when I take the data and I realize that I should stop him before he finishes the scan, I can't and it's a really bad drawback.

    How can I improve this problem?

    Thank you

    Hi m.s.taba,

    It seems to me that your code runs the function leave but does not exit the loop you are, then the program stops at the end of the loop.

    To avoid this, you can:

    • use a global variable to the time your long recall and the recall of quit smoking
    • Call ProcessSytemEvents in the loop
    • reminder for the button leave defines the global variable
    • inside the loop, immediately after ProcessSystemEvents, you should test the value of the variable, and if the value you must break out of the loop
    • only after the exit of the loop, you can complete your program

  • How to get an array of integers to user in the User Interface

    Hi all. I'm not a very experienced user of the CVI. I have almost exclusively coding in LabVIEW but have a client who wants all of their work in the CVI.

    I've been very fruitful so far (set up a Modbus API from scratch that supports all types of connection) but am confused on how I can get the integer multiples of the user without limiting the number of integers I can get. Essentially, I need to be able to get an array of integers to the user.

    General information, I am building a user interface to test my Modbus API. There are Modbus functions to 'Write multiple registers' and 'write multiple coils. I want the user to be able to enter all the values they want to write in one command.

    What is the best way to get an array of integers through the user interface?

    The easiest way is probably to allow user input in a textbox control numbers: items can be separated by spaces, commas, or even a line break (using ctrl + Enter). You will then need to extract the string from the TextBox and analyzed for numeric values using any non-digit character as a separator: strspn (string, '0123456789'); can be used for this.

    More complex, another possibility is to use a table control to receive user input: you Dresses an empty table with a reasonable number of roews, or you need some codes to add new lines as long as the user fills all those already existing. On the other hand, it will be easier since data recovery in a simple statement, you will all return values: GetTableCellRangeVals (panelHandle, PANEL_TABLE, VAL_TABLE_COLUMN_RANGE (1), table, VAL_COLUMN_MAJOR);

  • Error variables look a tab after race change the user interface

    Hello

    I have a problem which seems to be a bit like this:

    http://forums.NI.com/T5/NI-TestStand/error-viewing-variables-tab-in-runtime-operator-interface/m-p/1...

    The VI I'm running is a step of edit of a type of step. LabVIEW checks if the property 'Step.Setup.ReadMeasName' exists, fills a listbox with her if she does. An another ListBox with all available measure names will also appear on the user interface. The user has an Add and Remove button to remove the 'ReadMeas' list box measures or add them to it of the listbox 'MeasNames '. Several names may be added/removed according to what is selected when you press the buttons. Once 'Fact' is clicked the VI writes the 'Ref' to the list box "ReadMeas" property to "Step.Setup.ReadMeasName", using a node to set the value of property that is passed the TestStand sequence context. If the property does not exist it creates.

    The only time where I have any problem is when I try to remove items from the property, after it is already initialized (i.e. non-empty). In other words, if I run the VI of teststand, put several names as in "ReadMeas" click on done, again run the VI (already added names appear in the box when the user interface is displayed, LabVIEW reads "Step.Setup.ReadMeasName"), then remove the names. IF "ThisContext.Step.Setup.ReadMeasNames" has opened in the tab 'Variables' step when you try to remove the names, I got this message in the Variables tab: 'one or more errors occurred. Please save your work and restart the application. "If I'm careful of not having expaded 'ThisContext' in the variables tab, but check the property before and after the removal of names in the list it does not work properly, and there is no error.

    This isn't a big problem because I doubt that the end user will check to see that the property has actually filled, but I still want to fix the bug if possible. I installed the patch for TestStand 2010 and the .net Framework 4.0. Someone has an idea of what might be happening here?

    Thank you

    -Josh

    Josh-

    Looks like you are running in a known issue 193751, which is documented in TestStand 2010 and 2010 SP1 known issues list. It is a problem that we intend to fix in a future version of TestStand.

    I hope this helps and I'm sorry for any inconvenience this issue may cause you.

Maybe you are looking for