1 4 package org.webdocwf.util.loader.wizard; 5 6 import java.awt.BorderLayout ; 7 import java.awt.Component ; 8 import java.awt.Dimension ; 9 import java.awt.event.WindowAdapter ; 10 import java.awt.event.WindowEvent ; 11 12 import javax.swing.ImageIcon ; 13 import javax.swing.JButton ; 14 import javax.swing.JComboBox ; 15 import javax.swing.JInternalFrame ; 16 import javax.swing.JLabel ; 17 import javax.swing.JPanel ; 18 import javax.swing.JTabbedPane ; 19 import javax.swing.JTextField ; 20 import javax.swing.JToolBar ; 21 22 28 public class OctopusProjectFrame extends JInternalFrame { 29 30 JTabbedPane tabbedPane = new JTabbedPane (); 31 OctopusLoaderPanel loaderPanel; 32 OctopusGeneratorPanel generatorPanel; 33 JToolBar toolBar; 34 String projectName = ""; 35 String pathToOPF = ""; 36 37 public OctopusProjectFrame( 38 String name, 39 OctopusLoaderPanel loaderPanel, 40 OctopusGeneratorPanel generatorPanel, 41 JToolBar toolBar) { 42 super(name, true, false, true, true); 43 this.loaderPanel = loaderPanel; 44 this.generatorPanel = generatorPanel; 45 this.toolBar = toolBar; 46 this.projectName = name; 47 init(); 48 } 49 50 private void init() { 51 try { 52 setFrameIcon( new ImageIcon (getClass().getClassLoader().getResource("org/webdocwf/util/loader/"+ 53 "wizard/images/Enhydra16.gif"))); 54 setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); 55 JPanel contentPane = new JPanel (new BorderLayout ()); 56 contentPane.add(toolBar,BorderLayout.NORTH); 57 contentPane.add(tabbedPane,BorderLayout.CENTER); 58 setContentPane(contentPane); 59 addToTab("TDT Generator",generatorPanel); 60 addToTab("TDT Loader",loaderPanel); 61 setBounds(0, 0, 1000, 750); 63 }catch(Exception e) { 64 e.printStackTrace(); 65 } 66 } 67 68 public String getProjectName() { 69 return this.projectName; 70 } 71 72 public OctopusLoaderPanel getLoaderPanel() { 73 return this.loaderPanel; 74 } 75 76 public OctopusGeneratorPanel getGeneratorPanel() { 77 return this.generatorPanel; 78 } 79 80 public void addToTab(String title, Component component) { 81 this.tabbedPane.add(title, component); 82 } 83 84 public void setActiveTab(int index) { 85 this.tabbedPane.setSelectedIndex(index); 86 } 87 88 89 90 public static JButton createOctopusButton(String componentName, Dimension dimension) { 91 92 JButton button = new JButton (); 93 if (!componentName.equalsIgnoreCase("")) 94 button.setText(componentName); 95 button.setAlignmentX(Component.LEFT_ALIGNMENT); 96 button.setAlignmentY(Component.CENTER_ALIGNMENT); 97 button.setMinimumSize(new Dimension (dimension)); 98 button.setMaximumSize(new Dimension (dimension)); 99 button.setPreferredSize(new Dimension (dimension)); 100 101 return button; 102 } 103 104 public static JComboBox createOctopusCombobox(String componentName, Dimension dimension) { 105 106 JComboBox comboBox = new JComboBox (); 107 comboBox.setName(componentName); 108 comboBox.setAlignmentX(Component.LEFT_ALIGNMENT); 109 comboBox.setAlignmentY(Component.CENTER_ALIGNMENT); 110 comboBox.setMinimumSize(new Dimension (dimension)); 111 comboBox.setMaximumSize(new Dimension (dimension)); 112 comboBox.setPreferredSize(new Dimension (dimension)); 113 114 return comboBox; 115 } 116 117 public static JLabel createOctopusLabel(String componentName, Dimension dimension) { 118 119 JLabel label = new JLabel (); 120 label.setText(componentName); 121 label.setAlignmentX(Component.LEFT_ALIGNMENT); 122 label.setAlignmentY(Component.CENTER_ALIGNMENT); 123 label.setMinimumSize(new Dimension (dimension)); 124 label.setMaximumSize(new Dimension (dimension)); 125 label.setPreferredSize(new Dimension (dimension)); 126 127 return label; 128 } 129 130 public static JTextField createOctopusTextField(String componentName, Dimension dimension) { 131 132 JTextField textField = new JTextField (); 133 textField.setName(componentName); 134 textField.setAlignmentX(Component.LEFT_ALIGNMENT); 135 textField.setAlignmentY(Component.CENTER_ALIGNMENT); 136 textField.setMinimumSize(new Dimension (dimension)); 137 textField.setMaximumSize(new Dimension (dimension)); 138 textField.setPreferredSize(new Dimension (dimension)); 139 140 return textField; 141 } 142 143 public String getPathToOPF() { 144 return pathToOPF; 145 } 146 147 public void setPathToOPF(String pathToOPF) { 148 this.pathToOPF = pathToOPF; 149 } 150 151 } 152 | Popular Tags |