Posted on 2005-03-16
Medium Priority
Last Modified: 2010-03-31
Hello there,

I need an advice on the design of my program for school,
when the user open the window, a JTabbedPane appear.

If the user click on one of those tabs, he can see a JTable
and I would like to add a menu that let him do several things with the data in the Jtable
for example, add a row, edit a line, etc.

I tried to add buttons in a JPanel on the right of the JTable (so by default with a FlowLayout) , but the problem is that the buttons don't have all the same size, so I tried with a BorderLayout but then they getting bigger ...

maybe buttons wasn't a good idea,
(I would like to see directly all the options available,
so for example a JComboBox won't do it)

Has anyone an advice for me ?
Thank you.
Question by:matthew016
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Author Comment

ID: 13558304
I tried a JToolBar on the left, it's looks good but i can't let the buttons have the same size and make a vetical alignment

Assisted Solution

Naeemg earned 200 total points
ID: 13558361
use buttons with GridBagLayout

Accepted Solution

mkandre earned 204 total points
ID: 13565683
GridLayout (simpler) or GridBagLayout allows you control the layout much more than that of flow and border layouts.

optionally you can use a JMenuBar and just use setVisible(boolean) to make the diferent menus appear or disappear according to the selected tab.


Author Comment

ID: 13583123
Hi there, I finally used a JToolBar with a GridLayout, looks good
Thanks u both

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Suggested Courses
Course of the Month11 days, 16 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question