Make a PJC Swing component Modal?

Does anyone know how to keep a PJC that is a Swing component in the same focus as the form?
In other worsd, when you invoke a spell checker in MS Word the spell check window is in focus when the word window is in focus.
If a swing component is non modal then it can get lost in the shuffle. Is it possible to force a PJC to be Modal?
null

For instance, it looks as though the calendarWidget is non-modal

Similar Messages

  • How to set a Swing component as Modal on a SWT Component?

    How to set a Swing component as Modal on a SWT Componen?.I mean, I have a SWt Component window and from that window I am displaying a SWING Component Modal window.
    The problem is my swing window is not working as Modal always.
    When I opened the swing window from SWT window,swing window is working as Modal.But if Idouble click on Menubar or Title bar of the SWT Window then my Swing window goes back.If I click on any other part of the SWT window.. then once again Swing window is working as modal.
    Can any one suggest me to solve this?
    I think this is isuue related with Swing over SWT..

    pradeep.rajadurai wrote:
    I want set the JTable as a background of jframe or jinternalframe , how it is possible One way that may work, you can always extract the image from a rendered JTable and then paint the same image into the JPanel that holds your components via it's paintComponent method, then added the JPanel to the app's contentPane.
    give me simple pgmIs English your second language? Because if so, please understand that this demand can be taken by some as rude.

  • How to set a Swing component as Modal window on a SWT Component.?

    How to set a Swing component as Modal on a SWT Component.I mean, I have a window (SWT Container) with some menu items.
    When I click on one menu item then i will get one new Swing Window.
    When creating the new frame I had passed Modal value as TRUE in the constructer.Now child is not behaving as Modal Window.I mean I am able to go to parent window even though the child window is opened as a Modal Window.This is only happened when I double click on the Title Bar of the Parent Window.
    If I try to click on any other part of the Parent Window except Title bar ... the child window is working as a Modal Window.
    Can any one suggest me to solve this one !!

    int this case, do this :
    JFrame f = new JFrame("Authentification");
    f.getContentPane().setLayout(new BorderLayout());
    f.getContentPane().add(myJPanel, BorderLayout.CENTER);
    f.setBounds(x,y,w,h);
    f.setVisible(true);
    Where myJPanel is the Panel you developped.

  • Help-using document as a java swing component

    Hi,
    can i use a document excel file or a doc file as a swing component.
    i have few templates in in excel and .doc format.
    i use them to produce bills by just entering data.
    Now i want to develop a swing application and use the same templates in jpanel or jtextpane or jeditorpane.
    its very hectic to make templates in swing using tables and all.
    is there any api which can help me out???
    thanks

    as a Swing component? No.
    There's probably libraries for reading those types of files, and maybe displaying them. POI, perhaps?

  • Swing component fires an event to non-GUI code

    Hi all -- this is my first post in forums.sun.com.
    Question to get me started -
    I have a Swing component that fires an ActionEvent. I would like that ActionEvent to trigger code that does not run on the AWT Event Queue thread (some code that will take some time without impacting GUI rendering performance.)
    I know I could put that Event's action command into a synchronized Queue, and have a worker thread checking the queue and taking action when it finds a command there. Likewise, I could flag a volatile boolean as true, and have a worker thread check the flag and take action when true.
    Or (and I suspect this is best), I could create a new SwingWorker thread right in actionPerformed().
    Any opinions on what makes sense?

    pkwooster: Yep. That's what I meant.
    As for the design pattern, Observer was the pattern I was intending to use (and have already implemented). Would anyone argue that another method is more efficient or "correct"?
    My sample project is:
    Business Object -> Main Dialog -> Embedded Dialog
    The Main Dialog contains no business logic - just simple navigation events. The Embedded Dialog contains the real controls and reports any interaction using Swing events, which the Main Dialog picks up.
    I then set up the Observer pattern between the Main Dialog and the Business Object.

  • Searching a calendar swing component

    Hello friends.
    I'm looking for a calendar swing component, to make a schedule aplication (like Outlook).
    I found "Mig Java Calendar" (http://www.migcalendar.com/index.php) but it isn't free, i need one like this free.
    Do you know someone free?
    Thank you.

    And if you think, as I do, that a date picker is
    standard component and should be part of the jdk,
    please vote here:
    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=473
    0041
    -Pucethat is really helpful. I voted for it.

  • Resizing the wrapped swing component inside the javafx stage

    I have a customized swing component & need to wrap it in javafx stage. But as & when the javafx scene resizes, I want to resize the swing component accordingly.
    One way of resizing this is to scale the swing component. But is there any other way or layout to do it efficiently.
    --Nitin Pokalwar                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Hello
    <p>Let's have a look at this Forms PJC/JavaBean site</p>
    Francois

  • How to embed swing component into javaFX ?

    Maybe I missed sth, but can someone explain us how can we embed swing component into javaFX 2.0 ?
    This was previously handled with javaFX "srcipt", why can't we do it anymore ?
    As far as the work to migrate from 1.3 to 2.0 is hard and huge, why do fx2.0 do not offer such feature anymore ? :(
    I know that ThingFx project try to cope with, but the current code doesn't match with my needs.
    Thanks for help,
    Edited by: tibO on 23 nov. 2011 14:35

    I know this post is old and the original authors might not even ben active; but it essentiall gets to the heart of what I'm trying to.
    I have a JDialogBox. In it I have a panel (which I have to change to a JScrollPane). Inside the JPanel I have a JLabel and a JTextArea.
    I was told to; make it scrollable in the event that there is too much info for the JDialogBox and to add HTML formatting (simple stuff like bold and colors.
    1) The JScrollBar doesn't seem to produce the scroll side bars.
    2) I must not be implementing the JEditorPane correctly. I just substituted JEditorPane for JTextArea in my code and it returned a type converstion error. Is JEditorPane even the correct object to use? Should I be using JTextPane?
    The reason I can't do this on a JLabel by JLabel basis is because I don't know how many labels I will need at each runtime. And I also have to have a swingtimer on it. I could create an array and loop around it to create the JLabels. But it seems a waste of commuting cycles. This is no good?

  • New: awt is covering my swing component...

    i am using both awt and swing component on the same page. They are a List and a JComboBox.
    while the JcomboBox is placed above the List. it works fine but when i click on the JComboBox, the pull down menu is covered by the awt List. I know that using JList can solve the problem, but i'm new to swing and i just want to make the smallest change to my code.
    can i use layeredpane to help?

    here is a link to the Swing tutorial that mentions this problem:
    http://java.sun.com/docs/books/tutorial/uiswing/start/swingIntro.html#awt
    The Swing tutorial also has a section on converting from AWT to Swing. You should look at that.
    Here is another article from the Swing Connection titled "Mixing Heavy and Light Components"
    http://java.sun.com/products/jfc/tsc/articles/mixing/index.html
    Like the previous post says, you are better off not to mix the two.

  • Swing component's opaque property

    Recenetly I read an article about "Painting in AWT and Swing" and feel confused about some points in the article.
    http://java.sun.com/products/jfc/tsc/articles/painting/index.html
    The article mentioned several Swing Painting Guidelines, I have question about the following two paragraphs:
    6. If a Swing component's opaque property is set to true, then it is agreeing to paint all of the bits contained within its bounds (this includes clearing it's own background within paintComponent()), otherwise screen garbage may result.
    7. Setting either the opaque or optimizedDrawingEnabled properties to false on a component will cause more processing on each paint operation, therefore we recommend judicious use of both transparency and overlapping components.
    For the No.7, it's said setting the opaque to false will cause more process on each paint operation, I think it should changed to ture, since if set opaque property to true, it will paint all the bits contained within bounds as described in No.6.
    So is this an error? What on earth is efficient for the opaque property value?
    Thanks!

    For the No.7, it's said setting the opaque to false will cause more process on each paint operationWhen you create an application you do something like this:
    create a frame
    add a panel to the frame
    add a component to the panel. (lets say a JButton)
    When you click on a button you need to change the state of the button to look 'pressed'. So you need to repaint area on the screen where the button is painted.
    If the button is opaque(true) then you simply paint the button in its new state because the button is responsible for painting its background and any custom painting.
    if the button is opaque(false) then you don't paint the background which means you need to search for the parent of the button (in our example the panel). Once you find the parent you need to paint that area of the panel that the button overlays and then you do the custom painting of the button.
    So either way you have to repaint the same area. Hopefully it makes sense that painting a single component would be more efficient than painting parts of two separate components and determining which two components to repaint and what area to repaint of each component.

  • Flicker with heavyweight swing component and setVisible(false) on Linux

    Hi All,
    I'm using Java 6 update 14 on Ubuntu Jaunty.
    I'm developing a GUI for a system running linux. I'm using the Swing framework for the GUI but need to include 3D animation accelerated in hardware. I'm using the JOGL framework for applying the 3D animations which supplies one with two swing-like components, the GLJPanel and GLCanvas. These two components are lightweight and heavyweight swing components respectively.
    The difficulty arises when adding the heavyweight GLCanvas component into the gui. Often I need to do a setVisible(false) on the component in which case the GLCanvas hides correctly, but shows a flicker before the background is displayed. On digging a little deeper I found that because the GLCanvas is heavyweight, on linux it calls down to the sun.awt.X11 classes to do the setVisible(false) on hide. The very deepest call, the xSetVisible(false) method of the XBaseWindow class, causes the component to be replaced by first a grey backgound, and then the correct background. This intermediate grey background is causing the flicker.
    The source for the sun.awt.X11 packages was not available with the standard JDK 6 but I've found the open jdk source which matches the steps taken by the call. The xSetVisible method is as follows:
    0667:            public void xSetVisible(boolean visible) {
    0668:                if (log.isLoggable(Level.FINE))
    0669:                    log.fine("Setting visible on " + this  + " to " + visible);
    0670:                XToolkit.awtLock();
    0671:                try {
    0672:                    this .visible = visible;
    0673:                    if (visible) {
    0674:                        XlibWrapper.XMapWindow(XToolkit.getDisplay(),
    0675:                                getWindow());
    0676:                    } else {
    0677:                        XlibWrapper.XUnmapWindow(XToolkit.getDisplay(),
    0678:                                getWindow());
    0679:                    }
    0680:                    XlibWrapper.XFlush(XToolkit.getDisplay());
    0681:                } finally {
    0682:                    XToolkit.awtUnlock();
    0683:                }
    0684:            }I've found that the XlibWrapper.XFlush(XToolkit.getDisplay()) line (680) causes the grey to appear and then the XToolkit.awtUnlock(); line repaints the correct background.
    Using the lightwieght GLJPanel resolves this issue as it is a light weight component but unfortunately I'm unable to use it as the target system does not have the GLX 1.3 libraries required because of intel chipset driver issues (it has GLX 1.2). I cannot enable the opengl pipline either (-Dsun.java2d.opengl=True) for the same reason.
    Is there a way to configure a heavyweight component to avoid the operation in line 680? As far as I can tell, the flicker would disappear and the display would still be correctly rendered had this line not been executed. This problem is not present in windows.
    I've put together a minimal example of the problem. It requires the JOGL 1.1.1 libraries in the classpath. They can be found here: [JOGL-download|https://jogl.dev.java.net/servlets/ProjectDocumentList?folderID=11509&expandFolder=11509&folderID=11508]
    I've also found that running the program with the -Dsun.awt.noerasebackground=true vm argument reduces the flicker to just one incorrect frame.
    The program creates a swing app with a button to switch between the GLCanvas and a normal JPanel. When switching from the GLCanvas to the JPanel a grey flicker is noticeable on Linux. Step through the code in debug mode to the classes mentioned above to see the grey flicker frame manifest.
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Insets;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.media.opengl.GLCanvas;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JInternalFrame;
    import javax.swing.JPanel;
    import javax.swing.WindowConstants;
    import javax.swing.border.EmptyBorder;
    public class SwitchUsingJInternalFrameSwappedExample {
         private static JPanel glPanel;
         private static JPanel mainPanel;
         private static JPanel swingPanel1;
         private static boolean state;
         private static JInternalFrame layerFrame;
         private static GLCanvas glCanvas;
         public static void main(String[] args) {
              state = true;
              JFrame frame = new JFrame();
              frame.setSize(800, 800);
              frame.setContentPane(getMainPanel());
              frame.setVisible(true);
              frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
              frame.setBackground(Color.GREEN);
         // The main component.
         public static JPanel getMainPanel() {
              mainPanel = new JPanel();
              mainPanel.setBackground(new Color(0, 0, 255));
              mainPanel.setBorder(new EmptyBorder(new Insets(20, 20, 20, 20)));
              mainPanel.setLayout(new BorderLayout());
              mainPanel.add(getButton(), BorderLayout.NORTH);
              mainPanel.add(getAnimationPanel(), BorderLayout.CENTER);
              return mainPanel;
         // Switch button.
         private static JButton getButton() {
              JButton button = new JButton("Switch");
              button.addActionListener(new ActionListener() {
                   @Override
                   public void actionPerformed(ActionEvent e) {
                        switchToOpenGl();
              return button;
         // Do the switch.
         protected static void switchToOpenGl() {
              // Make the OpenGL overlay visible / invisible.
              if (!state) {
                   glCanvas.setVisible(false);
              } else {
                   glCanvas.setVisible(true);
              state = !state;
         // Normal swing panel with buttons
         public static JPanel getNormalPanel() {
              if (swingPanel1 == null) {
                   swingPanel1 = new JPanel();
                   for (int i = 0; i < 10; i++) {
                        swingPanel1.add(new JButton("Asdf" + i));
                   swingPanel1.setBackground(Color.black);
              return swingPanel1;
         // Extra panel container just for testing whether background colors show through.
         public static JPanel getAnimationPanel() {
              if (glPanel == null) {
                   glPanel = new JPanel(new BorderLayout());
                   glPanel.setBorder(new EmptyBorder(new Insets(20, 20, 20, 20)));
                   glPanel.setBackground(Color.YELLOW);
                   glPanel.add(getLayerFrame(), BorderLayout.CENTER);
              return glPanel;
         // A component that has two layers (panes), one containing the swing components and one containing the OpenGl animation.
         private static JInternalFrame getLayerFrame() {
              if (layerFrame == null) {
                   // Create a JInternalFrame that is not movable, iconifyable etc.
                   layerFrame = new JInternalFrame(null, false, false, false, false);
                   layerFrame.setBackground(new Color(155, 0, 0));
                   layerFrame.setVisible(true);     
                   // Remove the title bar and border of the JInternalFrame.
                   ((javax.swing.plaf.basic.BasicInternalFrameUI) layerFrame.getUI())
                             .setNorthPane(null);
                   layerFrame.setBorder(null);
                   // Add a normal swing component
                   layerFrame.setContentPane(getNormalPanel());
                   // Add the OpenGL animation overlay on a layer over the content layer.
                   layerFrame.setGlassPane(getGLCanvas());
              return layerFrame;
         // OpenGL component.
         public static GLCanvas getGLCanvas() {
              if (glCanvas == null) {
                   glCanvas = new GLCanvas();
                   glCanvas.setBackground(Color.CYAN);
              return glCanvas;
    }

    Oracle employees typically don't read these forums, you can report bugs here: http://bugs.sun.com/bugdatabase/

  • Changing custom AWT component to Swing component

    I created my own AWT component. I'd like to change it to Swing component.
    Does anyone know how to change or create a custom Swing component?
    Please also provide some framework to develop a custom Swing component.

    First try to know the difference between SWING & AWT. You can either adopt to SWING or AWT but be specific of what you want to do !
    If you like to migrate from AWT to SWING ,then make the necessary changes in your coding.(ie, re frame things like , Frame to JFrame , Button to JButton ,JTextField to JTextField etc..)
    For creating custom components ,say a component called MyLabel and you should design a class which extends JLabel and do whatever you like...
    eg import javax.swing.*;
    public class MyLabel extends JLabel
      MyLabel(String title)
         this.setTitle(title);
         this.setBackground(Color.white);
         this.setForeground(Color.blue);
    }For more details go to java tutorials.

  • Feature request: make the "transform" dialogs non-modal

    Currently, the transformation dialogs accessible at Object>Transform are modal. I'm talking about "Move…", "Rotate…", "Reflect…", and so forth. These dialogs, when open, lock the user out of any interaction with the artboard other than the "preview" button, until the dialog is closed.
    Even more problematically, they lock the scroll and zoom factor of the current user view, so that there's no way to inspect how a precise numeric adjustment affects a part of the layout outside the current window (or within the current window but very small inside it) without committing the change, inspecting it, and then later undoing if necessary. This creates cycles of tedious user adjustments (especially on small monitors) that really should be possible in one user step, by toggling the preview button on and off, and zooming/scrolling.
    This is contrary to most modern UI design principles, which suggest avoiding modes unless they are truly and meaningfully necessary. I don't think this is one of those cases. Photoshop made dialogs for adjustment layers non-modal with CS4, and while there are issues with the newer interface (see John Nack's Configurator workaround), I think it's a win overall. Illustrator needs to catch up in this regard. I realize there is some pretty serious refactoring involved to do this, but it has to be do-able.
    In the words of Larry Tesler's immortal Subaru license plate: "NO MODES"!

    ...make the "transform" dialogs non-modal...
    What, and bring Illustrator out of the 1980s?! Are you mad, man?
    Just so you know you're not alone; I've been complaining about AI's archaic dependency upon modal dialogs for many years.
    ...I'm fully aware of the Transform panel...observing that there's another way to do it...doesn't really address any of my points here...
    But it's not "another way to do it," because the functionality is not the same. The modal dialogs include crucial functionality that cannot be done in the Transform palette. For example, moving something in terms of distance and direction (diagonally), instead of merely by lame X and Y factors. Or transforming about an off-object center of transformation, rather than merely by the 9-point proxy.
    ...the "preview" isn't updated on keyboard entry, and the "preview" checkbox need to be manually toggled on and off...
    But the preview does refresh (and does not have to be toggled) in response to keyboard entry if that keyboard entry is by the arrow keys. For example: Select something, doubleClick the Scale tool, click your cursor in the Uniform value field, and tap the up/down arrow keys (or press and hold them). The value will increment and the preview will update with each key tap. (Be sure to teach that to your students.)
    That does not, of course, negate the complaint, but it does ameleorate it somewhat. The increments are preset; there are no preference settings for them. (Don't even get me started on preferences that should be doc-specific settings, and vice-versa).
    Nor does the valid point that problematic dialogs abound beyond just those associated with the transform tools, but I do agree with it. For just one of many examples, it's nothing short of idiotic that the Scale fields of Transform Each do not have a uniform scaling lock, and that only percentage fields are provided and no explicit dimension fields. Illustrator is quite saturated with such inconsistencies and half-baked implementations.
    But...you're often arguing with the emotionally attached Illustrator devoted here. So I wouldn't recommend holding your breath. It would probably be more effective teaching Illustrator's shortcomings to your beginning students. Probably one of the easiest ways to explain the problem of modal dialogs is to point out that you can't change the current selection with the dialog open.
    JET

  • Swing component's margin in a frame

    Hello all,
    When you set the bounds of a Swing component in a frame, it will automatically apply those bounds to the VISIBLE part of the frame, so that, a Y value of 0, for example, will not be at the very top of the frame, but right underneath the title bar of the frame. If you give a regular AWT a value of 0 to it's Y coordinate, part (or all) of it will be covered by the title bar of the frame. This does not happen with Swing components, which automatically add the height of the title bar to the value you give to their Y coordinate.
    Now, what I want to know is, how can I retrieve the value of that "automatic margin"?. How can I know the number of pixels that the Swing component is being slided down, in order to save the title bar of the frame? This value can not be constant, since it will differ from one platform to another, and from one Look 'n Feel to another, but I have not been able to find out the way to get the value that it's being applied in each case.
    As allways, many thanks in advance for your help.

    Don't know if there is any direct way to get this information. But, assuming the border width/height is equal on all four sides you could try something like:
    Dimension frameD = frame.getSize();
    Dimension contentD = frame.getContentPane().getSize();
    int borderWidth = frameD.width - contentD.width;
    int titleHeight = frameD.height - contentD.height - borderWidth;

  • Suggestion: Please make the Combine Files dialog modal to the Acrobat application instance.

    I often combine files into a PDF with Acrobat (XI). It is annoying that the main Acrobat window is shown while the Combine Files dialog window is open. I often review other PDF files during the process of selection for later combination. It happens far too often, that I accidentally close the Combine Files instance main Acrobat window during the process and subsequently lose the already specified file selection. I would suggest to make the Combine Files dialog modal for the Acrobat instance so that users would have to close the Combine Files dialog first, before closing the instance. I would appreciate this in a future update. Thanks a lot.
    Acrobat installé : C:\Program Files\Adobe\Acrobat 11.0\Acrobat\Acrobat.exe
        Version : 11.0.03.37
        Date de création : 2013/05/11
        Heure de création : 12:37:32
    Cartes graphiques : NVIDIA GeForce 9600 GT
        Version : 9.18.13.2018
        Vérification : OK
    Détails d’Acrobat :
       Sandboxing : Désactivé
       Captive Reader : Non
       Lecteur multiple sur un bureau : Désactivé
    Détails de l’affichage :
       Largeur d’écran : 1920
       Hauteur d’écran : 1080
       Nombre de moniteurs : 1
       Nombre de boutons de la souris : 3
       Possède une roulette : Oui
       Possède un stylet Windows : Non
       Jeu de caractères codés sur deux octets : Non
       Possède un éditeur de méthode d’entrée : Oui
       Dans l’environnement du lecteur d’écran : Non
    Détails de la session :
       Type de démarrage : Normal
       En cours d’arrêt : Non
       Réseau : Disponible
       Dans l’environnement Citrix : Non
       Dans l’environnement VMWare : Non
       Session à distance : Non
       Contrôle à distance :  Non
    Détails du compte :
       Droits utilisateur : Standard
       Contrôle de compte d’utilisateur : Par défaut
       Intégrité du processus : Non défini
       Type de profil : Aucun
    Détails sur Windows :
       Tablet PC : Oui
       Starter Edition : Non
       Media Center Edition : Oui
       Ordinateur lent : Non
    Dossier temporaire :C:\Users\Emploi\AppData\Local\Temp\
    Dossier Windows :C:\Windows
    Fabricant du système d'exploitation :Microsoft Corporation
    Fuseau horaire :Paris, Madrid
    Mémoire physique disponible :1783552 KB
    Mémoire physique totale :3669304 KB
    Mémoire virtuelle disponible :1922544 KB
    Mémoire virtuelle totale :2097024 KB
    Messagerie par défaut :Microsoft Outlook
        mapi32.dll
        Version : 1.0.2536.0 (win7_rtm.090713-1255)
        Date de création : 2010/11/20
        Heure de création : 23:29:12
    Moniteur :
        Nom :NVIDIA GeForce 9600 GT
        Résolution :1920 x 1080 x 59
        Bits par pixel :32
    Navigateur par défaut :C:\Program Files\Internet Explorer\iexplore.exe
        Version : 10.00.9200.16521 (win8_gdr_soc_ie.130216-2100)
        Date de création : 2013/07/10
        Heure de création : 10:54:20
    Nom du système :PRIVÉ-WT
    Nom du système d'exploitation :Microsoft Windows Vista
    Nom d'utilisateur :Emploi
    Paramètres régionaux :Français (France)
    Processeur :x86 Family 16 Model 5 Stepping 3  AuthenticAMD  ~3315  Mhz
    Taille de la page :4194303 KB
    Version BIOS :A_M_I  - 9001119
    Version du système d'exploitation :6.1.7601  Service Pack 1

    All feature requests must be made via the official web page:  http://www.adobe.com/go/wish

Maybe you are looking for