@@ -1910,25 +1910,6 @@ static public void setIcon(Frame frame) {
1910
1910
}
1911
1911
1912
1912
1913
- // someone needs to be slapped
1914
- //static KeyStroke closeWindowKeyStroke;
1915
-
1916
- /**
1917
- * Return true if the key event was a Ctrl-W or an ESC,
1918
- * both indicators to close the window.
1919
- * Use as part of a keyPressed() event handler for frames.
1920
- */
1921
- /*
1922
- static public boolean isCloseWindowEvent(KeyEvent e) {
1923
- if (closeWindowKeyStroke == null) {
1924
- int modifiers = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
1925
- closeWindowKeyStroke = KeyStroke.getKeyStroke('W', modifiers);
1926
- }
1927
- return ((e.getKeyCode() == KeyEvent.VK_ESCAPE) ||
1928
- KeyStroke.getKeyStrokeForEvent(e).equals(closeWindowKeyStroke));
1929
- }
1930
- */
1931
-
1932
1913
/**
1933
1914
* Registers key events for a Ctrl-W and ESC with an ActionListener
1934
1915
* that will take care of disposing the window.
@@ -2038,158 +2019,6 @@ static public void showError(String title, String message, Throwable e, int exit
2038
2019
}
2039
2020
2040
2021
2041
- // ...................................................................
2042
-
2043
-
2044
- // incomplete
2045
- static public int showYesNoCancelQuestion (Editor editor , String title ,
2046
- String primary , String secondary ) {
2047
- if (!OSUtils .isMacOS ()) {
2048
- int result =
2049
- JOptionPane .showConfirmDialog (null , primary + "\n " + secondary , title ,
2050
- JOptionPane .YES_NO_CANCEL_OPTION ,
2051
- JOptionPane .QUESTION_MESSAGE );
2052
- return result ;
2053
- // if (result == JOptionPane.YES_OPTION) {
2054
- //
2055
- // } else if (result == JOptionPane.NO_OPTION) {
2056
- // return true; // ok to continue
2057
- //
2058
- // } else if (result == JOptionPane.CANCEL_OPTION) {
2059
- // return false;
2060
- //
2061
- // } else {
2062
- // throw new IllegalStateException();
2063
- // }
2064
-
2065
- } else {
2066
- JOptionPane pane =
2067
- new JOptionPane ("<html> " +
2068
- "<head> <style type=\" text/css\" >" +
2069
- "b { font: 13pt \" Lucida Grande\" }" +
2070
- "p { font: 11pt \" Lucida Grande\" ; margin-top: 8px }" +
2071
- "</style> </head>" +
2072
- "<b>Do you want to save changes to this sketch<BR>" +
2073
- " before closing?</b>" +
2074
- "<p>If you don't save, your changes will be lost." ,
2075
- JOptionPane .QUESTION_MESSAGE );
2076
-
2077
- String [] options = new String []{
2078
- "Save" , "Cancel" , "Don't Save"
2079
- };
2080
- pane .setOptions (options );
2081
-
2082
- // highlight the safest option ala apple hig
2083
- pane .setInitialValue (options [0 ]);
2084
-
2085
- JDialog dialog = pane .createDialog (editor , null );
2086
- dialog .setVisible (true );
2087
-
2088
- Object result = pane .getValue ();
2089
- if (result == options [0 ]) {
2090
- return JOptionPane .YES_OPTION ;
2091
- } else if (result == options [1 ]) {
2092
- return JOptionPane .CANCEL_OPTION ;
2093
- } else if (result == options [2 ]) {
2094
- return JOptionPane .NO_OPTION ;
2095
- } else {
2096
- return JOptionPane .CLOSED_OPTION ;
2097
- }
2098
- }
2099
- }
2100
-
2101
-
2102
- //if (result == JOptionPane.YES_OPTION) {
2103
- //
2104
- // } else if (result == JOptionPane.NO_OPTION) {
2105
- // return true; // ok to continue
2106
- //
2107
- // } else if (result == JOptionPane.CANCEL_OPTION) {
2108
- // return false;
2109
- //
2110
- // } else {
2111
- // throw new IllegalStateException();
2112
- // }
2113
-
2114
- static public int showYesNoQuestion (Frame editor , String title ,
2115
- String primary , String secondary ) {
2116
- if (!OSUtils .isMacOS ()) {
2117
- return JOptionPane .showConfirmDialog (editor ,
2118
- "<html><body>" +
2119
- "<b>" + primary + "</b>" +
2120
- "<br>" + secondary , title ,
2121
- JOptionPane .YES_NO_OPTION ,
2122
- JOptionPane .QUESTION_MESSAGE );
2123
- } else {
2124
- JOptionPane pane =
2125
- new JOptionPane ("<html> " +
2126
- "<head> <style type=\" text/css\" >" +
2127
- "b { font: 13pt \" Lucida Grande\" }" +
2128
- "p { font: 11pt \" Lucida Grande\" ; margin-top: 8px }" +
2129
- "</style> </head>" +
2130
- "<b>" + primary + "</b>" +
2131
- "<p>" + secondary + "</p>" ,
2132
- JOptionPane .QUESTION_MESSAGE );
2133
-
2134
- String [] options = new String []{
2135
- "Yes" , "No"
2136
- };
2137
- pane .setOptions (options );
2138
-
2139
- // highlight the safest option ala apple hig
2140
- pane .setInitialValue (options [0 ]);
2141
-
2142
- JDialog dialog = pane .createDialog (editor , null );
2143
- dialog .setVisible (true );
2144
-
2145
- Object result = pane .getValue ();
2146
- if (result == options [0 ]) {
2147
- return JOptionPane .YES_OPTION ;
2148
- } else if (result == options [1 ]) {
2149
- return JOptionPane .NO_OPTION ;
2150
- } else {
2151
- return JOptionPane .CLOSED_OPTION ;
2152
- }
2153
- }
2154
- }
2155
-
2156
-
2157
- /**
2158
- * Retrieve a path to something in the Processing folder. Eventually this
2159
- * may refer to the Contents subfolder of Processing.app, if we bundle things
2160
- * up as a single .app file with no additional folders.
2161
- */
2162
- // static public String getContentsPath(String filename) {
2163
- // String basePath = System.getProperty("user.dir");
2164
- // /*
2165
- // // do this later, when moving to .app package
2166
- // if (PApplet.platform == PConstants.MACOSX) {
2167
- // basePath = System.getProperty("processing.contents");
2168
- // }
2169
- // */
2170
- // return basePath + File.separator + filename;
2171
- // }
2172
-
2173
-
2174
- /**
2175
- * Get a path for something in the Processing lib folder.
2176
- */
2177
- /*
2178
- static public String getLibContentsPath(String filename) {
2179
- String libPath = getContentsPath("lib/" + filename);
2180
- File libDir = new File(libPath);
2181
- if (libDir.exists()) {
2182
- return libPath;
2183
- }
2184
- // was looking into making this run from Eclipse, but still too much mess
2185
- // libPath = getContents("build/shared/lib/" + what);
2186
- // libDir = new File(libPath);
2187
- // if (libDir.exists()) {
2188
- // return libPath;
2189
- // }
2190
- return null;
2191
- }
2192
- */
2193
2022
static public File getContentFile (String name ) {
2194
2023
return BaseNoGui .getContentFile (name );
2195
2024
}
0 commit comments