1 56 package org.objectstyle.cayenne.modeler.dialog.pref; 57 58 import java.awt.BorderLayout ; 59 import java.awt.FlowLayout ; 60 61 import javax.swing.JButton ; 62 import javax.swing.JComboBox ; 63 import javax.swing.JDialog ; 64 import javax.swing.JPanel ; 65 import javax.swing.JTextField ; 66 67 import com.jgoodies.forms.builder.DefaultFormBuilder; 68 import com.jgoodies.forms.layout.FormLayout; 69 70 73 public class DataSourceCreatorView extends JDialog { 74 75 protected JTextField dataSourceName; 76 protected JComboBox adapters; 77 protected JButton okButton; 78 protected JButton cancelButton; 79 80 public DataSourceCreatorView() { 81 this.dataSourceName = new JTextField (); 82 this.adapters = new JComboBox (); 83 this.okButton = new JButton ("Create"); 84 this.cancelButton = new JButton ("Cancel"); 85 86 FormLayout layout = new FormLayout( 88 "right:pref, 3dlu, fill:max(50dlu;pref):grow", 89 ""); 90 DefaultFormBuilder builder = new DefaultFormBuilder(layout); 91 builder.setDefaultDialogBorder(); 92 93 builder.append("Name:", dataSourceName); 94 builder.append("Adapter:", adapters); 95 96 JPanel buttons = new JPanel (new FlowLayout (FlowLayout.RIGHT)); 97 buttons.add(cancelButton); 98 buttons.add(okButton); 99 100 getContentPane().setLayout(new BorderLayout ()); 101 getContentPane().add(builder.getPanel(), BorderLayout.CENTER); 102 getContentPane().add(buttons, BorderLayout.SOUTH); 103 104 setTitle("Create New Local DataSource"); 105 } 106 107 public JComboBox getAdapters() { 108 return adapters; 109 } 110 111 public JButton getCancelButton() { 112 return cancelButton; 113 } 114 115 public JButton getOkButton() { 116 return okButton; 117 } 118 119 public JTextField getDataSourceName() { 120 return dataSourceName; 121 } 122 } | Popular Tags |