Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Inserting pre programmed UI elements

  1. #1
    Junior Member
    Join Date
    Sep 2011
    Thanked 0 Times in 0 Posts

    Red face Inserting pre programmed UI elements

    Hi everyone, its my first time in this forum!
    i am kind of new to java programming and iam about to start a project, a java web start application
    for now, i need to know how can I develop a bar menu, a status bar, or another set of elements that are going to be common for many jframes
    the thing is that I need to programm them one time, and insert in all the frames that are required, dont know if I explain myself

    excuse my mistakes, i am from venezuela and my english is not that good

    Thanks in advance and I will be here everyday from now!

    Something missing: I am working with netbeans ide 7.0.1

  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Washington, DC
    My Mood
    Thanked 636 Times in 540 Posts

    Default Re: Inserting pre programmed UI elements

    I don't think you can add the same menu (the same instance) to multiple JFrames. You can write a method that creates a new instance and performs the customization on it, then returns it- and just call that method to add it to as many JFrames as you want.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Junior Member
    Join Date
    Sep 2011
    Thanked 0 Times in 0 Posts

    Default Re: Inserting pre programmed UI elements

    how can I do this? for example, I have two clases
    one called Main (a JFrame) where I want to put a menu bar, and another class called Elements (a JFrame) where my menubar with the menu items is located
    I tried calling from Main
    Elements el = new Elements();

    and in Elements:
    public void initiate() {

    I know this doesn't work, do I need to copy all the stuff from Generated Code in Elements and add it to the initiate() method in Elements and call it from an instance in Main?

Similar Threads

  1. [SOLVED] inserting utf8 data into DB
    By serdar in forum What's Wrong With My Code?
    Replies: 4
    Last Post: August 5th, 2011, 05:21 PM
  2. [SOLVED] Inserting date into database
    By mithcool in forum Java Theory & Questions
    Replies: 2
    Last Post: July 16th, 2011, 01:54 AM
  3. [SOLVED] ArrayList object's elements confusing??? doesnt replace the elements? set() method?
    By chronoz13 in forum What's Wrong With My Code?
    Replies: 10
    Last Post: June 21st, 2011, 01:20 PM
  4. Beginner Needs Help Inserting row to table
    By MoniD in forum JDBC & Databases
    Replies: 5
    Last Post: March 10th, 2011, 02:15 PM
  5. Inserting Image Help
    By Bradshjo in forum What's Wrong With My Code?
    Replies: 1
    Last Post: September 22nd, 2010, 12:50 PM