forked from jayunruh/Jay_Plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathduplicate_table_jru_v1.java
More file actions
40 lines (38 loc) · 1.42 KB
/
Copy pathduplicate_table_jru_v1.java
File metadata and controls
40 lines (38 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*******************************************************************************
* Copyright (c) 2012 Jay Unruh, Stowers Institute for Medical Research.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Public License v2.0
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
******************************************************************************/
import ij.*;
import ij.process.*;
import ij.gui.*;
import java.awt.*;
import ij.plugin.*;
import ij.util.*;
import ij.text.*;
public class duplicate_table_jru_v1 implements PlugIn {
public void run(String arg) {
Frame[] niframes=WindowManager.getNonImageWindows();
String[] titles=new String[niframes.length];
for(int i=0;i<niframes.length;i++){
titles[i]=niframes[i].getTitle();
}
GenericDialog gd=new GenericDialog("Windows");
gd.addChoice("Windows",titles,titles[0]);
gd.showDialog();
if(gd.wasCanceled()){return;}
int index=gd.getNextChoiceIndex();
if(niframes[index] instanceof TextWindow){
TextWindow tw=(TextWindow)niframes[index];
TextPanel tp=tw.getTextPanel();
String temptext=tp.getText();
int pos=temptext.indexOf("\n");
temptext=temptext.substring(pos+1,temptext.length());
new TextWindow(tw.getTitle(),tp.getColumnHeadings(),temptext,200,400);
} else {
IJ.showMessage("wrong window type");
}
}
}