()
| 73 | private PopupMenu pm; |
| 74 | |
| 75 | public Channels() { |
| 76 | super("Channels"); |
| 77 | if (instance!=null) { |
| 78 | instance.toFront(); |
| 79 | return; |
| 80 | } |
| 81 | ImageJ ij = IJ.getInstance(); |
| 82 | WindowManager.addWindow(this); |
| 83 | instance = this; |
| 84 | GridBagLayout gridbag = new GridBagLayout(); |
| 85 | GridBagConstraints c = new GridBagConstraints(); |
| 86 | setLayout(gridbag); |
| 87 | int y = 0; |
| 88 | c.gridx = 0; |
| 89 | c.gridy = y++; |
| 90 | c.gridwidth = 1; |
| 91 | c.fill = GridBagConstraints.BOTH; |
| 92 | c.anchor = GridBagConstraints.CENTER; |
| 93 | int margin = 32; |
| 94 | if (IJ.isMacOSX()) |
| 95 | margin = 20; |
| 96 | c.insets = new Insets(10, margin, 10, margin); |
| 97 | choice = new Choice(); |
| 98 | for (int i=0; i<modes.length; i++) |
| 99 | choice.addItem(modes[i]); |
| 100 | choice.select(0); |
| 101 | choice.addItemListener(this); |
| 102 | if (ij!=null) choice.addKeyListener(ij); |
| 103 | add(choice, c); |
| 104 | |
| 105 | CompositeImage ci = getImage(); |
| 106 | int nCheckBoxes = ci!=null?ci.getNChannels():3; |
| 107 | if (nCheckBoxes>CompositeImage.MAX_CHANNELS) |
| 108 | nCheckBoxes = CompositeImage.MAX_CHANNELS; |
| 109 | checkbox = new Checkbox[nCheckBoxes]; |
| 110 | for (int i=0; i<nCheckBoxes; i++) { |
| 111 | checkbox[i] = new Checkbox("Channel "+(i+1), true); |
| 112 | c.insets = new Insets(0, 25, i<nCheckBoxes-1?0:10, 5); |
| 113 | c.gridy = y++; |
| 114 | add(checkbox[i], c); |
| 115 | checkbox[i].addItemListener(this); |
| 116 | checkbox[i].addKeyListener(ij); |
| 117 | } |
| 118 | |
| 119 | c.insets = new Insets(0, 15, 10, 15); |
| 120 | c.fill = GridBagConstraints.NONE; |
| 121 | c.gridwidth = 2; |
| 122 | c.gridy = y++; |
| 123 | Panel panel = new Panel(); |
| 124 | int hgap = IJ.isMacOSX()?1:5; |
| 125 | panel.setLayout(new FlowLayout(FlowLayout.RIGHT,hgap,0)); |
| 126 | helpButton = new TrimmedButton("Help",IJ.isMacOSX()?10:0);//new Button("Help"); |
| 127 | helpButton.addActionListener(this); |
| 128 | helpButton.addKeyListener(ij); |
| 129 | panel.add(helpButton, c); |
| 130 | add(panel, c); |
| 131 | moreButton = new TrimmedButton(moreLabel,IJ.isMacOSX()?10:0);//new Button(moreLabel); |
| 132 | moreButton.addActionListener(this); |
nothing calls this directly
no test coverage detected