Ignore:
Timestamp:
2010-09-23T00:56:44+02:00 (14 years ago)
Author:
postfix
Message:

on smed added CheckBoxList

Location:
applications/editors/josm/plugins/smed/src/smed/menu
Files:
1 edited
1 moved

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/smed/src/smed/menu/SmedMenuBar.java

    r23288 r23315  
    1010import javax.swing.JMenuItem;
    1111
    12 import smed.menu.file.HideAction;
     12import smed.menu.file.TabManager;
    1313import smed.plug.ifc.SmedPluggable;
    1414
     
    2424     JMenuItem menuItem;
    2525     public List<SmedPluggable> plugins = null;
    26      HideAction hideAction = null;
     26     TabManager hideAction = null;
    2727     
    2828     public SmedMenuBar() {
     
    3434                "The only menu in this program that has menu items");
    3535
    36         menuItem = new JMenuItem("Hide",
    37                 KeyEvent.VK_H);
     36        menuItem = new JMenuItem("Tabmanager",
     37                KeyEvent.VK_T);
    3838
    3939        menuItem.addActionListener(new java.awt.event.ActionListener() {
     
    4444                                for(SmedPluggable p : plugins) myModel.addElement (p.getName());
    4545                               
    46                                 hideAction = new HideAction(myModel);
     46                                hideAction = new TabManager(myModel);
    4747                        }
    4848                });
  • applications/editors/josm/plugins/smed/src/smed/menu/file/TabManager.java

    r23310 r23315  
    22
    33
    4 import java.awt.Dialog;
    5 
    64import javax.swing.DefaultListModel;
    7 import javax.swing.JCheckBoxMenuItem;
    85import javax.swing.JDialog;
     6import javax.swing.JScrollPane;
     7
    98import javax.swing.JPanel;
    10 import java.awt.BorderLayout;
    119import java.awt.Dimension;
     10import javax.swing.JList;
     11import java.awt.Rectangle;
    1212import javax.swing.JButton;
    13 import java.awt.Rectangle;
    14 import javax.swing.JList;
    15 import javax.swing.border.BevelBorder;
    16 import javax.swing.border.Border;
    17 import javax.swing.border.LineBorder;
    18 import javax.swing.event.ListSelectionEvent;
    19 import javax.swing.event.ListSelectionListener;
    20 
    21 import java.awt.GridBagLayout;
    22 import java.awt.GridBagConstraints;
    23 import javax.swing.JCheckBox;
    24 
    25 import smed.list.CheckBoxJList;
    26 public class HideAction extends JDialog {
    27 
     13import java.awt.Font;
     14import javax.swing.JLabel;
     15import javax.swing.JTextField;
     16
     17
     18public class TabManager extends JDialog {
    2819        /**
    2920         *
    3021         */
    3122        private static final long serialVersionUID = 1L;
    32         private JDialog hideDialog = null;  //  @jve:decl-index=0:visual-constraint="62,8"
    33         private JPanel jContentPane = null;
    34         private JButton okButton = null;
    35         private CheckBoxJList hideList = null;
    36         private JCheckBox jCheckBox = null;
    37         private DefaultListModel model = null;
    3823       
    39        
    40         public HideAction(DefaultListModel model) {
     24        DefaultListModel model;
     25
     26
     27        private JDialog tabManagerDialog = null;  //  @jve:decl-index=0:visual-constraint="59,23"
     28
     29        private JPanel tabManagerPanel = null;
     30
     31        private JScrollPane tabScrollPane = null;
     32
     33        private JList tabList = null;
     34
     35        private JButton tabButtonOk = null;
     36
     37        private JButton tabButtonCancel = null;
     38
     39        private JButton tabButtonUndo = null;
     40
     41        private JButton tabButtonLoad = null;
     42
     43        private JButton tabButtonSave = null;
     44
     45        private JButton tabButtonDelete = null;
     46
     47        private JButton tabButtonVisible = null;
     48
     49        private JButton tabButtonAll = null;
     50
     51        private JButton tabButtonNone = null;
     52
     53        private JLabel tabLabelSelect = null;
     54
     55        private JLabel tabLabelRename = null;
     56
     57        private JTextField tabTextFieldRename = null;
     58
     59        public TabManager(DefaultListModel model) {
    4160                this.model = model;
    4261               
    43                 getHideDialog().setVisible(true);
    44         }
    45        
    46         /**
    47          * This method initializes hideDialog   
     62                getTabManagerDialog().setVisible(true);
     63        }
     64
     65        /**
     66         * This method initializes tabManagerDialog     
    4867         *     
    4968         * @return javax.swing.JDialog 
    5069         */
    51         public JDialog getHideDialog() {
    52                 if (hideDialog == null) {
    53                         hideDialog = new JDialog();
    54                         hideDialog.setResizable(false);
    55                         hideDialog.setSize(new Dimension(360, 480));
    56                         hideDialog.setModal(true);
    57                         hideDialog.setTitle("Hide Tab");
    58                         hideDialog.setContentPane(getJContentPane());
    59                 }
    60                 return hideDialog;
    61         }
    62         /**
    63          * This method initializes jContentPane
     70        private JDialog getTabManagerDialog() {
     71                if (tabManagerDialog == null) {
     72                        tabManagerDialog = new JDialog(this);
     73                        tabManagerDialog.setSize(new Dimension(409, 442));
     74                        tabManagerDialog.setResizable(false);
     75                        tabManagerDialog.setModal(true);
     76                        tabManagerDialog.setContentPane(getTabManagerPanel());
     77                        tabManagerDialog.setTitle("Tabmanager");
     78                }
     79                return tabManagerDialog;
     80        }
     81
     82        /**
     83         * This method initializes tabManagerPanel     
    6484         *     
    6585         * @return javax.swing.JPanel   
    6686         */
    67         private JPanel getJContentPane() {
    68                 if (jContentPane == null) {
    69                         jContentPane = new JPanel();
    70                         jContentPane.setLayout(null);
    71                         jContentPane.add(getOkButton(), null);
    72                         jContentPane.add(getHideList(), null);
    73                 }
    74                 return jContentPane;
    75         }
    76         /**
    77          * This method initializes okButton     
    78          *     
    79          * @return javax.swing.JButton 
    80          */
    81         private JButton getOkButton() {
    82                 if (okButton == null) {
    83                         okButton = new JButton();
    84                         okButton.setBounds(new Rectangle(115, 400, 110, 20));
    85                         okButton.setName("");
    86                         okButton.setText("Ok");
    87                         okButton.addActionListener(new java.awt.event.ActionListener() {
    88                                 public void actionPerformed(java.awt.event.ActionEvent e) {
    89                                         hideDialog.setVisible(true);
    90                                         hideDialog.dispose();
    91                                 }
    92                         });
    93                 }
    94                 return okButton;
    95         }
    96         /**
    97          * This method initializes hideList     
     87        private JPanel getTabManagerPanel() {
     88                if (tabManagerPanel == null) {
     89                        tabLabelRename = new JLabel();
     90                        tabLabelRename.setBounds(new Rectangle(15, 334, 70, 25));
     91                        tabLabelRename.setText("Rename:");
     92                        tabLabelSelect = new JLabel();
     93                        tabLabelSelect.setBounds(new Rectangle(16, 304, 72, 15));
     94                        tabLabelSelect.setFont(new Font("Dialog", Font.PLAIN, 12));
     95                        tabLabelSelect.setText("Select:");
     96                        tabManagerPanel = new JPanel();
     97                        tabManagerPanel.setLayout(null);
     98                        tabManagerPanel.setOpaque(true);
     99                        // tabManagerPanel.add(getJList(), null);
     100                        tabManagerPanel.add(getTabScrollPane(), null);
     101                        tabManagerPanel.add(getTabButtonOk(), null);
     102                        tabManagerPanel.add(getTabButtonCancel(), null);
     103                        tabManagerPanel.add(getTabButtonUndo(), null);
     104                        tabManagerPanel.add(getTabButtonLoad(), null);
     105                        tabManagerPanel.add(getTabButtonSave(), null);
     106                        tabManagerPanel.add(getTabButtonDelete(), null);
     107                        tabManagerPanel.add(getTabButtonVisible(), null);
     108                        tabManagerPanel.add(getTabButtonAll(), null);
     109                        tabManagerPanel.add(getTabButtonNone(), null);
     110                        tabManagerPanel.add(tabLabelSelect, null);
     111                        tabManagerPanel.add(tabLabelRename, null);
     112                        tabManagerPanel.add(getTabTextFieldRename(), null);
     113                }
     114                return tabManagerPanel;
     115        }
     116
     117
     118        /**
     119         * This method initializes tabScrollPane       
     120         *     
     121         * @return javax.swing.JScrollPane     
     122         */
     123        private JScrollPane getTabScrollPane() {
     124                if (tabScrollPane == null) {
     125                        tabScrollPane = new JScrollPane();
     126                        tabScrollPane.setBounds(new Rectangle(15, 8, 225, 285));
     127                        tabScrollPane.setViewportView(getTabList());
     128                        tabScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
     129                }
     130                return tabScrollPane;
     131        }
     132
     133        /**
     134         * This method initializes tabList     
    98135         *     
    99136         * @return javax.swing.JList   
    100137         */
    101         public JList getHideList() {
    102                 if (hideList == null) {
    103                         hideList = new CheckBoxJList();
    104                         hideList.setModel (model);
    105                         hideList.setBounds(new Rectangle(20, 15, 315, 370));
    106                         hideList.setBorder(LineBorder.createBlackLineBorder());
    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                
    117                 return hideList;
    118         }
     138        private JList getTabList() {
     139                if (tabList == null) {
     140                        tabList = new JList();
     141                }
     142                return tabList;
     143        }
     144
     145        /**
     146         * This method initializes tabButtonOk 
     147         *     
     148         * @return javax.swing.JButton 
     149         */
     150        private JButton getTabButtonOk() {
     151                if (tabButtonOk == null) {
     152                        tabButtonOk = new JButton();
     153                        tabButtonOk.setBounds(new Rectangle(254, 4, 130, 30));
     154                        tabButtonOk.setFont(new Font("Dialog", Font.BOLD, 12));
     155                        tabButtonOk.setText("Ok");
     156                }
     157                return tabButtonOk;
     158        }
     159
     160        /**
     161         * This method initializes tabButtonCancel     
     162         *     
     163         * @return javax.swing.JButton 
     164         */
     165        private JButton getTabButtonCancel() {
     166                if (tabButtonCancel == null) {
     167                        tabButtonCancel = new JButton();
     168                        tabButtonCancel.setBounds(new Rectangle(254, 44, 130, 30));
     169                        tabButtonCancel.setFont(new Font("Dialog", Font.BOLD, 12));
     170                        tabButtonCancel.setText("Cancel");
     171                }
     172                return tabButtonCancel;
     173        }
     174
     175        /**
     176         * This method initializes tabButtonUndo       
     177         *     
     178         * @return javax.swing.JButton 
     179         */
     180        private JButton getTabButtonUndo() {
     181                if (tabButtonUndo == null) {
     182                        tabButtonUndo = new JButton();
     183                        tabButtonUndo.setBounds(new Rectangle(254, 84, 130, 30));
     184                        tabButtonUndo.setFont(new Font("Dialog", Font.BOLD, 12));
     185                        tabButtonUndo.setText("Undo");
     186                }
     187                return tabButtonUndo;
     188        }
     189
     190        /**
     191         * This method initializes tabButtonLoad       
     192         *     
     193         * @return javax.swing.JButton 
     194         */
     195        private JButton getTabButtonLoad() {
     196                if (tabButtonLoad == null) {
     197                        tabButtonLoad = new JButton();
     198                        tabButtonLoad.setBounds(new Rectangle(186, 328, 104, 30));
     199                        tabButtonLoad.setFont(new Font("Dialog", Font.BOLD, 12));
     200                        tabButtonLoad.setText("Load");
     201                }
     202                return tabButtonLoad;
     203        }
     204
     205        /**
     206         * This method initializes tabButtonSave       
     207         *     
     208         * @return javax.swing.JButton 
     209         */
     210        private JButton getTabButtonSave() {
     211                if (tabButtonSave == null) {
     212                        tabButtonSave = new JButton();
     213                        tabButtonSave.setBounds(new Rectangle(293, 328, 104, 30));
     214                        tabButtonSave.setFont(new Font("Dialog", Font.BOLD, 12));
     215                        tabButtonSave.setText("Save");
     216                }
     217                return tabButtonSave;
     218        }
     219
     220        /**
     221         * This method initializes tabButtonDelete     
     222         *     
     223         * @return javax.swing.JButton 
     224         */
     225        private JButton getTabButtonDelete() {
     226                if (tabButtonDelete == null) {
     227                        tabButtonDelete = new JButton();
     228                        tabButtonDelete.setBounds(new Rectangle(186, 362, 104, 30));
     229                        tabButtonDelete.setText("Delete");
     230                }
     231                return tabButtonDelete;
     232        }
     233
     234        /**
     235         * This method initializes tabButtonVisible     
     236         *     
     237         * @return javax.swing.JButton 
     238         */
     239        private JButton getTabButtonVisible() {
     240                if (tabButtonVisible == null) {
     241                        tabButtonVisible = new JButton();
     242                        tabButtonVisible.setBounds(new Rectangle(293, 362, 104, 30));
     243                        tabButtonVisible.setText("visible");
     244                }
     245                return tabButtonVisible;
     246        }
     247
     248        /**
     249         * This method initializes tabButtonAll
     250         *     
     251         * @return javax.swing.JButton 
     252         */
     253        private JButton getTabButtonAll() {
     254                if (tabButtonAll == null) {
     255                        tabButtonAll = new JButton();
     256                        tabButtonAll.setBounds(new Rectangle(92, 300, 72, 20));
     257                        tabButtonAll.setFont(new Font("Dialog", Font.PLAIN, 12));
     258                        tabButtonAll.setText("all");
     259                }
     260                return tabButtonAll;
     261        }
     262
     263        /**
     264         * This method initializes tabButtonNone       
     265         *     
     266         * @return javax.swing.JButton 
     267         */
     268        private JButton getTabButtonNone() {
     269                if (tabButtonNone == null) {
     270                        tabButtonNone = new JButton();
     271                        tabButtonNone.setBounds(new Rectangle(166, 300, 72, 20));
     272                        tabButtonNone.setFont(new Font("Dialog", Font.PLAIN, 12));
     273                        tabButtonNone.setText("none");
     274                }
     275                return tabButtonNone;
     276        }
     277
     278        /**
     279         * This method initializes tabTextFieldRename   
     280         *     
     281         * @return javax.swing.JTextField       
     282         */
     283        private JTextField getTabTextFieldRename() {
     284                if (tabTextFieldRename == null) {
     285                        tabTextFieldRename = new JTextField();
     286                        tabTextFieldRename.setBounds(new Rectangle(14, 362, 167, 32));
     287                }
     288                return tabTextFieldRename;
     289        }
     290
    119291}
Note: See TracChangeset for help on using the changeset viewer.