JFrame without  _| |X

Hi, I guess it's in the APIs, but I have looked for it and I cannot find. I guess it must be something really easy. How can I create a JFrame without the "minimize", "maximize", and "close" buttons?
Thanks.

As well as the apis there are zillions of posts already asking this question:
http://onesearch.sun.com/search/developers/index.jsp?charset=UTF-8&qt=jframe+minimise+button&col=devforums
I believe it is not possible to keep the title bar and lose the buttons, if that is what you wanted.

Similar Messages

  • Print JFrame without title bar and border

    I am trying to print out a JFrame which contains two JPanels. The following code is part of my implementation of Printable which prints the entire JFrame including the title bar and border. I've considered implementing Printable in the JPanel classes but then I don't know how I would get everything on one page as a single image. Is there some way to just print the contentPane of the JFrame?
         public int print(Graphics g, PageFormat pf, int pi)
              throws PrinterException {
              if (pi >= 1) {
                   return Printable.NO_SUCH_PAGE;
              Graphics2D g2 = (Graphics2D) g;
              double scaleX = pf.getImageableWidth()/getWidth();
              double scaleY = pf.getImageableHeight()/getHeight();
              double scale = 1;
              g2.translate((int) pf.getImageableX(), (int) pf.getImageableY());
              if (scaleX < 1 || scaleY < 1) {
                   scale = scaleX < scaleY ? scaleX : scaleY;
                   g2.scale(scale,scale);
              printAll(g2);
              return Printable.PAGE_EXISTS;
         }                    

    Thanks.
    I can get the Jframe without the title bar and I can get it to drag on the desktop with your suggestions. I still need it to have rounded edges.

  • Closing all JFrames without killing the application

    Is there a way I can close all JFrames without quiting the application? I have several JFrames open that I want to dispose of at the same time. Is this possible?

    If you close all the JFrames, then how does the user
    interact with the application?I think that's outside the scope of the original question, but there are a number of possibilities. To name just a few:
    1) The console
    2) The program opens a new JFrame after some time has elapsed (maybe an appointment reminder application, or an instant messenger client, for example)
    3) The program is really a server, so you don't need to see anything
    4) The program is "spyware" so it's meant to be hidden
    5) The program runs in full-screen mode part of the time (for example, a game which uses JFrames to choose options, then full-screen for game play)
    ...

  • Resize JFrame without flickering

    When I try to resize my frame with the setSize() methode it starts
    flickering but if i resize with the mouse it works fine.
    Is there an other solution to resize a JFrame without flickering?
    import java.awt.*;
    import javax.swing.*;
    public class TestFrame extends JFrame  {
        JPanel panel = new JPanel();
        JButton button = new JButton("Resize");
        public TestFrame() {
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            setSize(200,200);
            setLayout(new GridLayout());
            panel.setBackground(Color.red);
            button.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    setSize(getSize().width + 1, getSize().height + 1);
            this.add(button);
            this.add(panel);
        public static void main(String[] args) {
            TestFrame frame = new TestFrame();
            frame.setVisible(true);
    }

    frame.setUndecorated(true);and implement MouseListener and MouseMotionListener for resizing by mouse dragging on the edge

  • Disabling Maximize option from JFrame without disabling the resizing option

    Hi all,
    I want to know how we can disable the maximize option of a JFrame window without disabling the resizing option. I have tried JFrame.resizable(false). It disables both maximizing and resizable option. But I need the resizable option to be working.
    Anyone can help me?
    Thanks in Advance

    this works OK on 1.5.0_05 (unsure about other versions)
    and you'll lose the minimize as well
    import javax.swing.*;
    import java.awt.*;
    class Testing
      public void buildGUI()
        JFrame f = new JFrame("JFrame");
        f.setUndecorated(true);
        f.getRootPane().setWindowDecorationStyle(JRootPane.PLAIN_DIALOG);
        f.setSize(400,300);
        f.setLocationRelativeTo(null);
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setVisible(true);
      public static void main(String[] args)
        SwingUtilities.invokeLater(new Runnable(){
          public void run(){
            new Testing().buildGUI();
    }

  • JFrame without icon in taskbar

    Hi to you all.
    I'm writing an application that needs to open many(from 1 to as many the user opens) distinct JFrame on the desktop. I would like to eliminate the icon in the taskbar[I don't know if the name "taskbar" is correct 'cause I'm not anglophone, however, the one with the start button on it ;) ]. I searched carefully in the whole JFrame javadoc but found no method that could help me. It's because it doesn't exist or because I didn't find it? I also looked for it in the forums but I wasn't able to find something there neither.
    Thanks

    I had a similar problem right now. I was trying to get a JWindow behave correctly with focus events, but had no luck with it.
    Then first I tried to do it with a JFrame, but didn't like the thing you talked about: The taskbar icon of the JFrame.
    But then I remembered dialogs as they have no taskbar icon.
    So to do your stuff just use a JDialog, put it setUndecorated(true) (to take away the title bar if you need to) and you're good to go.
    To catch focus events, use windowFocusListener and get focus with requestFocus().
    The problem you had is this: The JWindow (and WIndow) have much more strict requirements for gaining focus than with dialogs and frames. For these matters see Java API for Window class, methods isFocusableWindow() and getFocusableWindowState().
    To get JWindow's focus work, you have to have its owner visible and a visible focusable child component in the window (in its contentPane).
    Sidenote: Actually I was looking for an answer for my problem from this thread and even read mlk's suggestion about dialogs, but it didn't ring any bells at that time (well it seems that I have 5 minute wiring...).

  • JFrame without titlebar and stuff

    Hi!
    I want to replace the standard titlebar and buttons and so with one's o've created myself. I tried using a JWindow but that one doens't show up in the toolbar in Windows XP (like a JFrame does). Is there a component that does show up in the toolbar, but doens't have a titlebar with the _ [] X buttons on it?
    Many thanks in advance

    Try calling setUndecorated(true) on your frame. That will take away everything that you don't want.

  • Placing a new Jpanel on a JFrame without moving the existing components.

    I am creating an application in which data is entered over several screens a next button is used to get to the next screen similar to how a wizard functions. To do this I use a JFrame with several panels on top of it each panel on top of the jframe rather than on top of each other. Each panel contains buttons and radio buttons.
    The problem I have is that every time I drag a new Jpanel on to the JFrame it pushes all my carefully arranged controls on the existing panel to the side. The problem seems to be partly because when a new panel is dragged on to the screen it is placed as a component on the already existing panel rather than on the JFrame.
    Is there a way to freeze the components on the panel so they wont more or to place a panel directly onto the jframe rather than onto the previous jpanel to avoid disrupting the previous frame.
    I have played around with the properties but have not had any luck.
    Thanks for any help.

    I am creating an application in which data is entered over several screens a next button is used to get to the next screen similar to how a wizard functionsThe [Card Layout Actions|http://www.camick.com/java/blog.html?name=card-layout-actions] may help in this process.

  • Closing a JFrame without using System.exit(0)

    Hello all,
    I'm writting an application at the moment that uses a JFrame as an "about box" invoked when a menu item from another JFrame is selected . The about box is set to undecorated, and I have set up an Thread to handle an animation of the credits that move up slowly. I have also added into it code to play a sound file while the credits are running.
    I wanted to have it so that the user can just click once anywhere on the Panel area of the about box, and that would close the about box window and stop the sound.
    I can get it to stop the sound on click no problem, what I'm having issues with is closing just the about box Frame. I've used System.exit(0) but this closes the original application, which I dont want it to do. I've been looking at online example code and I've found that dispose() might work... Problem is my JFrame for the about box is initiated in the main applications JFrame under an eventListener for the menuItem 'about'. The sound file is played inside the JPanel of the about box. And the listener to close it is located in the same place ( about box JPanel ).. does anyone know how to get this frame ( initiated in main applications JFrame ) and dispose of this frame through code located in the JPanel of the about box.
    I hope this is descriptive enough for you.
    Please let me know if you have any questions about my question.
    Many thanks,
    Mark.

    It seems you are asking how to find the parent frame of a Component that you know is within a frame?
    You can getParent() of the component. If it is a frame (instanceof) - dispose, else check for the getParent()...
    If you don't want to code it yourself use SwingUtilities.getWindowAncestor(Component) to get the Window in which the panel is.
    HTH
    Mike

  • Closing The JFrame without using setVisible(false)

    I am using a frame for creating table "public class createTable extends JFrame" this class is being used by two panels to display the data . in a last panel where I have put two buttons "ADD" for adding records to a access table and "RETURN" to return back , while closing the "createTable" frame.
    On Clicking the "RETURN" button the code :
    setVisible(false)
    just closes the buttons in the panel whereas the original frame doesnot hides. whereas, if i use an instance of createTable:
    private createTable ctbl;
    and the have it as
    ctbl.setVisible(false);
    exception is thrown . as well as the method :
    void remove(Container con) also throws exception and does not functions smoothly.
    Can anyone please help me>>>>

    The problem is probably that you're calling setVisible on the button, not on the frame.
    If you maintain a reference to the frame then just do something like this:
    frame.setVisible(false);If you don't then you'll need to work out which frame the button belongs to:
    SwingUtilities.getWindowAncestor(this).setVisible(false);Hope this helps.

  • JFrame displays without its components or settings (please help)

    On clicking a button in an app, due to computational time required, I need to have a message popup that says 'Please Wait', which vanishes on end of needed computation. For this, I have a small working class MsgDiag that simply displays a non-modal titled JFrame showing a message string in a JLabel and an 'ok' in a JButton. This works fine when invoked directly via its own main method as a standalone, but when called from that other application(also a extended JFrame) via button click, it just brings up a blank grey untitled JFrame without the components (JLabel and JButton) or the background color! It does stay up for the required duration and vanishes on disposing its JFrame as expected but why blank w/o components or settings ?
    I also find that though the JFrame component comes up blank grey, if during the computation portion in calling application, if any info/errors are popped up via direct call to a JOptionPane().showMessageDialog(JFrame(),msgString, titleString, msgType), then along with that modal popup (from JOptionPane), the grey JFrame gets correctly drawn with components and background !
    Does this provide any hints ? Since MsgDiag works ok by itself I am puzzled.
    I also tried putting basic code from MsgDiag (creating JFrame, adding its components, setting it visible etc) into the other app directly but same grey blank frame results. Had there been a non-modal JOptionPane I could have tried using it. I use JRE 1.4.2

    Per your suggestion, I tried putting computational part in a different thread. Also tried putting the thread priority for computational thread to lowest.
    In other approach, also tried putting the GUI popup (frame2) in a separate thread with highest priority while lowest priority computational thread executed. But neither approach worked. Still shows frame2 as blank w/o background or components inside while low priority computational thread finished, when frame2 gets disposed as instructed.
    In 1st approach, also tried adding validate() following setSize() as some other posts have suggested but that did not change anything. Any other pointers ?

  • JFrames withous status bar with "Java Applet Window" ?

    Hello.
    I call a JFrame from JApplet. All my JFrames with a status bar where string "Java Applet Window" is showing. How can I creat JFrames without that status bar?
    Thank you in advance.

    This shows as a security measure because your applet isn't "signed". Your applet must be signed in order for this to not show.
    Refer to the following for a how-to:
    http://java.sun.com/developer/qow/archive/167/index.jsp

  • Updating a JFrame's Background every second

    Hello all,
    What i want to achieve here is very simple, I have a class which extends JFrame. In my constructor, i create my GUI (background and buttons etc.), so here is my code :
    //other imports goes here
    public class TestBg extends JFrame implements ActionListener{
         //constructor
         public TestBg(){
              //.. other codes go in here
              //set the first background
              setContentPane(getImage());
              //create a timer which is invoked every second
              Timer timer = new Timer(1000,this);
              timer.start();
         //close constructor
         public void actionPerformed(ActionEvent e){
              //print a statement to see if method is invoked
              System.out.println("Method invoked");
              setContentPane(getImage());
    }//close classlets say the method getImage() returns a JLabel, which set it to the JFrame's background.
    The actionPerformed method is invoked every second, but the background isn't changing ( getImage() returns a different JLabel each time)
    what extra code do i have to add ? thanks.
    NOTE : I just discovered something, i think the JFrame needs to be repainted. Because whenever i resize the Frame, the background changes!, but i do not know how to 'referesh' the JFrame without resizing it.
    Message was edited by:
    TrAnScEnD3nT
    Message was edited by:
    TrAnScEnD3nT

    That's because You add them to container that is an original content pane. Then when You call setContentPane this container is thrown away with all it's content and new "empty" container is put in that place.
    I advise using a JPanel as a contentPane and don't change it on the run. Insted you can use the timer to repaint that panel with some image specified.

  • Imitating the add() function without actually adding a Applet object

    Okay, I have an instance of an object that ultimately extends Applet (not JApplet). I want this applet to paint itself onto another instance of JFrame without adding (performing the add(component) method) the applet instance.
    Note though that if I do add the applet to the JFrame, the object is painted correctly and everything works fine. But for some reasons specific to me (that I don't want to go into details with), I do not want to add the applet.
    I would want to do something like this:
    Applet instance = /* my instance */
    JFrame frame = /* my frame */
    JPanel pane = new JPanel(new BorderLayout()) {
      public void paint(Graphics g) { instance.paint(g) }
      public void update(Graphics g) { instance.update(g) }
    frame.add(pane);Using the above concept, the frame doesn't get any painting. Exactly what does the add method do that I'm not imitating here? I've tried looking through the source and I don't see much changing of the actual instance. I also tried setting the parent of the applet (using reflect) to my JPanel (above example), but that did nothing. I tried doing that since I thought the applet may have uses the getGraphics() method for getting a graphics to draw with. BTW, I do not have source code to the Applet instance: I'm trying to make this dynamic.
    Thanks in advance for any support
    Message was edited by:
    khaoz
    null

    There are 2 problems I can think of:
    1. Calling paint on heavyweight components does no drawing to the graphics object. You can see this if you try to use the java print API to print a heavyweight button or something
    2. I'm not sure that calling paint on Applet causes the applets children to get drawn.
    Your best bet might be to use the java.awt.Robot, do a screen scrape of your applet and then draw that in your frame.

  • Getting rid or hide of the title bar without using jwidow

    hi everyone,
    is there any way to get rid or hide of the title bar in a Jframe without using JWindow because this one didn't conserve all the abilities a JFrame(listeners)...
    thanks in advance

    It is setUndecorated(true), but you'll need version 1.4 to use it. If you don't have it, then you use JWindow...
    http://java.sun.com/j2se/1.4/docs/api/javax/swing/JFrame.html

Maybe you are looking for

  • IPod touch 5g won't sync with iTunes windows 8.1

    I updated to iTunes 11.1.4.62 on windows 8.1. Now my iPod touch will not sync when it's plugged in to iTunes. I've been syncing with this pc since I got my iPod no problems until now it asked me wheather I trust this pc now I want this fixed.

  • Who can help me with my ORDER?!

    I had made an online order for my iphone 5s on 11/15 online. It showed that will be delivery by 11/19. I  had recived the email with conformation # as quickly, but it always show "being processed, check it back tomorrow" in my order status. I have ch

  • How do you save your music from the iPod to your pc

    I just purchased the new 5th gen ipod touch. I would like to save the music on my old 4th gen ipod onto my computer. How do I do that?

  • Inspection Plan/Revision level

    Hi PP Gurus, I have a Problem in Inspection Lot.The system is not reading the new Inspection Plan. The material is assigned to a Revision level with valid from date 10.12.2007 and the earlier Inspection Plan(Group 21) was also created on 10.12.2007.N

  • Ichat Keeps Telling Me My Password is Incorrect

    I have an AIM account that I have been using for years and I eventually got a mac and put it into Ichat, everything worked perfectly. All my friends were transfered and everything. However, after a year a symbol came up next to my username. It was a