How to properly resize a group

I have following problem:
To fit a group properly into a pane I want to resize it. Currently, I use setScale.. . The size changes, however the bounds remain the same.
What is the correct way to achieve that?
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.TitledPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.stage.Stage;
public class JavaFXApplication1 extends Application {
    @Override
    public void start(Stage primaryStage) {
        HBox root = new HBox();
        VBox left = new VBox();
        root.getChildren().add(left);
        //create a titled pane with the max width of 100
        TitledPane tp = new TitledPane();       
        tp.setPrefWidth(100);
     tp.setMaxWidth(100);
     tp.setText("Notification");
     tp.setCollapsible(false);
        left.getChildren().add(tp);
        StackPane stackPane = new StackPane();
     stackPane.setPrefHeight(180);
     stackPane.setPrefWidth(100);
     stackPane.setMaxWidth(100);
     tp.setContent(stackPane);
       //just a second node beneth the Titled Pane  
        root.getChildren().add(new Button("Test"));
       // now create a larger circle, scale it down
       // and add it to the stackpane within the titdled pane
       Group gnote = new Group();       
       Circle cleft = new Circle(100,Color.GOLDENROD);
       gnote.getChildren().add(cleft);
       gnote.setScaleX(0.5);
       gnote.setScaleY(0.5);             
       stackPane.getChildren().add(gnote);
        Scene scene = new Scene(root, 300, 250);       
        primaryStage.setTitle("Hello World!");
        primaryStage.setScene(scene);
        primaryStage.show();
    }Edited by: skauf on 17.01.2013 07:29

Note to myself:
Put the scaling group into another group. This was too obvious.

Similar Messages

  • How to properly build a grouped ListView for Win 8.1 and future versions?

    Hi,
    I am porting a Windows Phone 8 app to Windows 8.1 and trying to create a grouped list of items using a ListView. After several hours of trying and reading the ListView documentation I am totally confused and still have no idea of how to correctly use the
    ListView.
    Of course I found a lot of descriptions of how to style a ListView but it seems that ListView was heavily changed in Windows 8.1 and most examples refer to Win 8.0. Styles that worked in 8.0 can lead to crashes in 8.1.
    The ListView has an ItemPanel, an ItemTemplate, a GroupStyle... The GroupStyle uses a HeaderTemplate, a Panel, a ContainerStyle, etc... ContainerStyle is honered in Win 8.0 but not in Win 8.1 if ItemPanel is an ItemsStackPanel... Also ContainerStyle will
    not be supported in future versions, etc... What...?
    I would like to style the ListView like this:
    Problem 1:
    How to stretch the Header over the complete width. The solution I found was to alter the default GroupStyle.ContainerStyle to stretch the HorizontalContentAlignment of the HeaderContent instead of using the default left align. Workes fine, but the
    docu says:
    "[ContainerStyle may
    be altered or unavailable for releases after Windows 8.1 and is not supported for
    ItemsControl.GroupStyle.]"
    So, how to stretch the header without using ContainerStyle?
    Problem 2:
    How to add a footer to the group?

    I have the same problem and have tried the stuff above. When I edit the xaml code the GroupHeader expands to the width of the ListView. But when I compile
    the code it collapses to almost 1 pixel in width (it looks like that), beginning to be a bit frustrated :-(
    Here is my listview xaml code:
            <ListView
    x:Name="MainListView"
     Grid.Row="1"
     Margin="10,10,10,0"
     ItemTemplateSelector="{StaticResource
    MinTemplateSelector}"
     ItemsSource="{Binding
    Source={StaticResource
    GroupedData}}" >
    <ListView.ItemContainerStyle>
    <Style
    TargetType="ListViewItem">
    <Setter
    Property="HorizontalContentAlignment" Value="Stretch"/>
    </Style>
    </ListView.ItemContainerStyle>
    <ListView.ItemsPanel>
                    <ItemsPanelTemplate>
    <VirtualizingStackPanel
    />
    </ItemsPanelTemplate>
    </ListView.ItemsPanel>
    <ListView.GroupStyle>
    <GroupStyle>
    <GroupStyle.HeaderTemplate>
    <DataTemplate>
    <Grid
    Height="70"
     Background="#FF662485"
    Margin="0"
     Width="{Binding
    ActualWidth,
     ElementName=MainListView,
    Mode=OneWay}">
    <TextBlock
    Text="{Binding
    GroupName}"
     FontFamily="Segoe UI Light"
           FontWeight="ExtraLight"
     FontSize="26.667"
    Margin="9,0,20,0"
     HorizontalAlignment="Stretch"
     VerticalAlignment="Center"
     TextTrimming="WordEllipsis"
    Foreground="White"/>
    </Grid>
    </DataTemplate>
    </GroupStyle.HeaderTemplate>
    </GroupStyle>
    </ListView.GroupStyle>
    </ListView>
    Any ides why it goes wrong ?
    /Mads

  • How do I resize a group of Like Objects to have identical Height/Width

    I would like to do this while EDITTING the Panel not during run-time.

    > I would like to do this while EDITTING the Panel not during run-time.
    In LV7, you use the toolbar menu item to make items the same height,
    width, or a particular size via a dialog box.
    Greg McKaskle

  • How do I resize a UML shape?

    how do I resize a UML shape?

    Hi,
    Go to Developer tab> Shape Design Group> Protection> Select None.
    Now, we can resize the UML shape.
    Regards,
    George Zhao
    TechNet Community Support

  • How do I resize a graph?

    Hello,
    how do I resize a graph? From what I can see, I can only set its size when I create it?
    I guess I could Transform > Scale an existing graph - but I'd rather set a fixed width and height so I can keep the proportions right for when I import the graph into InDesign.
    Thanks!

    The final size of your graph depends amongst other things on the size of the type and the number of digits in the XY values. So rescaling with either the Scale ot Transform tools is almost always necessary. I suggest snapping ruler guides to a rectangle which is in the correct size may be a good idea. Then you can always snap your graph to fit to the guides. Be aware that simple scaling will result in the type becoming distorted. You can select the type by double (or treble)-clicking on one of the digits with the Direct Selection (white arrow) tool. That way you select the whole group to adjust the size of the type.

  • How do I size teh group area oin teh mixed signal graph to fit my signal names?

    I have a simple mixed signal graph and I have programmed my signal names and they are longer than the width of the existing group pane on the object and I want them to be visible.  How can I resize the graph panes after I write the names to the object?  I know I can customize the thing, but is there a method or property that I am missing here?
    Solved!
    Go to Solution.
    Attachments:
    Untitled 1.vi ‏12 KB

    It looks like this is a known problem. You can change the legend size using a property node for waveform graphs and charts, but not for a mixed signal graph.  A good work around would be to mouse-over the grey bar between the legend and the plot area until your cursor changes to the resize tool.  You can then size it to be large enough to show the whole legend.  This is an issue that is set to be resolved in future versions of LabVIEW.
    Applications Engineer
    National Instruments

  • How do I access the groups selected in DisplayNewUserDialog?

    I am developing a user manager for a deployment so that the production floor manager can add users as they are trained. I modified the simple OI to add a button "Manage users", which is implemented as a VI.
    I have this pretty much working except when I add a user using the DisplayNewUserDialog, I don't see any way to access the groups that can be selected in the dialog. Selecting a group in the dialog apparently does nothing. I save the user object that gets passed back from the dialog and that "sticks". But the group selection doesn't stick nor do I see any way to access the selection. Using the DisplayEditUserDialog on the same user object does properly save selected group membership(s) without having to make an extra call.
    I see that in the example CreateDeleteUsers.seq, there is a step "Add User to Group" which looks up the group by the name selected by the user. To paraphrase the steps:
    Add new user: RunState.Engine.UsersFile.UserList.SetPropertyObjectByOffset(0, 0x1, Locals.User)
    Add user to group (sets privileges): RunState.Engine.GetUserGroup(Locals.GroupName).Members.SetValStringByOffset(0, 0x1, Locals.User.AsUser.LoginName)
    I don't see how I can programmatically retrieve that group name ("Locals.GroupName" above) from the dialog box, nor from the user object that is returned from the dialog box. Is this a bug?
    Solved!
    Go to Solution.

    Update: I misunderstood the dialog somewhat. It allows you to copy privileges from a group, not select the group itself (although I still didn't see any evidence that the copied privileges stick either).  Since I want to put a newly added member in the "Operator" group, I will have to train the floor supervisors to first add the user and then edit (using the edit dialog) to add the user to the correct group. I'm kind of happy with the VI. Here are some screen shots:
    The current user cannot delete himself. If he has admin privileges, he can add and edit.
    Users with admin privileges can select from the list of users (alphabetized) and add, delete, or edit.
    Users without admin privileges can only change their own record, and only their password within that record.

  • How to properly clean?

    Hey guys I just bought a MBP a couple days ago and I already spilled something on it... it hardened and I wanted to know how to properly clean it off my computer so I don't scratch it?
    While I'm asking, I was wondering how to get rid of fingerprints off the screen? the computer did come with a cloth but I heard it doesn't do anything and a lens cleaner was better.. Thanks

    http://support.apple.com/kb/HT3226
    Dave M.
    MacOSG Founder/Ambassador  An Apple User Group  iTunes: MacOSG Podcast
    Macsimum News Associate Editor  Creator of 'Mac611 - Mobile Mac Support'

  • How do I resize a div/element that's position fixed with css ?

    Supper,
    I set up a fixed element using this code in stage/ composition ready :
    sym.$("body").append(sym.$("Group").css({"position":"fixed"}));
    The element does "position:fixed" but its size has changed.
    How do I resize it to its previous size?
    I tried the same css insertion method with size properties as I used in "fixed"( example above) .
    It Failed.
    So second question is based on that it also loses its "responsive scaling" properties
    (just the "fixed" element not the rest of the project)
    and no longer zooms in scale.
    Can I fix an elements position and maintain scaling with the rest of the project at 100% width?
    My objective is to scroll under a fixed element scaled to fit browser.
    Thank You,
    Henry

    According to the InDesign Help file:
    Do one of the following:
    (Windows) Start InDesign, and then press Shift+Ctrl+Alt. Click Yes when asked if you want to delete preference files.
    (Mac OS) While pressing Shift+Option+Command+Control, start InDesign. Click Yes when asked if you want to delete preference files.

  • I have an 'untitled group' in my contacts on my iphone 4. How can I rename that group please?

    I have some contacts in a separate group that comes up as 'untitled group'. I want to properly name that group but have no idea how to do that and I cant find any reference to naming contact groups in the i phone online manual. Any solutions please. Thanks. Anthony

    The other option is to back up your iPhone 4 to iCloud now, then reset the iPhone 6 (Settings>General>Reset All Content & Settings) and then set it up again using the most current iCloud backup.
    Cheers,
    GB

  • How to properly disconnect a Mini Display Port (MDP) from a Macbook Pro 2012, 1,9?

    Hello:
    I was wondering if any Macxperts out there had any idea on how to properly disconnect a MDP Thunderbolt Cable from a 2012 1,9 Gen. Macbook Pro. From my experience with older Macbooks the command was "Command + F7" or something of the sort.
    On my Macbook Pro 2012, there is no such button or commend to properly disconnect the plug; as if one were to disconnect or "eject" an external HD. I have read some articles on Google that some people just disconnect the plug and that action is sufice to disconnect an external video projection (Ex: Flat Screen Samsung).
    Can a Macxpert or Genius comment on this piece of information? I would really apprecite some light shed on this situation. I just don't see unpluggin a cable connected to a video source enough to properly shut off a connection with out damaging the Macbook Pro's video card.
    Thanks
    A

    Hello, Niel:
    I just answer my own question. Forgive me but I am not up-to-date on the techlingo (Hot Swappable) but I just googled the term and found my answer.
    Thanks again.
    Best,
    A

  • How do I see the group that my contact has been assigned  to when I view the individual contact card?

    I have added my contacts to specifics groups via icloud. I want to be able to see the group my contact belongs to when I bring a contact up (either on my iphone or on icloud).  How can I get the "Group"  the contact has been assigned to to show on their contact?

    what do you mean by game-state
    PS: i asked this question and they told me to be more specific.

  • How can I set up group contacts on my IPad Air?

    HOw can I set up group contacts on my IPad Air?

    I Don't know if you can or not.
    but you could try one if these 2 things:
    -under a new contact in name type the names of the people. Next, I'm not sure if this will work, but for phone just put a different hone down.
    -Also tou could just make a group message. In messages just type all the names in the to field after you tap compose.

  • How do you resize multiple artboards in Illustrator at the same time?

    Hi,
    This is a question that has been bugging me for a while.  I'm currently on CS6 but I'm looking for a solution that can also work on CS5 for a co-worker.
    Having multiple artboards has been established since CS4 and I have yet to see an official way of resizing multiple artboards, if anything there should at least be a plug-in.
    As great of a feature it is, it seems a little short sited.  If one has multiple artboards one should be able to manage multiple artboards, right?
    I totally love having multiple artboards but I should be able to resize and manage multiple artboards as well.
    This is great for building icon sets but how can I resize the set all at once?
    I was considering trying to do an action but odds are I still would have to select an artboard one by one to do which doesn't save much time if you have like 30 artboards to apply this to. 
    I don't even see a batch render for artboards and Photoshop has that for its files.
    I'm well aware of the solution that is displayed here:
    http://forums.adobe.com/thread/1093465
    Which is a script.  I'm not sure where I'm supposed to put it.

    mec_os wrote:
    you can resize the artwork on export. no need to draw it to size.
    Unfotunately when I looked into that does not seem to be the case.  However I can resize when I "Save for Web" but that appears to only work for one artboard at a time.  I can Save As or Export multipe artboards but not adjust the size.  Believe me I would be happy if I could resize multiple artboards upon export but apparently that is not an option.
    mec_os wrote:
    you can put the scripts in illustrator's folder/presets/en_us(or whatever localization you have)/scripts. you can then access them in illustrator from the menubar/File/Scripts/
    there are also applications that will let you execute scripts with assigned shortcuts. i believe sparks is free.
    Thanks for pointing out the location. 
    Do I save it as a txt file or something else?
    (I was guessing that I would copy the script into notepad or something)

  • How do I use contact groups to easily dial friends and fam

    Hi
    I set up groups (family/friends) in my address book MAINLY NOT to have to filter through every "Elizabeth" in my phone just to call my sister!  Now, although I have a group of family and friends set up, I cant figure out how to utilize them (the groups) to quickly dial them...?  If I type friends or family in the tool bar, nothing comes up.. or if I go to "Contacts" in my iphone (4S), tap the "Groups" button in the upper left corner, it brings me to a page listing 
    All iCloud
    Friends
    Family
    untitled groups etc..
    When I click on Family, it only "un checks" that group... ?
    I cannot locate the group for easy access anywhere I try and am hoping someone smarter can help me out ASAP!  I have just about given up on it, but it would make my life akabillion times easier as I am in sales and have akabillion and 5 clients in my phoe ...
      Thanks!
        ---Lost in Los Angeles

    hey thanks!
       ok, I did that... just realized that function .  But what about for a client list... (i seperate them by zip code).
    Do you know how I would do that? I literally have like, over 500... !  Would make it so easy to label the groups by zip so I can easily pull up thier call list.... I downloaded an app to try to help but it is even more confusing (I wish I were more technically educated, so sorry ...)
    But THANKS for getting back so quick

Maybe you are looking for