Help with disabling close icon of last opened tab in JTabbedPane

Hello
Would someone help me out ? I have 3 tabs opened in a JTabbedPane, each with close icon "X". I am looking for a way to tell my program: if the user closes 2 tabs and only 1 remain, disable the close icon "X" of the last opened tab so that the user is unable to close the last tab. I have searched the forum, most I have run into are how to create the close icon. Would someone give me some insight into how to go about doing this? or if you have come across a forum that discusses this, do please post the link. Also, I am using java 1.6.
Thanks very much in advance

On each close, look how many tabs are remaining open in the JTabbedPane (getTabCount).
If there is only one left, set its close button to invisible. Something like this:
if (pane.getTabCount() == 1) {
    TabCloseButton tcb = (TabCloseButton) pane.getTabComponentAt(0);
    tcb.getBtClose().setVisible(false);
}

Similar Messages

  • When I click on the "+" to the right of the last open tab on the tab bar, a new tab will not open. Help, Thanks, Jim

    When I click on the "+" to the right of the last open tab on the tab bar, a new tab will not open. Help, Thanks, Jim

    Well, it is showing as being install in the version of Firefox that you posted here with.
    Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.21) Gecko/20110830 '''AskTb'''AD3/3.12.2.16749 Firefox/3.6.21
    ''''' "and whenever I click on a bookmark, it opens in a new tab automatically" '''''
    Probably caused by an extension, or a couple of extensions that are in conflict with each other. <br />
    http://support.mozilla.com/en-US/kb/troubleshooting+extensions+and+themes

  • How do I make the "Open new tab" button positioned at the end of the tab strip, on the right, next to the last open tab, just as the standard Firefox should be.

    My "Open a new tab" button (the +) does not appear at the end of the tab strip, it does not look like it is given in all photos here in the support page. It did not look like this before either. Now I have it at the most left end i.e. before the tabs begin. I can move it to the most right, but it sticks there. I want it to be attached to the last open tab, as it used to be, and as is shown in example Firefox photos.
    Could be useful if I sent you a print screen, but I don't see an attachment option here.
    Thanks!

    See https://bugzilla.mozilla.org/show_bug.cgi?id=574833 - Installing Persona theme completely covers the caption buttons

  • When ever I customize the toolbar the open new tab sign that is the + sign near the lastly opened tab in the tab bar disappears and it remains so even after restarting Firefox.

    When ever I customize the toolbar, the open new tab sign that is the + sign near the lastly opened tab in the tab bar disappears and it remains so even after restarting Firefox. This happens only after updating to the new version 4.0.1 it never happened in the older versions 3.x.xx- checked it thrice. Thought it could be a bug and i didn't know where to report also don't have time and patience to search for the appropriate page so i'm reporting here for improving my favorite browser.

    You can find the New Tab button showing as a '+' on the Tab bar.<br />
    You can open the Customize window and drag the New Tab button from the Tab bar on another toolbar and it will become a regular toolbar button like the New Tab button that you have in Firefox 3 versions.<br />
    If you want the New Tab button at the far right end of the Tab bar then place a flexible to the left of it.<br />
    *New tab toolbar button: https://addons.mozilla.org/firefox/addon/new-tab-toolbar-button/

  • Disable close icon on title bar

    Is it possible to disable the close icon on the title bar (right hand corner) in a swing window?
    Fai.

    Example:
    frameNameHere.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    There is also the option to take away the "window-frame" alltogether with:
    frameNameHere.setUndecorated(true);
    Though if you do that you should probably use the "DO_NOTHING_ON_CLOSE" anyway, since otherwise it can still be closed with Alt F4 for instance.

  • Why do many of my edited photos save with a blank icon and not open?

    I am using Elements 10 on a Windows 7 computer. I have been trying for 2 days to edit and save my photos. This is only happening about 1 in 10 times yet I take the same steps every time. I have checked the properties of the blank files which cannot open and they all have a different Type of File e.g. MODEL file (.model) and 1 File(.1) They were all saved as jpeg but only the ones with 'Opens with Windows Live Photo Gallery' actually open. The ones with blank icons say 'Opens with: Windows Shell Common'??? They don't open. If anyone can help me I will stop crying thanks.

    Try renaming the files to something like 1234.jpg
    Make sure the file name contains only one full stop (period)

  • Disable Close icon

    Hi
    I saw different posts on this topic but found no solution to let it work for me .
    Under 1.4 and Windows L&F what is the correct way to disable or remove the close icon in the title bar of a JFrame?
    Thanks in advance
    Wolfgang R.

    Call the method
    setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    On your frame. This will prevent the frame from beeing closed when the user clicks on the little "x" in the title bar. I think this is as far as you get, you can't really disable the button on a frame. If you don't want the button, use a JWindow instead of the JFrame. (JWindow has no decorations).
    By the way, you can still assign a WindowListener to the frame. windowClosing will still be called when the user clicks on the close button (even when the window will not actually close). You can add a close dialog threre and close the window manually.
    Regards
    Der Hinterwaeldler

  • My "Open New Tab" (tab with "x") to right of already open tabs is missing..

    '''I used to have the "Open New Tab" option (the small tab with an "x" to open new tab page) to the right of my already open tabs. I upgraded Firefox to newest version (12 maybe????....so many updates I can't keep up). This feature is gone as well as my Auto-Fill which were my 2 favorite features!!!'''

    Actually this tab deal wasn't a specific setting that I know of. When I first chose to use the multiple tabs at the top of my Firefox page.....there they were. No matter how many pages/tabs I opened there was always a new blank one on the right of the tabs. The newest one is the size of the tabs that are "pinned" rather than full sized. This is much harder to explain in writing....so don't know if I'm being clear at all.
    In the Toolbar Layout options there is an icon + that can be dragged to a toolbar, but it stands alone as opposed to being part of the tabs. I can click it to open another tab, but it's a 2 step process. I much preferred the other way.

  • Close icon display for a Tab(ShowdetailItem)

    Hi,
    I am using the PanelTab with multiple ShowDetailItems. I am giving the close icon provision for the showdetail item. But the close icon is coming only in mouse over.
    I need to display the close always(ShowDetailItem).
    Reg,
    Brahma B

    There is a tutorial for JScrollPane:
    http://java.sun.com/docs/books/tutorial/uiswing/components/scrollpane.html
    It came to my mind that JSplitPane is not using JScrollPane for the two components you add. So perhaps the solution would be to "wrap" both your components to their own JScrollPane before you add them to the split pane.
    Then for those scroll panes I would probably use:
    JScrollPane.setColumnHeaderView(myXCloseButtonInAPanel)
    or
    JScrollPane.setCorner(upperRightCorner, myXCloseButton)
    I don't know if that will work, or how it will look like now that you use the scroll pane's scrollbars instead of the split pane's scroll bar. You have to experiment with it. The scroll pane's should be able to resize themself to fit in the split panes areas when you move the divider, and maybe that's not so easy to do. Otherwise you will end up with both a scrollbar from the split pane and a scroll bar from the scroll pane.. yuck.
    Maybe someone else has a better solution?

  • HT1338 I need help with numbers. I try to open numbers and I get a message stating that I need an update. When I go to update apple say I am up to date, but I still can't open numbers. I keep going around and circles. Help

    I cannot open numbers. When I click to open the message says that, I need to update. When I go to updates is says I am updated. I keep going around and circles. Can anyone help?

    Look in your Applications folder for the new version.
    Remove the old icon from the Dock and drag down the new one for ease of use.

  • Help with disabling Backup Assistant Plus

    Upgraded to ICS last week. Now since there is no Charge Only option when plugging in to PC via USB, is there a way to keep Backup Assistant Plus from always opening the page?

    I would recommend you use Google android services for you device. I have used Google in almost all of my phones and with never a problem. Backup assistant plus is not as stable or as easy to use as Google. Just set up a Google account if you don't have one already (and I'm sure you do) .  Give it a try  
    Do a Google backup
      1. Sign in to your Google's device, online account and go to settings.
      2. Personal, Backup and reset, and select both Backup my data and Automatic restore.
      3. Go to Settings, Personal, Accounts & Sync, and select your Google account.
      4. Select all of the option boxes listed, to ensure that all available data is synced.
      5. Though the specific procedure may slightly vary between Android devices, the process is generally the same.

  • Help with iphoto please,  I can't open my photos.

    I have iphoto 11' and today when I went to save photos onto hard drive the thumbnail is there but when I open it there is an exclamation mark, It's happened to a lot of the photo's but some still work,  can anyone help me?? I don't want to lose my photos.

    It says my start up disc is full, But I didn't delete photos??
    That probably is the problem - you need to make space before you do anything  --  How much free space do you have on your main drive?
    If you have an external hard drive that is formatted Mac OS extended (journaled) that has adaquate space on it you can mover you iphoto library there - once space is available then you can address trying to fix it
    Moving the iPhoto library is safe and simple - quit iPhoto and drag the iPhoto library intact as a single entity to the external drive - depress the option key and launch iPhoto using the "select library" option to point to the new location on the external drive - fully test it and then trash the old library on the internal drive (test one more time prior to emptying the trash)
    And be sure that the External drive is formatted Mac OS extended (journaled) (iPhoto does not work with drives with other formats) and that it is always available prior to launching iPhoto
    And backup soon and often - having your iPhoto library on an external drive is not a backup and if you are using Time Machine you need to check and be sure that TM is backing up your external drive
    And again - do you have a good backup? You may need it depending on hwa tthe space problem caused
    LN

  • Need help with .mov files that won't open

    Here's the situation...
    I have 2 dvdr's with 4 .mov files on them. when i try to copy them to my desktop it tells me that
    "the finder cannot complete the operation because some data in "BonJovi_Who_SaysDV NTSC.mov" could not be read or written. (Error code -36)
    I have to gain access to these .mov files tonight or I'm gonna be a real shithead. I just got the discs fedex'd to me today so I didn't put it off til the last minute. Can anyone offer any possible solutions? If so, please help.
    Java

    Putting aside copyright issues in (naive?) belief you have a legitimate use of the material, your problem lies in the file or disk. One of them is either corrupt or not compatible with the drive you are trying to read it on. Try it on another computer (even a PC) and if you can read it on that computer make a new copy of the file on a new disk or a firewire drive (or USB stick if it fits).

  • Please help with medical files I need to open immediately and cannot.

    I have some medical files sent to me that I desperately need to open. The instructions were to copy the file to the desktop, a zip file by the way, left click using the mac button and "I" at the same time. A menu would open saying "open with" and I was to choose stuffit. Then enter the password when prompted. I was able to get to the stuffit part and the password prompt and entered the password, but nothing happened. I keep getting the error message: Unable to unarchive "LoganRobertPEME.zip" into "Desktop". (Error 1-Operation not permitted.)
    Can anyone help me open this file?
    Thanks

    Contact whoever sent you the file. Perhaps it's a bad archive. Or be sure you entered the password correctly. They are case sensitive.

  • Help with pulling records for the last 24 hours

    Post Author: kbrinton
    CA Forum: Formula
    Hi,
    I don't know what is wrong with me but I can not figure out how to get Crystal to pull records for the last 24 hours.  I have a date field I can key off of but I can not figure out the formula or correct syntax to put in the Selection formula.  Any help would be great!!  Thanks

    Post Author: SKodidine
    CA Forum: Formula
    No need to create any formula.  In your record selection criteria type:
    {table.date} in dateadd("h",-24,currentdatetime) to currentdatetime
    If you just want the prior 24hrs and do not care about the time then replace 'currentdatetime' with 'currentdate'.
    (currentdatetime - 24) will give you 24 days before and not 24 hours.

