JFrame setUndecorated problem

I set my JFrame undecorated like this:
jframe.removeNotify();
jframe.setUndecorated(true);
jframe.setVisible(true);This works great, only my textFields get unselectable when i use removeNotify(). When i don't use removeNotify, my frame doesn't get undecorated. When i click on a button, the textfields are selectable again.
How can i solve dis problem?

oeps. it's the textfields are selectable again when an other frame is opened and the focus had gone back to the frame with the textFields.
Probably it has something to do with a focus.... ???

Similar Messages

  • Problem with JFrame.setUndecorated(true)

    I am using a L&F that overrides the JFrame's default title bar, which requires that the following methods are called before showing my main gui.
    JFrame.setDefaultLookAndFeelDecorated(true);
    JDialog.setDefaultLookAndFeelDecorated(true);after gui is shown, i have a process that pops up a new JFrame with a progress bar, with a splash screen feel (no title bar), but ever since i called the above methods, i cant get the title bar to go away.
    JFrame frame = new JFrame("go away");
    frame.setUndecorated(true);how can i have my cake and eat it too? (draw main gui with new title bar L&F, then show splash/progress without title bar)
    thanks,
    mark

    I don't play with the default LAF but have you tried something like:
    JFrame.setDefaultLookAndFeelDecorated(true);
    JDialog.setDefaultLookAndFeelDecorated(true);
    JFrame frame = new JFrame(...)
    frame.setVisible(true);
    JFrame.setDefaultLookAndFeelDecorated(false);
    JDialog.setDefaultLookAndFeelDecorated(false);
    Show your splash screen here
    JFrame.setDefaultLookAndFeelDecorated(true);
    JDialog.setDefaultLookAndFeelDecorated(true);

  • JFrame decorations problem

    Greetings:
    I've found searching at the net, that it is suggested "that the L&F (rather than the system) decorate all windows. This must be invoked before creating the JFrame. Native look and feels will ignore this hint". The command that does this is the static JFrame.setDefaultLookAndFeelDecorated(true); .
    If I install Metal L&F as default, and then go to Full Screen and change the L&F, it partially WORKS (the Metal L&Fdecorations are set like in an InternalFrame); but if I set the System L&F as default and change the L&F, the new L&F does not recive its propper decorations but rather the system ones.
    Could anyone help me in this issue?
    Thanks a lot in advanced.
    Javier
    // java scope
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import com.sun.java.swing.plaf.motif.*;
    public abstract class LandFTest {
       public static void main(String[] args) {
          try {UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } //UIManager.getCrossPlatformLookAndFeelClassName()
          catch (Exception e) { }
          SwingUtilities.invokeLater(new Runnable() {
             public void run() { JFrame.setDefaultLookAndFeelDecorated(true);
                                 MainWin myWindow = new MainWin(" Look & Feel Test");
                                 myWindow.pack();
                                 myWindow.setVisible(true); }
    class MainWin extends JFrame {
          public Box mainLayout = new MainComponent(this);
             public JScrollPane mainLayoutScrollPane = new JScrollPane(mainLayout);
          public Boolean FullScrnOn=false;
       public MainWin (String mainWin_title) {
          Container framePanel = this.getContentPane();
          this.setTitle(mainWin_title);
          this.setLocationRelativeTo(null);
          this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          framePanel.add(mainLayoutScrollPane,BorderLayout.CENTER);
    class MainComponent extends Box {
          Box controls_Box = Box.createHorizontalBox();
          Box lfControl_Box = Box.createVerticalBox();
          JRadioButton landfRadioButton1 = new JRadioButton(" Metal skin (Java)"),
                       landfRadioButton2 = new JRadioButton(" System skin",true),
                       landfRadioButton3 = new JRadioButton(" Motif skin");
          ButtonGroup lanfFButtonGroup = new ButtonGroup();
          JButton fullScrnButton = new JButton("Full Screen On");
    public MainComponent(MainWin refFrame){
          super(BoxLayout.Y_AXIS);
          this.initMainCompopent(refFrame);
          this.setMainComponent();
       public void initMainCompopent (MainWin refFrame) {
           LookAndFeel_ActionListener landFListener = new LookAndFeel_ActionListener(lanfFButtonGroup, refFrame);
           FullScreen_ActionListener fullSCrnListener = new FullScreen_ActionListener(refFrame);
          lfControl_Box.setBorder(BorderFactory.createTitledBorder(" Look & Feel Control "));
          landfRadioButton1.setActionCommand("Java");
             landfRadioButton1.addActionListener(landFListener);
             lanfFButtonGroup.add(landfRadioButton1);
          landfRadioButton2.setActionCommand("System");
             landfRadioButton2.addActionListener(landFListener);
             lanfFButtonGroup.add(landfRadioButton2);
          landfRadioButton3.setActionCommand("Motif");
             landfRadioButton3.addActionListener(landFListener);
             lanfFButtonGroup.add(landfRadioButton3);
          fullScrnButton.addActionListener(fullSCrnListener);
          fullScrnButton.setAlignmentX(Component.CENTER_ALIGNMENT);
       public void setMainComponent () {
          controls_Box.add(Box.createHorizontalGlue());
          controls_Box.add(lfControl_Box);
             lfControl_Box.add(landfRadioButton1);
             lfControl_Box.add(landfRadioButton2);
             lfControl_Box.add(landfRadioButton3);
          controls_Box.add(Box.createHorizontalGlue());
          this.add(Box.createVerticalGlue());
          this.add(controls_Box);
          this.add(Box.createVerticalGlue());
          this.add(fullScrnButton);
          this.add(Box.createVerticalGlue());
    class LookAndFeel_ActionListener implements ActionListener {
          private ButtonGroup eventButtonGroup;
          private MainWin eventFrame;
       public LookAndFeel_ActionListener (ButtonGroup buttonGroup, MainWin eventFrame) {
          this.eventButtonGroup = buttonGroup;
          this.eventFrame = eventFrame;
       public void actionPerformed(ActionEvent event) {
          String command = eventButtonGroup.getSelection().getActionCommand();
          GraphicsDevice scrnDevice = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
          eventFrame.dispose();
          if (command.equals("System")) {
            try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); }
            catch (Exception e) { }
          else { if (command.equals("Java")) {
                   try { UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());}
                   catch (Exception e) { }
                 else { if (command.equals("Motif")) {
                          try { UIManager.setLookAndFeel(new MotifLookAndFeel()); }
                          catch (Exception e) { }
                        else { }
          SwingUtilities.updateComponentTreeUI(eventFrame);
          if (eventFrame.FullScrnOn){ try {scrnDevice.setFullScreenWindow(eventFrame); }
                                      finally {  }
          } else { JFrame.setDefaultLookAndFeelDecorated(true); }
          eventFrame.setVisible(true);
          //eventFrame.getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
    class FullScreen_ActionListener implements ActionListener {
          private MainWin eventFrame;
       public FullScreen_ActionListener (MainWin eventFrame) {
          this.eventFrame = eventFrame;
       public void actionPerformed(ActionEvent event) {
             MainComponent mainFrameLayout = (MainComponent)eventFrame.mainLayout;
             GraphicsDevice scrnDevice = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
          if (!eventFrame.FullScrnOn){
             if (scrnDevice.isFullScreenSupported()) {
                // Enter full-screen mode with an undecorated JFrame
                eventFrame.dispose();
                eventFrame.setUndecorated(true);
                eventFrame.setResizable(false);
                mainFrameLayout.fullScrnButton.setText("Full Screen Off");
                eventFrame.FullScrnOn=!eventFrame.FullScrnOn;
                try {scrnDevice.setFullScreenWindow(eventFrame); }
                finally {  }
             } else { JOptionPane.showMessageDialog(eventFrame, "Full Screen mode is not allowed \nby the system in this moment.",
                                                                " Full Screen Info", JOptionPane.INFORMATION_MESSAGE); }
          else { // Return to Windowed mode mode with JFrame decorations
                  eventFrame.dispose();
                  eventFrame.setUndecorated(false);
                  eventFrame.setResizable(true);
                  mainFrameLayout.fullScrnButton.setText("Full Screen On");
                  eventFrame.FullScrnOn=!eventFrame.FullScrnOn;
                  try { scrnDevice.setFullScreenWindow(null); }
                  finally { }
          eventFrame.setVisible(true);
    }

    Greetings:
    Thanks a lot for your kind answer:
    After reading your reply, I've done some studies directly in the API in how does the L&F's are managed. Of what I've understood (please correct me if I'm wrong), the things are as follow:
    i) System and Motif Look and Feel's does NOT support decorations, so that's why you should let the JVM do the decoration work (that is, use myFrame.setUndecorated(false); ).
    In this case, it does not matter if you use JFrame.setDefaultLookAndFeelDecorated(true); before the creation of the frame: it won't show decorations if you don't use the command mentioned.
    ii) Metal (Java) Look and Feel DOES support decorations; that's why, if you use JFrame.setDefaultLookAndFeelDecorated(true); before the creation of the frame, you'll see it's own decorations. In this case, you should use myFrame.setUndecorated(true); so the L&F does all the decorating work, avoiding the weird sitiuation of showing double decorating settings (L&F's and native system's).
    iii) So, the real problem here would be if you want to have, as a user choice, that the System/Motif L&F's will be available together with the Java's (Metal). I've made the next variation to my code, so that this will be possible:
    class LookAndFeel_ActionListener implements ActionListener {
    private ButtonGroup eventButtonGroup;
    private MainWin eventFrame;
    public LookAndFeel_ActionListener (ButtonGroup buttonGroup, MainWin eventFrame) {
    this.eventButtonGroup = buttonGroup;
    this.eventFrame = eventFrame;
    public void actionPerformed(ActionEvent event) {
    String command = eventButtonGroup.getSelection().getActionCommand();
    GraphicsDevice scrnDevice = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
    eventFrame.dispose();
    if (command.equals("System")) {
    try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    eventFrame.setUndecorated(false); // make sure the native system controls decorations as this L&F doesnt's manage one's.
    catch (Exception e) { }
    else { if (command.equals("Java")) {
    try { UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); }
    catch (Exception e) { }
    eventFrame.setUndecorated(true); // make sure the L&F controls decorations as it actually has one's.
    else { if (command.equals("Motif")) {
    try { UIManager.setLookAndFeel(new MotifLookAndFeel()); }
    catch (Exception e) { }
    eventFrame.setUndecorated(false); // make sure the native system controls decorations as this L&F doesnt's manage one's.
    else { }
    SwingUtilities.updateComponentTreeUI(eventFrame);
    if (eventFrame.FullScrnOn){ try {scrnDevice.setFullScreenWindow(eventFrame); }
    finally { }
    } else { }
    eventFrame.setVisible(true);
    }iv) The issue here is that, as I needed to use myFrame.dispose() (the JVM says that it is not possible to use setUndecorated(false); in a displayable frame), I recieve and error:
    Exception in thread "AWT-EventQueue-0" java.lang.IllegalStateException: Buffers have not been created
    at sun.awt.windows.WComponentPeer.getBackBuffer(WComponentPeer.java:846)
    at java.awt.Component$FlipBufferStrategy.getBackBuffer(Component.java:3815)
    at java.awt.Component$FlipBufferStrategy.updateInternalBuffers(Component.java:3800)
    at java.awt.Component$FlipBufferStrategy.revalidate(Component.java:3915)
    at java.awt.Component$FlipBufferStrategy.revalidate(Component.java:3897)
    at java.awt.Component$FlipBufferStrategy.getDrawGraphics(Component.java:3889)
    at javax.swing.BufferStrategyPaintManager.prepare(BufferStrategyPaintManager.java:508)
    at javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:264)
    at javax.swing.RepaintManager.paint(RepaintManager.java:1220)
    at javax.swing.JComponent.paint(JComponent.java:1015)
    and, yet, the Metal (Java's) L&F keeps without decorations. Is it there a way to solve this without having to create a new instance of the frame and use JFrame.setDefaultLookAndFeelDecorated(true); before the creation of such new instance of the frame for the Metal's (Java) L&F?
    Thanks again for al lthe help: this was, definetelly, something not obvious to figure out (or to find a hint on the net).
    Regards,

  • Undecorated jframe resize problem

    i created a custom jframe look by setting a jframe to undecorated and designing my own maximize/minimize/close buttons and other things to improve its appearence
    the problem is that when set to undercorated all the default resizing/move methods are gone
    i tried implementing my own resize methods, they seem to work but it flashes like crazy while resizing
    anyone have any idea how to stop all the flashing or a better way to implement this?
    the following is a small example of the problem i am having, i only implemented the north resize part so the code can be easier to read.
    thnx in advance
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.imageio.*;
    import java.io.*;
    import java.awt.image.BufferedImage;
    public class TestFrame extends JFrame implements MouseMotionListener, MouseListener
         Point sp;
         int     compStartHeight;
         int minHeight = 100;
         JPanel frameContent = new JPanel();
         public TestFrame()
              super("testing frame");
              setSize(600, 600);
              setContentPane(frameContent);
              frameContent.setBackground(Color.black);
              frameContent.setLayout(new BoxLayout(frameContent, BoxLayout.Y_AXIS));     
              setUndecorated(true);
              addMouseMotionListener(this);
              addMouseListener(this);
              JButton testButton = new JButton("TEST");
              JButton testButton2 = new JButton ("TEST2");
              frameContent.add(testButton);
              frameContent.add(Box.createVerticalGlue());
              frameContent.add(testButton2);
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              setVisible(true);
         public void mouseMoved(MouseEvent e)
              Point p = e.getPoint();
              if (p.y > e.getComponent().getSize().height - 5)
                   setCursor( Cursor.getPredefinedCursor( Cursor.N_RESIZE_CURSOR ));
              else
                   setCursor( Cursor.getPredefinedCursor( Cursor.DEFAULT_CURSOR));
         public void mouseDragged(MouseEvent e)
              Point p = e.getPoint();
              int compWidth = getSize().width;
              if (getCursor().getType() == Cursor.N_RESIZE_CURSOR)
                   int nextHeight = compStartHeight+p.y-sp.y;
                   if (nextHeight > minHeight)
                        setSize(compWidth,nextHeight);
                        validate();
              else
                   int x = getX()+p.x-sp.x;     
                   int y = getY()+p.y-sp.y;     
                   setLocation(x,y);
         public void mousePressed(MouseEvent e)
              sp = e.getPoint();
              compStartHeight = getSize().height;
         public void mouseEntered(MouseEvent e)
        public void mouseExited(MouseEvent e)
              if (sp == null)
                   setCursor( Cursor.getPredefinedCursor( Cursor.DEFAULT_CURSOR));
        public void mouseClicked(MouseEvent e)
        public void mouseReleased(MouseEvent e)
              sp = null;
         public static void main(String[] args)
         new TestFrame();
    }

    I doubt there is a faster / easier way to resize.
    Have you tried adding
    public boolean isDoubleBuffered()
      return true;
    }To over-ride Component.isDoubleBuffered. This should sort out your flickering problem.
    Bamkin

  • JFrame applications problem

    Hi, i'm just starting out writing swing applications and i'm having a few problems.
    Don't bother answering this if you think i'm too stupid because i don't want to waste your time.
    Whenever i write a swing application, it compiles but when i try to run it i get: <b>Exception in thread "main" java.lang.NoSuchMethodError: main</b>
    Heres my code:
    <code>
    import java.awt.*;
    import javax.swing.*;
    public class swingframe extends JFrame
         private JButton but;
         public swingframe()
                   Container c=getContentPane();
                   c.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
                   c.setBackground(Color.black);
                   but = new JButton("Wyld Stallyns Rule!!!");
                   but.setBackground(Color.green);
                   c.add(but);
    </code>
    Sorry again if i'm wasting your time.
    <b>Thanks</b>

    import java.awt.*;
    import javax.swing.*;
    public class SwingFrame extends JFrame{
       private JButton but;
       public SwingFrame(){
          Container c=getContentPane();
          c.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
          c.setBackground(Color.black);
          but = new JButton("Wyld Stallyns Rule!!!");
          but.setBackground(Color.green);
          c.add(but);
          this.setSize(200, 200);
          this.setDefaultCloseOperation( EXIT_ON_CLOSE );
       public static void main(String []args){
          new SwingFrame().show();
    }

  • JFrame minimizing problem

    I am writing an application where i have many JFrames on the screen at the same time. The problem is that when i click on a menu item in one of the screens the rest of them get minimized. Is there any way of preventing this without using JInternalFrames.

    can you please supply source code, I may not be able to help but other's can.

  • JFrame Dispose Problem

    Hello everyone,
    This is probably a really easily answerable question and I think the reason is that I have the problem is because I'm getting a stack overflow but I am not sure how to solve it.
    So, my program is a simple login and logout program
    A login JFrame creates a new Main JFrame when log in is pressed, then login is disposed.
    When a user logs out of the main frame, a new Login Frame is created and the Main Frame disposed
    The problem is that when the user logs in again, the main frame is created but the login frame remains even though dispose is called,
    why is this?
    Any help at all is greatly appreciated!
    Cheers

    why is this?You have a bug in your code.
    For more help create a [SSCCE (Short, Self Contained, Compilable and Executable, Example Program)|http://sscce.org], that demonstrates the incorrect behaviour.
    Don't forget to use the Code Formatting Tags so the posted code retains its original formatting. That is done by selecting the code and then clicking on the "Code" button above the question input area.

  • JFrame setResizable problem

    hi everybody,
    i'm using j2sdk1.4.2_03 and i want a JFrame all time maximized, i used:
    frame.setExtendedState(Frame.MAXIMIZED_BOTH);
    frame.setResizable(false);
    but if i double click on the upper bar the window is still resizable, do anybody of you know where is my problem?
    thanks

    http://developer.java.sun.com/developer/bugParade/bugs/4465093.html

  • JFrame refesh problem

    I was building a huge app... And at one point, a problem appeared. Spent hours on it. Then I cut it down to the most simple element.
    I have an app, this is all it does: creates a frame and changes the color of the background. Yet for some reason, I need to resize for the background color to be applied.
    JFrame APP_FRAME = new JFrame();          
    APP_FRAME.getContentPane().setBackground( Color.black );
    APP_FRAME.setBackground( Color.black );
    APP_FRAME.setVisible( true );
    APP_FRAME.setSize( 645, 512 );
    That's all it is! The black background doesn't apply unless I resize! It works when I set the background color directly on the frame rather than the ContentPane... But later on, I add tons of things in my ContentPane, and I still have the bug of having to resize to get an initial display.
    I would appreciate any help, I can't believe I'm stuck on such a detail!
    Thanks in advance,
    JN

    Still nothing...
    I created a whole new program:
    import java.awt.Color;
    import javax.swing.JFrame;
    JFrame frm = new JFrame();
    frm.setVisible(true);
    frm.getContentPane().setBackground(Color.blue);
    frm.pack();
    frm.setSize(640,480);
    as simple as it gets.. My windows appears in 640X480 but with a gray background. Why doesn't it start off in blue! :-(

  • JFrame movability problem...

    Hi All.
    How to make the JFrame immovable.
    that is ,the frame should not be dragged or resized by the user.
    Kindly help me out to sove this problem.
    I tried frame.setResizable(false);
    but it does not worked out.
    Regards,
    Sdivyya

    javax.swing.JWindow.....

  • JFrame Repaint problem

    I am new to Java Swing and I have a problem.
    I have a GUI program which extends JFrame and contains some business logic. In the middle of executing the business logic, I need to display a chart and I used another JFrame to display the chart. The chart did display but once the control return back to the original process, the chart Jframe turn blank. How can I get the display of the chart until user closes it?
    public class ChangeMetric extend JFrame implements ActionListener {
    public void actionPerformed(ActionEvent event) {
    JFrame jf = new JFrame();
    JPanel jp = new JPanel();
    jp.setSize(500,500);
    jf.getContentPane().add(jp);
    jf.setVisible(true);
    JOptionPane.showConfirmDialog(null, "Report has been saved to : " + path + "\n " +
                   "Do you want another report?", "Completed", JOptionPane.YES_NO_OPTION);
    //Jf turn blank after the JoptionPane displayed.
    Thanks in advance.
    Alex

    I need to display a chart and I used another JFrame to display the chart.An application should only have a single JFrame. Use a JDialog instead. You create it the same way you do a JFrame, the only difference is you specify the frame as the owner.
    Jf turn blank after the JoptionPane displayed.Then you must be doing something really wierd in your code. There is no reason for the option pane to have any effect on your dialog.
    And when you post your SSCCE, don't forget to use the Code Formatting Tags so the posted code retains its original formatting. That is done by selecting the code and then clicking on the "Code" button above the question input area.

  • JFrame.setSize() problem

    I'm facing a strange problem. I have a class derived from JFrame which is the main application frame window. Problem is I'm not able to set its size arbitrarily e.g. in following call to setSize(...) even if I replace 700 with 100 OR 1000 or whatever, the frame is always displayed of some fixed size . I can't find out why .. any clues ?
    JGuessFrame() {
    this.setSize(700, 700);   
    // Center the window on the screen
    setLocationRelativeTo(null);
    setDefaultLookAndFeelDecorated(true);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }

    try this:
    JGuessFrame() {
    this.setSize(700, 700);
    // Center the window on the screen
    setLocationRelativeTo(null);
    setDefaultLookAndFeelDecorated(true);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    this.pack(); // maybe this will help
    // if not then try this
    this.repaint();

  • JFrame restoration problem.

    Hello everyone!!
    My problem is:
    I have a jframe inside of that there's a jpanel.
    the jpanel mouse listener calls a method in a different class that uses the graphic reference of the jpanel to draw. once I minimize and maximize the jframe the drawing disappear. once I click on the area where drawing used to be it appears again.
    I have an inner window listener class in the jframe which calls the same method in the same instance of the other class but nothing happens until I click on the area on the mouse listener calls the method!!
    please help.

    Go through ths tutorial:
    The Java&#8482; Tutorials: [Performing Custom Painting|http://java.sun.com/docs/books/tutorial/uiswing/painting/index.html]
    After that, if you still have a question, post a SSCCE that clearly demonstrates the problem.
    db

  • Switch JFrame setUndecorated On and Off, help

    i need to make a frame so that if the user hits f4 the frame decorations
    disappear.
    If i open the frame with setundecorated(true) the frame works fine.
    The same with the default setUndec(false).
    However it is unable to switch from one to the other.
    A jframe can only be undecorated when it is undispalayble.
    How do i make it undisplayable but displayed?
    If i call removeNotify() (the only way i know to make the frame
    undisplayable - otherwise setundec throws an error) the frame closes.
    Anyone have any suggestions? this is really important! thanks alot!

    Here's a slight modification. Notice I had to re-map action and keyStroke.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class UndecoratedFrameTest extends JFrame {
        private boolean unDecorated = false;
        private DecorateAction action;
        private JPanel mainPanel;
        public UndecoratedFrameTest() {
            action = new DecorateAction("Toggle");
            buildGUI();
        private void buildGUI() {
            mainPanel = (JPanel) getContentPane();
            mainPanel.setLayout(new BorderLayout());
            JPanel centerPanel = new JPanel();
            centerPanel.add(new JLabel("Center"));
            mainPanel.add(centerPanel, BorderLayout.CENTER);
            setUndecorated(unDecorated);
            JButton decButton = new JButton(action);
            mainPanel.add(decButton, BorderLayout.SOUTH);
            mainPanel.getActionMap().put("toggle", action);
            mainPanel.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_F4, 0), "toggle");
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            pack();
            setLocationRelativeTo(null);
        private void toggleDecoration() {
            dispose();
            setUndecorated(!unDecorated);
            mainPanel.getActionMap().put("toggle", action);
            mainPanel.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_F4, 0), "toggle");
            setVisible(true);
            unDecorated = !unDecorated;
        public static void main(String[] args) {
            Runnable runnable = new Runnable() {
                public void run() {
                    UndecoratedFrameTest undecoratedFrameTest = new UndecoratedFrameTest();
                    undecoratedFrameTest.setVisible(true);
            SwingUtilities.invokeLater(runnable);
        private class DecorateAction extends AbstractAction {
            public DecorateAction(String name) {
                super(name);
            public void actionPerformed(ActionEvent e) {
                toggleDecoration();
    }Cheers
    DB

  • Modal dialog to a JFrame creates problem in windows XP

    I have a problem with JDialog(modal) when it is set to a JFrame.
    It works when the focus is on the dialog.
    If some other application is selected from the taskbar of the windows XP and selecting back the JFrame, the dialog is not poping up on to the frame but it is hided. The dialog can be accessed by selecting Alt+Tab.
    Any solution for this.Pl help.

    hi!
    you need to create a Short, Self Contained, Compilable and Executable, Example Program that demonstrates the incorrect behaviour, so that any one can easily understand where you are doing a mistake.
    And don't forget to use the Code Formatting Tags so the code retains its original formatting.
    :)

Maybe you are looking for

  • Partner function in header level of sales order

    Hi All, During the sales order create/change (VA01/va02). Depending upon the business unit i want to populate partner function. I have modified the user exit "MV45AFZZ - userexit_save_document_prepare " and userexit_save_document . i tried both the e

  • How to convert a PFX file into mobileconfig format?

    Hi, I'm trying to automate the task of creating a mobileconfig file with a client certificate in it. I understand that this is some kind of base64 encoding, but I don't get what they're encoding. My PFX files are protected with a password (Although I

  • Power Point Import

    Hi All The custom animation set in power point is not reflected while the slides are imported into captivate. Imported slides are appearing as image. Is there any settings. Please clarify Thanks

  • Conversion of VIs from LabView 2013 to 2011

    Hi, I would be grateful for conversion of zipped VIs from LabView 2013 to 2011. Thank You, Michal Solved! Go to Solution. Attachments: main VIs.zip ‏38 KB

  • Captions in slideshow

    I am able to see captions for individual images. I do not see them in the slideshow. Must I selection this display option somewhere or are captions not viewable in the starter edition?