Changeset 23288 in osm
- Timestamp:
- 2010-09-21T00:13:50+02:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/smed/src/smed
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed/src/smed/menu/SmedMenuBar.java
r23282 r23288 1 1 package smed.menu; 2 2 3 import java.awt.Rectangle;4 import java.awt.event.ActionEvent;5 import java.awt.event.ActionListener;6 3 import java.awt.event.KeyEvent; 7 4 import java.util.ArrayList; 8 5 import java.util.List; 9 6 10 import javax.swing.JCheckBox; 11 import javax.swing.JDialog; 7 import javax.swing.DefaultListModel; 12 8 import javax.swing.JMenu; 13 9 import javax.swing.JMenuBar; 14 10 import javax.swing.JMenuItem; 15 import javax.swing.JPanel;16 import javax.swing.SwingUtilities;17 11 18 import smed.Smed;19 import smed.list.JCheckBoxList;20 12 import smed.menu.file.HideAction; 21 13 import smed.plug.ifc.SmedPluggable; … … 31 23 JMenu menu, submenu; 32 24 JMenuItem menuItem; 25 public List<SmedPluggable> plugins = null; 26 HideAction hideAction = null; 33 27 34 public SmedMenuBar() {28 public SmedMenuBar() { 35 29 menuBar = new JMenuBar(); 36 30 … … 46 40 47 41 public void actionPerformed(java.awt.event.ActionEvent e) { 48 HideAction hideAction = new HideAction();49 JDialog dialogHide = hideAction.getHideDialog(); 50 JCheckBoxList hideList = hideAction.getHideList();42 DefaultListModel myModel = new DefaultListModel(); 43 44 for(SmedPluggable p : plugins) myModel.addElement (p.getName()); 51 45 52 JCheckBox jCheckBox = new JCheckBox(); 53 jCheckBox.setBounds(new Rectangle(5, 10, 300, 20)); 54 jCheckBox.setText("hello world"); 55 56 List<JCheckBox> hideCBList = new ArrayList<JCheckBox>(); 57 58 /* 59 for(SmedPluggable p : Smed.getPlugins() ) { 60 61 } 62 */ 63 64 hideList.add(jCheckBox); 65 66 67 dialogHide.setVisible(true); 46 hideAction = new HideAction(myModel); 68 47 } 69 48 }); -
applications/editors/josm/plugins/smed/src/smed/menu/file/HideAction.java
r23282 r23288 4 4 import java.awt.Dialog; 5 5 6 import javax.swing.DefaultListModel; 6 7 import javax.swing.JCheckBoxMenuItem; 7 8 import javax.swing.JDialog; … … 15 16 import javax.swing.border.Border; 16 17 import javax.swing.border.LineBorder; 18 import javax.swing.event.ListSelectionEvent; 19 import javax.swing.event.ListSelectionListener; 17 20 18 21 import java.awt.GridBagLayout; … … 20 23 import javax.swing.JCheckBox; 21 24 22 import smed.list. JCheckBoxList;25 import smed.list.CheckBoxJList; 23 26 public class HideAction extends JDialog { 24 27 … … 30 33 private JPanel jContentPane = null; 31 34 private JButton okButton = null; 32 private JCheckBoxList hideList = null;35 private CheckBoxJList hideList = null; 33 36 private JCheckBox jCheckBox = null; 37 private DefaultListModel model = null; 34 38 39 40 public HideAction(DefaultListModel model) { 41 this.model = model; 42 43 getHideDialog().setVisible(true); 44 } 35 45 36 46 /** … … 77 87 okButton.addActionListener(new java.awt.event.ActionListener() { 78 88 public void actionPerformed(java.awt.event.ActionEvent e) { 89 hideDialog.setVisible(true); 79 90 hideDialog.dispose(); 80 91 } … … 88 99 * @return javax.swing.JList 89 100 */ 90 public J CheckBoxList getHideList() {101 public JList getHideList() { 91 102 if (hideList == null) { 92 hideList = new JCheckBoxList(); 103 hideList = new CheckBoxJList(); 104 hideList.setModel (model); 93 105 hideList.setBounds(new Rectangle(20, 15, 315, 370)); 94 106 hideList.setBorder(LineBorder.createBlackLineBorder()); 95 } 107 hideList.addListSelectionListener(new ListSelectionListener() { 108 109 @Override 110 public void valueChanged(ListSelectionEvent arg0) { 111 int i = hideList.getSelectedIndex(); 112 System.out.println("i:\t" + i); 113 } 114 }); 115 } 116 96 117 return hideList; 97 118 } -
applications/editors/josm/plugins/smed/src/smed/tabs/SmedTabAction.java
r23282 r23288 25 25 */ 26 26 private static final long serialVersionUID = 1L; 27 private SmedTabbedPane smedTabs = new SmedTabbedPane(); 28 private SmedMenuBar smedMenu = new SmedMenuBar(); 27 29 28 30 public SmedTabAction() { … … 49 51 frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); 50 52 53 smedMenu.plugins = smedTabs.plugins; 54 51 55 //Add content to the window. 52 frame.setJMenuBar( new SmedMenuBar());53 frame.add( new SmedTabbedPane(), BorderLayout.CENTER);56 frame.setJMenuBar(smedMenu); 57 frame.add(smedTabs, BorderLayout.CENTER); 54 58 55 59 //Display the window. -
applications/editors/josm/plugins/smed/src/smed/tabs/SmedTabbedPane.java
r23282 r23288 19 19 public class SmedTabbedPane extends JPanel { 20 20 21 privateList<SmedPluggable> plugins = null;21 List<SmedPluggable> plugins = null; 22 22 23 23 /**
Note:
See TracChangeset
for help on using the changeset viewer.