View unanswered posts | View active topics It is currently Wed May 24, 2017 5:15 am

Reply to topic  [ 1 post ] 
 Components Position-Size problems 
Author Message

Joined: Mon Sep 28, 2009 10:37 pm
Posts: 2
Post Components Position-Size problems
Hi everyone!
I´m a newbie in MigLayout and i´m having some problems.
My JFrame is 800x600 in size
I have a JPanel with some components like:

private JPanel getJPanel() {
  if (jPanel == null) {
    jPanel = new JPanel(); 
    jPanel.setLayout(new MigLayout());
    //add components
    jPanel.add(new JLabel("Equippament/Tools"));
   jPanel.add(getComboBoxTools(), "span, grow");
   jPanel.add(new JLabel("Size:"));
   jPanel.add(new JTextField(20));
   jPanel.add(new JLabel("Size Account:"));
   jPanel.add(new JTextField(20));         
   jPanel.add(new JLabel("Item:"));
   jPanel.add(new JTextField(20),"wrap");   
        jPanel.add(new JLabel("Control note:"));
   jPanel.add(new JTextField(20));
   jPanel.add(new JLabel("Quantity:"));
   jPanel.add(new JTextField(20));
   jPanel.add(new JLabel("Nº of species:"));
   jPanel.add(new JTextField(20),"wrap");
   jPanel.add(new JLabel("Partnership:"));
   jPanel.add(new JTextField(20));
   jPanel.add(new JLabel("Date of register:"));
   jPanel.add(new JTextField(10));
   jPanel.add(new JLabel("Date of capture:"));
   jPanel.add(new JTextField(10));
   jPanel.add(new JLabel("Serial number:"));
   jPanel.add(new JTextField(20),"wrap");
        jPanel.add(new JLabel("Notes/Observations:"),"wrap");
   jPanel.add(new JTextArea(4,70),"wrap");
        jPanel.add(new JLabel("List Items:"),"wrap");      
        jPanel.add(getJPanel1(),"span, grow");
      return jPanel;


My getJPanel1() contains my jtable:
private JPanel getJPanel1() {
      if (jPanel1 == null) {
         jPanel1 = new JPanel();
         jPanel1.setLayout(new MigLayout());      
jPanel1.add(getJScrollPane());//, BorderLayout.CENTER);         
      return jPanel1;

And my ContentPane:
private JPanel getJContentPane() {
      if (jContentPane == null) {
         jContentPane = new JPanel();
         jContentPane.setLayout(new BorderLayout());
         jContentPane.add(getJJToolBarBar(), BorderLayout.NORTH);
         jContentPane.add(getJPanel(), BorderLayout.CENTER);         
      return jContentPane;

But after my conponent number nine("Serial number") all the components lost their sizes.Just to remember i wanna a frame like that:

"Label" [a big Combobox]
"label"[textfield 20] "label" [textfield20] "label"[textfield20]
"label"[textfield 20] "label" [textfield20] "label"[textfield 10]
"label"[textfield 20] "label" [textfield 10] "label"[textfield 10]
"label"[textfield 20]
[textarea 4,70]
[JTable 720,240]

Please, any help will be good!


Mon Aug 09, 2010 10:22 pm
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.