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.JDialog ; 63 import javax.swing.JPanel ; 64 import javax.swing.JTextField ; 65 66 import com.jgoodies.forms.builder.DefaultFormBuilder; 67 import com.jgoodies.forms.layout.FormLayout; 68 69 72 public class DataSourceDuplicatorView extends JDialog { 73 74 protected JTextField dataSourceName; 75 protected JButton okButton; 76 protected JButton cancelButton; 77 78 public DataSourceDuplicatorView(String title) { 79 setTitle(title); 80 81 this.dataSourceName = new JTextField (); 82 this.okButton = new JButton ("Create"); 83 this.cancelButton = new JButton ("Cancel"); 84 85 FormLayout layout = new FormLayout("right:pref, 3dlu, fill:250", ""); 87 DefaultFormBuilder builder = new DefaultFormBuilder(layout); 88 builder.setDefaultDialogBorder(); 89 90 builder.append("Name:", dataSourceName); 91 92 JPanel buttons = new JPanel (new FlowLayout (FlowLayout.RIGHT)); 93 buttons.add(cancelButton); 94 buttons.add(okButton); 95 96 getContentPane().setLayout(new BorderLayout ()); 97 getContentPane().add(builder.getPanel(), BorderLayout.CENTER); 98 getContentPane().add(buttons, BorderLayout.SOUTH); 99 } 100 101 public JButton getCancelButton() { 102 return cancelButton; 103 } 104 105 public JTextField getDataSourceName() { 106 return dataSourceName; 107 } 108 109 public JButton getOkButton() { 110 return okButton; 111 } 112 } | Popular Tags |