• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

my java project.

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
at the moment im learning java and i have created 2 .classes
can someone help me by editing it so that the second class is activated by the menubar in the first class. im really lost on multi class java. tutorials dont seem to help



 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

jeff howard wrote:can someone help me by editing it so that the second class is activated by the menubar in the first class. im really lost on multi class java. tutorials dont seem to help


First: Welcome to JavaRanch.
Second: I hate to say, but nobody's going to go through a thousand lines of code.

I suggest you read the SSCCE page (←click) and come up with something more focused and reasonable.

Also, please DontWriteLongLines; it makes your thread very hard to read.
For future reference, the rule is:
80 characters max.
(the SSCCE page actually recommends 62)
And that includes string literals AND comments AND long method calls.

Winston
 
Marshal
Posts: 80282
432
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome again
Agree with Winston that the long lines make your code hard to understand.
The long list of menu items without spaces is particularly difficult to read. Why have you got such a long declaration? Why are they fields rather than local variables in the constructor/setUpGUI method?
Why are you hard‑coding so much text? Why don't you load the text from a resources file?
Why have you got \n in the text? I know the books all show \n but (unless somebody has told you they want an LF character) it may be the wrong line end.

I would go farther than Winston's suggestion of an SSCCE. You are not activating any classes; you probably want to create an instance and display it. Why have you got so many top‑level containers (frames)? You should be aiming for one frame full stop. Get yourself a completely new app. I would suggest you start by displaying a frame with one component added. Remember always to start the event despatch thread.That code is probably full of spelling errors, so you will have to beat it into submission before it will actually compile.

Now add a menu to the frame. Now add a menu item to the frame. Now add an ActionListener (as an anonymous class) to the menu item which changes the colour of the panel. Now you can work out how to use that listener to make something else appear. You may want a desktop pane and internal frames rather than multiple frames. If you need a second top‑level container, use a dialogue.
 
Campbell Ritchie
Marshal
Posts: 80282
432
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to our GUIs forum.
 
What a show! What atmosphere! What fun! What a tiny ad!
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic