1 4 package org.oddjob.designer; 5 6 import java.awt.Component ; 7 import java.awt.Font ; 8 import java.awt.GridBagConstraints ; 9 import java.awt.GridBagLayout ; 10 import java.awt.Insets ; 11 12 import javax.swing.JLabel ; 13 import javax.swing.JPanel ; 14 import javax.swing.SwingConstants ; 15 import javax.swing.border.Border ; 16 import javax.swing.border.CompoundBorder ; 17 import javax.swing.border.EmptyBorder ; 18 import javax.swing.border.TitledBorder ; 19 20 23 24 public class Looks{ 25 26 public static final int DESIGNER_TREE_WIDTH = 200; 27 public static final int DETAIL_FORM_WIDTH = 400; 28 public static final int DETAIL_FORM_BORDER = 4; 29 public static final int GROUP_BORDER = 3; 30 31 public static final int DETAIL_USABLE_WIDTH = DETAIL_FORM_WIDTH 32 - 2 * GROUP_BORDER- 2 * DETAIL_FORM_BORDER; 33 34 public static final int TEXT_FIELD_SIZE = 24; 35 public static final int LABEL_SIZE = 20; 36 37 public static final int LIST_ROWS = 8; 38 39 public static final int DESIGNER_HEIGHT = 380; 40 public static final int DESIGNER_WIDTH 41 = DESIGNER_TREE_WIDTH + DETAIL_FORM_WIDTH; 42 43 49 public static Border groupBorder(String title) { 50 return new CompoundBorder (new TitledBorder (title), 51 new EmptyBorder (GROUP_BORDER, GROUP_BORDER, GROUP_BORDER, GROUP_BORDER)); 52 } 53 54 58 public static Component typePanel(String tag) { 59 JPanel typePanel = new JPanel (new GridBagLayout ()); 60 61 GridBagConstraints c = new GridBagConstraints (); 62 c.weightx = 1.0; 63 c.weighty = 0.0; 64 c.fill = GridBagConstraints.HORIZONTAL; 65 c.anchor = GridBagConstraints.NORTHWEST; 66 c.insets = new Insets (4, 4, 4, 4); 67 68 typePanel.setBorder(Looks.groupBorder("Type")); 69 JLabel typeLabel = new JLabel (tag, SwingConstants.CENTER); 70 typeLabel.setFont(typeLabel.getFont() 71 .deriveFont(Font.BOLD, typeLabel.getFont().getSize() * 1.1F)); 72 typePanel.add(typeLabel, c); 73 return typePanel; 74 } 75 76 } 77 | Popular Tags |