1 2 25 26 package org.aspectj.tools.ajbrowser; 27 28 import java.io.*; 29 import javax.swing.*; 30 import java.awt.*; 31 import javax.swing.border.*; 32 import org.aspectj.ajde.ui.swing.*; 33 34 37 public class BrowserOptionsPanel extends OptionsPanel { 38 39 private JPanel runOptions_panel = new JPanel(); 40 private JPanel build_panel = new JPanel(); 41 private FlowLayout flowLayout1 = new FlowLayout(); 42 private JTextField classToRun_field = new JTextField(); 43 private JLabel jLabel4 = new JLabel(); 44 private BorderLayout borderLayout4 = new BorderLayout(); 45 private JPanel buildPaths_panel = new JPanel(); 46 private Box compileOptions_box2 = Box.createVerticalBox(); 47 private JTextField classpath_field = new JTextField(); 48 private JTextField outputPath_field = new JTextField(); 49 private JLabel jLabel16 = new JLabel(); 50 private JLabel jLabel15 = new JLabel(); 51 private Box compileOptions_box3 = Box.createVerticalBox(); 52 private BorderLayout borderLayout1 = new BorderLayout(); 53 private Border border1; 54 private TitledBorder titledBorder1; 55 private Border border2; 56 private Border border3; 57 private TitledBorder titledBorder2; 58 private Border border4; 59 60 public BrowserOptionsPanel() { 61 try { 62 jbInit(); 63 this.setName("AJBrowser Options"); 64 } catch (Exception e) { 65 e.printStackTrace(); 66 } 67 } 68 69 public void loadOptions() throws IOException { 70 outputPath_field.setText( 71 BrowserManager.getDefault().getBrowserProjectProperties().getOutputPath() 72 ); 73 classpath_field.setText( 74 BrowserManager.getDefault().getBrowserProjectProperties().getClasspath() 75 ); 76 classToRun_field.setText( 77 BrowserManager.getDefault().getBrowserProjectProperties().getClassToExecute() 78 ); 79 } 80 81 public void saveOptions() throws IOException { 82 BrowserManager.getDefault().getBrowserProjectProperties().setOutputPath( 83 outputPath_field.getText() 84 ); 85 BrowserManager.getDefault().getBrowserProjectProperties().setClasspath( 86 classpath_field.getText() 87 ); 88 BrowserManager.getDefault().getBrowserProjectProperties().setClassToExecute( 89 classToRun_field.getText() 90 ); 91 } 92 93 private void jbInit() throws Exception { 94 border1 = 95 BorderFactory.createEtchedBorder(Color.white, new Color(156, 156, 158)); 96 titledBorder1 = new TitledBorder(border1, "ajc Build Paths"); 97 border2 = 98 BorderFactory.createCompoundBorder( 99 titledBorder1, 100 BorderFactory.createEmptyBorder(5, 5, 5, 5)); 101 border3 = 102 BorderFactory.createEtchedBorder(Color.white, new Color(156, 156, 158)); 103 titledBorder2 = new TitledBorder(border3, "Run Options"); 104 border4 = 105 BorderFactory.createCompoundBorder( 106 titledBorder2, 107 BorderFactory.createEmptyBorder(5, 5, 5, 5)); 108 this.setLayout(borderLayout1); 109 build_panel.setLayout(borderLayout4); 110 classToRun_field.setFont(new java.awt.Font ("SansSerif", 0, 11)); 111 classToRun_field.setMinimumSize(new Dimension(200, 21)); 112 classToRun_field.setPreferredSize(new Dimension(250, 21)); 113 jLabel4.setFont(new java.awt.Font ("Dialog", 0, 11)); 114 jLabel4.setText("Fully qualified name for main class to run: "); 115 buildPaths_panel.setLayout(flowLayout1); 116 runOptions_panel.setBorder(border4); 117 buildPaths_panel.setBorder(border2); 118 classpath_field.setFont(new java.awt.Font ("SansSerif", 0, 11)); 119 classpath_field.setMinimumSize(new Dimension(100, 21)); 120 classpath_field.setPreferredSize(new Dimension(150, 21)); 121 outputPath_field.setPreferredSize(new Dimension(225, 21)); 122 outputPath_field.setMinimumSize(new Dimension(100, 21)); 123 outputPath_field.setFont(new java.awt.Font ("SansSerif", 0, 11)); 124 jLabel16.setText("Classpath (defaults to current directory): "); 125 jLabel16.setPreferredSize(new Dimension(200, 25)); 126 jLabel16.setMaximumSize(new Dimension(400, 25)); 127 jLabel16.setFont(new java.awt.Font ("Dialog", 0, 11)); 128 jLabel15.setMaximumSize(new Dimension(400, 25)); 129 jLabel15.setFont(new java.awt.Font ("Dialog", 0, 11)); 130 jLabel15.setPreferredSize(new Dimension(230, 25)); 131 jLabel15.setText("Output path (defaults to current directory): "); 132 titledBorder1.setTitleFont(new java.awt.Font ("Dialog", 0, 11)); 133 titledBorder2.setTitleFont(new java.awt.Font ("Dialog", 0, 11)); 134 runOptions_panel.add(jLabel4, null); 135 runOptions_panel.add(classToRun_field, null); 136 build_panel.add(buildPaths_panel, BorderLayout.CENTER); 137 build_panel.add(runOptions_panel, BorderLayout.SOUTH); 138 compileOptions_box2.add(outputPath_field, null); 139 compileOptions_box2.add(classpath_field, null); 140 compileOptions_box3.add(jLabel15, null); 141 compileOptions_box3.add(jLabel16, null); 142 buildPaths_panel.add(compileOptions_box3, null); 143 buildPaths_panel.add(compileOptions_box2, null); 144 this.add(build_panel, BorderLayout.NORTH); 145 } 146 147 } | Popular Tags |