Undecorated Frame (with title bar)

Is there a way to put a title bar accross my frame but remove the small buttons in the right side of the title bar? I can't really have "undecorated" frames since the user has to be able to resize and move the frame, but I don't want them to be able to see the "X" to close the window. I have disabled it by setting the default close operation to do nothing, but I am sure I will get complaints when they click on that and nothing happens (the way they close it is the same way they opened it -- via a checkboxmenuitem), so I think if they don't see the red x in the upper right corner they will just assume they have to use the checkboxmenuitem (and uncheck it) but if they see it they will want it to close it for them. Any ideas? I had thought of overriding the frame to catch the close operation but then I have to hook that frame to every checkboxmenuitem and it would get really hairy.

If I'm reading this right you have a JCheckbox with a listener so that when it 'unchecks',
there's some sort of code generated prior to the child window closing.
If so, can't you just add a windowlistener to the child frame, and in windowClosing 'uncheck' the checkbox
something like this
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class ParentWindow extends JFrame implements ItemListener
  JCheckBox chk = new JCheckBox("Open new window");
  ChildWindow cw;
  public ParentWindow()
    setLocation(300,200);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    JPanel jp = new JPanel();
    chk.addItemListener(this);
    jp.add(chk);
    getContentPane().add(jp);
    pack();
  public void itemStateChanged(ItemEvent ie)
    int state = ie.getStateChange();
    if(state == ItemEvent.SELECTED)
      cw = new ChildWindow(this);
    if(state == ItemEvent.DESELECTED)
      //other cose associated with uncheck event
      cw.dispose();
  public static void main(String args[]){new ParentWindow().setVisible(true);}
class ChildWindow extends JFrame
  ParentWindow parent;
  public ChildWindow(ParentWindow pw)
    parent = pw;
    setLocation(300,200);
    setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
    addWindowListener(new WindowAdapter(){
      public void windowClosing(WindowEvent e){
        parent.chk.setSelected(false);}}); //<-----------------
    JPanel jp = new JPanel();
    jp.add(new JLabel("Child Window"));
    getContentPane().add(jp);
    pack();
    setVisible(true);
}

