1 30 31 package com.jgoodies.looks.demo; 32 33 import javax.swing.*; 34 35 import com.jgoodies.forms.builder.DefaultFormBuilder; 36 import com.jgoodies.forms.layout.FormLayout; 37 import com.jgoodies.looks.Options; 38 39 45 final class HtmlTab { 46 47 private static final String HTML_TEXT = 48 "<html><b>Bold</b>, <i>Italics</i>, <tt>Typewriter</tt></html>"; 49 50 private JButton button; 51 private JToggleButton toggleButton; 52 private JComboBox comboBox; 53 private JRadioButton radioButton; 54 private JCheckBox checkBox; 55 private JLabel label; 56 57 58 61 private void initComponents() { 62 button = new JButton(HTML_TEXT); 63 button.putClientProperty(Options.IS_NARROW_KEY, Boolean.TRUE); 64 toggleButton = new JToggleButton(HTML_TEXT); 65 toggleButton.putClientProperty(Options.IS_NARROW_KEY, Boolean.TRUE); 66 radioButton = new JRadioButton(HTML_TEXT); 67 label = new JLabel(HTML_TEXT); 68 checkBox = new JCheckBox(HTML_TEXT); 69 comboBox = new JComboBox(new String [] { HTML_TEXT, "Two", "Three" }); 70 } 71 72 75 JComponent build() { 76 initComponents(); 77 78 FormLayout layout = new FormLayout( 79 "right:max(50dlu;pref), 6dlu, pref", 80 ""); 81 DefaultFormBuilder builder = new DefaultFormBuilder(layout); 82 builder.setDefaultDialogBorder(); 83 84 builder.append("Button:", button); 85 builder.append("Toggle Button:", toggleButton); 86 builder.append("Combo Box:", comboBox); 87 builder.append("Label:", label); 88 builder.append("Radio Button:", radioButton); 89 builder.append("Check Box:", checkBox); 90 return builder.getPanel(); 91 } 92 93 94 } | Popular Tags |