Changeset 23443 in osm for applications/editors/josm/plugins/smed/src
- Timestamp:
- 2010-10-02T16:39:43+02:00 (15 years ago)
- Location:
- applications/editors/josm/plugins/smed/src/smed
- Files:
-
- 2 edited
-
plug/ifc/SmedPluggable.java (modified) (1 diff)
-
tabs/SmedTabbedPane.java (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed/src/smed/plug/ifc/SmedPluggable.java
r23426 r23443 9 9 boolean start(); 10 10 boolean stop(); 11 boolean hasFocus(); 12 boolean lostFocus(); 13 int getIndex(); 14 void setIndex(int index); 11 15 String getName(); 12 16 String getFileName(); -
applications/editors/josm/plugins/smed/src/smed/tabs/SmedTabbedPane.java
r23437 r23443 32 32 static private List<SmedPluggable> plugins = null; 33 33 static private JTabbedPane tabbedPane = null; 34 @SuppressWarnings("unused") 35 private int activeIndex = -1; 34 36 35 37 public SmedTabbedPane() { … … 42 44 43 45 if(plugins != null) { 46 47 if(tabbedPane == null) tabbedPane = new JTabbedPane(); 48 44 49 ImageIcon icon = null; 45 if(tabbedPane == null) {46 tabbedPane = new JTabbedPane();47 tabbedPane.addChangeListener(new ChangeListener() {48 49 @Override50 public void stateChanged(ChangeEvent event) {51 System.out.println("hello world");52 }53 });54 }55 50 56 51 JComponent panel; … … 68 63 tabbedPane.addTab(p.getName(),icon, panel, p.getInfo()); 69 64 tabbedPane.setMnemonicAt(i, KeyEvent.VK_1 + i); 65 if(i == 0) { 66 p.hasFocus(); 67 activeIndex = 0; 68 } 69 p.setIndex(i); 70 70 71 71 i++; … … 80 80 //The following line enables to use scrolling tabs. 81 81 tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); 82 83 // add ChangeListener 84 tabbedPane.addChangeListener(new ChangeListener() { 85 86 @Override 87 public void stateChanged(ChangeEvent event) { 88 System.out.println("hello world"); 89 System.out.println("activeIndex:\t" + activeIndex); 90 JTabbedPane pane = (JTabbedPane) event.getSource(); 91 92 for(SmedPluggable p : plugins) { 93 if(p.getIndex() == activeIndex) p.lostFocus(); 94 } 95 96 System.out.println(pane.getSelectedIndex()); 97 activeIndex = pane.getSelectedIndex(); 98 for(SmedPluggable p : plugins) { 99 if(p.getIndex() == activeIndex) p.hasFocus(); 100 } 101 } 102 }); 103 82 104 } 83 105 } catch (IOException e) { … … 89 111 public static List<SmedPluggable> getPlugins() { return plugins; } 90 112 public static JTabbedPane getTabbedPane() { return tabbedPane; } 91 92 /*93 @Override94 public void stateChanged(ChangeEvent event) {95 System.out.println("hello world");96 97 }98 */99 113 }
Note:
See TracChangeset
for help on using the changeset viewer.
