Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Layout Problem  RSS feed

 
Mathews P Srampikal
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JRame and working fine with windows resolution 1024 But when it comes to 600,800.All the components are messed and JTable is not visible with columns or rows.I am using GridbagLayout.Any suggestions.Please Help.
 
Sebastiaan Kortleven
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you show the constraints?
 
Mathews P Srampikal
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is the things i am adding to
JScrollPane scrollPane=new JScrollPane(table);
pane.setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.gridx = 0;
c.gridy = 0;
c.insets = new Insets(0,5,0,5);
pane.add(lblTotal, c);
c.gridx = 1;
c.gridy = 0;
c.insets = new Insets(0,5,0,5);
pane.add(txtTotal, c);
c.gridx = 2;
c.gridy = 0;
pane.add(lblDisplaying, c);
c.gridx = 3;
c.gridy = 0;
pane.add(txtFrom, c);

c.gridx = 4;
c.gridy = 0;
pane.add(lblTo, c);

c.gridx = 5;
c.gridy = 0;
pane.add(txtTo, c);
c.gridx = 6;
c.gridy = 0;
pane.add(cmbPaging, c);
c.gridx = 7;
c.gridy = 0;
pane.add(butFirst, c);
c.gridx = 8;
c.gridy = 0;
pane.add(butPrev, c);
c.gridx = 9;
c.gridy = 0;
pane.add(butNext, c);
c.gridx = 10;
c.gridy = 0;
pane.add(butLast, c);
c.gridx = 0;
c.gridy = 1;
c.gridwidth = 12;
c.insets = new Insets(10,0,10,0); //Top 10 and Bottom 10 padding
pane.add(scrollPane, c);
//pane.add(table, c);

c.insets = new Insets(0,5,0,5);
JPanel panBottom=new JPanel();
panBottom.setLayout(new GridBagLayout());
GridBagConstraints gc = new GridBagConstraints();
gc.insets = new Insets(0,5,0,5);

gc.gridx = 0;
gc.gridy = 0;
panBottom.add(butClose, gc);

gc.gridx = 1;
gc.gridy = 0;
panBottom.add(butClear, gc);
gc.gridx = 2;
gc.gridy = 0;
panBottom.add(butAssign, gc);

gc.gridx = 3;
gc.gridy = 0;
panBottom.add(butDetails, gc);
gc.gridx = 4;
gc.gridy = 0;
panBottom.add(butFilter, gc);
c.gridx = 0;
c.gridy = 2;
pane.add(panBottom, c);
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!