Maybe you are looking for

  • Ssrs 2008 grand totals of report

    In an SSRS 2008 report, I am placing a grand total amount in the report footer since I want the amount at the very end of the report. The problem is when the report is exported to PDF, the amount is a long ways from where the detail lines are located

  • HP Photosmart C 5280

    Mac mini computer using 10.9 will not use all functions of the printer.  The computer will not recognize the scan function.  Is this a Apple problem or do you no longer support the printer using 10.9?  Do I need a new printer scaner?

  • Windows 8.1 Top Troublesho​oting and Highlights Articles and Documents

    See the post here: http://h30434.www3.hp.com/t5/Notebook-Operating-Sy​stems-and-Software/Windows-8-1-Top-Troubleshooting​... and here: http://h30434.www3.hp.com/t5/Notebook-Operating-Sy​stems-and-Software/Windows-8-1-Highlights-and-Us..​. Want to hel

  • How to remove "Items" in the Search Header Component

    Hi guys I'm hoping some of you can help me out with this problem. In my collection renderer, I have entered "SearchHeaderComponent,this", which has given me the Searchheadercomponent, that I was interested in. Unfortunately I'm only interested in the

  • Air 3.7 (android)  javascript issue in stagewebview

    Hi I have simple javascript code runing in stagewebview: //  javascript atob() is used for  base64 decoding. var serializeObject = JSON.parse(atob("eyJjYWxsQmFjayI6IltTV1ZDYWxsQmFja11pbml0SlMiLCJtZXRob2QiOiJpbml0SlMiLCJh cmd1bWVudHMiOltdfQ==")); aler