MCPcopy Create free account
hub / github.com/OpenSourcePhysics/osp / OSPFrame

Method OSPFrame

src/org/opensourcephysics/display/OSPFrame.java:100–143  ·  view source on GitHub ↗

OSPFrame constructor with a title. @param title

(String title)

Source from the content-addressed store, hash-verified

98 * @param title
99 */
100 public OSPFrame(String title) {
101 super(TeXParser.parseTeX(title));
102 if (OSPRuntime.appletMode) {
103 keepHidden = true;
104 }
105 buttonPanel.setVisible(false);
106 setLocation(topx, topy);
107 Dimension d = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
108 topx = Math.min(topx + 20, (int) d.getWidth() - 100);
109 topy = Math.min(topy + 20, (int) d.getHeight() - 100);
110 setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
111 // Changes font size to current level
112 FontSizer.addListener(FontSizer.PROPERTY_LEVEL, new PropertyChangeListener() { // $NON-NLS-1$
113 @Override
114 public void propertyChange(PropertyChangeEvent e) {
115 setFontLevel(FontSizer.getLevel());
116 }
117
118 });
119 ToolsRes.addPropertyChangeListener(ToolsRes.OSP_PROPERTY_LOCALE, new PropertyChangeListener() { //$NON-NLS-1$
120 @Override
121 public void propertyChange(PropertyChangeEvent e) {
122 refreshGUI();
123 }
124
125 });
126 if (!OSPRuntime.isJS)
127 try {
128 setIconImage(ResourceLoader.getImageIcon(OSP_ICON_FILE).getImage());
129 } catch (Exception ex) {
130 ex.printStackTrace();
131 // image not found
132 }
133 addWindowListener(new WindowAdapter() {
134 /**
135 * Closes and disposes child windows when this window is about to be closed.
136 */
137 @Override
138 public void windowClosed(WindowEvent e) {
139 disposeChildWindows();
140 }
141
142 });
143 }
144
145 protected String action=null;
146 private ComponentAdapter adapter=null;

Callers

nothing calls this directly

Calls 12

parseTeXMethod · 0.95
addListenerMethod · 0.95
getImageIconMethod · 0.95
minMethod · 0.80
setContentPaneMethod · 0.80
setVisibleMethod · 0.65
getWidthMethod · 0.65
getHeightMethod · 0.65
getImageMethod · 0.65
setLocationMethod · 0.45

Tested by

no test coverage detected