Similar Messages

  • Different icon for Frame's title bar and alt tab

    I have been using Frame.setIconImage to supply the image icon for the title bar and (on Windows, the <alt><tab> image). The trouble is there is only one image for both but one is usually small 16x16 and the other is usually large 32x32. What I have been doing is creating an image that is 32x32 but scales back to 16x16 and still looks good.
    The trouble is it is tricky to create graphics like that. I wondered is there a way to specify one image for the title bar and another image for the <alt><tab> image?
    thanks,
    Ian

    Has anyone encountered this problem before? Is there
    a solution? Or can anyone say definitivly that
    specifying the title bar icon and the <alt><tab> icon
    separately is not possible?Sorry- you can't do it. Windows apps can do this easily because they use a .ico that can contain both the 16x16 and 32x32.
    There are a couple of hacks I tried once, trying to swap icons based on events, but they are horrible hacks and don't work well enough to use. Your choices are as follows:
    1. Use a 16x16 .gif as your icon and have it look good in the upper left hand corner of your frame but horrible during alt-tab,
    or
    2. Use a 32x32 .gif and have it look poorly in the upper left hand corner of your frame but good during most other times.
    I'd choose #1.
    (The reason behind all of this is Java does a much worse job of resizing your icon than you could do yourself with a little work in Paint Shop Pro.)

  • So simple, yet so annoying: problem resizing anchored frame with grab bars

    Asked a question yesterday on how to 'snug' an anchored frame to an image. Got the answer and it works great (Esc-m-p)
    Now... the reason I needed to do this is that when I try to resize a frame with the grab bars, it 'jerks' as I move vertically or horizontally.
    What that means is...
    With borders on, the frame border is a dotted line.
    If I grab the left side of a frame and move my mouse to the right to make the frame smaller, the border doesn't move smoothly -- it jumps a distance of about 1.5 of those dotted lines. Thus I can't always make the frame fit nicely.
    Talked to another Frame user and she said that her's drags smoothly.
    So... am I missing a setting somewhere? Any thoughts would be greatly appreciated.

    ##&*!
    I was working over a VPN when I first experienced the problem... everything was slower than molasses. Set Snap off, did some other work, Frame crashed.
    Setting didn't persist, but everything had taken so long I forgot to check it.
    Gah. Yes, Snap off works wonders when it's *actually* off.

  • Problem with title bar icons to change window size

    i am running v 2.6 on vista 64 bit with a dual core processor. the window opens full screen on my Eizo 24" monitor set at 1900x1200 but there are no choices in the top right of my menu bar to shrink, move the window. i therefore cannot shrink the window or move it to my second monitor. if i right click on the lightoom icon in the taqsk bar, there are no choices to move, size, minimize,etc.  other applications including photoshop work fine with easy control of window size so i do not think it is my system or graphics card. contol-Q does not close the program and the only way i can do so is from the file menu.
    help please.

    Jerome,
    Hit 'F' enough times to get the title bar back.
    Hal

  • Stacked Canvas with Title Bar

    Hi , Is it possible to add a title bar on top of the stacked canvas ? Thanks.

    where the title name can be displayed , like title name on top of a window.  anyway,  i have created a new window same size as the stacked canvas and displaying the title name now . Thanks for your response.

  • Turning menu bar on with title bar off

    I love how the title bar is gone from Firefox 4 and when I press ALT I can get the menu bar up next to the FIREFOX drop-down
    I want to turn the menu bar on permanently, but as soon as I do the title bar comes back and the Firefox drop-down goes away (taking up more real estate).
    How can I turn on the menu bar but keep the title bar off and the Firefox drop-down on?

    You can't. You can either see the menu bar or the orange Firefox button.<br />
    You can however customize the Firefox button or place extra items on the title bar.
    * New Old Menu: https://addons.mozilla.org/firefox/addon/new-old-menu/
    * Personal Titlebar: https://addons.mozilla.org/firefox/addon/personal-titlebar/
    * Personal Menu (Personal Firefox Button): https://addons.mozilla.org/firefox/addon/personal-menu/

  • Answer to support question on issue with title bar disappearing

    I had the issue listed at:
    https://addons.mozilla.org/en-US/firefox/addon/hide-caption-titlebar-plus-sma/versions/
    The answer I found is at:
    http:// www. askvg. com/how-to-enable-titlebar-text-and-icon-in-mozilla-firefox/#comment-1844783
    Please update your support article with this answer. It worked well for me!
    Take care,
    Stephen
    ''inaccurate information hyperlinked''

    No se escribir ingles. pero tengo el mismo problema que aqui se expone. ojala puedan solucionarlo. quisiera que hubiera una opcion para ocultar la barra de tareas.
    I'm having the same issue and would really appreciate a solution. Thanks!

  • Off-screen title bar and menu

    I have a dual monitor setup, where the monitors have different resolution. I usually open documents on the larger screen, but if I open a second document it opens on the smaller screen with title bar and main menu off-screen. Is it any way I can anchor new windows to the top of the screen instead of the bottom?

    parish_chap wrote:
    V.K. wrote:
    parish_chap wrote:
    Unfortunately, as with Expose, the Prefs window disappears when I activate Spaces.
    I don't quite understand what you mean. do you mean that the system preferences window moves off screen when you enable spaces? when you enter spaces view (F8 is the default shortcut) you should see all windows in all spaces on all monitors. is this not working?
    It isn't displayed, i.e. it disappears. Remember this is a MS app and appears to follow the semantics of modal dialogues in Windows, i.e. they aren't "real" windows. They are a PITA in Windows as it's possible to hide them with another window and they are a pain to find - they don't appear in window lists and you can't Alt-TAB to them.
    oh, yes, I forgot about that. I know that MS office Spaces integration was supposed to be fixed in Snow Leopard but I guess that didn't happen with MSN messenger. that's probably also the reason those apple scripts you tried didn't work.
    Looking at this from a different angle, where are window positions likely to be saved as the position is retained across reboots. Is it the OS that handles this, or the app itself?
    the window positions of an application are stored in the preference file of that application in /users/username/library/preferences. if you quit an application, delete its preference file and relaunch it then it should display on the default screen with default values. however, some apps (like Mail) keep important data in their preference files and deleting them will wipe that data.
    Thanks. As you said about Mail, MSN Messenger stores all its data in their, e.g. account details, and the plist file is binary, but a quick Google revealed plutil so I converted it to XML, edited it in vi, and converted back to binary +et voilà+ it worked!!
    The window position was 0, -56 so I just changed it to 0, 56
    that will of course, do it.
    Thanks for your help!
    you are welcome.

  • AS Droplet in XCode - Problem with display dialog with title

    hi,
    i am using XCode to create an AS droplet.
    wondering why i cant set a title to my display dialog code.
    during search in this forum i found this thread:
    http://discussions.apple.com/thread.jspa?messageID=6364939&#6364939
    but to be honest, i didn't expect that i am limited in Xcode too.
    Short code example:
    display dialog "foo"
    works
    but
    this code:
    display dialog "foo" with title "bar"
    not.
    Would be great to find a workaround to get dialogs with titles.
    And on the other hand to understand why i cant use title in Xcode.
    btw: is it possible to format the output of a display dialog ?
    i.e. creating new lines ?
    best regards
    fidel

    Hello
    I'm not sure but you may try 'run script' to invoke 'display dialog' of Standard Additions.
    Something like this.
    --SNIPPET
    set t to "line 1
    line 2
    line 3
    line 4"
    run script "display dialog \"" & t & "\" ¬
    with title \"Testing\" ¬
    buttons {\"OK\"} default button 1"
    --END OF SNIPPET
    As for 'display dialog' in AS Studio, it differs from and overrides 'display dialog' command in Standard Additions. Don't know why it does not have 'with title' which is rather new parameter introduced with AS 1.10 (OSX 10.4).
    cf.
    AppleScript Studio Terminology Reference (pdf)
    Panel Suite > Terminology > Commands > display dialog
    Regards,
    H
    Message was edited by: Hiroto

  • Window with no taskbar entry, both JWindow and undecorated frames dont work

    I wanted to create a borderless, window without a titlte bar, with no task bar entry, so as in JDK 1.3, I created a JWindow and it worked pretty good. Now that I have upgraded to JDK 1.4, it turns out that in order to get a focus to components with JWindow, you need to pass in a controller frame in the JWindow constructor, and this controller frame has to be made visible for the components within the window to have focus. Now that I pass in a controller frame to the JWindow constructor and make it visible, I see an icon for the window in the taskbar.
    The new way to create borderless window in JDK 1.4 is to create an undecorated frame, but for undecorated frames an icon always appear in the task bar.
    Anybody knows how to have a borderless window without a title bar and task bar entry in JDK 1.4. Any help would be highly appreciated.
    Thanks

    try creating a JDialog and call setUndecorated on it. I think Dialogs don't add taskbar entries.

  • Disable close opearion(X) on the title bar of a frame.

    Hai,
    I need to disable the close operation on the title bar of the frame.
    Can anyone give me the solution.
    Thanks
    SmartStar.

    hai,
    the code given is allowing me not to colse the frame, but it is not displaying the frame with the size i had given in the setSize().
    I need a code to achive a task such that, even after i click on the close on the title bar, it should not perform any function and display the frame as it is. with out any resizing.

  • Why do I have two title bars - one with the title of the page I'm looking at and another with the new orange drop down menu? Plus I can't get FF4 to save my tabs, even when I go to about:config, why is that?

    I downloaded FF4, thinking that it would merely update from my previous installation, but all my tabs were gone. FF looks really weird - here is a link to a picture of it: http://tinypic.com/r/2mwdus4/7 - I have two title bars, my bookmarks toolbar is missing and the tabs are on the bottom. If I go to view => toolbars and click one of them, suddenly the second title bar (with the orange menu) disappers and my bookmarks toolbar comes back (even if I don't click on it in "view"). I can't get the browser to remember my tabs between sessions even though I set it to remember them in my settings. I even changed the browser.showQuitWarning to true in about:config, but it didn't work. What is going on?

    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]]

  • Change the colour of title bar of frame

    how can we change the colour of title bar of any frame?

    i want to have control of the title bar.there must be some way out.look & feel gives it colour of that perticular types colour(motif,met,native).but i want my choosen colour for it.if you have any direction to solve it please suggest me that.

  • Title bar of standard page come with German, how to change to English

    Hi Experts,
        I am creating an page contain an WebdynPro ABAP. When user click link in the WD it will pop up new browser for standard appraisal document provided by SAP. The problem is the title bar of the pop up come with German. So i have checked the Master Language properties of page and iView for standard apprisal document, it has been set to 'EN'. I have no idea how to change it to English.
        Could you please advise.
    Thank you in advance,
      Noppong Jinbunluphol
    Edited by: Noppong Jinbunluphol on Feb 15, 2012 3:16 AM

    Change in the backend side

  • How to see document file name with full path when hovering mouse over title bar?

    Using PS CS6, Windows 7 x64.
    I was under the impression that when hovering my mouse over the document title bar, I would see a tooltip showing the full file name, including the path.  This isn't happening and I'm wondering if there is a way to do this.  I know I can click File > Save As, or Ctrl+Shift-S to see the full path, but hoving over the title bar would be easier.  (What I am seeing now in the tooltip is the file name, % magnification and which layer I have selected.  Basically, the tooltip is just showing what's in the title bar without hovering.)
    Thank you!
    John

    Hm, I wonder if it's something they may have enabled only for the Cloud version (I have 13.1.2).  If so, I didn't notice the change at the time of the upgrade.
    Nope, it's not that - I have a virtual machine for testing with 13.0.1 installed...  This is what I see there:
    -Noel

Maybe you are looking for