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

Method showDialog

ij/src/main/java/ij/plugin/Text.java:30–72  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

28 }
29
30 private void showDialog() {
31 ImagePlus imp = WindowManager.getCurrentImage();
32 Roi roi = imp!=null?imp.getRoi():null;
33 TextRoi textRoi = roi!=null&&(roi instanceof TextRoi)?(TextRoi)roi:null;
34 String fillc = "None";
35 TextRoi.setDefaultFillColor(null);
36 TextRoi.setDefaultAngle(0.0);
37 if (textRoi!=null) {
38 Font font = textRoi.getCurrentFont();
39 fontSize = font.getSize();
40 angle = (int)textRoi.getAngle();
41 style = font.getStyle();
42 justification = textRoi.getJustification();
43 Color c = textRoi.getStrokeColor();
44 if (c!=null) color=c;
45 fillc = Colors.colorToString2(textRoi.getFillColor());
46 antialiased = textRoi.getAntiAlias();
47 }
48 colorName = Colors.colorToString2(color);
49 gd =GUI.newNonBlockingDialog("Fonts");
50 gd.addChoice("Font:", getFonts(), font);
51 gd.addChoice("Style:", styles, styles[style]);
52 gd.addChoice("Just:", justifications, justifications[justification]);
53 gd.addChoice("Color:", Colors.getColors(colorName), colorName);
54 gd.addChoice("Bkgd:", Colors.getColors("None",!"None".equals(fillc)?fillc:null), fillc);
55 gd.addSlider("Size:", 9, 200, fontSize);
56 gd.addSlider("Angle:", -90, 90, angle);
57 gd.addCheckbox("Antialiased text", antialiased);
58 Point loc = Prefs.getLocation(LOC_KEY);
59 if (IJ.debugMode) {
60 Dimension screen = IJ.getScreenSize();
61 IJ.log("Fonts: "+loc+" "+screen);
62 }
63 if (loc!=null) {
64 gd.centerDialog(false);
65 gd.setLocation (loc);
66 }
67 gd.addDialogListener(this);
68 gd.setOKLabel("Close");
69 gd.hideCancelButton();
70 gd.showDialog();
71 Prefs.saveLocation(LOC_KEY, gd.getLocation());
72 }
73
74 String[] getFonts() {
75 GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();

Callers 1

runMethod · 0.95

Calls 15

getCurrentImageMethod · 0.95
getRoiMethod · 0.95
setDefaultFillColorMethod · 0.95
setDefaultAngleMethod · 0.95
getCurrentFontMethod · 0.95
getAngleMethod · 0.95
getJustificationMethod · 0.95
colorToString2Method · 0.95
newNonBlockingDialogMethod · 0.95
getFontsMethod · 0.95
getColorsMethod · 0.95
getLocationMethod · 0.95

Tested by

no test coverage detected