Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Menu based on text

 
Lovro Posaric
Greenhorn
Posts: 11
Firefox Browser Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
I want to make menu on left side of frame, buttons'd be text...when clicked they'd open submenu and after that new jframe/panel...Hope you know what I want...
I read lots of examples but they wasn't what I wanted..most of them was on upper side..opening while clicked(I want it to be there opened all time while program is running)...
Please answer!
Thanks!
 
Paul Clapham
Sheriff
Pie
Posts: 20966
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, of course your "menu" can't be a JMenu because that automatically goes at the top of the frame with dropdowns and so on, and you said you didn't want that.

But you can still create a JPanel whose layout manager splits it into two parts vertically. In the left part is where you want your menu buttons, correct? So in the left pane you would use a layout manager which arranged your menu buttons in a vertical list. Although you mentioned "submenus", so maybe you should have a JTree there with your menu options.

At any rate you should go through the Swing tutorial, especially the parts which cover the common layout managers, so you have a better idea of what things are possible.
 
Lovro Posaric
Greenhorn
Posts: 11
Firefox Browser Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

In the left part is where you want your menu buttons, correct?

Yes and no, I want them look like just text that is clickable..I mean, when you click on it, it opens some window or so...
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You probably still want buttons, then. But see if you can take the borders off the buttons, so only the text remains visible.
 
Lovro Posaric
Greenhorn
Posts: 11
Firefox Browser Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for answers!

this worked, but when I click on button it becomes blue(eclipse's default) until cursor is on it...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic