1 package org.antlr.works.project; 2 3 import com.jgoodies.forms.factories.Borders; 4 import com.jgoodies.forms.factories.FormFactory; 5 import com.jgoodies.forms.layout.CellConstraints; 6 import com.jgoodies.forms.layout.ColumnSpec; 7 import com.jgoodies.forms.layout.FormLayout; 8 import com.jgoodies.forms.layout.RowSpec; 9 import org.antlr.xjlib.appkit.frame.XJDialog; 10 import org.antlr.xjlib.foundation.XJSystem; 11 12 import javax.swing.*; 13 import java.awt.*; 14 44 45 public class ProjectRunSettingsDialog extends XJDialog { 46 47 public ProjectRunSettingsDialog(Container parent) { 48 super(parent, true); 49 50 initComponents(); 51 setSize(550, 160); 52 53 if(XJSystem.isMacOS()) { 54 CellConstraints cc = new CellConstraints(); 55 56 buttonBar.remove(cancelButton); 57 buttonBar.remove(okButton); 58 59 buttonBar.add(cancelButton, cc.xy(2, 1)); 60 buttonBar.add(okButton, cc.xy(4, 1)); 61 } 62 63 setDefaultButton(okButton); 64 setOKButton(okButton); 65 setCancelButton(cancelButton); 66 } 67 68 public void dialogWillCloseOK() { 69 } 70 71 public void setRunParametersString(String string) { 72 runArgumentsField.setText(string); 73 } 74 75 public String getRunParametersString() { 76 return runArgumentsField.getText(); 77 } 78 79 public void setShowBeforeRunning(boolean flag) { 80 showBeforeRunningButton.setSelected(flag); 81 } 82 83 public boolean isShowBeforeRunning() { 84 return showBeforeRunningButton.isSelected(); 85 } 86 87 90 91 private void initComponents() { 92 dialogPane = new JPanel(); 95 contentPane = new JPanel(); 96 label1 = new JLabel(); 97 runArgumentsField = new JTextField(); 98 label2 = new JLabel(); 99 showBeforeRunningButton = new JCheckBox(); 100 buttonBar = new JPanel(); 101 okButton = new JButton(); 102 cancelButton = new JButton(); 103 CellConstraints cc = new CellConstraints(); 104 105 setTitle("Run Settings"); 107 Container contentPane2 = getContentPane(); 108 contentPane2.setLayout(new BorderLayout()); 109 110 { 112 dialogPane.setBorder(Borders.DIALOG_BORDER); 113 dialogPane.setLayout(new BorderLayout()); 114 115 { 117 contentPane.setLayout(new FormLayout( 118 new ColumnSpec[] { 119 FormFactory.DEFAULT_COLSPEC, 120 FormFactory.LABEL_COMPONENT_GAP_COLSPEC, 121 new ColumnSpec("max(min;200dlu):grow") 122 }, 123 new RowSpec[] { 124 FormFactory.DEFAULT_ROWSPEC, 125 FormFactory.LINE_GAP_ROWSPEC, 126 FormFactory.DEFAULT_ROWSPEC, 127 FormFactory.LINE_GAP_ROWSPEC, 128 FormFactory.DEFAULT_ROWSPEC, 129 FormFactory.LINE_GAP_ROWSPEC, 130 FormFactory.DEFAULT_ROWSPEC 131 })); 132 133 label1.setText("Run arguments:"); 135 contentPane.add(label1, cc.xy(1, 3)); 136 contentPane.add(runArgumentsField, cc.xy(3, 3)); 137 138 label2.setText("(i.e. Test input.txt)"); 140 label2.setFont(new Font("Lucida Grande", Font.PLAIN, 10)); 141 contentPane.add(label2, cc.xy(3, 5)); 142 143 showBeforeRunningButton.setText("Show this dialog before running"); 145 contentPane.add(showBeforeRunningButton, cc.xywh(1, 7, 3, 1)); 146 } 147 dialogPane.add(contentPane, BorderLayout.CENTER); 148 149 { 151 buttonBar.setBorder(Borders.BUTTON_BAR_GAP_BORDER); 152 buttonBar.setLayout(new FormLayout( 153 new ColumnSpec[] { 154 FormFactory.GLUE_COLSPEC, 155 FormFactory.BUTTON_COLSPEC, 156 FormFactory.RELATED_GAP_COLSPEC, 157 FormFactory.BUTTON_COLSPEC 158 }, 159 RowSpec.decodeSpecs("pref"))); 160 161 okButton.setText("OK"); 163 buttonBar.add(okButton, cc.xy(2, 1)); 164 165 cancelButton.setText("Cancel"); 167 buttonBar.add(cancelButton, cc.xy(4, 1)); 168 } 169 dialogPane.add(buttonBar, BorderLayout.SOUTH); 170 } 171 contentPane2.add(dialogPane, BorderLayout.CENTER); 172 pack(); 173 } 175 176 private JPanel dialogPane; 179 private JPanel contentPane; 180 private JLabel label1; 181 private JTextField runArgumentsField; 182 private JLabel label2; 183 private JCheckBox showBeforeRunningButton; 184 private JPanel buttonBar; 185 private JButton okButton; 186 private JButton cancelButton; 187 189 } 190 | Popular Tags |