"Clip" correct for background with round edge

Hi all. I'm having a problem with a round border and a round bottom. If you look at the code below, you will see that I have a border specified with a radius of 5. If I run the present, the bottom sticks outside the border. If I put also the context in which a radius of 5, it still seems wrong since the outside of the border turns to purple while I expect it to be the red light. If I change the bottom radius of 4 then the inside of the border is not quite equal to the background.

How to define a border and just tell the background needs to be 'cut' by it?

Thank you, Nick.
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.FlowPane;
import javafx.stage.Stage;

public class RoundTest extends Application {
    @Override
    public void start(Stage stage) throws Exception {
        FlowPane flowPane = new FlowPane();
        Scene scene = new Scene(flowPane, 500, 500);
        flowPane.setStyle("-fx-padding: 10;");
        Label label = new Label("Hello");
        label.setStyle("-fx-border-color: red; -fx-border-radius: 5; -fx-background-color: blue;");
//        label.setStyle("-fx-border-color: red; -fx-border-radius: 5; -fx-background-color: blue; -fx-background-radius: 5;");
        flowPane.getChildren().add(label);
        stage.setScene(scene);
        stage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}

It's actually sort of a difficult question to answer well.

The standard style sheet caspian.css for JavaFX 2.2 almost does not use of the borders.
The standard controls of the Caspian have things that look like borders or edges highlighted, but they are almost always implemented by stratified environments.
For example, a ring around a button is a blue background which is placed under the bottom of the key, making the ring to resemble a border, even if it is not.

I don't really know why the bottom layer approach was chosen on a border + approach background. The possible reasons are:
-It is easier.
-its performance is superior.
-It provides a better visual experience.
Maybe it's one or all of the above.

Nevertheless, I think that there was probably a good reason why the bottom layer approach has been chosen, then you would probably better stick.
One of the advantages of this approach are there are many similar examples in the caspian.css that you can copy from and use.

An example of string of css style for your sample using boundary layers app could be something like:

-fx-padding: 1;  -fx-background-insets: 0, 1;  -fx-background-radius: 5, 5;  -fx-background-color: firebrick, forestgreen;

Playing with combinations of laminates circles, padding and background-inserts you can get, borders around your controls which can be either entirely encapsulated in layout standard of your control or outside of it (like the focus ring), so that when you add something as a focus ring around your control, it is not movement of the control on the screen - it really just surrounds the control.

An updated version of your application example that uses it is below:

import javafx.application.Application;
import javafx.scene.*;
import javafx.scene.control.Label;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

public class RoundTest extends Application {
  @Override public void start(Stage stage) throws Exception {
//    System.setProperty("prism.lcdtext", "false");
    StackPane stackPane = new StackPane();
    Scene scene = new Scene(stackPane, 500, 500, true);
    stackPane.setStyle(
        "-fx-background-color: cornsilk;"
      + " -fx-border-insets: 10;"
      + " -fx-border-color: rgba(128, 128, 128, 0.5)"
    );
    Label label = new Label("Hello");
    label.setStyle(
//        "-fx-padding: 5;"
//      + " -fx-background-insets: 0, 5;"
//      + " -fx-background-radius: 5, 5;"
        "-fx-padding: 1;"
      + " -fx-background-insets: 0, 1;"
      + " -fx-background-radius: 5, 5;"
      + " -fx-background-color: firebrick, forestgreen;"
      + " -fx-text-fill: whitesmoke;"
    );
//    label.setScaleX(5);
//    label.setScaleY(5);
    stackPane.getChildren().add(new Group(label));
    stage.setScene(scene);
    scene.setCamera(new PerspectiveCamera());

    stage.show();
  }

  public static void main(String[] args) { launch(args); }
}

Now for other questions you raise:

If I run the present, the bottom sticks outside the border

Yes, the background properties border radius and radius are independent, so if you use a rounded edge, you must also use a rounded background or the background will extend beyond the corners of the border.

If I put also the context in which a radius of 5, it still doesn't seem right because outside of the border turns to purple while I expect it to be the red light

JavaFX 2.2 uses anti-aliasing just about all of it is rendered (and even something else for lcd called sub-pixel text rendered in some cases). Your edge is a single pixel wide. If the border is not exactly sitting on a pixel boundary, it will mingle in the background. Even if the sides of the border to sit exactly on the boundary of the pixel, when the border turns corners, smoothing algorithms are suddenly stirring the corner of the border and the background around the inside edge of the corner.

You have chosen a green background and a red border. When you mix these two colors, you get purple (which is what's happening).

I don't know of anyway to turn on or turn off rendering of smoothing for the JavaFX scene graph objects (perhaps something to do that might come along for the ride with the support of Java 8 3D scene graph).

Regardless, you probably want to anti-aliasing for your rendering anyway. If you develop your application, knowing that anti-aliasing will happen. To do this, choose colors that marry well when anti-aliasing. Caspian done by deriving a lot of foreign background colors inner background colors (i.e. any relief or darkening of the border). It works well because they have the same mix of basic RGB, just in different portions component, so anti-aliasing mixes seamlessly. Full of choice colors at opposite ends of the RGB Spectrum as red and blue translates jarring mixtures as violet. Even if anti-aliasing is not in question, your eyes can play you tricks and have trouble seeing clearly the boundary between this kind of colors due to the strange optics of the eyes.

Another strategy to alleviate the nasty mix is to use more pixels, for example instead of a one pixel border, use a border of two pixels - mixture of anti-aliasing will be much less noticeable. Using the strategy of greater pixel works very well in conjunction with the new screens of higher resolution (the so-called retina displays), where the pixels themselves are so small that the human eye is unable to distinguish the pixels and how they blend together.

All that being said - your original example with rounded edges and bottom doesn't look too bad to me :-)

-------------

Another question that I fell on during the test, it is that there is a css attribute - fx-border-style, that can have the values of centered, inside and outside, and when I tried to put I got messages like:

WARNING: declaration of com.sun.javafx.css.parser.CSSParser style of analysis error CSS online ' - fx - padding: 1; -fx-background-inserts: 0, 1; -fx-background-RADIUS: 5, 5; -fx-background-color: brick refractories, forestgreen; -fx-border-style: inside; -fx-text-fill: whitesmoke;' of javafx.scene.Node$22@1bd5d8ab: not supported the of 'inside' when parsing "border - fx - style' to [1 138].

The css reference note to guide the border feature copy of the w3c background and border features, but there is no nut, silverside, border style centered in the w3c css reference, so I guess that there is a mistake in the JavaFX 2 css documentation it around which is taken in charge and what is implemented of the w3c css reference. Note that I'm not really that JavaFX css processing must correspond to the reference of css of w3c that I find the system complicated and difficult to understand w3c.

http://docs.Oracle.com/JavaFX/2/API/JavaFX/scene/doc-files/cssref.html#region
http://www.w3.org/TR/CSS3-background/#border-style

Perhaps as borders in css do not seem to be used much in JavaFX, the issue of documentation is not such a big.

Tags: Java

Similar Questions

  • several fields with a rounded edge

    Hi team.

    I need to create a screen with multiple fileds with rounded corners one. As to create contacts or create tasks:

    Any suggestions?

    Thanks for your help.

    Jorge Luis

    Your problem is here:

    container = (VerticalFieldManager) getMainManager ();
    container1 = (VerticalFieldManager) getMainManager ();

    They are all two refer to the same thing now.

    You must use "container = new VerticalFieldManager();" and "container1 = new VerticalFieldManager();"

    Add (container1) and then add (container)

  • Adobe Capture CC is available for use with Samsung Galaxy S7 and edge S7 phones?

    Hi Adobe community I have so far struggled to get an answer on the following question: is Adobe Capture CC available for use with Samsung Galaxy S7 and edge S7 phones? and I was wondering if there is someone who can help?

    Any assistance is much appreciated.

    Thank you

    Bruce

    Hi Bruce,.

    Yes. I think that these two devices are supported. GooglePlay installation problems?

    Let me know and I can talk to the product team.

    Sue.

  • Cannot set a default for documents pdf Acrobat XI.  Wants to stay with Microsoft Edge.  16 Windows.

    Cannot set a default for documents pdf Acrobat XI?  Wants to stay with Microsoft Edge.  16 Windows.

    Hi tenleyvan,

    Could you please if you want to XI default Acrobat open pdf documents?

    Or do you want to open pdf in Microsoft Edge?

    Do XI Acrobat default to open the PDF, right-click on any pdf file > click Open with > choose another application > select Adobe Acrobat in the list > check "Always use this app to open .pdf files" > OK

    It goes the same for Microsoft Edge, select Microsoft Edge in the list instead of Adobe Acrobat.

    Let us know if you face any problem.

    Thank you! Shivam

  • How to set the color for background ChoiceBox point to ChoiceBox with css?

    How to set the color for background ChoiceBox point to ChoiceBox with css?

    I need to change the backgound color list items.

    I tried with the following code, but it's not help to:

    {.context-menu .choice-box

    -fx-background-color: Red;

    }

    .choice-box .menu-item {}

    -fx-background-color: red;

    }

    In Java 8, either of your selectors should work.

    In Java 7 (JavaFX 2.2), you need of the following workaround:

    #choice-box-menu-item {
         -fx-background-color: red ;
    }
    
  • Need Suggestion for background replacement (which extends tiles with Perspective)

    Hello

    I'm all a web developer before... not a photo Retoucher. I don't have a lot of Mothering (although I'd take ) but just a few suggestions. I have a typical case where a customer is going to give me a narrative which must be replaced. Usually I can work some 'magical' with content-aware fill and hide but I get a surprising number of shots such as this, where there is a background with a repetition of 'something' that must be repeated/extended and maintain the perspective. Below was my first shot at a "dummy" effort that shows what I'm trying to find out how. I just copied/pasted a selection and used content-aware-scale of wobbly way "Frankenstein." I hope that there is a better way I'm too ignorant to have figured out! In addition to extending the tiles, I need match the light/shadow. Advice or some books/tuts suggested would be VERY much appreciated.

    Oh Yes... I use Windows C5.5 (not made to the cloud yet.)

    TIA,

    JC-

    Berhonda-toilet-original.jpgrhonda-toilet-trial-2.jpg

    I would try the vanishing point.  It will be a problem to get the corresponding color.  Maybe almost better just to recreate a tile background.

  • Save my Clip Positions of film with PHP and MySQL

    Hello

    I created a video (FLV) Player, who just plays my videos. Everything works fine and I would like to add a new button to save the position according to which the film played up to. So I can come back later and have the opportunity to play the film to the point that the last time he was arrested. Therefore, I need to save my Clip Positions of film with PHP and MySQL.

    So far, I created a button that saves the position of the my video clip "ns.time' in a variable. I'm currently just display this variable, but I need to export to my file PHP where it gets sorted to be sent to mySQL database. Could you tell m e how can be down or where I can find more material (tutorial) to achieve this.

    I tried to export using 'getURL(url,window,method)' that points to my PHP file. But for some reason any when he sends some information to my php and not only the Position of Movie Clip. I realized from the address line that attempts to send millions of movie flow information, etc..

    I realized that Flash tries to send information of my Listbox and trees which are the list of film clips I have. I don't know why he's trying to send this information! Is anyway I can stop the Flash to send information to my PHP file and send only the value of my a Variable?

    Here's how I send the value of the Variable entry in the PHP file...

    getURL (" http://www.myDomainName.com/aishopper/test2/matrix.php","", "GET" ");

    Thank you so much and have a great day.

    Babak

    Hello JayCharles,

    Thanks for your suggestion. You are absolutely correct, and made me aware of the error I made. I used your suggestion and it has worked very well. Once again, thank YOU for your help.

    See you soon,.

    Babak: o).

  • Clip of MultiCam, but with audio from SEVERAL sources at the same time?

    I recorded a seminar using several audio and video sources. Audio sources include a wire tie, room microphone and read directly from a computer.

    I got all the raw materials imported into FCPX and created a multicam clip, and everything is synchronized perfectly.

    For the video, I know how to make the cut between my different cameras.

    But for audio, I would be able to play several audio channels at once - namely, lapel mic and the mic to the audience. How can I do this?

    I know I could put the multicam audio clip: setback (for example) then also drag the microphone to the audience for the game. But that means every time I make an edit, I have to make it through two sources and must be absolutely sure that they fall never out of sync.

    I guess I could drag the multicam clip in the timeline twice (one above the other, so two are playing simultaneously), with a video source set to none. But the same problem - I always have to be very careful with the changes, two parallel versions never move out of sync.

    Is there a better way to do it?

    There are also sometimes I can do some automation of the volume of the different channels... so everything what you are proposing, please keep this in mind.

    Thank you!

    In fact with a multicam clip you need not "stuff" to work with multiple audio. It has excellent support directly in the application.

    See Steve Martin explain this: https://www.youtube.com/watch?v=HE4FRDMJBS0

  • When taking picture with the light in the background with the camera back from my iPhone more than 6 s, there is a clear blue colour square (a bit like a reflection of the light) will appear.

    When taking picture with the light in the background with the camera back from my iPhone more than 6 s, there is a clear blue colour square (a bit like a reflection of the light) will appear.

    someone has an idea of what's going on?

    The blue square is the area of the camera is in point and exposure on.

    Tap on the area actually taking a picture of. For example, if you take a photo of someone int eh the room and the bottom is very light (or dark), tap on the face of the person to turn to that.

    See it-> http://iphonephotographyschool.com/how-to-use-iphones-camera-app/

  • You can download service pack 1 and 2 correctly for me, sp1 has been downloaded many times, but I get pop ups, saying: I do not have sp1 and I don't know where the sp2 went his lost

    you have my permission to connect to my laptop to do what must be corrected. Thank you

    Hello

    I'm sorry, but we do not dial out.

    We provide the information that you can use yourself.

    Click Start > right click on computer > left click on properties > see if you have Vista 32 bit or Vista 64-bit installed.

    It will also tell you here what Service Packs, if any, are already installed.

    Then, choose the download of 'bit' OK to use to install Service Packs, first of all the installation of SP1.

    Vista SP1 32-bit (x 86): http://www.microsoft.com/en-us/download/details.aspx?id=30

    Vista SP1 64-bit: http://www.microsoft.com/en-us/download/details.aspx?id=21299

    Vista SP2 32-bit (x 86): http://www.microsoft.com/en-us/download/details.aspx?id=16468

    Vista SP2 64-bit: http://www.microsoft.com/en-us/download/details.aspx?id=17669

    And if you have any problems:

    There is a Forum that Microsoft has put in place for problems with Vista Service Packs. If repost you the Forum they will definitely try to help you here...

    http://social.technet.Microsoft.com/forums/en/itprovistasp/threads

    See you soon.

  • Five of the six updates have been installed correctly, KB2698365 failed with error code 80070570. What should I do to install this important update

    Five of the six updates have been installed correctly, KB2698365 failed with error code 80070570. What should I do to install this important update successfully. I'm not a pc expert and don't have no knowledge will take it the word of experts from the pc. KB2698365 is 'important', so I tried to install it several times, but always failing with error code 80070570. I've been on a boring treasure hunt for to install this 'important' update, it seems to find no will to give helpful advice anywhere. I would appreciate help installation of this major update, and talk about normal advice, how to install it successfully without failure of the error code 80070570. What is the error code 80070570.? I use windows vista Home premium, service pack 2, 32-bit operating system. I'm using the essentials of security. Thank you for the consideration of this issue. NIC

    Hi, Grizzly7659,

    Follow the instructions given by Taurian & guenoun

    http://answers.Microsoft.com/en-us/Windows/Forum/windows_other-windows_update/error-code-80070570/a2df7d06-BE9B-4554-b796-c52fac838842

    http://answers.Microsoft.com/en-us/Windows/Forum/windows_other-windows_update/error-code-80070570/51c5b0d3-BFDD-4f69-bff7-623954866b59

  • E3000 won't handshake with the edge router

    Recently, I bought new E3000. I place the E3000 with edge router static IP address rather DCHP which seemed failing at the same IP address and DNS. Associated with the E3000 laptops have their own IP which differ from the IP address of the border router. E3000 is configured with firewall No. minimum protection, for now. The reason for a minimum protection was to get the handshake between the two routers. The border router is a product of Verizon. The old router I was using is a Netgear who did the handshake with the edge router. I have the latest firmware for the E3000 version of the Firmware: 1.0.04)is build 6. Router will not handshake with wired connections or wireless. Used to connect to the E3000 laptop is running Windows 7 Ultimate.  In fact, all laptops here use the same OS and connect wirelessly. I've tried the package of software provided on the site, which housed a diagnosis that apparently could not solve the problem as well. I have not idea about why E3000 not handshake with the edge router. Can we make a few suggestions. Thank you to all those who respond.

    What is the IP address of the router Verizon? What you write suggests that the Verizon router uses 192.168.1.1. If this is the case, establish the E3000 as a switch simple ethernet access point as follows:

    1. disconnect the E3000 from the Verizon router.
    2 wire a single computer in the E3000.
    3. open the web interface at http://192.168.1.1/ (or whatever the IP address you put it now).
    4. on the main configuration page, make sure that your type of internet connection is on "auto/DHCP.
    5. on the same page, set the LAN IP address to 192.168.1.2.
    6. on the same page, disable the DHCP server.
    7. save the settings.
    8 unplug the computer and one of the LAN ports numbered from the E3000 wireless to your router to Verizon.

    That's all. Now, you can use the E3000 as access point and you can use the remaining 3 LAN ports for wired devices.

  • background with best practices GUI thread

    Hi all

    I need to develop an application with background threads over an o and a graphical user interface easy to access some data from the background to the execution of threads and set some parameters to send to these discussions.

    I read on this forum and a few doc in KB, found more or less a strategy:

    1. make the application with an alternative entry point. I start the background thread when the application starts without any argument. When I click on the alternative input I with arg gui, then I have a splash screen.

    2. to push some parameter and to background threads, I use persistent object.

    What is the right way?

    Can someone send me some examples, any interesting doc Ko or post?

    You seem to have quite right, at least how I would.

    You can consider using RuntimeStore as PersistentStore.  PersistentStore allows you to add things to your Threads process and/or save the results so that these data are kept after a failure of the device. If you have things that can get lost or are not Persistable, a shared area of RuntimeStore will also act as an ease of communication between your UI and Threads.

    You think about the implementation of a SystemListener in your background Application so that the wires can be turned off when the device is powered off and powered upwards again on restart.

    I also find it useful to time to completely stop long discussions and start a new.  This just frees all the resources that the thread may have caught accidentally.

    You may need to think about how provide you authorization for background processing.

    Hope this is useful.

  • Google Chrome has stopped working correctly, for this problem can do

    Google Chrome has stopped working correctly, for this problem can do

    Event Viewer reports

    1. normally, when an error occurs on your computer looking in Event Viewer should be your starting point to find a solution. More related system errors are recorded and get an exact copy of the relevant report is important. Unfortunately, is not easy to understand reports and most of the users computer need help with their interpretation. I have to say later interpretation.

    2 Event Viewer includes three main newspapers of Windows. Here's the Application, security, and system. For purposes of troubleshooting system is by far the most important.

    3. to access the system log, select Start, Control Panel, administrative tools, Event Viewer, in the list on the left of the window select Windows and the system logs. Place the cursor on the system, right click and select filter current log. Check the front of the error and click OK and see you only reports errors. Click the Date and time column header to sort. You may need to click a second time to see the last report above.

    4. a tip for posting copies of error reports! Run Event Viewer and double-click the error you want to copy. Click the copy button to place a copy in the Clipboard and close Event Viewer. Now start your message and paste it into the body of the message. Make sure that it is the first dough right out of the event viewer.

    5. He cautioned against three types of reports, information, and reports errors. In most situations, it is the error reports that offer the best information but sometimes WARNING reports provide useful clues.

    6. all reports have stamps date and hour and when troubleshooting, it is important to focus on the latest reports. Reports of studies from the point when the computer is started, and then check if a similar report appeared in the previous session. If errors do not repeat investigation as to why they happen is wasted effort.

    7. in the individual reports the most important information is the event ID and Source such as these help when looking for help on the internet. The description is just as important and copy the exact text to use as search criteria greatly helps achieve better results when using Google. Not paraphrase descriptions when other people asking for help.

  • WebHelp topics are not correctly displayed in Microsoft Windows/Edge 10

    Hi, someone else experienced problems display WebHelp output in the browser Edge Microsoft in Windows 10? I found that CSS styles are not used in one of the subjects and images are blocked. When I try to access the start page, it is redirected to whnjs.htm. The WebHelp content properly on other browsers on windows 10 (IE, firefox, chrome, etc.). Any advice would be appreciated.

    Thanks for all the tips. Our solution was to switch to the sensitive HTML output. It works well with the edge browser.

Maybe you are looking for