Dealing with small buttons

Hello

I am creating a spinner control (i.e. a TextField followed by two small button objects that provide the feature to increase/decrease the value of the textfield).

I implement using a HBox containing a TextField and a VBox, where the VBox contains two buttons (btnUp and btnDown).

I can't figure out how to make the small buttons (I want them to be half the height of the text field).
SetMaxHeight() implementation does not work. The only way I found to make them smaller is to use setScaleY (0.5), but it does not help the page layout because it is not considered during calculations available.

What would be the best way to develop this type of arrangement of controls?

Hello

I think you'll find that your problem is related to the style of the button. In particular the 'fill' and perhaps also the font size (if you use a text).

Try this:

TextField field = new TextField("Test");
spinner.setCenter(field);

VBox buttonPane = new VBox();

String buttonStyle = new StringBuilder()
        .append("-fx-padding: 0 6 0 6;")
        .append("-fx-font-size: 6;")
        .toString();

Button upButton = new Button("u");
upButton.setStyle(buttonStyle);
VBox.setVgrow(upButton, Priority.ALWAYS);
buttonPane.getChildren().add(upButton);

Button downButton = new Button("d");
downButton.setStyle(buttonStyle);
VBox.setVgrow(downButton, Priority.ALWAYS);
buttonPane.getChildren().add(downButton);

spinner.setRight(buttonPane);

Note the VBox.setVgrow is supposed to make controls stretch to fill the space as far as I know, but it doesn't seem to work. I usually use the MigLayout so I'm not too familiar with it. If you need more help on this, probably best to post again.

See you soon,.
zonski

Did you find this answer useful? If so, please mark it as 'correct' or 'useful '.

Tags: Java

Similar Questions

  • My vision of photoshop is too large with small buttons. The view has changed and I would like to go back to the way it was.

    My vision of photoshop is too large with small buttons. The view has changed and I would like to go back to the way it was.

    Change the scale of the user interface in the preferences at 100%:

  • How to program a structure dealing with a button control that will send a single output signal?

    I want to send one second pulse 2 to the counter when a user has pressed a button.  I used to generate the pulse code assist DAX.  How do I code the case structure so that it will run the case once (send a shock to the meter) and then returned the switch to OFF?  I have included the code that I currently have.

    Just change the mechanical action (i.e. latch when released). Just like the stop button.

  • Win 7 - closing button displays updates to deal with but no updates ever treated on "stop".

    Latest windows 7

    Windows Update works fine in the sense that the traffic updates are treated and updated correctly.  But there are 3 or 4 weeks, I noticed the power off button displaying the exclamation symbol and when I got "high" on the button it displayed the following message - "installs the updates and then shuts your computer."

    I turned off, but no updates have been processed.  I turned on again and check the updates manually, but there is nothing exceptional.  I have a few days later a bunch of updates have been processed when I turned on (all properly updated), but I still got the message on the off button indicating updates to be processed when I turned off.  When I turned off no updates have been processed.  Other that an annoying message on the off button, there seems to be nothing wrong with my computer.

    To try to address the issue, I ran the Windows update program utility troubleshooting on the Microsoft site.  He said that this is a problem ("registration for the service is missing or corrupted") and said that it has been fixed.  However, the Power Off button continues to indicate that updates will be handled when I turned off, but stop down quickly without ever get processed implemented to date.

    This isn't a big problem for me, but everything just annoying.  Can anyone help

    Windows Update behaves properly and install updates when they become available.  The only problem is that ever time I'd go to power off the system tell me that updates would be installed when I turned off.  But there is never to deal with updates and the system would be turned off after a very slight delay.  So on advice from Microsoft, I changed the windows settings of update "manual" and checked from time to time for updates and the issue was "resolved."

  • Whenever I hit the installer and run it, it comes up with a window with two buttons, an asset and a button at home. A small circle rotates around on the screen. Nothing ever happens in addition. I tried it several times redownloading. What sh

    Whenever I hit the installer and run it, it comes up with a window with two buttons, an asset and a button at home. A small circle rotates around on the screen. Nothing ever happens in addition. I tried to re - download several times. What should I do? Here is a picture of what happens:CCFail.PNG

    See if the following can help:

    White screen

    https://forums.Adobe.com/thread/1249756

  • Help! with the buttons

    Hello
    Scenario #1: I created an image in Flash CS3, I use with Actionscript 2.0. I have 12 small pictures on the chassis that are buttons.
    Scenario #2: In a single frame, I added a clip that is 12 larger images and a description of each in their own framework along the time line.

    Try as I might I can't work, how the buttons work. I want the user to click on one of the buttons and for the enlarged image in the clip to appear in the main part of the film.
    Here is a link to some screenshots of what I did.
    http://www.michaeltaylor.biz/Flash/buttons.html


    Can anyone help, or does anyone know of a tutorials that deal with what I can have a look at.

    Thanks in advance

    Michael

    It's always a bit difficult to say how you have things set up, but here's a solution possible scenario...

    First of all, you have essentially 13 points, 12 buttons and a movieclip with larger images. Give all instance names in the properties panel.

    Let's say that you named the first button: btn1
    and the movieclip is named: imgs_mc
    and the first image of the movieclip aligns with the btn1 goal...

    Btn1.onRelease = function() {}
    imgs_mc.gotoAndPlay (1);
    }

  • A small button in the Customization screen.

    A small button in the Customization screen seems out of place. It looks like the Hello feature, but it works.

    Firefox 33.1 Win 7 x 64

    Screenshot: http://s15.postimg.org/xzh4cfga3/Capturar.png

    This is the Hello button to be used with WebRTC which is activated in the next version of Firefox.

    He shouldn't be there but in Firefox 33

  • Two small buttons on the side of the switch just stop working - Tecra M5

    I had this problem before too many and I was told that the way to resolve the issue was a recovery CD, which means losing all my DATA and blabla... The problem is that the two very small buttons on the side of the switch just stop working.

    Just as that. They are always connected as when the laptop is on in standby or hibernation mode if you click on them it restart the machine. We tried something with Toshiba technician before and also their repair without success Center (change the purpose of the button, reinstall the program etc...) The only remedy was still a lot of recovery CD and a replacement of the machine, thank you for that. The sentence is still started. It could be a problem as cookies, just a wild guess or anything else.

    Now, nobody knows how to solve this problem, or had the same problem?
    Thank you. Olivier

    You talk about the presentation of Toshiba and Toshiba Assist buttons. Am I wrong?
    It seems that there might be corrupted registry keys or the common modules stopped working.
    Why? I put t know but perhaps I got a solution
    Try reinstalling the common modules.
    First remove it from the Add & Remove programs. Then restart the laptop and install the downloaded again common modules.

  • Dialogue with radio buttons

    Honourable experts,

    I'm on Win7 64 bit, CS6 (ID 8.1.0.420).

    Script of skills - somewhere in the "Very basic" level

    Now try to adopt, my needs, a dialog box with radio buttons, as in Script UI v2-2 Peter Kahrel, pdf, page 17:

    var w = new Window ("dialog");
    var radio_group = w.add ("panel");
    radio_group.alignChildren = "left";
    radio_group.add ("radiobutton", undefined, "InDesign");
    radio_group.add ("radiobutton", undefined, "PDF");
    radio_group.add ("radiobutton", undefined, "IDML");
    radio_group.add ("radiobutton", undefined, "Text");
    w.add ("button", undefined, "OK");
    // set dialog defaults
    radio_group.children[0].value = true;
    function selected_rbutton (rbuttons)
    {
    for (var i = 0; i < rbuttons.children.length; i++)
    if (rbuttons.children[i].value == true)
    return rbuttons.children[i].text;
    }
    if (w.show () == 1)
    alert ("You picked " + selected_rbutton (radio_group))
    

    My version is designed for operation on the text selected (with the text tool). And here's the problem.

    After selecting the text with Ctrl + A, or shift + end or Ctrl + Shift + end - then - hit KB shortcut assigned to the script I usually 'loose' the mouse pointer. It is still there, but turns out is invisible on the entire InDesign window. "Usually" means approximately 5-6, 10 times... Who escapes from the script window and still hit the shortcut script works - next try mouse pointer remains visible. Until you select another part of the text...

    If the text has been selected with the mouse - or - script is invoked by double-clicking its name in the actions palette, everything goes well, always. Also works well with other types of selection.

    Changing shortcut KB has no effect.

    Replace a mouse has no effect. Microsoft (wired) and mouse optical Logitech (wireless) tested.

    However:

    on a system that is completely up-to-date (Windows 10 Pro N, 1511 version, build 10586,63 x 64 / InDesign CC 2015.2, to build a 11.2.0.100 x 64) it works - there is no mouse pointer disappears.

    Have not the opportunity to test on any other configuration now.

    Could someone confirm this mouse related volatility on Win7/CS6, or is it quite unique in my system?

    And another question:

    Is it possible to activate here cycling through radio buttons to arrow keys, as he works in the script of this Marc Autret?

    http://www.Indiscripts.com/post/2009/09/clean-up-your-pasteboard

    He would let me live with the 1st problem unsolved... Anyway, the keyboard-based workflow is preferable.

    Behold, this is my version changed so far. However, it comes in the same way as described above.

    w=new Window("dialog", "Code");
    radio=w.add("panel", undefined, "Choose Action");
    w.alignChildren="fill";
    radio.optionbtns=radio.add("group");
    radio.optionbtns.orientation="column";
    option1=w.add("radiobutton", undefined, "Action One");
    option2=w.add("radiobutton", undefined, "Action Two");
    option3=w.add("radiobutton", undefined, "Action Three");
    option4=w.add("radiobutton", undefined, "Action Four");
    option1.value = true;
    w.add ("button", undefined, "OK");
                if (w.show() == 1){  
         if (option1.value == true)  
         {alert("Action One!"); exit();};
         if (option2.value == true)  
         {alert("Action Two!"); exit();};
         if (option3.value == true)  
         {alert("Action Three!"); exit();};
          if (option4.value == true)  
         {alert("Action Four!"); exit();};  
        }
    {  
        exit();  
        };
    

    Your comments are greatly appreciated.

    Except the upgrade - this isn't an option so far, sorry, Adobe...

    Hello

    small changes, try this:

    var
      w=new Window("dialog", "Code"),
      radio=w.add("panel", undefined, "Choose Action"),
      option1=radio.add("radiobutton", undefined, "Action One"),
      option2=radio.add("radiobutton", undefined, "Action Two"),
      option3=radio.add("radiobutton", undefined, "Action Three"),
      option4=radio.add("radiobutton", undefined, "Action Four");  
    
    w.add ("button", undefined, "OK"); 
    
    option1.value = true;
    radio.alignChildren="left";
    radio.margins = [10,20,10,10];
    
    function handle_key (key)
    {
      var
      scope = radio.children.length,
      p, newPos, step;
      switch (key.keyName)
      {
      case "Up": step = -1; break;
      case "Down": step = 1; break;
      default : return;
      }
      for (p = 0; p < scope; p++)
      if (radio.children[p].value) {
      newPos = p + step;
      switch (newPos) {
      case scope: newPos = 0; break; // go to first
      case -1: newPos = scope - 1; // go to last
      }
      radio.children[newPos].value = true;
      break;
      }
      } // handle_key
    
    w.addEventListener ("keydown", function (k) {handle_key (k)});
    
    if (w.show() == 1){
         if (option1.value) alert("Action One!");
         if (option2.value) alert("Action Two!");
      if (option3.value) alert("Action Three!");
      if (option4.value) alert("Action Four!");
        }
    else {
        exit();
        };
    

    Can't help you with strange behavior mouse (no idea)

    Jarek

  • Dynamically new tabs, add a tab with a button pane

    In most modern browsers, it is very easy and intuitive how to open a new tab in the same window.
    Usually, there is a small button with a "+" to the right of the tabs. When you click this button, a new tab is created and it receives focus.

    What is the easiest way to mimic this behavior in a JavaFX application?. I think trying to add a tab 'false' with a sign «+» Then I know when this tab is clicked, and on this event, I could dynamically create a new tab and give it focus.
    What is the right way to do it? A small example of how best to implement it would be greatly appreciated.

    This seems to work ok:

    import javafx.application.Application;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.control.Tab;
    import javafx.scene.control.TabPane;
    import javafx.scene.layout.AnchorPane;
    import javafx.stage.Stage;
    
    public class TabPaneWithAddButton extends Application {
    
      @Override
      public void start(Stage primaryStage) {
        final AnchorPane root = new AnchorPane();
        final TabPane tabs = new TabPane();
        final Button addButton = new Button("+");
    
        AnchorPane.setTopAnchor(tabs, 5.0);
        AnchorPane.setLeftAnchor(tabs, 5.0);
        AnchorPane.setRightAnchor(tabs, 5.0);
        AnchorPane.setTopAnchor(addButton, 10.0);
        AnchorPane.setLeftAnchor(addButton, 10.0);
    
        addButton.setOnAction(new EventHandler() {
          @Override
          public void handle(ActionEvent event) {
            final Tab tab = new Tab("Tab " + (tabs.getTabs().size() + 1));
            tabs.getTabs().add(tab);
            tabs.getSelectionModel().select(tab);
          }
        });
    
        root.getChildren().addAll(tabs, addButton);
    
        final Scene scene = new Scene(root, 600, 400);
        scene.getStylesheets().add("tabs.css");
        primaryStage.setScene(scene);
        primaryStage.show();
    
      }
    
      public static void main(String[] args) {
        launch(args);
      }
    }
    

    with the css (tabs.css) file:

    @CHARSET "US-ASCII";
    
    .tab-header-area {
      -fx-padding: 0 0 0 50 ;
    }
    
  • Need help with small DVD menu highlighting issue

    This should be brief, and I might have thought this out already is no so many variables and combinations of the completion of the steps in the correct order.

    I mostly followed this tutorial for easter eggs: http://TV.Adobe.com/watch/digital-video-CS5/Encore-menus/

    The part that I am focused on is between the time timeline 04:30 - ~ 06:00 dealing with duplication of group and the modification of existing elements to create an additional hidden button for the highlight of the Easter egg. My problem is that my three videos are static on the main menu and not text.

    So I do this wrong, but I have direct link to the PS to copy the group, but I need to add a text layer in the copied folder to make the button invisible. My highlight for the videos above is just a large rectangle of 16:9, but I want to be a form of specific profile, the Easter egg. So almost exactly as he did in the video, I imported a file PSD with the shape I wanted... He says CTRL + select for windows, but who doesn't. (Keep in mind that I'm not really a Photoshop user, been using Fireworks for ever). OK, so I select the layer of the imported images, click the magic wand select his area, hide it from view, click the layer existing highlight, shade of colour the previous matches and he said "just to fill it. At this point, with the magic wand tool active on the form, I would like to fill, it doesn't let me fill.

    I select the wrong point? As I said, select the CTRL (means click?) does not work. Because it is such a guru, he uses a lot of keystrokes or shortcut keys that I'm not familiar with. I'm done with this nice menu to 99%, I just need to up the highlight of an Easter egg in the light and I'm probably done.

    Thanks for all the help, I hope I was clear.

    ~ Jonathan

    OK nevermind. I thought about it somehow. I did hidden text touches an object dynamic and bound the two together in the area of layers. Both activating / deactivating the made button highlights and preview my menu showed that it works correctly. I just burn a final and it works very well. Sweet.

  • Dealing with the size of the large file CS5/Aperture 3

    Is it possible to save a PS image changed completely without using 150 MB of storage? I opened a NAVE MB 18 of A3 to PS. converted to B & w using a variety of settings in CS5. Save as a PSD not flattened, gave a 150 MB file size. A flattened jpeg file is 18 MB. 150 MB images will quickly devour disk space. The warning in jpeg triangle suggests that not all layers are saved. Thank you.

    in order to save in layers, I'll have to deal with 150 MB of files.

    PSD files use compression (I forgot what the name), a file tif layered with one of the cuts without loss can be smaller but take longer to save and open.

    If I want to include all the layers in a jpeg file, flatten it before the record?

    If a file contains layers and you save a jpg file off it will automatically be a flattened image copy.

  • dealing with points of reference on green screen?

    I am putting together a small shot of green screen involving a pan across a table top with glasses, sitting on the table.

    I was about to mark the green screen to follow the bottom, so I can put in a layer of a bar scene in post.

    my amateur question is how do you deal with inlay on the track on the green screen in post points?

    should I make sure that the marks on the green screen are a certain color?

    I was wondering how it works when I move into the glasses and see the markers in the background through the glass?

    Thank you!

    Dean

    The best option for tracking of markers is to make the same color as your background but about 1 stop more light or darker in color. Most of the tracking software will manage this difference very well. The second thing we do is make big enough markers so that they are at least 15 to 30 pixels wide in the shot. They've got to be big enough to track. The third clue is to use as much depth of field you can so the edges of the markers are sharp. Avoid the blur of movement and markers of development.

    Make sure that your markers will show the prospect. Don't put them right on the rear wall. You need at least 4 on the table top and about twice that many on the wall back. The markers that have different geometric shapes are also easier to follow than the circles. Triangles, cross, square...

    Try and plan your photo so that you do not have the markers through the glass...

    Last Council... He is a great. If you want key glass remember that glass is very reflective. Put as much white behind the camera and on the sides you can for glassware looks good and has some interesting thoughts. If you have a sample of the bar of the texture or the background, see if you can place that strategically so that reflections appear in the glass.

    Now that I'm done with the advice, here is a requirement. Do not pull on DV or HDV, or any other color space compressed original film. You need all the color information, you can get to draw a convincing key with your main subject glassware.

  • I forgot my password for apple and have permission to stage the 2 and broken my old phone and do not have the same number of what I can do my account is already waiting to be reset, but it takes apple long to to deal with the what else is there to do?

    I forgot my password for apple and have permission to stage the 2 and broken my old phone and do not have the same number of what I can do my account is already waiting to be reset, but it takes apple long to to deal with the what else is there to do?

    You know the e-mail password what do you use? I lost over $ 30 on my old Apple ID because I couldn't get into the email and apple would not transfer my money to my new account.

  • iPad Pro three small buttons on the side

    What are the three small buttons on the side of the iPad Pro for? They are a load of connection?

    This is the connection for the lid of the keyboard smart and all other smart connected devices who can come to the iPad Pro models

    This smart connector feeds the smart keyboard cover and keeps loaded and connected to the iPad Pro.

Maybe you are looking for

  • Your CD or DVD drive cannot read or write media

    I did not burn any CD or DVD on my desktop in a few months. Now when I try, my program writing, Roxio Easy Media Creator 9.0, do note "no drive detected".  Cleary Device Manager shows the two CD/RW (I have two installed) present and activated without

  • Windows will not activate with a valid key?

    We got a new computer with Windows 7 pre-installed on it, but we took the hard drive out of that to transfer files to the new. We have installed a new hard drive clean in the old PC and I try to activate my retail Windows Vista but it says that the k

  • No safe mode - Vista

    For some reason, my pc in Vista Ultimate, goes into safe mode.   Help?

  • Not followed local requests

    Hello I'm new here... I searched help and the forums for a solution to the question and so far have not found anything. We have two JAVA virtual machine in our configuration, the first contains servlets that use of spring remoting to communicate with

  • Headphone connection

    Is there a place to plug my headphones in the back of my HP Pavillion desktop PC, model No.6705F?