Hide menu bar and title bar in a JFrame

Hi!
I'm using a JFrame for a kind of viewer application. I start it as normal, so the JFrame has a JMenuBar with menus and the title bar with the application name.
So far, all right, but at some point I would like to press a JButton to make the viewer application full screen, that is, hiding the window title bar and the JMenuBar.
Any idea?
PD: I've tried the method myJMenuBar.setVisible(false) in order to hide the menu bar, but it seems it doesn't work because I'm using the Look&Feel Metal with border decorations.

something like this seems to work OK.
basically, create a JPanel that is the contentPane of the frame, then for full screen
create a JWindow, add the panel to the window, show the window
(alt-F4 to close)
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class Testing
  public void buildGUI()
    JMenu menu = new JMenu("File");
    JMenuItem menuOpen = new JMenuItem("Open");
    JMenuItem menuSave = new JMenuItem("Save");
    JMenuBar menuBar = new JMenuBar();
    menu.add(menuOpen);
    menu.add(menuSave);
    menuBar.add(menu);
    JButton btn = new JButton("Full Screen");
    final JPanel p = new JPanel(new GridBagLayout());
    p.add(btn,new GridBagConstraints());
    final JFrame f = new JFrame();
    f.getContentPane().add(p);
    f.setJMenuBar(menuBar);
    f.setSize(200,100);
    f.setLocationRelativeTo(null);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setVisible(true);
    btn.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent ae){
        JWindow w = new JWindow(f);
        w.add(p);
        f.setSize(0,0);
        w.setSize(Toolkit.getDefaultToolkit().getScreenSize());
        w.setVisible(true);
  public static void main(String[] args)
    SwingUtilities.invokeLater(new Runnable(){
      public void run(){
        new Testing().buildGUI();
}

Similar Messages

  • Larger fonts in Menu bar and title bars?

    I recently purchased an Intel Mac Mini for my mother. She does not have the greatest eyesight and I would like to increase the size of the font used in the menu bar, window title bar, etc.. In Windows there is a "large font" theme that does this very nicely.
    Is this possible?
    The only thing I found that might help is the "Zoom" mode and thats not going to work. She has enough trouble using the mouse as it is and this will only be more difficult...
    Thanks,
    Jeff

    Hi Jeff,
    Welcome to Apple Discussions!
    You can use Universal Access, it's in Control panels
    to 'display fonts no smaller than' a specific size,
    this is probably what you're looking for
    regards,
    Peter.
    OK, Let us try this again.
    If I bring up "System Preferences" and then click on the "Universal Access" doohickey I get a control panel applet that has 4 tabs. The first tab labeled "Seeing" does not contain any option to set a minimum font size. It only contains the "VoiceOver", "Zoom", and "Display" options. None of these options allow me to set the minimum font size. The other tabs in the universal access applet are "Hearing", "Keyboard", "Mouse and Trackball" -- none of these contain anything to do with setting font size.
    Perhaps you can provide more detailed instructions to find this mysterious font size setting?
    I just searched again in this forum and found this recent discussion which seems to say it is not possible to somehow enable larger fonts in the menu bar and title bar and such. This is ridiculous. Since you can now get LCD displays that have very high pixel density the physical size of these fonts is quite small. Changing the display resolution is not a valid solution since everything gets blurry when you use an LCD at non-native resolution.
    Here is URL to recent discussion.
    http://discussions.apple.com/thread.jspa?messageID=3308141
    Please tell me that it is possible to increase the size of the font in the menu bar... If I cannot do this I have spent $700 on a computer my mother cannot use.

  • Standard menu bar and title bar

    Hi to all
    I am developing a module pool program in which I have defined set pf status in PBO event.
    But while running the program that standard tool bar not working.
    Plz guide me....
    Thanks & Regards
    Anubhav

    hi anubhav gupta,
    PBO---
            after defining set pf status in PBO event,double click on the name of the status u have given.
       u will enter into the new screen which consists of menu bar
                                                                               application tool bar
                                                                               function keys.
    open the function keys,u will have the options there,for example write exit on one of the icon and double click on that,function attributes window will open,and give thefunction code as 'exit',function type as 'E',
    PAI----
        crate a PAI module,in that write the following code
    MODULE cancel_0102 INPUT.
      CLEAR ok_code.
      ok_code = sy-ucomm.
      CASE ok_code.
        WHEN 'BACK' OR 'CANCEL'.
          SET SCREEN 100.
          LEAVE SCREEN.
        WHEN 'EXIT'.
          LEAVE PROGRAM.
      ENDCASE.
    ENDMODULE.                 " cancel_0102  INPUt
    i think this solves ur problem.

  • CS4 menu and title bars missing

    Hello,
    I have just upgraded to CS4 and am attempting to get acquainted with the new workspace options.  Is there a way to maximize a floating window in Standard Screen Mode without losing the menu and title bars?  I figured out how to drag images to CS4 and have them open as floating windows instead of tabs.  However, when I maximize one of the images/floating windows, the menu and title bars are left out and are not visible.  I would like to set the menu and title bars  so that all images appear beneath them whether they or maximized or minimized.
    Regards,
    Scott

    Did you try the F10 key?
    Maybe this helps:
    * http://kb.mozillazine.org/Corrupt_localstore.rdf
    Start Firefox in [[Safe Mode]] to check if one of the add-ons is causing the problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
    * Don't make any changes on the Safe mode start window.
    See:
    * [[Troubleshooting extensions and themes]]

  • How to merge title bar and tab bar on Gnome desktop?

    Not exactly a Firefox issue, but if it works fine on Windows it should work on Gnome too...
    How can I merge title bar and tabs bar?
    In Windows if we hide the menu bar Firefox puts in a single line Firefox button, tabs and minimize, maximize and close buttons. But in Gnome it keeps the separated title bar (with the minimize, maximize and close buttons).
    Is there any way to really implement it on Gnome Desktop?

    I want to back up what was said here. Chrome and Chromium have done this for as long as I can remember and the Linux distribution is entirely irrelevant in this case (as in most cases). There is an option to use the "system title bar and borders" in Chrome. If applied Chrome will have that blocky, chunky effect of not having the tabs overlapping into the title bar that firefox has. By default chrome does not use the system-provided title bar and borders. They wrote their own. The result is it looks nice. I prefer firefox by miles over Chrome, but have to admit it is chunky and ugly around the edges by comparison.
    The problem is not that it is "not possible in Linux." As a dedicated Linux user, hearing that oft-repeated phrase gets really old. There is nothing about Linux that makes things not possible when it comes to coding features. What is going on is the shortcuts available to make the coding quick and easy may not already exist. Fewer people use Linux, fewer people develop for Linux, and there is often less existing code base already written for Linux to make a coding job quick and easy. Also, there is less incentive to write original code to make something work for Linux because we are relatively few; the countless minions using Windows are all complaining about other things and much more loudly so.
    There is no doubt the task could be accomplished--which I would love to see--but the developers have to prioritize. I get that. Just wish they'd be honest rather than use the lazy answer of "It can't be done on your system."

  • How do I put my menu bar and address bar back at the top?

    I closed my menu bar and address bar, etc. Now I can get them back I even tried reinstalling Firefox and that didn't work. Opposite clicking the top of the page doesn't work, either. HELP!
    == This happened ==
    Just once or twice
    == When I temporarily turned off my bars.

    Hit the '''Alt''' key to show the Menu bar, then open View > Toolbars and select Menu bar, so it has a check-mark.

  • How can we enable Bookmarks menu below the title bar?

    How can we enable Bookmarks menu below the title bar as it is in the desktop version..
    Why there is no option to configure it..

    While Firefox for Android uses the same internals as Firefox desktop the interface is completely different. The bookmarks toolbar does not exist on Firefox for Android.

  • How do I view the Horizontal Scrolling bar and status bar at the bottom of the screen. I can only see the top menus, toolbars and vertical scroll bar?

    Before the most recent upgrade, the bottom horizontal scrolling bar and status bar appeared on my screen. Now since upgrading, I cannot see the. Anyone ideas how to restore them?

    If you haven't already, you could force-quit Quicktime by using the menu option from the desktop (finder) and choose Quicktime.
    Not sure what you have frozen on the screen, be it a failed movie, or some unusual screen shot. If you can find by date (created) you may be able to look for .mov or quicktime suffix name or other video file content to delete it.
    And you may have to restart your computer and perhaps run repair disk permissions from Disk Utility's first aid on the hard disk drive in your computer.
    Not sure if all that would help now, but it is something a few days late...!
    Good luck & happy computing!

  • The font in Safari's bookmarks bar and tabs bar has suddenly changed

    The font in Safari's bookmarks bar and tabs bar has suddenly changed to a lighter font.  How do I change the font back?  I'm not speaking of the font size/type in the web browser in viewing web pages, but the font in the application itself has changed. It's rather annoying and would like to be able to change it back!  I'm running Safari v5.1.7

    OK, Margie, here's what to do . . .
    First Quit Safari.
    Then Find your User's (Home) folder library. 
    It's hidden, but here's how you find the Home Library:
    Click on the desktop to get the Finder menu.  Then go up to  "Go" in the menu bar, while holding down the option key.
    You'll now see the User Library in the drop down list. Open it, then look for the Fonts folder.
    Take the fonts folder to the desktop.
    Restart Safari.
    Any better?
    (Warning:  This is only for the Users/Home > Library > Fonts folder.  Under no circumstances, should this be done with the SYSTEM > Library > Fonts folder.) 

  • Firefox 4 search bar and "Tips" bar are blank windows that do not work. Removed F4 and downloaded again three times but no joy. Gone back to F 3.6.17.

    On Firefox 4 home page the "Tips" bar and search bar above it
    are both blank windows. The search bar does not say Google on left side. I can type in search bar but when I click on search nothing happens. ( Desktop XP Pro)
    On my Laptop (XP home edition) Firefox 4 works fine and I have not found any faults so far.
    It's a shame losing RealPlayer downloader for YouTube. I have to go to IE for that.

    Seems that may have worked and that's great, thank you. But now I have another problem which seems to be as persistent as the search bar has been.
    Now when I edit the bar and position of the buttons some of those buttons disappear when I click Ok in the customization, but reappear when I reopen the customization settings.
    Why is that? When I put a space in between some of the buttons the buttons near the space will disappear and leave a blank space where it should be.
    I'm beginning to be rather annoyed with this Firefox Beta to say the least and am considering returning to the version before it. Whatever I do now as far as customizing is concerned of the toolbar is reset every time I reopen Firefox. The buttons are no longer where I had set them up, the address bar is stretched to it's maximum, the Menu Bar is back the far left edge, buttons are missing that I had put there, and buttons I had removed are returned.
    :| I know it may seem insignificant to some people but it annoys the crap out of me. I understand this is a beta and if there is no solution then I perhaps will use the earlier version for a while.
    Thanks for your input by they way, it's much appreciated.

  • Address bar and search bar freeze when a pdf is open in Firefox 4

    The address bar and search bar freeze when I open a PDF document in Firefox 4. I have Adobe Reader X installed.
    This means you cannot type anything in the address bar for that tab or any other tab until you close that PDF.
    Any ideas? Thanks! :)

    Oh it was a problem with Adobe's Plug-in. As per [https://support.mozilla.com/en-US/questions/804580#answer-167069 MrKoffee's answer ], I noticed that I already had Adobe Reader X installed but nevertheless I went to adobe.com to download it again. When I installed it this time, it said "installing updated patch". Went back to Firefox to check and problem solved! :)
    Ps. did not need to disable any previous plug-in or even close Firefox.

  • Scroll bar and tab bar turn to images, images on a page repeat themselves

    I don't know exactly how to explain my problem so I'll just give some examples.
    - On youtube, video thumbnails copy themselves on top of the other video thumbnails, and sometimes I can see 2 or 3 same thumbnail, but when I hover the cursor above them they return to normal. The names or video links are unaffected, just the thumbnail.
    - On facebook and some other forums, same problem exists. One thing I noticed, it doesn't affect huge files, as in it doesn't replace huge images but copies something like 200x200 image to some other place.
    - Some of the tabs in tab bar and scroll bar sometimes turn into diagonal patterns, and scroll bar sometimes has the same problem I gave as example above. The grey default layer turns into an image. But hovering the cursor above it returns it to normal again.
    Any help is appreciated.

    Hi, thanks a lot for the support. I've found the solution!
    I've checked all of the installed programs on my system. All programs are from verified publishers.
    Actual problem was with graphic drivers. My laptop is Sony Vaio and therefore I had the recommended latest drivers (for my graphic card) available from Sony website installed. The graphic card is from NVIDIA GeForce. So, don't know why but I uninstalled all graphic drivers from the system and downloaded the latest drivers available for my graphic card hardware from NVIDIA website. Now the new latest drivers from NVIDIA solved the problem !!! Firefox is working perfect. No problem on any website.
    May be the same can work for other Firefox users also having this problem. No need to disable "hardware acceleration when available" in Firefox.
    Happy !!!! :D :D

  • Why can't I enlarge safari bar and bookmarks bar so the print is larger.  I can only do this if I change resolution on display.  I do not want to make my 27" smaller.  Any comments?

    After just installing Mountain Lion on mid 2011 iMac 27" I find it does not allow increasing size of font for Safari bar and Bookmarks bar.  The print is so small it is difficult to see.  I can change resolution of screen but the the size of the screen becomes smaller.  Not what I had in mind when I bought this iMac.  Is there any fix out there and is Apple working on this problem?  Any comments would be appreciated.  Thanks.

    Safari – Enlarge browsers toolbar text
    Firefox

  • Browser bar and the bar above it disappeared, how do I get it back

    I have Safari on my PC and the browser bar and the bar that has the files, edit, etc on it disappeared, how do I get it back? I was allowing my 2 year old daughter watch a show on netflix using google chrome but somehow she managed to get safari open and net thing I knew the browser bar is missing and when I tried to get it back, I managed to make things worse by making the bar above it disappear too. How do I get them back?

    The OP is using or trying to use OS X on a non-Apple netbook or I've misunderstood.
    What on earth makes you think that? He's posted in the Windows category of the Safari community. He has never mentioned Mac OS. He said Safari was installed on his PC in his very first post. Furthermore, the details of his replies to your advice are precisely what you should expect if he was using Safari for Windows, and trying to implement the (inapplicable and unimplementable) Safari for Mac advice in the context of his particular issue. You've got this one very badly wrong from the beginning right through to now, and in that context the implication that he was trying to get advice here on how to do something illegal was not only wrong, but insulting.

  • Is it possible to remove the delimiting line between Bookmarks bar and Tab bar?

    I place the Tab bar between the Bookmarks bar and the page content area, as the attached image shows.
    Is it possible to remove the delimiting line between Bookmarks bar and Tab bar? I feel that line is redundant.

    Your Tab bar doesn't look standard.
    Did you check the code with the default theme if you currently use a custom theme?
    ''(note that you can still use the code with a smaller font size if you like the monospace font; I do prefer this to make it easier to click the mouse)''

Maybe you are looking for