Two quick questions (hopefully) - right way to dynamically change the CSS class and put of Splash screen implemented

Couple of quick questions have left me speechless!

So, it seems obvious that many JavaFX applications want to dynamically change the CSS styles.  Is the best way to do it through la.getStyleClass () .add ("classname") < node >?  The underlying data structure is a list of observable.  So let's say we have 5 styles that simply to change the fill color of a circle of 5 different colors, respectively.  So if I have a condition in which I want to dynamically apply 1 of these 5 styles, as I do now it's by setting all 5 styles as a string in a list by using a static initializer, then I call < node > .getStyleClass () .removeAll (list), then getStyleClass () .add ("classname").  I do this to avoid adding again and still the same style and inflate the underlying list.  What is the right way to manage dynamic CSS styles?

Finally a very simple I think.  So I know there's a little differently to implement a splash screen.  My app has certainly got bigger in the last few months of development and I noticed there are about a 5 second delay between when I run the application when I see the main stage.  I was thinking what a splash screen would be nice to fill that time.  I had no time to prototype using a Preloader and I fear that using another, early stage start-up again would be too long of a delay.  "I actually thought that using the Nice and simple JVM argument" - splash: image name > "would be simple, easy and effective.  Unfortunately when I try to do, the splash screen appears but never goes away.  Anyone know what is happening with this?

Your mechanism to manage the css style classes is a good approach; I've used several times. I wonder why the style classes have been implemented as a list, instead of a game, but there may be cases of good use for the use of a list.

In some cases you can also consider using CSS PsuedoClasses, which were presented in JavaFX 8. Here is a little easier to use, especially if you have two options. But a use case might look like:

public class Message {
    public enum Status { NORMAL, WARNING, CRITICAL }

    private final ObjectProperty status = new SimpleObjectProperty<>(Status.NORMAL);
    private final StringProperty message = new SimpleStringProperty();

