1 package org.jacorb.poa.gui.beans; 2 3 22 23 29 public class CloseButtonPanel extends java.awt.Panel implements java.awt.event.ActionListener { 30 private CloseButtonPanelController controller = null; 31 private String buttonLabel = "Close"; 32 private java.awt.FlowLayout ivjCloseButtonPanelFlowLayout = null; 33 private java.awt.Button ivjCloseButton = null; 34 37 38 public CloseButtonPanel() { 39 super(); 40 initialize(); 41 } 42 46 public CloseButtonPanel(java.awt.LayoutManager layout) { 47 super(layout); 48 } 49 private void _actionCloseButtonPressed() { 50 if (controller != null) { 51 controller._actionCloseButtonPressed(); 52 } 53 } 54 public void _init(CloseButtonPanelController _controller, String _buttonLabel) { 55 controller = _controller; 56 buttonLabel = _buttonLabel; 57 getCloseButton().setLabel(" "+buttonLabel+" "); 58 } 59 63 64 public void actionPerformed(java.awt.event.ActionEvent e) { 65 if ((e.getSource() == getCloseButton()) ) { 68 connEtoC1(e); 69 } 70 } 73 77 78 private void connEtoC1(java.awt.event.ActionEvent arg1) { 79 try { 80 this._actionCloseButtonPressed(); 83 } catch (java.lang.Throwable ivjExc) { 86 handleException(ivjExc); 89 } 90 } 91 95 96 private java.awt.Button getCloseButton() { 97 if (ivjCloseButton == null) { 98 try { 99 ivjCloseButton = new java.awt.Button (); 100 ivjCloseButton.setName("CloseButton"); 101 ivjCloseButton.setLabel(" Close "); 102 } catch (java.lang.Throwable ivjExc) { 105 handleException(ivjExc); 108 } 109 }; 110 return ivjCloseButton; 111 } 112 116 117 private java.awt.FlowLayout getCloseButtonPanelFlowLayout() { 118 java.awt.FlowLayout ivjCloseButtonPanelFlowLayout = null; 119 try { 120 121 ivjCloseButtonPanelFlowLayout = new java.awt.FlowLayout (); 122 ivjCloseButtonPanelFlowLayout.setAlignment(java.awt.FlowLayout.RIGHT); 123 ivjCloseButtonPanelFlowLayout.setHgap(10); 124 } catch (java.lang.Throwable ivjExc) { 125 handleException(ivjExc); 126 }; 127 return ivjCloseButtonPanelFlowLayout; 128 } 129 133 private void handleException(Throwable exception) { 134 135 136 } 139 142 143 private void initConnections() { 144 getCloseButton().addActionListener(this); 147 } 148 151 152 private void initialize() { 153 setName("CloseButtonPanel"); 156 setLayout(getCloseButtonPanelFlowLayout()); 157 setBackground(java.awt.SystemColor.control); 158 setSize(427, 34); 159 add(getCloseButton(), getCloseButton().getName()); 160 initConnections(); 161 } 164 168 public static void main(java.lang.String [] args) { 169 try { 170 java.awt.Frame frame; 171 try { 172 Class aFrameClass = Class.forName("com.ibm.uvm.abt.edit.TestFrame"); 173 frame = (java.awt.Frame )aFrameClass.newInstance(); 174 } catch (java.lang.Throwable ivjExc) { 175 frame = new java.awt.Frame (); 176 } 177 CloseButtonPanel aCloseButtonPanel; 178 aCloseButtonPanel = new CloseButtonPanel(); 179 frame.add("Center", aCloseButtonPanel); 180 frame.setSize(aCloseButtonPanel.getSize()); 181 frame.setVisible(true); 182 } catch (Throwable exception) { 183 System.err.println("Exception occurred in main() of java.awt.Panel"); 184 exception.printStackTrace(System.out); 185 } 186 } 187 public void paint(java.awt.Graphics g) { 188 g.setColor(getBackground()); 189 g.fill3DRect(0, 0, getBounds().width, getBounds().height, true); 190 } 191 192 } 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | Popular Tags |