1 package rero.dck; 2 3 import java.awt.*; 4 import java.awt.event.*; 5 6 import javax.swing.*; 7 import javax.swing.event.*; 8 9 import java.util.*; 10 11 public abstract class DGroup extends DContainer implements DItem 12 { 13 protected String title; 14 protected int inset; 15 16 public DGroup (String _title) 17 { 18 this(_title, 0); 19 } 20 21 public DGroup (String _title, int _inset) 22 { 23 title = " " + _title + " "; 24 inset = _inset; 25 } 26 27 public int getEstimatedWidth() 28 { 29 return 0; 30 } 31 32 public void setAlignWidth(int width) { } 33 34 public JComponent setupLayout(JComponent component) 35 { 36 component.setLayout(new BorderLayout()); 37 38 JPanel temp = new JPanel(); 39 temp.setPreferredSize(new Dimension(inset, 0)); 40 41 component.add(temp, BorderLayout.EAST); 42 43 temp = new JPanel(); 44 temp.setPreferredSize(new Dimension(inset, 0)); 45 46 component.add(temp, BorderLayout.WEST); 47 48 JPanel child = new JPanel(); 49 child.setBorder(BorderFactory.createTitledBorder(getTitle())); 50 child.setLayout(new GridBagLayout()); 51 52 component.add(child, BorderLayout.CENTER); 53 54 return child; 55 } 56 57 public String getTitle() 58 { 59 return title; 60 } 61 62 public JComponent getComponent() 63 { 64 return getDialog(); 65 } 66 } 67 | Popular Tags |