Turn on thread page Beta

Destroying an object (Java) watch

    • Thread Starter
    Offline

    0
    ReputationRep:
    I know this is a very basic question, just started my Java assignment and am very out of practise.

    How do you destroy an object i.e a button

    i.e

    Code:
    Button startbut=new Button("Start Game");
    			add (startbut);
    	}
    	public void actionPerformed(ActionEvent e)
    	{
    		//destroy button here
    	}
    Offline

    0
    ReputationRep:
    (Original post by amazingtrade)
    I know this is a very basic question...
    *hideously confused*

    Wha?
    Offline

    0
    ReputationRep:
    (Original post by amazingtrade)
    I know this is a very basic question,
    Yes, very basic..... :rolleyes:
    What the hell?
    xox
    Offline

    4
    ReputationRep:
    Can't you just press delete?
    • Thread Starter
    Offline

    0
    ReputationRep:
    (Original post by piginapoke)
    The only way to destroy an Object in Java is to set it to null; then the garbage collector may or may not release the memory. Unless you're talking about removing it from the display, in which case you'll have to do startbut.setVisible(false);
    Thanks, yeah that will be fine, I just want to hide away from the screen basicaly.

    I find all this OO stuff so confusing!

    Kingasuprise and Mr White - Exactly I don't really understand it either!
    Offline

    0
    ReputationRep:
    (Original post by Lord Huntroyde)
    Can't you just press delete?
    No, that would be much too easy.
    Offline

    8
    ReputationRep:
    When in doubt dance!

    (Sorry for this non constructive (in a conformed sense) post)
    • Thread Starter
    Offline

    0
    ReputationRep:
    (Original post by me!)
    When in doubt dance!

    (Sorry for this non constructive (in a conformed sense) post)
    So I am so am I, I've left this assignment till late because I've been dreading it, nothing seems to work.

    I'll be lukcy to get a 3rd in this assignment. I thought I was quite good at programming as well.
    Offline

    10
    ReputationRep:
    (Original post by amazingtrade)
    I find all this OO stuff so confusing!
    I find event handling confusing.
    Offline

    0
    ReputationRep:
    (Original post by Nylex)
    I find event handling confusing.
    I dont even know what handling is lol
    xox
    Offline

    1
    ReputationRep:
    (Original post by kindersurprise)
    I dont even know what handling is lol
    xox
    I can show you. :eek:
    Offline

    10
    ReputationRep:
    (Original post by kindersurprise)
    I dont even know what handling is lol
    xox
    Events are things like keystrokes, pressing a button, mouse clicks.
    Event handling is responding to those things in a program, ie. code that does certain things when a certain button is pressed, etc.
    Offline

    0
    ReputationRep:
    (Original post by amazingtrade)
    I know this is a very basic question, just started my Java assignment and am very out of practise.
    I dont mean to be negative, or to put you on a downer, but this should be very easy for a 3rd year computing student. What languages did you learn in your first and second years?
    • Thread Starter
    Offline

    0
    ReputationRep:
    (Original post by Chris_)
    I dont mean to be negative, or to put you on a downer, but this should be very easy for a 3rd year computing student. What languages did you learn in your first and second years?
    I'm a second year student and not strictly a computing student I'm doing Multimedia and Internet Technology, most the programming langauges have been taught this year. Until this module I've never seen the object oriented model before.

    So for I've done
    ASP
    PHP
    VB6
    C
    Java (this module)
    and other simple langauges such as HTML, CSS, Lingo and Actionscript

    The modules I did last year were more about broadcast technologies (i.e TV), video production, MIDI, synthesis and VB.

    Next year I do .NET, C++ in depth sound/video production, more advanced graphics design etc.

    P.S Piginapoke the set vistible false thing works fine thanks
    Offline

    0
    ReputationRep:
    OK, sorry, I thought you were just on a straight computing degree.
    Offline

    2
    ReputationRep:
    We so need a computing subforum.
    Offline

    1
    ReputationRep:
    (Original post by rahaydenuk)
    We so need a computing subforum.
    i dread to think.......*imagines quake 3 t-shirts and yoda backpacks*
    Offline

    2
    ReputationRep:
    (Original post by piginapoke)
    Absolutely. I rarely check the academia forum (as I know about little else), and this question would have eluded me if it was posted in there.
    I'll see what I can do.
    • Thread Starter
    Offline

    0
    ReputationRep:
    A computing subsection would be very handy. The only problem is I can see it been populated with:

    "my msn aint workin' and i dowload a mp3 file caled ganstarap.mp3.exe and ths has f*cking my compotuer up, wotz wrong with dit?"

    Perhaps it would be good if there was a PC related subforum and a programming one.
    Offline

    0
    ReputationRep:
    (Original post by amazingtrade)
    Perhaps it would be good if there was a PC related subforum and a programming one.
    I was thinking of something along these lines aswell, but a programming sub-forum would be quite specialised, so it wouldn't be used by many people, and so probably isn't justified.
 
 
 
Poll
Who is most responsible for your success at university
Useful resources

The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE

Write a reply...
Reply
Hide
Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.