    // constructor, getters, setters, and property accessors....
}
public Label createLabel(Message message) {
    PseudoClass warning = PseudoClass.getPseudoClass("warning");
    PseudoClass critical = PseudoClass.getPseudoClass("critical");

    Label label = new Label();
    label.textProperty().bind(message.messageProperty());
    message.statusProperty().addListener((obs, oldStatus, newStatus) -> {
        label.pseudoClassStateChanged(warning, newStatus == Message.Status.WARNING);
        label.pseudoClassStateChanged(critical, newStatus == Message.Status.CRITICAL);
    }
    return label ;
}

And then your css looks like

.label:warning {
    -fx-text-fill: orange ;
}
.label:critical {
    -fx-text-fill: red ;
}

Tags: Java

Similar Questions

  • What is the right way to migrate from the PS CS5 and LR5 from my old Mac Pro to my new iMac 5 k?

    I am ready to migrate my boot drive for the new iMac and I worry about the right way to take my Adobe Ps and Lr, Br on the new computer. I migrate disable on the old machine, or disable and remove and reinstall on the new iMac? I don't want to spoil!

    Yes, you can install from your original discs as well.

  • It is a way to force capitalize an entry in a field in a web form. What would be hard-code? I don't want to change the CSS class.

    This code would be:

    < label for = "CAT_Custom_162533" > TYPE IN YOUR FASCIA NAME below: < / label > < input type = "text" placeholder = "for example. Incredible juice Joe"class ="cat_textbox"id ="CAT_Custom_162533"name ="CAT_Custom_162533"maxlength ="4000"/ >

    You would do this with javascript.

  • How do I dynamically change the the number of vCPU and amount of a virtual computer memory?

    Hi all

    My first question is how do I dynamically change the number of vCPU and amount of a computer virtual memory when the virtual machine is running? If so, this may be achieved by writing a few scrpits to inform the hypervisor?

    My second question is, I can start a virtual machine in KVM with the number of vCPUs and amount of memory configured in the startup script. I don't know if this is supported in vmware ESXi?

    I couldn't find the answer in the ESXi 5.0 user guide.

    Your suggestion will be highly appreciated.

    Cheng Wang

    http://sparrowangelstechnology.blogspot.com/2012/11/hot-add-of-CPU-and-memory-to-virtual.html

    You can change the ram and the CPU, but it must be enabled.

    by default, only it isn't.

    See this link to change the settings of vm via powercli

    http://ICT-freak.nl/2010/05/07/PowerCLI-script-to-schedule-memory-and-or-vCPU-updowngrade/

  • Is there a way to dynamically determine the number of parameters to a procedure side Server?

    Hello

    This is a helper method used to call a server-side function that traverses the bindVars parameter to fill the PARAMETERS of the function. Is there a way to dynamically determine the parameters input/output based on the procedure name in the stmt parameter? No member of the CallableStatement class looked promising, but the getParameterMetaData() in the PreparedStatement class method seemed it might be useful lead. However, I have not found any (yet) a detailed description of how to use it.

    protected Object callStoredFunction (int sqlReturnType, String stmt,

    Object [] bindVars) {}

    CallableStatement st = null;

    try {}

    // 1. Create a JDBC CallabledStatement

    St = getDBTransaction () .createCallableStatement)

    ("" start?: = '+stmt+ ";" end; ", 0);

    // 2. Register for the first variable binding for the return value

    st.registerOutParameter (1, sqlReturnType);

    If (bindVars! = null) {}

    // 3. Loop on values for the bind variables passed, if any

    for (int z = 0; z < bindVars.length; z ++) {}

    // 4. Set the value of vars binding provided by the user in the stmt

    st.setObject (z + 2, bindVars [z]);

    }

    }

    // 5. Set the value of vars binding provided by the user in the stmt

    st.executeUpdate ();

    // 6. Returns the value of the first variable binding

    Return st.getObject (1);

    }

    catch (SQLException e) {}

    throw new Aexception.getLocalizedMessage (e);

    }

    {Finally

    If (st! = null) {}

    try {}

    // 7. Close statement

    St.Close ();

    }

    catch (SQLException e) {}

    }

    }

    }

    James

    PreparedStatement.getParameterMetaData () subject is exactly what you need for this task.

    Once you have the ParameterMetaData you can ask how many parameters are present, and how they are. Parameters are numbered from 1 to n, and you can use ParameterMetaData.getParameterMode (1); to get the function of parameter 1. The modes are defined as static values of the ParameterMetaData object. Check out the doc at http://docs.oracle.com/javase/7/docs/api/java/sql/ParameterMetaData.html

    Timo

  • Is there a way to dynamically calculate the values for the IN operator?

    I want to know if there is a way to dynamically calculate the criteria to include within an IN operator in the WHERE clause. "For example when I try to run the following I get an Oracle error message ' OR!-01722: invalid number." The script below is just an example to help illistrate the problem, I don't want to hardcode the values assigned to the v_test directly within the IN operator because the values of v_test will change from user to user.

    DECLARE

    v_test VARCHAR2 (10): = '1,15,25,55';
    v_tmp VARCHAR2 (50): = NULL;

    BEGIN
    SELECT d.metric_title IN the tbl_health_metric_definition v_tmp d
    WHERE d.metric_status = 'Active' AND d.metric_id IN (v_test);
    END;

    You can convert the string "1,15,25,55" online like this

    SQL> select regexp_substr('1,15,25,55' ,'[^,]+', 1, level) list
      2    from dual
      3  connect by level <= NVL( LENGTH( REGEXP_REPLACE( '1,15,25,55' , '[^,]+', NULL ) ), 0 ) + 1
      4  /
    
    LIST
    ----------
    1
    15
    25
    55
    

    and use this selection in your IN clause.

  • I would like to know if there is any way I can remove the 32-bit and keep the 64-bit without harming my computer

    I ran windows 7 installation on my computer using DVD who had 32 and 64-bit data and for that I currently have 32-bit and 64-bit installed in my computer. So I would like to know if there is any way I can remove the 32 bit and keep the 64 bits without harming my computer or stored data because now both bits is eating space on my C drive/partition!

    OT:

    Windows

    Why do you think you have "32-bit and 64-bit" versions of Windows 7 installed?

    If you installed the 64-bit version (which you will need if your computer has more than 4 GB of RAM and you want to use all of this RAM), you can see a few references to 32-bit architecture.  The 64 bit version of Windows needs these files in order to run software that is designed for 32-bit architecture.

    Perhaps the most obvious instance is the presence of the following two directories:

    C:\Program Files and C:\Program Files (x 86).  It is normal for both of these directories present in a 64-bit system.

    Maybe this will help--> 32-bit and 64-bit Windows: frequently asked questions

  • How to dynamically change the graphic style css?

    What is the right method to dynamically replace the graphic style of JavaFx 2.2 in the code? I modified the example in the tutorial below with or without loading the css file. So far, I am unable to replace the style from the code. My goal is to dynamically set the width of each line. We use Java with Eclipse on Windows 7 (64-bit) 7_51. The CSS generated in the code below works when it is in the file. There must be a better way than to write a new file and read it, right?

          String title = "Chart Title";
          stage.setTitle("Stage Title");
          final LogAxis xAxis = new NumberAxis();
          final NumberAxis yAxis = new NumberAxis();
          final LineChart<Number, Number> chart = new LineChart<>(xAxis, yAxis);
          chart.setTitle(title);
          chart.setLegendVisible(false);
          chart.setCreateSymbols(false);
          xAxis.setLabel("x-axis");
          yAxis.setLabel("y-axis");
    
          // each bar is a line from x,0 to x,y
          int width = 24; // pixels
          for (int i = 0; i < ydata.length; i++)
          {
             String css = "";
             // TODO: dynamically calculate unique width for each "bar"
             final XYChart.Series data = new XYChart.Series();
             data.setName("Series" + (i + 1));
             data.getData().add(new XYChart.Data(xdata[i], 0.0f));
             data.getData().add(new XYChart.Data(xdata[i], ydata[i]));
             chart.getData().add(data);
             // Dynamically set style instead of reading from file
             // Assign each "bar" data series a color and line width
             css += ".chart-series-line{ -fx-stroke: red; -fx-stroke-width: ";
             css += width;
             css += "px; }\n";
             data.getNode().setStyle(css);
             System.out.println("node style: " + data.getNode().getStyle());
             System.out.println("node style class: " + data.getNode().getStyleClass());
             width *= 3; // TODO: replace this with dynamic calculation of width
          } // end for
    
          final Scene scene = new Scene(chart, 800, 600);
          scene.getStylesheets().add("Chart.css");
          System.out.println("Scene stylesheet: " + scene.getStylesheets());
          System.out.println("chart style: " + chart.getStyle());
          System.out.println("chart style class: " + chart.getStyleClass());
          System.out.println("chart style sheet: " + chart.getStylesheets());
          stage.setScene(scene);
          stage.show();
    

    The Node #setStyle (String) method only supports the statements, not the rule full css. The setStyle call with '.chart-series-line {-fx-stroke...} '. "should give an error in the parser. Something like "whereas IDENT.

    You might find the line you want in the series. If series.getNode () is a form (as it will be for a line chart), you can just get the node in a form and call the setStrokeWidth() directly.

  • procedure that will dynamically build the query data and table Medallion

    Hi people,

    I write a procedure that dynamically build the query data and insert in the table "dq_summary".
    enforcement procedure with success and data not inserted into the table 'dq_summary '.

    I have thin problem in code attached below
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    FOR rep IN cur_di_attr
          LOOP
            dbms_output.put_line ('d: ');   
            
            BEGIN
              EXECUTE IMMEDIATE 'SELECT table_name FROM ' || sum_tab || ' WHERE id = ' || rep.attribute_id INTO rep_tab;
              dbms_output.put_line ('rep_tab: '||rep_tab);
              run_query := run_query || ' ' || rep_tab || ' WHERE ' || nvl(wh_cond, '1 = 1');
              EXECUTE IMMEDIATE run_query INTO end_rslt;
            
              EXECUTE IMMEDIATE 'UPDATE dq_summary SET ' || prop || '_' || p_code || ' = ' || end_rslt || ' WHERE attribute_id = ' || rep.attribute_id;
              dbms_output.put_line ('e: ');      
              dbms_output.put_line ('rep_tab: '||rep_tab);
              dbms_output.put_line ('end_rslt: '||end_rslt);
              dbms_output.put_line ('f: '); 
            EXCEPTION
              WHEN no_data_found THEN
                rep_tab := '';
                sum_tab := '';
            END;  
          
          END LOOP;    
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    but in the procedure below must be run several times
    create or replace
    PROCEDURE DQ_REPORT_PROC
    AS
      prop                              di_proposition.pro_name%type;
      col_var                           VARCHAR2(100);
      p_code                            dq_parameter.para_code%type;
      sum_tab                           di_proposition.summary_table%type;
      run_query                         dq_parameter.run_query%type;
      wh_cond                           dq_parameter.where_cond%type;
      end_rslt                          VARCHAR2(20);
      rep_tab                           VARCHAR2(50);
      v_error_msg                       VARCHAR2(200);   
      v_error_code                      VARCHAR2(200);  
      v_object_name                     VARCHAR2(50)                          DEFAULT 'DQ_REPORT_PROC';
      v_iss_no                          VARCHAR2(20)                          DEFAULT NULL;
      CURSOR cur_di_prop IS 
        SELECT upper(replace(replace(pro_name, ' '),'-')) pro_name
          FROM di_proposition;
      
      CURSOR cur_di_para IS
        SELECT upper(para_code) para_code, run_query, where_cond
          FROM dq_parameter;
      
      CURSOR cur_di_attr IS 
        SELECT attribute_id
          FROM dq_summary;
    BEGIN
      
      DELETE FROM dq_summary;
    
      INSERT INTO dq_summary (attribute_id, entity_name, attribute_name, data_champ) 
        SELECT a.attribute_id, b.entity_name, a.attribute_name, a.data_champ
          FROM di_attribute_master a, di_entity_master b
         WHERE a.entity_id = b.entity_id;
    
      FOR c_prop IN cur_di_prop
      LOOP
        prop := c_prop.pro_name;
        
        BEGIN
          SELECT distinct SUBSTR(column_name, 1, INSTR(column_name, '_')-1), summary_table
            INTO col_var, sum_tab
            FROM user_tab_cols a, di_proposition b
           WHERE a.table_name = 'DQ_SUMMARY'
             AND upper(replace(replace(b.pro_name, ' '),'-')) = prop
             AND SUBSTR(a.column_name, 1, INSTR(a.column_name, '_')-1) = upper(replace(replace(b.pro_name, ' '),'-'))
             AND upper(b.status) = 'Y';
             
             dbms_output.put_line ('col_var: '||col_var);
             dbms_output.put_line ('sum_tab: '||sum_tab);
             
        EXCEPTION
          WHEN no_data_found THEN
            col_var := '';
            sum_tab := '';
        END;
    
        dbms_output.put_line ('a: ');
    
        FOR para IN cur_di_para
        LOOP
         dbms_output.put_line ('b: ');
          p_code := para.para_code;
          run_query := para.run_query;
          wh_cond := para.where_cond;
          dbms_output.put_line ('c: ');
          FOR rep IN cur_di_attr
          LOOP
            dbms_output.put_line ('d: ');   
            
            BEGIN
              EXECUTE IMMEDIATE 'SELECT table_name FROM ' || sum_tab || ' WHERE id = ' || rep.attribute_id INTO rep_tab;
              dbms_output.put_line ('rep_tab: '||rep_tab);
              run_query := run_query || ' ' || rep_tab || ' WHERE ' || nvl(wh_cond, '1 = 1');
              EXECUTE IMMEDIATE run_query INTO end_rslt;
            
              EXECUTE IMMEDIATE 'UPDATE dq_summary SET ' || prop || '_' || p_code || ' = ' || end_rslt || ' WHERE attribute_id = ' || rep.attribute_id;
              dbms_output.put_line ('e: ');      
              dbms_output.put_line ('rep_tab: '||rep_tab);
              dbms_output.put_line ('end_rslt: '||end_rslt);
              dbms_output.put_line ('f: '); 
            EXCEPTION
              WHEN no_data_found THEN
                rep_tab := '';
                sum_tab := '';
            END;  
          
          END LOOP;    
        END LOOP;
      END LOOP; 
      COMMIT;   
    EXCEPTION
          WHEN OTHERS THEN
             v_error_msg   := SQLERRM;
             v_error_code  := SQLCODE;  
             TRACKER_LOG_EXECEPTION(v_iss_no, v_object_name, CURRENT_TIMESTAMP, v_error_msg, v_error_code);
          COMMIT;        
      
    END DQ_REPORT_PROC;
    Published by: BluShadow on February 7, 2012 12:04
    addition of {noformat}
    {noformat} tags.  Please read {message:id=9360002} and learn to do this yourself in future.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            

    903830 wrote:

    I write a procedure that dynamically build the query data and insert in the table "dq_summary".
    enforcement procedure with success and data not inserted into the table 'dq_summary '.

    I'm sorry. But there is no kind of say that way. The code is undesirable. The approach is wrong. This will not happen. This will cause the fragmentation of memory in the shared Pool. This will lead to another session being impossible to analyze the sliders because of the fragmented memory.

    Not only that. The underlying data model is questionable.

    All this seems a candidate perfect as an example of how NOT to design and code and use Oracle.

  • Dynamically change the path of the report

    Is it possible to dynamically change the path where reports are saved. TestStand 4.1.1

    Glennjammin,

    You can set a path to the specific report for any sequence that you run via the entry points of process model using the reminder of your sequence ReportOptions. It will allow you to change the current settings in the Options report (including the path) for the execution of this sequence. This allows each of your sequences have unique report options.

    If I understand your question, you want to do is exactly what is meant recall ReportOptions.

    -Jack

  • dynamically change the targeted and untargeted application icons

    Hi all

    In JDE 4.7.0, can I dynamically change icon application targeted and untargeted.

    My application connects to a server once a week and draws new content and 2 new icons.

    Can I use the icons drawn recently to replace the existing icons.

    Thank you.

    My glance, you have codes is about right.  Note that you will need to provide the images you downloaded as Bitmaps.  There are a number of discussions on this Forum dealing with requirements to download the files and convert them to Bitmaps, so have a look round for help with that.

  • A way to change the font, size and "BOLD" to each page?

    Due to problems described here https://support.mozilla.org/en-US/questions/1012057?esab=a & s = & r = 0 & as = s I erase that I need something (an extension, perhaps) I want to recognize and change the font size and "BOLD" fonts in each page.
    Is there something like this?
    Maybe also for the bookmarks bar...

    You can use the NoSquint extension to define the size of the font (zoom text/page) and the color of the text on web pages.

  • Dynamically change the number of sub-panels

    Hello

    I have a computer where usually 4 testplaces of production are connected to.

    I want to have a main VI indicating the status of the 4 different testplaces, that I can do with 4 separate sub-panels - no problem.

    The issue is that I would be flexible in testplaces how I show in a program (as this hole thing is pretty cool, and I expect that some changes will come). Is it possible to dynamically change the number of sub-panels displayed (other that make it twenty of them and turning off then those you don't need)?

    My first idea was to place the school in a table, but unfurtunately is not possible.

    Best regards

    Frank

    Yamaeda wrote:

    The POP in separate windows, and you can have as much as you want.

    Or make separate them windows, and then set up a child-parent relationship in Windows, it seems as if it was all about a user interface.

    http://screencast.com/t/P9SJ1anR

    It's nice enough for the demo beta like software, but works.

    https://lavag.org/topic/17046-multi-panel-interface/

  • I lost at the age of Mythology the titans expansion disc, but I still have key code, is there a way I can download age of mythology and put the key in to make it work?

    I lost at the age of Mythology the titans expansion disc, but I still have key code, is there a way I can download age of mythology and put the key in to make it work?

    Hi mxbot221,

    It is very unfortunate to know that you have lost the game disc. It is indeed a nice game that requires precision and work of the spirit.

    But the good thing is that you can download the demo version of the game among the links below and then, can enter the product key to unlock all its features.

    Here are the links: 1) http://www.microsoft.com/games/pc/titans.aspx

    2) http://www.microsoft.com/games/titans/downloads.aspx

    In addition, you can try to contact the Microsoft Supplemental Parts team for a replacement CD. To locate the phone number, visit the following Microsoft Web site: http://support.microsoft.com/default.aspx?scid=fh; EN-US; CNTACTMS

    Ref: How to replace Microsoft software or hardware, order service packs and upgrades, and replace product http://support.microsoft.com/kb/326246 manuals

    You can also try http://forums.gamesforwindows.com/ Games Microsoft support forum> for more discussions about the game.

    Hope this information was useful.
    -------------------------------------------------------------------
    Naveen
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Dynamically change the language in cvi

    Hello

    I would like to know if it is possible to dynamically change the IUR in English language to Russian?

    I have a program written in cvi and I need to be able to scwitch English to Russian UI when the user clicks a button...

    Thanks in advance

    Yes: You must create a resource of language of the dossier and can then use the LoadLocalizedPanel / LocalizePanel and LoadLocalizedMenuBar / LocalizeMenuBar

Maybe you are looking for

  • I have the background and the lavafoxv2 address bar. How can I get the google lavafoxv2 homepage to appear

    no problem with the extension. It displays a google for lavafoxv2 home page. How can I make my home page. I have the theme, but my home page is the homepage of the basis of firefox

  • I put openintabs to true, but it still does not; Win7/64 ffox 3.6

    running win7/64 ffox 3.6; I have browser.search.openintab true value but is still does not work. I have to right click and select open in a new tab.

  • Create a set of recovery problem

    I have a windows 8, 64-bit computer pc laptop (HP pavilion g6). Whenever I try to create a collection set with DVD discs I get this message "we live errors in the creation of recovery media. Please try again. » Any suggestions on how to overcome this

  • game has a few graphics that are blackened

    questions about the effects of browser I installed a game for Win XP Ser2 using the compatibility setting but without success. The PC came with 2 browsers IE and Google Chrome. I had to uninstall Chrome for some other reason and the game has now resp

  • on graphics hardware

    I pavillio G6 computer laptop and I installed windows 7 ultimat 64bits. I ve installed AMD Graphic driver and also driver intel HD that is embedded in the laptop of my. But I'm unable to enable AMD graphics hardware. Please tel me how to activate the