Changeset 24002 in osm for applications/editors/josm
- Timestamp:
- 2010-11-01T17:38:19+01:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed_bfw/smed_bfw/src/smed_bfw/ex/SmedEx.java
r23994 r24002 1 1 package smed_bfw.ex; 2 2 3 import java.awt.BorderLayout; 4 import java.awt.Dimension; 5 import java.awt.Rectangle; 6 import java.awt.event.ActionEvent; 7 import java.awt.event.ActionListener; 8 9 import javax.swing.JButton; 3 10 import javax.swing.JFrame; 11 import javax.swing.JOptionPane; 12 import javax.swing.JPanel; 13 import javax.swing.JTabbedPane; 4 14 5 15 import org.osgi.framework.BundleActivator; … … 17 27 18 28 IManager manager = null; 29 JTabbedPane myPane = null; 30 private JPanel jPanel = null; 31 private JButton jButton = null; 19 32 20 33 @Activate … … 26 39 private void init() { 27 40 if(manager == null) System.out.println("something is wrong"); 28 else System.out.println("things alright"); 41 else { 42 myPane = manager.getTabbedPane(); 43 myPane.addTab("hello",null,getJPanel(),"hello"); 44 add(myPane, BorderLayout.CENTER); 45 setSize(new Dimension(420, 470)); 46 setVisible(true); 47 } 29 48 } 30 49 50 51 /** 52 * This method initializes jPanel 53 * 54 * @return javax.swing.JPanel 55 */ 56 private JPanel getJPanel() { 57 if (jPanel == null) { 58 jPanel = new JPanel(); 59 jPanel.setLayout(null); 60 jPanel.setPreferredSize(new Dimension(200, 130)); 61 jPanel.add(getJButton(), null); 62 } 63 return jPanel; 64 } 65 66 /** 67 * This method initializes jButton 68 * 69 * @return javax.swing.JButton 70 */ 71 private JButton getJButton() { 72 if (jButton == null) { 73 jButton = new JButton(); 74 jButton.setBounds(new Rectangle(15, 40, 160, 40)); 75 jButton.setText("Hello World!"); 76 77 jButton.addActionListener(new ActionListener() { 78 79 @Override 80 public void actionPerformed(ActionEvent arg0) { 81 JOptionPane.showMessageDialog( null, "it works" ); 82 } 83 }); 84 } 85 return jButton; 86 } 31 87 32 88 @Deactivate
Note:
See TracChangeset
for help on using the changeset viewer.