Results 1 to 5 of 5
  1. #1
    sirwiggles's Avatar
    sirwiggles is offline Member
    Join Date
    Feb 2009
    Posts
    31
    Rep Power
    0

    Default GUI Programming Help

    Can anyone point me to any kind of resources (tutorials, books, websites, etc) to do with programming GUIs in Java, more specifically, the interaction between components and programming events.

    I have designed a programme, all the GUI work is done, i am now in the process of making it fully functional (adding events to the components) and I am having trouble understanding how to access different containers.

    For example, i have a menubar which has an option to change the colour of some text, which is in the same frame, nested in a JPanel, within a JLabel.
    How do I get access to that JLabel, from the menubar, actually from the event that the JMenuItem triggers.

    In the past, when not dealing with menubars, I have used getParent(), to move through the containers, then using get() methods to access other objects. Is there an easier or more elegant way of doing this?

    Any help would be great, I can post examples if I have not made myself clear.
    They're 10 people in the world, those who speak binary, and those who dont.
    ^ Lame i know, but i can actually count in it nowadays! :eek:

  2. #2
    sirwiggles's Avatar
    sirwiggles is offline Member
    Join Date
    Feb 2009
    Posts
    31
    Rep Power
    0

    Default

    Bump, any ideas?

    I was going to put this in the advanced sub-forum, but thought otherwise.. was I wrong?
    They're 10 people in the world, those who speak binary, and those who dont.
    ^ Lame i know, but i can actually count in it nowadays! :eek:

  3. #3
    markw8500's Avatar
    markw8500 is offline Senior Member
    Join Date
    Jul 2008
    Location
    Pennsylvania, USA
    Posts
    136
    Rep Power
    0

    Default

    Unfortunately your question is not as easy to answer as anyone would like it to be... You can start by Googling Java key words like:
    ActionListener
    KeyListener
    MouseListener
    Interface

    That should give you a good head start...
    Who Cares... As Long As It Works...

  4. #4
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    7

    Default

    If all your components are in one class, then each component should have an instance field. If the panels are in separate classes, then treat the panels as objects and provide appropriate methods to modify their contents.

    Look at the Sun Java Tutorial on Swing, about halfway down the main page. BTW, learn about the EventQueue and the event dispatcher thread.

  5. #5
    OrangeDog's Avatar
    OrangeDog is offline Senior Member
    Join Date
    Jan 2009
    Location
    Cambridge, UK
    Posts
    838
    Rep Power
    6

Similar Threads

  1. programming homework
    By pinkdiamondgail in forum Advanced Java
    Replies: 3
    Last Post: 04-15-2009, 01:10 PM
  2. Socket programming
    By ikoko in forum New To Java
    Replies: 1
    Last Post: 10-16-2008, 02:50 PM
  3. New to Programming . . .Need Help
    By DSutta22 in forum New To Java
    Replies: 2
    Last Post: 09-10-2008, 05:19 AM
  4. programming
    By abcdefg in forum New To Java
    Replies: 9
    Last Post: 03-10-2008, 10:34 AM
  5. Programming block
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-25-2007, 11:20 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •