How to focus owner of stage?

Hi,
I have an application and I've created a transparent stage on top of main stage and initialise the main stage as its owner. Then I create an additional visible stage and then close the visible stage. The focus goes back to my transparent stage. I must click on my main stage first to get the focus on the main stage or alternative I can ALT+F4 to close my transparent stage.
I want my transparent stage to never receive focus. If it would receive focus, I would like the focus to be sent to its owner. I though the following would work (Scala):
class SpyScopeGlass(owner: Window) extends Stage(StageStyle.TRANSPARENT) {
this.focusedProperty().addChangeListener { (_, _, newValue) =>
println("--> spy stage focussed: " + newValue)
owner.setFocused(true)
owner.requestFocus()
println("--> forward focussed: " + owner)
The println runs as expected, but the focus never goes back to the owner. Any ideas why the owner doesn't focus?
Cheers,
-John

888641 wrote:
Hi Narayan,
Thanks for your reply. I am still somewhat confused though. I tried to call toFront on the owner stage and it neither goes to the front (which I didn't want anyway) nor gets the focus.
this.focusedProperty().addChangeListener { (_, _, newValue) =>
this.owner match {
case ownerStage: Stage => {
ownerStage.toFront()
ownerStage.setFocused(true)
}Do you by any chance know why focus doesn't transfer as expected?
Cheers,
-John
Edited by: 888641 on Oct 1, 2011 2:05 AMHello user,
Have you tried to use some toBack() function too??
The toFront() actually makes your windows at front but the javafx automatically handles the focus windows so to explicitly make other windows not to be focused , TRY WITH toBack() function. You can see in the code of my previous thread comment that I've used toBack() too.
Thanks.
Narayan

Similar Messages

  • Forcing a component to be the root focus owner

    I've never really understood how focus works in Java, and even with the new focus technology I'm still struggling!!!
    I am trying to build an instant messenger dialog box. It is just a JFrame with a JTextPane inserted in "Center" and a JTextField inserted in "South" (by the way, there is no button - just pressing enter sends the message). I want the JTextField to have focus when the box opens up but I can't get it to do such a simple thing!!! Could someone help???
    Thanks.
    Andrew

    Thanks for your help. Here is my code. Also, I am using JDK1.4 but I would like to make it work in 1.3 if possible.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import javax.swing.text.*;
    public class InstantMessageBox extends JFrame
         public InstantMessageBox()
              setTitle( "DMST - Instant Message Box" );
              setSize( 350, 250 );
              addWindowListener( new WindowAdapter()
                        public void windowClosing( WindowEvent we )
                             System.exit( 0 );
                   DefaultKeyboardFocusManager focus_manager = new DefaultKeyboardFocusManager();
                   Container content_pane = getContentPane();
                   JTextPane text_area = new JTextPane();
                   text_area.setEditable( false );
                   SimpleAttributeSet red_attr = new SimpleAttributeSet();
                   StyleConstants.setForeground( red_attr, Color.red );
                   SimpleAttributeSet blue_attr = new SimpleAttributeSet();
                   StyleConstants.setForeground( blue_attr, Color.blue );
                   StyledDocument sd = text_area.getStyledDocument();
                   try
                        sd.insertString( sd.getLength(), "<peter> Hello James... how are you?\n", red_attr );
                        sd.insertString( sd.getLength(), "<james> Oh, hello.\n", blue_attr );
                   catch( BadLocationException ble )
                        System.out.println( ble );
                   JScrollPane text_area_scroll = new JScrollPane( text_area );
                   text_area_scroll.setBackground( Color.white );
                   Border display_matte_border = BorderFactory.createMatteBorder( 4, 4, 4, 4, Color.blue );
                   Border display_titled_border = BorderFactory.createTitledBorder( display_matte_border, "Display Area" );
                   text_area_scroll.setBorder( display_titled_border );
                   content_pane.add( text_area_scroll, "Center" );
                   JTextField text_field = new JTextField( 10 );
                   text_field.requestFocus();
                   Border input_matte_border = BorderFactory.createMatteBorder( 4, 4, 4, 4, Color.blue );
                   Border input_titled_border = BorderFactory.createTitledBorder( input_matte_border, "Input Area" );
                   text_field.setBorder( input_titled_border );
                   content_pane.add( text_field, "South" );
                   System.out.println("The current focus owner is " + focus_manager.getFocusOwner());
         public static void main( String[] args )
              JFrame message_box = new InstantMessageBox();
              message_box.show();
    }

  • R12.1.1 staging complete! How to check whether the stage is Good

    Hi Gurusl,
    I have completed staging R12.1.1 for Hp unix B.11.31. I want to know how to check whether the stage is good for installation or whether it is corrupted. Is there any metalink note or script from where we can check it. Ur help will be highly appreciated. Thanks in advance
    regards,

    Hi,
    Please refer to (Note: 802195.1 - MD5 Checksums for R12.1.1 Rapid Install Media).
    Regards,
    Hussein

  • How do I set the stage (or the background in the stage?) to be transparent?

    How do I set the stage (or the background in the stage?) to be transparent?
    Thanks
    Gary

    Select Stage.
    Color Swatch
    Then set the Alpha slider to 0.
    Darrell

  • How to focus a row directly when the search found the result....in active w

    how to focus a row directly when the search found the result....in active widget

    Considering that I don't understand what you're talking about - does altering the selection of the widget and requesting the focus help?

  • How can I expand the stage (in one direction) on rollover? Or click?

    Hello,
    I'm looking to create an expanding/collapsing HTML5 banner using Edge Animate.
    For example, say I start with a 728x90 banner. How can I make the stage expand (from the bottom edge) to 728x270?
    At the moment I'm looking to expand on rollover then collapse back to original stage size on rollout - but in the future I know I'll want the same functionality using a button.
    All help is appreciated, thank you!

    I am on the go for the day but here is a quick routine, using the toggle() method.
    In your case you can't collapse the etage to 0, otherwise you have no way of getting to the second click.
    In my exmple, click anywhere on the stage, it collapses to the minHeight value of 15.
    Click it again and it restores to the predefined height of the stage.
    var minHeight = 15;
    var myStageHeight = sym.$("Stage").css("height");
    sym.$("Stage").toggle(function(){                    // run on first click of Stage
        sym.$("Stage").animate({height: minHeight}, 500 );
    }, function() {                                                   // run the second click of Stage
        sym.$("Stage").animate({height: myStageHeight}, 500 );
    If you are going to apply to an element, say a button, then its going to require you to move (flow) the button to the collapsed position.
    I'll play with that notion later, when I get back.
    Try the above
    hth
    Darrell

  • If Moto Droid X gets Gingerbread update today(3/27), how will Fasicnate owners here react?

    If Moto Droid X gets Gingerbread update today(3/27),
    how will Fasicnate owners here react?

    potove wrote:
    If Moto Droid X gets Gingerbread update today(3/27),
    how will Fasicnate owners here react?
    yet another {please keep your posts courteous}who joined just to stir stuff up.

  • How to focus No button in JOptionPane.showConfirmDialog?

    How to focus No button in JOptionPane.showConfirmDialog when the Dialog window is opened?
    (default it focus Yes button).
    Please help me. Thank you very much.

    Use the showOptionDialog(...) method then you can specify the buttons and which button has focus.

  • How to focus mm:treenode?

    Hi all,
    Recently I'm working on an issue related mm:treecontrol, the node will be re-created in some cases as designed, but when you navigate nodes through keyboard, these re-created nodes will loose their focuses.
    How to focus the mm:treenode?
    Stupid question but I really need the answer.Without debugging tool, how do you resolve the bugs writtern in JavaScript? I heard there is debug version for that.
    I'm using CS6 DW.
    Thanks,
    Charles

    Sorry.  I have no idea to what you're referring.
    All I could find on Google for mm:treenode relates to extending DW MX.
    http://www.adobe.com/support/dreamweaver/extend/extending_dwmx_errata/extending_dwmx_errat a02.html
    Nancy O.

  • How to change owner of queries and transport.

    Hi Experts,
    Earlier the queries are designed by some other user.According to business requirements I have customised the data targets and infosets also accordingly.All queries are designed on infosets only.
    If I  am coming to query designer to change queries according to requirements, i am not getting change or edit mode for that,even if  I saved the query with some other technical name also I am not getting change or edit mode.
    While I open the opened the query it is showing the following errors :
    1. Bex transport request is not available or not suitable.
    2. Choose an existing request.
    Up to my understanding to assign the queries to my own BEX transport requests ,how can  I change the previous query owner to my user name.
    If I  assign to own bex transport request then
    Please let me know if any information needed still.

    Dear,
    As explained above .....go to SE09 and selct the request and change the owner...
    Also,
    If u use SAVE AS option for the existing query,,,then a new query opens..
    and assign that query to a NEW Transport Request...
    This solves ur problem...
    The problem of
    1. Bex transport request is not available or not suitable.
    2. Choose an existing request.
    is because... the query has been attached to a TR which has been already moved to Quality or Prod...
    So any changes have to be put in that request which is no longer available..
    So use Save AS option and assign it to a new TR.
    Hope this helps u..
    Best Regards,
    VVenkat..

  • Hi, does any one know how to change  owner name?

    Hi, i have bought an iphone unlocked on ebay recently, the phone is working perfectly.
    Does enyone know how to change the owner name? what details would i need? I have the IMEI,  name of the guy who sold the iPhone and his email address, do you think this is enough?
    Please i need help!!!!
    Do you think that the guy who sold the iPhone can block the phone after a little while? Is there anything i can do?
    I have asked the guy to send me his details and i have explained to him why i need it, but he's not answering :-((((
    HELP HELP
    Thank in advance people........

    Use iTunes to setup the phone like new: http://support.apple.com/kb/ht3828
    Very simple.

  • How do I interact between stage and classes?

    Hi,
    I have asked this question before, and all I got is "Go back
    to reading beginner books", so I'm hoping that someone here is
    willing to actually answer my question as opposed to brushing me
    off because they were unwilling to help...
    And yes, I have read books on the topic and gone through tons
    of the documentation and not found the answer to this. I have
    ActionScript 1 and JavaScript experience, so this whole business
    shouldn't be this hard.
    I am using ActionScript 3 in Flash CS3.
    My problem is this:
    I need to find out how to send commands between stuff on the
    stage and stuff that's defined in a class.
    I have had this issue for ages and kept trying to find ways
    around it since so far I haven't been able to find help for it.
    For example:
    When using a document class, how can I access the current
    frame number of the Stage?
    Or using a document class, how can I access any object (like
    a MovieClip with instance name) that was put on the stage using the
    IDE?
    Currently, to be more specific, I am trying to do something
    really simple:
    Make a button work on my stage that is not always visible.
    With AS3 that's not as easy anymore as it used to be.
    So what I did now is create the button in the document class,
    used addChild and set it to alpha = 0.
    Now, when the Stage reaches specific frames (i.e. ones with
    labels, and I got this part figured out), it is supposed to make
    the button visible. Then I can add event listeners and stuff, and I
    can figure that part out myself.
    I don't know how to access the stage frame number from the
    document class, so I put it into a frame script in frame 1, but now
    this script cannot access the button that is defined in the
    document class.
    It's driving me bananas...
    PLEASE, someone here, can someone please explain to me how I
    can make this work?
    I have seen plenty of diagrams of the Display List and the
    Object Hierarchy, but none of that explains how to actually USE any
    of it...
    Thanks so much in advance to anyone who is willing to spend
    some time to answer!

    Well, first of all, I have to say that AS3 has basically been
    designed to be difficult on purpose, in that all this interaction
    between objects is purposefully very strict. For this reason, I
    still use AS2 for all my basic Flash work. AS3 is just a lot more
    involved, a lot more strict, a lot less forgiving... you need a lot
    of experience with it before it starts to make sense.
    Now, I think I might have a few specific answers to your
    questions:
    From any DisplayObject (this includes any Document class,
    which has to extend MovieClip or in some cases Sprite) you can
    access the Stage using the 'stage' property.
    However, stage is probably not exactly what you want, you
    want the main timeline, which is the child of stage. To access the
    main timeline, you can use the 'root' property of any
    DisplayObject.
    However, unless you have strict mode off, Flash won't let you
    just say "root.myMovieClip" because the root property is of the
    type DisplayObject, which is not a dynamic class (meaning you can't
    add properties to it) and it has no built in property "myMovieClip"
    so it thinks you made a mistake. So you have to "cast" the root
    property as a MovieClip, which *is* dynamic so it will let you try
    to reference anything on it (like AS1/2 did for everything.)
    So what all that means is this should work from inside you
    document class:
    (root as MovieClip).myMovieClip
    or
    MovieClip(root).myMovieClip
    Either will successfully reference a MovieClip you had put on
    the main stage in the IDE and named "myMovieClip".
    Rather than setting the alpha to 0, try setting visible to
    false. I think this will disable all interactive events, where
    simply setting alpha to 0 would make it still be interactive.
    HTH

  • How to focus two text boxes at a time?

    Hi,
    I am developing a packet analyzer software. In that, I need to focus two text boxes as I select a treeview item.
    I am using a following code:
    delegate void voiDelegate();
    private void click(object sender, RoutedPropertyChangedEventArgs<object> e)
    TreeViewItem t;
    t =(TreeViewItem) tvMain.SelectedItem;
    StackPanel s = (StackPanel)t.Header;
    List<TextBlock> l = new List<TextBlock>(3);
    foreach (TextBlock children in s.Children)
    l.Add(children);
    string ch = l[3].Text;
    string[] sp = ch.Split('-');
    int te = Convert.ToByte(sp[1]) - Convert.ToByte(sp[0]) + 1;
    PacketDisplay1.SelectionStart = PacketDisplay2.SelectionStart = Convert.ToByte(sp[0]);
    PacketDisplay1.SelectionLength= PacketDisplay2.SelectionLength = te;
    voiDelegate giveFocusDelegate = new voiDelegate(giveFocus);
    Dispatcher.BeginInvoke(giveFocusDelegate, new object[] { });
    private void giveFocus()
    PacketDisplay1.Focus();
    PacketDisplay2.Focus();
    but here I am able to focus only on second Textbox. I need to focus on both textboxes. How can I achieve this?
    My requirement is like this
    thank you.

    The documentation is pretty clear on this: There can be only one
    element on the whole desktop that has keyboard focus:
    https://msdn.microsoft.com/en-us/library/aa969768%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396.
    There is logical focus and there is keyboard focus. There can be multiple elements that have logical focus in an application but only a single element can have keyboard focus. Please refer to the link above for details.
    If you want to highlight text in two different TextBoxes at the same time, you could replace the TextBox elements with RichTextBox elements, and set the background of a text range. Please refer to the following thread for more information about how you could
    do this:
    http://stackoverflow.com/questions/18015380/how-can-i-change-the-selected-text-background-color-in-rich-text-box-wpf-c-sharp
    Here is an example for you:
    public partial class Window6 : Window
    private static TextPointer GetTextPointAt(TextPointer from, int pos)
    TextPointer ret = from;
    int i = 0;
    while ((i < pos) && (ret != null))
    if ((ret.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.Text) || (ret.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.None))
    i++;
    if (ret.GetPositionAtOffset(1, LogicalDirection.Forward) == null)
    return ret;
    ret = ret.GetPositionAtOffset(1, LogicalDirection.Forward);
    return ret;
    internal string Select(RichTextBox rtb, int offset, int length, Color color)
    // Get text selection:
    TextSelection textRange = rtb.Selection;
    // Get text starting point:
    TextPointer start = rtb.Document.ContentStart;
    // Get begin and end requested:
    TextPointer startPos = GetTextPointAt(start, offset);
    TextPointer endPos = GetTextPointAt(start, offset + length);
    // New selection of text:
    textRange.Select(startPos, endPos);
    // Apply property to the selection:
    textRange.ApplyPropertyValue(TextElement.BackgroundProperty, new SolidColorBrush(color));
    // Return selection text:
    return rtb.Selection.Text;
    public Window6()
    InitializeComponent();
    //set text
    PacketDisplay1.Document.Blocks.Clear();
    PacketDisplay1.Document.Blocks.Add(new Paragraph(new Run("some text....")));
    PacketDisplay2.Document.Blocks.Clear();
    PacketDisplay2.Document.Blocks.Add(new Paragraph(new Run("some other text....")));
    //set background
    this.Select(this.PacketDisplay1, 0, 4, SystemColors.HighlightBrush.Color); //select "some"
    this.Select(this.PacketDisplay2, 0, 4, SystemColors.HighlightBrush.Color); //select "some"
    There is no way to achieve this by simply selecting text in two different TextBoxes and there is no way to set the background of a text range in a ordinary TextBox so you must use a RichTextBox here.
    Please remember to close your threads by marking helpful posts as answer and then start a new thread if you have a new question. Please don't ask several questions in the same thread.

  • How to focus and select to the next cell with a ListView when scrolling?

    I have a ListView filled with cells and I'd like to scroll to the next cell to have it focused and selected.
    My code works to scroll down but the scroll bar is going to far!
    How can I reduce the scroll size to each cell, so I can see the focused cell? Is there a better way to implements this?
    Here is my code:
    documentListView.scrollTo(0);
    documentListView.getSelectionModel().select(0);
    int indexSize = documentListView.getItems().size();
    for (Node node : documentListView.lookupAll(".scroll-bar")) {
      if (node instanceof ScrollBar) {
      final ScrollBar bar = (ScrollBar) node;
      bar.valueProperty().addListener(new ChangeListener<Number>() {
      @Override
      public void changed(ObservableValue<? extends Number> value, Number oldValue, Number newValue) {
      int selectedIndex = documentListView.getSelectionModel().getSelectedIndex();
      if(selectedIndex <= indexSize && listScrollDown(oldValue.floatValue(), newValue.floatValue())) {
         selectedIndex++;
         documentListView.scrollTo(selectedIndex);
         documentListView.getFocusModel().focus(selectedIndex);
         documentListView.getSelectionModel().select(selectedIndex);
    Thanks for your help,
    Regards

    You could set the IsHitTestVisible property of the WebControl to false but then you won be able to interact with the web page:
    <awe:WebControl ... IsHitTestVisible="False"/>
    Another better option would be to handle the PreviewMouseLeftButtonDown of the WebControl, find the ListBoxItem in the visual tree and then set its IsSelected property like this:
    <ListView x:Name="BrowserListview" ItemsSource="{Binding browserCollection}">
    <ListView.ItemTemplate>
    <DataTemplate>
    <VirtualizingStackPanel Orientation="Horizontal">
    <awe:WebControl Source="{Binding mySource}" PreviewMouseLeftButtonDown="wc_MouseLeftButtonDown"/>
    <Rectangle/>
    </VirtualizingStackPanel>
    </DataTemplate>
    </ListView.ItemTemplate>
    </ListView>
    private void wc_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) {
    ListViewItem lbi = FindParent<ListViewItem>(sender as DependencyObject);
    BrowserListview.UnselectAll();
    lbi.IsSelected = true;
    private static T FindParent<T>(DependencyObject dependencyObject) where T : DependencyObject {
    var parent = VisualTreeHelper.GetParent(dependencyObject);
    if (parent == null) return null;
    var parentT = parent as T;
    return parentT ?? FindParent<T>(parent);
    Hope that helps.
    Please remember to close your threads by marking helpful posts as answer.

  • How to set owner-only access file permissions both on Linux and Windows

    Hi everybody.
    I have the following problem. I need to store some private user information in file system. So I need to set owner-only access permissions for some directory in user home. I did not find API for doing this. As I understand this is platform specific thing. Could anybody tell me how can I do this both on Linux and Windows?
    Thank you in advance.

    More ideas just came back to me (of something I did before)
    Each OS requires a different control.
    For Windows you will need to set the .policy file for each user (a pain if you have more than a dozen of clients) granting access (R or RW) to files/directories.
    Then you have to write some native code (access via JNI) to access/modify your authorization.
    A more professional solution that I used was J-Integra (other similar tool exist).
    Basically it is a bridge between Java and COM. It magically give you access to the COM API from Java (and vice versa).
    In my case it was to read/write/modify Winword documents transfered between PC and server.
    From memory you have to run the com2java.exe to build the bridge (classes in Java language) between the 2 families. Compile those classes and you have a "driver" for the COM (Microsoft Objects).
    Here I must confess my ignorance on Microsoft.
    Those COM objets must give you some easy/integrated access to the API for LDAP or Microsoft Active Directory Service (for centralize control with more complex setup).

Maybe you are looking for

  • Pages documents snet by email cannot be opened

    Having used IWork08 successfully for the past 8 months, I was dismayed to find out that a colleague of mine who had just downloaded the trial version could not open the files I sent her (Pages, Keynote or Numbers). She could send me a basic template

  • How do I download the newer version of iTunes on a computer ?

    I'm trying to get on iTunes from my computer which has Windows . But it won't let me open the app . A little window pops up saying "The file 'iTunes Library .itl' cannot be read because it was created by a newer version of iTunes . I want to open it

  • Transfer Custom and enhanced infotypes to ALE HR

    Hi All. We have a few customer infotypes (9xxx) and have enhanced a few standard ones like pa0185 etc. Now we have to transfer the data of these infotypes to other system. Standard PFAL transaction does not populate these. I know there is an enhancem

  • Black outline imported SWF

    I was given a SWF file of an animation that was created a few years ago. When I import the SWF file into After Effects CC, I get a black square with a black circle in the middle that moves in and out of the animation. I think the animator was using c

  • Downgrading JDK of a remote Solaris to install WebLogic Server 10.0

    Hello all, I've been assigned a virtual machine at my intern that needs WebLogic installed on it as part of my training. While going through WebLogic 10.0 compatibility notes in the Oracle website I have found that it requirea a 1.5 JDK while the Sol