How can I disable a method from a direved class

I am extended TreeSet for an assigment with some new functionality.
This new class is rbTree.
I need to disable all of the old functions so that if a user creates a new rbTree he will only be able to use the methods defined in rbTree.
rbTree uses some of treeSets methods using super.
I now how to just overwrite them but I think I should let the user know those methods are unsupported, by throwing an exception. I can't throw any exceptions because most of treeSets methods don't.
I know there is an easy way to do this, and I don't think I should just leave them blank.
Any ideas?
thanks in advance
-Marc

If you have a new class that extends TreeSet that shouldn't expose any of the TreeSet methods, don't extend TreeSet. Prefer composition over inheritance. You can use a TreeSet as a private member within your class; e.g. your new class has-a TreeSet, rather than is-a TreeSet. This way you control which functionality of the TreeSet to use, but only expose your new methods.
Also, you should read and implement Code Conventions for the Java™ Programming Language - it will help you and others understand/maintain your code.
Example:import java.util.TreeSet;
public class RbTree
    private TreeSet set = new TreeSet();
     * only allow a specific type of object (my.pkg.MySpecialObject) to be added to the set.
    public add(MySpecialObject mso)
        set.add(mso);
    // other methods follow...
}

Similar Messages

  • The windows of the Windows bar are already a form of tabs, so I don't need them in Firefox. How can I disable them completely from Firefox 23?

    RE: TABS ARE WINDOWS!
    The Windows bar already functions as a tab bar. Those tabs are called "windows." So, I find Firefox tab windows superfluous. How can I disable them completely from Firefox 23? I don't need what is essentially TWO windows bars covering up the entire width of my widescreen monitor's image! I already have a Windows bar at the bottom of my screen and, if I really wanted to, I could change ITS position to the top of the screen, so that it would LOOK like the Firefox tab windows bar. Firefox TABS are, essentially, a superfluous SECOND WINDOWS BAR.
    Here are my reasons for why I'd rather use Mozilla's Firefox, than Microsoft's Internet Explorer or Google's Chrome. I love and admire Firefox for Mozilla's intent on good security, for Firefox's Personas add-on, and for Firefox's free use of the Ad-Block add-on which, as you know, has the distinct virtue of reducing screen clutter--the last of which is my motive for wanting to get rid of the SUPERFLUOUS Firefox tabs "windows" bar. I am dreadfully sick of companies forcing miscellaneous bars (mostly representing marketing campaigns trying to sell me something) into my browser (and down my throat) every time I download something. (In case you haven't guessed, I am deliberately referring to your Firefox tabs bar as a "Firefox tabs 'windows' bar," because TABS are WINDOWS!)

    Let me clarify even more. The Firefox add-on you mention does not remove "tabs" windows. It only HIDES the "tabs" bar when there is only one "tab" in that window. It DOES NOT end "tabs." It does not turn "tabs" off.
    I know this, because, even with the add-on you recommend, the "tabs" bar often re-appears when I open a link, which--for some unknown reason--Firefox defaults to opening in a second "tab" within the same window, rather than putting it in a new Windows bar window. This, of course, disregards what I want to happen.
    I want to use my Windows bar to control my windows. I do not want my Firefox browser controlling my windows--which it calls "tabs." Can you tell me how to shut off "tabs?"

  • How can I disable a JInternalFrame from being "restored"?

    Sorry, I thought I should start a new thread for a new question.
    With my JInternalFrame, I have it minimized initially when it is created. Now, how can I prevent the user from opening or "restoring" that frame? Basically, I just want the "title" bar to appear, and disable the frame from opening up.
    thanks

    try this
    import java.awt.Dimension;
    import java.beans.PropertyVetoException;
    import javax.swing.JButton;
    import javax.swing.JDesktopPane;
    import javax.swing.JFrame;
    import javax.swing.JInternalFrame;
    import javax.swing.*;
    import java.beans.VetoableChangeListener;
    import javax.swing.event.InternalFrameAdapter;
    import javax.swing.event.InternalFrameEvent;
    import java.beans.PropertyChangeEvent;
    public class DesktopPane extends JDesktopPane
    implements VetoableChangeListener {
    JInternalFrame jif;
    JPanel p1;
    public DesktopPane() {
    p1 = new JPanel();
    JButton b = new JButton("Test");
    p1.add(b);
    jif = new JInternalFrame("test1", true, false, true, true);
    jif.getContentPane().add(p1);
    jif.setVisible(true);
    jif.setSize(new Dimension(200, 200));
    add(jif);
    jif.addVetoableChangeListener(this);
    try {
    jif.setIcon(true);
    } catch (Exception ex) {
    jif = new JInternalFrame("test2", true, false, true, true);
    jif.getContentPane().add(p1);
    jif.setVisible(true);
    jif.setSize(new Dimension(200, 200));
    add(jif);
    jif.addVetoableChangeListener(this);
    try {
    jif.setIcon(true);
    } catch (Exception ex) {
    public void vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException {
    String property = evt.getPropertyName();
    if (property.equals(JInternalFrame.IS_ICON_PROPERTY)){
    boolean isIcon = ((Boolean)evt.getNewValue()).booleanValue();
    if (!isIcon){
    throw new PropertyVetoException("message", evt);
    }

  • How can I disable developers tools from using function keys?

    Every time I try to use my Quake like console binded to the F12 key, it opens the dev.Tools. How can I disable or even better uninstall dev. Tools.
    I don't want to change the key I use for my console, I want dev.tools to stop bothering me when I'm browsing the web, IT'S DISTURBING!!!
    Most people doesn't need dev tools, just put it as a plugin !!!

    Was eventually able to eliminate this problem by deleting the size entry in the devtools.toolbox.host using about config.
    At least it's invisible now instead of occupying half the page every time I hit F12.

  • How can you disable Adobe Reader from opening a file right after you save it as a pdf?

    Hi,
    I often save word files as pdf files and right after I save them as pdfs it opens the file in adobe reader. How can I disable this?
    Thanks

    Ahh, but that's the design function of any PDF viewer add-on to a browser.
    To avoid -- Use the browser feature that saves a file to the local machine.
    Then open the file with the appropriate application.
    If your machine/device does not support this then you'd want to change to one that supports what you want eh.
    Be well...

  • How can I disable html5 videos from displaying on web pages?

    I use yahoo.com as my "news" page. In the last month or so there are more and more small format videos next to the new article. Used to be just a still pic, but now more "invasive". If I had my way I'd still click on "text only" like the old modem days. I want to READ an article, and I find the video images on their main page, before clicking on a story, to be distracting. Also, I'm on a limited data usage plan so don't appreciate them shoving data down my throat.
    Using Firefox 32.0 and Windows 8.1
    Yesterday I installed the "No Script" extension thinking I could block Just these videos, but doesn't seem to work that way. It blocks most everything including interactions like clicking on a button.
    If I examine the "object" (video) it appears to be an "html5" item. This seems to be something new from what I can google.
    There are a few help screens for html5, but these are "how do I play them" instead of "how can I block them".

    Try to set the media.autoplay.enabled pref to false on the <b>about:config</b> page.
    You can open the <b>about:config</b> page via the location/address bar.
    You can accept the warning and click "I'll be careful" to continue.
    *http://kb.mozillazine.org/about:config
    You can also see if this extension works (Flash Block is currently broken).
    *FlashStopper: https://addons.mozilla.org/en-US/firefox/addon/flashstopper/

  • How can I disable new messages from rotating?

    Hi All,
    My apologies if this has already been answered. I'm using Messages on my Macbook. I am trying to find if there is a way to disable new chats from moving above old chats. The way it works now, I use Messages for work, and when I have 3 people messaging me at once, the messages keep doing a musical chairs back and forth switch.
    I've looked through all of the settings and have not found anything. Let me know if I'm explaining this poorly and I'll try and communicate it better.
    Thanks for any help you guys can provide.
    Derrick

    HI,
    Which bit is not working ?
    The bit that sort them Manually  ?
    Or the bit that you can't change that always puts new ones at the top ?
    8:10 pm      Monday; September 22, 2014
    ​  iMac 2.5Ghz i5 2011 (Mavericks 10.9)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
     Couple of iPhones and an iPad

  • How can I disable backup password from I tune?

    how can Idisable backup password from Itune ?

    How does this relate to iPhoto on a Mac? Do you not want to be in the iPhone 4 forum?
    OT

  • How can I disable managed properties from being automatically generated in SharePoint 2013

    In SharePoint 2010 we had the option to turn this off for a crawled property category.
    How can we turn this function off in SharePoint 2013?

    Thanks Steve! That sure was not obvious... check, save, uncheck save... how did you figure that one out?
    Mike Smith TechTrainingNotes.blogspot.com
    Books:
    SharePoint 2007 2010 Customization for the Site Owner,
    SharePoint 2010 Security for the Site Owner

  • Can we call a method from a adapter class?

    Hi
    I have added KeyAdapter class to a textfield now i want to call a method in the outer class from inside the adapter class. I tried but its showing some error,
    public class A
    A()
    TF1.addKeyListener(new KeyAdapter()
    public void keyReleased(KeyEvent e)
    A a=new A();
    ec.chkSalary();                    
    chkSalary()
    can i call the method like this?

    yeah.. i got it.. i just passed that KeyEvent object to the method
    but i did declare that as a char in that method like,
    chkSalary(e) // e is the KeyEvent reference
    and the method is
    chk(char e);
    thats it.
    thank you yaar.

  • How can I disable my ipod from being controlled by others

    My brother has an iPhone 5 and he keeps restarting my whole iPod from his phone.  Does anyone know how to disable it or something that won't let him do that? And by restarting I mean he restarts it to a whole new iPod.

    He is probably using Find My iPhone app and you are probably on the same icloud account so he can restore it
    the app is here:
    https://itunes.apple.com/gb/app/find-my-iphone/id376101648?mt=8
    Turn off find my iphone by going into settings>icloud and then toggle find my iphone off
    http://support.apple.com/kb/PH2697
    Hope this helps

  • How can I disable .mp4 videos from playing automatically on Yahoo News? (and elsewhere)

    I posted a similar question last week about disabling html5 videos and that seems to have worked. But I notice that when I look at the Yahoo News main page, some videos (thumbnails) are playing automatically as I'm scrolling up and down the page. I find that annoying, distracting, and is probably consuming data on my limited plan.
    I see other questions posted about .mp4, but those are all how to PLAY rather than NOT play videos.
    Any help would be appreciated.

    You can look at: Stop Autoplay: https://addons.mozilla.org/firefox/addon/1765

  • How can I disable Game Center from iPad

    2 problems:  I can't log into Game Center. It doesn't recognize my Apple ID or password (after resetting the password) . 
    I Want to stop Game Center from popping up every time I play a game.
    suggestions?

    Yes, you explained how to create a folder, but your explanation did not work for me. Perhaps 'Game Center' is not an application? Let me explain.
    I never use iPod, and now I have Game Center, which I don't use. After you posted your suggestion, I pressed 'Game Center', waited until all the applications wiggled, and then I dragged 'Game Center' to 'iPod'. No folder was created. What happened was that the iPod application decided to avoid the Game Center application and no matter how insistent I was, they did not merge or create a folder.
    I guess I just have to live with those applications -if they are called applications as I'm not sure of this since they don't behave as the majority of applications- Apple insists I exhibit in the iPad. I hope we will not gather one of the unwanted ones in every software update.
    Thanks again for your reply and your patience.

  • How can I disable 'backspace' key from navigating back a page?

    Several times over the last couple weeks, I type up a very well thought out response on Facebook in political conversations with friends. An hour or two into my work, I hit backspace with the intent of editing what I wrote (maybe after I scrolled or something, so maybe I unintentionally took the edit window out of focus). The navigator takes me back a page and I lose my two hours of work. Infuriating! Shortcuts with the ability to wipe out two hours of works should be disable-able. Not only that, I feel that is an unsafe shortcut for this very reason, and would have added a SHIFT modifier key or something like that. I think I invented a cool word: disable-able.

    You can set the Integer pref <b>browser.backspace_action</b> to <i>2</i> on the <b>about:config</b> page to disable the backspace action. BTW Shift + Backspace does the reverse: going Forward if possible, so that is taken as well.
    * http://kb.mozillazine.org/browser.backspace_action
    *http://kb.mozillazine.org/about:config

  • How can i disable i cloud from my pc?

    some one help mee

    Hello PeterM108,
    Thank you for using Apple Support Communities!
    Sounds like you want to turn off iTunes Match.
    You can turn off iTunes Match in the same place you turn in on in the menu bar.
    In iTunes, choose Store > Turn On iTunes Match.
    From: iTunes 11 for Mac: Access all your music anytime, anywhere with iTunes Match
              http://support.apple.com/kb/PH12284
    Take care,
    Sterling

Maybe you are looking for

  • HP Pavilion dv6-1030 recovery

    I bought a recovery disc set 1 and 2 for a HP Pavilion dv6-1030us. After recovery, my windows vista keeps asking me to enter the product code and a message that says that my copy of windows is not genuine.

  • My ipad 2 hangs during software download

    how do i restart the device the icons are not working, switch off bar does not slide because of the error message left on teh screen posted

  • Itunes 10.5 freezing and taking ages to back up

    whan im backing up my ipod touch 4g to itunes it freezes or stops and wont turn off im usind windows 7 and intel pentium plz help it will eventually sync but i have to turn my computer off like 5 times and it is very annoying i have tried to run it a

  • I have more than 5 computers in my family and would like to know if I  use the same I'd?

    I have more than 5 computers in my family and would like to know if I  use the same I'd?

  • Loss of internal sound devices.

    After trying portable speakers (which used a usb and 3.5mm headphone jack) to play a show on my Macbook Air (Mid '13), I swapped for a HDMI TV setup to play the show. After successful entertainement and returning to my quarters, I noticed the Air can