I created a semi modal jwindow?!

I have a jframe, which calls a modal jdialog.
On that jdialog I use a custom control which creates a jwindow. My problem is that when the jdialog is modal all mouse events are blocked in the created jwindow and I can't figure out why. However, if the jdialog is created as modeless everything works fine.
Anybody have any ideas?
V

Thank you,
Now I have found that this is an issue that has not been solved for several years. Partial / Window / Parent modality is something, AFAIK, not supported currently in Java.
There have been workarounds for it, like the one shown in thread [http://forums.sun.com/thread.jspa?forumID=257&threadID=215788] .
Hope there will be a feature to do this in a future release.

Similar Messages

  • Is there a way to create a semi-transparency with Java?

    I would like to be able to create a semi transparent form and I was does anyone know how to do this?

    import java.awt.*;
    import java.awt.geom.*;
    import java.awt.image.*;
    import java.io.*;
    import java.net.*;
    import javax.imageio.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class CompositeTest extends JPanel {
        private BufferedImage backImage, frontImage;
        private float alpha = 1;
        public CompositeTest() throws IOException {
            backImage = ImageIO.read(new URL("http://today.java.net/jag/bio/JagHeadshot-small.jpg"));
            frontImage = ImageIO.read(new URL("http://today.java.net/jag/Image54-small.jpeg"));
        public Dimension getPreferredSize() {
            return new Dimension(backImage.getWidth(), backImage.getHeight());
        public void setAlpha(float alpha) {
            this.alpha = alpha;
            repaint();
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D) g;
            int x = (getWidth() - backImage.getWidth())/2;
            int y = (getHeight()- backImage.getHeight())/2;
            g2.drawRenderedImage(backImage, AffineTransform.getTranslateInstance(x, y));
            Composite old = g2.getComposite();
            g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha));
            x = (getWidth() - frontImage.getWidth())/2;
            y = (getHeight()- frontImage.getHeight())/2;
            g2.drawRenderedImage(frontImage, AffineTransform.getTranslateInstance(x, y));
            g2.setComposite(old);
        public static void main(String[] args) throws IOException {
            final CompositeTest app = new CompositeTest();
            JSlider slider = new JSlider();
            slider.addChangeListener(new ChangeListener(){
                public void stateChanged(ChangeEvent e) {
                    JSlider source = (JSlider) e.getSource();
                    app.setAlpha(source.getValue()/100f);
            slider.setValue(100);
            JFrame f = new JFrame("CompositeTest");
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            Container cp = f.getContentPane();
            cp.add(app);
            cp.add(slider, BorderLayout.SOUTH);
            f.pack();
            f.setLocationRelativeTo(null);
            f.setVisible(true);
    }

  • How to create a sophisticated modal interface returning a value?

    Hi,
    I am trying to create an interface in Java with sophisticated features to allow a user to select a date value. It has to be modal, that is, when the user clicks on a button, the frame opens, the user selects a value and the value must be retrieved by the calling frame.
    JDialog is not OK, because it does not allow to design a sophisticated interface. The customization possibilities of JDialog are not enough for my needs. I need to design a full screen with several tables, combox boxes, etc...
    How should I proceed? What type of object should I use / inherit of? What mechanism should I use to retrieve the value selected by the user? I can see (in http://java.sun.com/docs/books/tutorial/uiswing/components/dialog.html) that JOptionPane allows to retrieve a value from a modal box. That is exactly what I need, but for a much more sophisticated interface.
    Any ideas? Thanks !

    I had a serious look at the source of JDialog once,
    with a view to doing my own modal stuff. Too much
    like hard work.It's really not that hard, as long as you realize that calling setVisible(true) on a modal dialog suspends the current event pump and starts a new one. Once the dialog is set invisible or disposed, the original pump resumes.
    So, assuming that you've created a class to manage the dialog, you'd implement a show() method like the following (hasn't been compiled, may contain syntax errors):
    // note: this class is responsible for building and displaying
    //       a dialog; it doesn't need to inherit from JDialog, and
    //       becomes a lot cleaner if you don't inherit
    public class MyDialogManager
        private JDialog _myDialog;
        private JTextField _field;
        public MyDialogManager(JFrame owner, String title)
            _myDialog = new JDialog(owner, true, title);
            // build out the dialog here, including text field
        public String showMyDialog()
            _myDialog.setVisible(true);
            // this thread is suspended until the dialog is closed
            return _field.getText();
    }

  • How to create a semi circle swipe?

    Hi,
    I am quite experienced in Photshop and other elements however I am an absolute novice when it comes to flash.
    What I am trying to create is an effect for a logo in which the motif in a semi circle shape which i want to appear in a wipe fashion starting left to right so that in wipe across and the shape appears in full at the end.
    The shape in a rainbow....this would also have the company name below the logo which would be visible from start to finish. I have attached the picture of the logo. I would like the gold pot to also appear in the swipe of the rainbow.
    Is it possible to be able to create this affect and also could you help me through this as much as possible.
    I am extremely grateful for any help available
    All the best

    Look into using a mask over the rainbow.  A mask will only display what is beneath it.  Make the mask a rectangular movieclip with its registration point top center and rotate it so that it gradually covers the rainbow.  If you make it large enough and center it under the rainbow and then gradually rotate it clockwise it should give the wipe effect you are looking for.  As for the pot of gold, I'd also do that separately with a mask being moved down over it.
    If you have no experience using masks in Flash, you should hopefully be able to find a tutorial via Googling "Flash mask tutorial".

  • Help creating a semi-generic map

    Hi guys, i want to use a semi-generic map: its key should be a InetSocketAddress and its value can be anything.
    So i tried creating a Map<Entry<InetSocketAddress,? extends Object>> but it does not give me an option to create an Iterator.
    Can anyone please suggest a better way?

    Hi guys, i want to use a semi-generic map: its key
    should be a InetSocketAddress and its value can be
    anything.
    So i tried creating a Map<Entry<InetSocketAddress,?
    extends Object>> but it does not give me an option to
    create an Iterator.
    Can anyone please suggest a better way?Hi,
    Just declare the value as Object. E.g.
        HashMap<String, Object> map = new HashMap<String, Object>();
        map.put("A key", new Integer(1));
        Iterator<Object> it = map.values().iterator();
        while (it.hasNext()) {
            System.out.println(it.next());
        }Kaj

  • How to make a modal JWindow

    I want to make my JWindow modal. Any idea????
    Thanks very much..

    Hi,
    I know thats possible through JNI by making calling to the native operating system. I dont know how to do that. If you could give any idea, or sample code, that would be great. Thanks very much....

  • JDialog or modal JWindow from JWindow

    Hi
    I can get a JDialog from a JFrame easy enough but I want to get one from a JWindow. Any ideas?
    Also it would be nice if the JDialog had no exit button.
    Thanks
    Chris

    I tried using the following to create my window -
    mTableMenu = new JWindow(new JFrame(){public boolean isShowing(){return true;}});
    instead of
    mTableMenu = new JWindow();
    as per JWindow documentation and I could really get the focus listener to work. But then that brought me to my old problem that I had with JPopupMenu and JDialog - the datechooser inside the right-click menu won't allow me to select a date.
    Is there any way to show a datechooser inside a right-click menu(as In JWindow) and also have it go on right-click-popupmenu-deactivated(as in JPopupMenu and JDialog)?
    Guys, I am stuck big time on this and am banging my head since two days over this. Help!

  • Modal JWindow

    Is there a simple way of setting a JWindow to be MODAL???
    Thx again!

    You might be able to use Glasspane to block all the other windows. Its a round-about way of doing things, I would make sure that you can't get JDialog to do what you want first.
    If you call getGlassPane() on you Frame / JFrame / JWindow / whatever, you will get the GlassPane object associated with that frame, and set it to visible. This should block user interactions with the frame underneath. Of course, calling this method on all the necessary windows will be tricky.
    e.g. frame.getGlassPane().setVisible(true);This article explains root panes etc.:
    http://java.sun.com/docs/books/tutorial/uiswing/components/rootpane.html
    Hope that helps.
    James
    http://jamesjavablog.blogspot.com/

  • In need of help, creating a semi- simple program

    I'm creating a program that is suppose to fit such criteria,
    Read a file of real numbers (doubles), find the smallest and largest, print the numbers read (4 per line), and print the following statistics for the input data:
    · Sum
    · Smallest
    · Largest
    · Average
    I know how to get the file and im using readline to get the information. Below is some of my code where it is as of now.
    BufferedReader bufRead = new BufferedReader(input);
    String line;
    line = bufRead.readLine();
    while (line != null)
         double random = new double(line);
         //Im getting complaints with my while statement also....
         System.out.printf("% 8d\n",randomint.dblValue());
    line = bufRead.readLine();
    bufRead.close();
    catch (ArrayIndexOutOfBoundsException e)
    System.out.println("Usage: java ReadFile filename\n");
                   catch (IOException e)
    e.printStackTrace();
    Any help is greatly appreciated as Im kinda rusty at programing. been a while.

    It's probably a good idea to begin with your own code: compiling and running it at each step to make sure it is correct. If you get stuck post what you have so far (using the "code" tags) and say what the exact compiler message is. And even before writing your own code, figure out what you are going to do - think about how you would solve this problem with pencil and paper. If you had a stream of numbers being given to you, what things would you have to keep track of so that you could report the sum, min max and average at the end?
    That said "new double(line)" makes no sense as double is a primitive. To parse a string (that is, figure out its numeric counterpart) use the Double method [parseDouble()|http://java.sun.com/javase/6/docs/api/java/lang/Double.html#parseDouble(java.lang.String)]. And it makes no sense to close the reader each time you read a line.

  • No Planned order created for semi finished

    Hello PP Experts,
    I have a semifinished material which is used for several materials and everywhere it works fine, hence a planned order is created, except for one material.
    I have checked pretty much every entry for differences on this material. The only difference I found is that the Indicator: recursiveness allowed was set.
    Do you think this might be the reason why no planned order is created ?
    I tried to unflag the recursiveness indicator and saved the bom. But the update latest forever and finally the whole update service got stuck.
    Thus I deleted the indicator on the database, but still no planned order was created. Not sure though which checks are behind that field.
    Thanks for any ideas!

    I have checked pretty much every entry for differences on this material. The only difference I found is that the Indicator: recursiveness allowed was set.
    Did you compare the entries table wise? STPO for the working bom and the bom with problem with same material.
    Make sure in BOM >> item detail >> status/long texts
    Bulk is not checked
    Material provision indicator is not entered.
    Also check if the production order type of problematic one is different. If yes check setting in OPL8 and the field Reservation/Purch. Req.

  • How to create a semi circuler slider using java swing or awt

    I am trying to create a Jslider like thing but in semicirculer shape. Thanks in advance for providing any help.

    Is it possible to create such UI in java swing?Just to further illustrate, Swing only provides the raw foundation you need to be able to build a GUI. With the stock components you can create static user interfaces with standard controls. If you want to go further, you need to either find a component that somebody else already wrote, or you go into custom painting as previous posters suggested. To do an animating component for example, you would need all the frames as BufferedImage objects and you would combine custom painting with a Swing timer to update the displayed frame at a specified framerate.
    if you search for "java swing animation" using google, I'm sure you can find the examples you need. And here is the trail about swing timers:
    http://java.sun.com/docs/books/tutorial/uiswing/misc/timer.html

  • Creating modal modules?

    I'm trying to use a single module loader to create
    dynamically loaded modal modules. The modules that are loaded are
    dynamic in that the path to the module is passed as a parameter
    (retrieved via XML depending on user level, etc.).
    I've tried using the PopUpManager, but it fails because the
    path to the module is passed as a String data-type as oppose to a
    Class data-type.
    I've tried porting some of the code from the PopUpManager
    class to create a FocusManager for the module itself, but I get
    errors with that as well.
    So, is there a way to load these modules and make them modal?
    If so, how can it be accomplished?
    Thanks,
    Greg

    I did something similar I believe.
    It uses both the PopupManager and the ModuleManager and is
    'state-based.' That is, for each state change, the PopupManager
    removes the last module, if any, and loads a new one based on the
    new state. The module is presented both centered and modal.
    In my case I made a simple PopupModuleBase class (.as) like:
    public class PopupModuleBase extends Box
    so my modules can be simple MXML SWFs: you could use other
    than a box, but I found the box best for my application.
    Anyway, if you are still struggling and would like to discuss
    it further, let me know.

  • How to create non-modal dialog box?

    I'm trying to create a non-modal dialog box. The purpose is to show an alarm for the user but should leave the calling VI continuing to run. I have created such a thing -- the problem is that I can't figure out how to get the dialog box to go away! It stops running but the window just hangs around. See the attached VIs and image.
    Thanks in advance for your help,
    Chad
    Attachments:
    alarm_ui.png ‏11 KB
    alarm_ui-2.vi ‏11 KB
    message_to_user.vi ‏11 KB

    Ok, I've attached the files. Thanks for looking at this.
    Chad
    Attachments:
    alarm_ui-2.vi ‏11 KB
    message_to_user.vi ‏11 KB

  • I've problems with skillbuilders Modal Page (2.0.0) plugin

    Hi,
    I'm a newbie on Apex. I'm creating an application with APEX 4.2.1 using the plugin Skillbuilders modal page 2.0 to create/edit the form,
    but after I submitted all the information on page2, I'm not able to come back to page1 and also it doesn't appear the message
    "Action Processed."
    Could you tell me why doesn't work or checking my demo application on apex.oracle.com (http://apex.oracle.com/pls/apex/f?p=58394:1).
    The credentials are:
    workspace: draccanelli
    username: [email protected]
    pwd: draccanell1
    Application: DR - Modal
    ID: 58394
    These are the steps I made:
    a) install plugin
    b) change security from ...
    c) create TEST application (DR - Modal) doing these steps:
    Theme used for the application demo: theme 25
    Page1:
    c.1) change some attributes of create button
    Static ID: create-btn
    Action: defined by DA
    c.2) create DA "create": event:click
    selection type: jquery
    jquery selector: #create_btn
    Action: skillbuilders Modal Page (2.0.0)
    URL Location: statically defined
    static URL: f?p=&APP_ID....
    Auto Close on Element: div#success-message
    c.3) change some attributes for report "report"
    Link Attributes: onclick="return false;" class="edit-link"
    c.4) create DA "Edit Modal": event:click
    selection type: jquery
    jquery selector: .edit-link
    Action: skillbuilders Modal Page (2.0.0)
    URL Location: attribute of triggering element
    static URL: href
    Auto Close on Element: div#success-message
    c.5) create DA "Modal Page auto close": event: Auto Close (skillbuilders 2.0.0)
    selection Type: DOM Object
    DOM Object: document
    Action: Refresh
    add another action:
    event: Auto Close (skillbuilders 2.0.0)
    action: execute JavaScript Code
    Code:
    $('#messages')
    .hide()
    .empty()
    .append(this.data.$modalPageCloseObject)
    .slideDown('slow');
    Page2:
    d.1) change template: Popup
    d.2) change branches to the page 102
    Page 102 (Close Modal)
    e.1) create page with no item
    Thanks in advance...
    Davide

    Your auto-close selector is wrong. You probably copied over the default values, and those do not work on theme 25. The template for your popup page is "Popup".
    Looking at the success message subtemplate for the Popup page template:
    <div class="apex_grid_container">
      <div class="apex_cols apex_span_12">
        <section class="uMessageRegion successMessage clearfix" id="uSuccessMessage">
          <div class="uRegionContent clearfix">
            <a href="javascript:void(0)" onclick="apex.jQuery('#uSuccessMessage').remove();" class="uCloseMessage"><span class="visuallyhidden">#CLOSE_NOTIFICATION#</span></a>
            <img src="#IMAGE_PREFIX#f_spacer.gif" class="uCheckmarkIcon" alt="" />
            <div class="uMessageText">
              <h2 class="visuallyhidden">#SUCCESS_MESSAGE_HEADING#</h2>
              #SUCCESS_MESSAGE#
            </div>
          </div>
        </section>
      </div>
    </div>Your auto close selector would be
    section#uSuccessMessageDon't use .apex_grid_container and also not .apex_cols apex_span_12
    These are classes also used for the body and are not reserved to only the success message.
    However, your auto close action will not work too. Again, you probably copied over the default values, but it won't match with the page template. There is no #messages container to append to. Again, look at the page template for page 1, success message subtemplate, which is the same code as above.
    Not home yet. Since the auto-close selector will only fetch the success message section tag, we can't just insert that in the parent page if there is no div container for it yet. First test for the existance of a success message region, and if not, add the containers. Note that this is very template specific!
    Looking at the page template body code:
    <div id="uBodyContainer">
    #REGION_POSITION_01#
    #SUCCESS_MESSAGE##NOTIFICATION_MESSAGE##GLOBAL_NOTIFICATION#
    <div id="uOneCol">
      <div class="apex_grid_container">
        <div class="apex_cols apex_span_12">
          #BOX_BODY#
        </div>
      </div>
    </div>
    </div>The success message can be inserted before div#uOneCol.
    Annoyingly, notice the onclick code of the uCloseMessage link. This will not be copied over, meaning that the success message will be there, looking pretty. Very annoying. So we'll bind for that.
    This will go into the auto close execute javascript:
    if($('section#uSuccessMessage').length){
       $('section#uSuccessMessage').parent().html(this.data.$modalPageCloseObject)
    }else{
       var newContainer = $('<div class="apex_grid_container"><div class="apex_cols apex_span_12"></div></div>');
       newContainer.find('div.apex_cols').html(this.data.$modalPageCloseObject)
       $('div#uOneCol').before(newContainer);
       $('a.uCloseMessage').click(function(){$(#'uSuccessMessage').remove();});
    };In the end, i only had to adjust the auto close selector and the auto close javascript code.
    Edited by: Tom on Dec 19, 2012 9:51 AM: forum ate my code but my CTRL+C skills nailed it.

  • How can I make a default border for a JWindow?

    I have a JWindow object that is created when a button is pressed in a JFrame. I want the JWindow to have the same type of border as the JFrame from which it's created. However, the JWindow is not created automatically with a border as the JFrame is, so I don't know how to set the border abstractly so that whatever border is used for the JFrame, per he default L&F, will also be used for the JWindow.
    I tried grabbing the border object from the JFame instance itself, but there is no such field in JFrame or any of its ancestor classes. I looked at UIDefaults, but I have no idea how this class can be used to get what I want. For example, if I use UIDefaults.getBorder(Object obj), what do I specify for the argument?
    I'd be happy with an abstract or a concrete solution. That is, either using the default Border for top level containers in the current L&F, or by grabbing an actual Border instance from a JFrame object.
    -Mark

    Also, I'm curious why you said that JFrame is not a swing component.A Swing component extends JComponent. Basically this means that all the painting of the component is done in Java. You can add Borders to any Swing component. It is called a light weight component. A light weight component cannot exist by itself on the window desktop.
    JFrame, JDialog and JWindow are top level components. They can exist on their own on the windows desktop because essentially they are Windows native components. They have been fancied up to make it easy for you to access and add other Swing components to it which is why they are found in the swing package.
    A Windows border is not the same thing as a Swing Border and there is no way to access the native windows border and use it in a Swing application (that I know of anyway). Swing Borders are not used in a normal JFrame, the Windows border is used. You can however, turn off the use of Windows decorations and use Swing painted decorations. Read the tutorial on [url http://java.sun.com/docs/books/tutorial/uiswing/components/frame.html#setDefaultLookAndFeelDecorated]Specifying Windows Decorations. However, this doesn't really help you with your Border problem. If you look at the source code for the FrameBorder, you will find that the "blue" color of the Border is only painted for "active" windows and a JWindow can never be the active window, only the parent JFrame or JDialog is considered active.
    Here is a simple program for you to play around with:
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.border.*;
    public class FrameDecorated
         public static void main(String[] args)
              JFrame.setDefaultLookAndFeelDecorated(true);
              JFrame frame = new JFrame();
              frame.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
              frame.setSize(300, 300);
              frame.setVisible(true);
              Border border = frame.getRootPane().getBorder();
    //          Border border = UIManager.getBorder( "RootPane.frameBorder" );
              System.out.println( border );
              JWindow window = new JWindow(frame);
              JPanel contentPane = (JPanel)window.getContentPane();
              contentPane.add(new JTextField(), BorderLayout.NORTH);
              contentPane.setBorder( border );
              window.setSize(300, 300);
              window.setLocationRelativeTo( null );
              window.setVisible( true );
              System.out.println("Window:" + window);
              Window ancestor = SwingUtilities.getWindowAncestor(contentPane);
              System.out.println("Ancestor:" + ancestor);
              System.out.println(ancestor.isActive());
              System.out.println(frame.isActive());
    }

Maybe you are looking for

  • Time Machine reports issue backing up to Time Capsule

    Ever since I have upgraded to 10.6.4, I have been unable to complete a Time Machine backup. My backup volume is contained on a 2TB Time Capsule. Paraphrasing the error message, "Time Machine reports that it is unable to backup due to a problem with t

  • XSDs/DTDs for BI reports xml

    In Oracle BI Answers, in the Advanced tab, it' possible to see / define the XML (saw:criteria, saw:columns, saw:views etc). The saw:report root node defines two Siebel XML namespace : xmlns:saw="com.siebel.analytics.web/report/v1″ xmlns:sawx="com.sie

  • Accrual/Deferral

    What is accrual and deferral.

  • HT201250 Avoiding Time Machine Deletions?

    I want to preserve my family photos and videos on an external hard drive as I am filling up my MacBook Pro storage, meaning I need to remove some videos from my MacBook so I can add more.  It sounds like Time Machine will write over old files to keep

  • IPhone Programs Closing Randomly to "Home" page

    Hello, I have had my new iPhone, for a littler over a week. It seems that the majority of my software programs close un-expectedly, when I am working in them, usually with-in a minute or less of opening the program(s). The only one that doesn't seem