Results 1 to 2 of 2
- 12-12-2012, 04:25 PM #1
Member
- Join Date
- Dec 2012
- Posts
- 1
- Rep Power
- 0
School Project - Help with JTabbedPane Layout/Formatting of one of the Tabs
I am new to JAVA, but long time programmer C#, Basic, Pascal.
Anyway, I am working on a class project with 8 tabs and each tab does something different. The one I am having problems with is a Calculator/Converter of sorts.
It is supposed to look like this one. I am finding the programming part to be fairly simple, just figuring out the layout is very daunting.
I think I need to add another panel or figure out how to split the one I have into north and south. There are eventually going to be a few buttons on the bottom.

However instead it looks like this:

I know about GridLayout an tried to do it as 2,5 (two rows, 5 columns):

My TabbedPane looks like
My lenthCalc file:Java Code:setlCalc(new LengthCalc()); jp4.setLayout(new GridLayout(2,5)); jp4.add(getlCalc().getLblMm()); jp4.add(getlCalc().getLblMeters()); jp4.add(getlCalc().getLblYards()); jp4.add(getlCalc().getLblFeet()); jp4.add(getlCalc().getLblInches()); jp4.add(getlCalc().getMm()); jp4.add(getlCalc().getMeters()); jp4.add(getlCalc().getYards()); jp4.add(getlCalc().getFeet()); jp4.add(getlCalc().getInches());
I can attach the complete code if it helps.Java Code:public class LengthCalc { private JTextField mm = new JTextField(5), meters = new JTextField(5), yards = new JTextField(5), feet = new JTextField(5), inches = new JTextField(5); private JButton convertLength, exitButton; private JLabel lblMm = new JLabel ("Millimeters"), lblMeters = new JLabel ("Meters"), lblYards = new JLabel ("Yards"), lblFeet = new JLabel ("Feet"), lblInches = new JLabel ("Inches") ; public LengthCalc(){ }Last edited by CarlosSpicyWeiner; 12-12-2012 at 04:30 PM.
- 12-12-2012, 04:38 PM #2
Re: School Project - Help with JTabbedPane Layout/Formatting of one of the Tabs
Moved from New to Java.
This Tutorial Lesson: Laying Out Components Within a Container (The Java™ Tutorials > Creating a GUI With JFC/Swing) should help you to pick a suitable layout. Don't lose sight of the fact that you can nest containers, each with their own layout manager, in an outer container that agan, has its own layout manager.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
Similar Threads
-
Custom JTabbedPane layout policy
By Leanne182x in forum AWT / SwingReplies: 0Last Post: 02-15-2011, 11:53 AM -
How to close all tabs in JTabbedPane?
By LeonLanford in forum AWT / SwingReplies: 8Last Post: 06-28-2010, 05:05 PM -
Arrangement of tabs in JTabbedPane
By swapnilnawale in forum AWT / SwingReplies: 0Last Post: 03-20-2009, 07:27 PM -
Adding Tabs to JTabbedPane
By blackstone in forum AWT / SwingReplies: 2Last Post: 11-14-2007, 03:15 PM -
resize tabs in jtabbedpane
By osval in forum New To JavaReplies: 1Last Post: 08-02-2007, 03:02 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks