MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / create

Method create

ij/src/main/java/ij/text/TextWindow.java:112–164  ·  view source on GitHub ↗
(String title, TextPanel textPanel, int width, int height)

Source from the content-addressed store, hash-verified

110 }
111
112 @AstroImageJ(reason = "Add check for AIJ windows", modified = true)
113 private void create(String title, TextPanel textPanel, int width, int height) {
114 enableEvents(AWTEvent.WINDOW_EVENT_MASK);
115 if (IJ.isLinux()) setBackground(ImageJ.backgroundColor);
116 add("Center", textPanel);
117 addKeyListener(textPanel);
118 ImageJ ij = IJ.getInstance();
119 if (ij!=null) {
120 textPanel.addKeyListener(ij);
121 if (!IJ.isMacOSX()) {
122 Image img = ij.getIconImage();
123 if (img!=null)
124 try {setIconImage(img);} catch (Exception e) {}
125 }
126 }
127 addFocusListener(this);
128 String title2 = getTitle();
129 isResultsTable = title2.equals("Results") || title.contains("Measure");
130 if (!isResultsTable && title2.endsWith("(Results)")) {
131 isResultsTable = true;
132 title2 = title2.substring(0, title2.length()-9);
133 setTitle(title2);
134 textPanel.title = title2;
135 }
136 addMenuBar();
137 setFont();
138 WindowManager.addWindow(this);
139 Point loc=null;
140 int w=0, h=0;
141 if (title.contains("Results") || title.contains("Measure")) {
142 loc = Prefs.getLocation(LOC_KEY);
143 w = (int)Prefs.get(WIDTH_KEY, 0.0);
144 h = (int)Prefs.get(HEIGHT_KEY, 0.0);
145 } else if (title.equals("Log")) {
146 loc = Prefs.getLocation(LOG_LOC_KEY);
147 w = (int)Prefs.get(LOG_WIDTH_KEY, 0.0);
148 h = (int)Prefs.get(LOG_HEIGHT_KEY, 0.0);
149 } else if (title.equals("Debug")) {
150 loc = Prefs.getLocation(DEBUG_LOC_KEY);
151 w = width;
152 h = height;
153 }
154 if (loc!=null&&w>0 && h>0) {
155 setSize(w, h);
156 setLocation(loc);
157 } else {
158 setSize(width, height);
159 if (!IJ.debugMode)
160 GUI.centerOnImageJScreen(this);
161 }
162 show();
163 WindowManager.setWindow(this);
164 }
165
166 /**
167 * Opens a new text window containing the contents of a text file.

Callers 1

TextWindowMethod · 0.95

Calls 15

isLinuxMethod · 0.95
getInstanceMethod · 0.95
isMacOSXMethod · 0.95
addMenuBarMethod · 0.95
setFontMethod · 0.95
addWindowMethod · 0.95
getLocationMethod · 0.95
getMethod · 0.95
centerOnImageJScreenMethod · 0.95
setWindowMethod · 0.95
setBackgroundMethod · 0.80
substringMethod · 0.80

Tested by

no test coverage detected