Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4278beb

Browse files
author
zhourenjian
committed
Move *.properties into *.js so that this example can be loaded from other sites
(no XMLHttpRequest calls are made for *.properties).
1 parent efb455c commit 4278beb

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

tests/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ControlExample.java

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
* @j2sRequireImport java.lang.reflect.Constructor
3535
*/
3636
public class ControlExample {
37-
private static ResourceBundle resourceBundle =
38-
ResourceBundle.getBundle("examples_control");
37+
private static ResourceBundle resourceBundle;
38+
3939
private ShellTab shellTab;
4040
private TabFolder tabFolder;
4141
Image images[];
@@ -292,6 +292,13 @@ static String getResourceString(String key, Object[] args) {
292292
* Loads the resources
293293
*/
294294
void initResources() {
295+
if (resourceBundle == null) {
296+
/**
297+
* @j2sNative
298+
* java.util.ResourceBundle.registerBundle("examples_control", "error.CouldNotLoadResources = Unable to load resources\nwindow.title = SWT Controls\ncustom.window.title = SWT Custom Controls\n\nText_Buttons\t\t= Text Buttons\nSize \t\t\t\t= Size\nAlignment\t\t\t= Alignment\nLeft\t\t\t\t= Left\nRight\t\t\t\t= Right\nUp\t\t\t\t\t= Up\nDown\t\t\t\t= Down\nCenter\t\t\t\t= Center\nOne\t\t\t\t\t= One\nTwo\t\t\t\t\t= Two\nThree\t\t\t\t= Three\nImage_Buttons\t\t= Image Buttons\nControl_Example\t\t= Control Example\nParameters\t\t\t= Parameters\nOther\t\t\t\t= Other\nEnabled\t\t\t\t= Enabled\nVisible\t\t\t\t= Visible\nPreferred \t\t\t= Preferred\nStyles\t \t\t\t= Styles\nMenu_Styles\t \t\t= Menu Styles\nMenuItem_Styles\t \t= MenuItem Styles\nListeners\t\t\t= Listeners\nSelect_Listeners\t= Select Listeners\nListen\t\t\t\t= Listen\nClear\t\t\t\t= Clear\nSet_Get\t\t\t\t= Set/Get API\nParameter_Info\t\t= {0} e.g. {1} \nInfo_int\t\t\t= 4\nInfo_intA\t\t\t= 1,2,3\nInfo_long\t\t\t= 4\nInfo_longA\t\t\t= 1,2,3\nInfo_char\t\t\t= c\nInfo_charA\t\t\t= c,d,e\nInfo_boolean\t\t= true\nInfo_booleanA\t\t= true,true\nInfo_String\t\t\t= hello\nInfo_StringA\t\t= hello,there\nInfo_Point\t\t\t= 0,0\nInfo_TabItem\t\t= Tab 0\nInfo_TabItemA\t\t= Tab 0,Tab 2\nInfo_TableItem\t\t= Index:2\nInfo_TableItemA\t\t= Index:2,Index:4\nInfo_TreeItem\t\t= Node 1\nInfo_TreeItemA\t\t= Node 1,Node 3\nSelect_All\t\t\t= Select All\nDeselect_All\t\t= Deselect All\nOK\t\t\t\t\t= OK\nFillDamage\t\t\t= Fill Damaged Area With Color\nTitle_Text\t\t\t= Title Text\nText_Labels\t\t\t= Text Labels\nImage_Labels\t\t= Image Labels\nCustom_Labels\t\t= Custom Labels\nCustom_Combo\t\t= Custom Combo\nOne_Two_Three\t\t= One Two Three\nText_ToolBar \t\t= Text ToolBar\nImage_ToolBar \t\t= Image ToolBar\nImageText_ToolBar\t= Image and Text ToolBar\nMaximum\t\t\t\t= Maximum\nMinimum\t\t\t\t= Minimum\nSelection\t\t\t= Selection\nIncrement\t\t\t= Increment\nPage_Increment\t\t= Page Increment\nThumb\t\t\t\t= Thumb\nDigits\t\t\t\t= Digits\nTree_With_Images\t= Tree With Images\nDialog_Type\t\t\t= Dialog Type\nCreate_Dialog\t\t= Create Dialog\nButton_Styles\t\t= Button Styles\nIcon_Styles\t\t\t= Icon Styles\nModal_Styles\t\t= Modal Styles\nFile_Dialog_Styles\t= File Dialog Styles\nItem_Styles\t\t\t= Item Styles\nDialog_Result\t\t= Dialog Result\nColorDialog\t\t\t= ColorDialog\nDirectoryDialog\t\t= DirectoryDialog\nFileDialog\t\t\t= FileDialog\nFontDialog\t\t\t= FontDialog\nPrintDialog\t\t\t= PrintDialog\nMessageBox\t\t\t= MessageBox\nMulti_line\t\t\t= A multi line text widget.\nExample_string\t\t= The quick brown fox jumps over the lazy dog.\nHeader_Visible\t\t= Header Visible\nLines_Visible\t\t= Lines Visible\nMoveable_Columns\t= Moveable Columns\nMultiple_Columns\t= Multiple Columns\nLocked\t\t\t\t= Locked\nCombo_child\t\t\t= Combo Child\nNode_1\t\t\t\t= Node 1\nNode_2\t\t\t\t= Node 2\nNode_3\t\t\t\t= Node 3\nNode_4\t\t\t\t= Node 4\nNode_1_1\t\t\t= Node 1.1\nNode_2_1\t\t\t= Node 2.1\nNode_3_1\t\t\t= Node 3.1\nNode_2_2\t\t\t= Node 2.2\nNode_2_2_1\t\t\t= Node 2.2.1\nParent\t\t\t\t= Parent\nNo_Parent\t\t\t= No Parent\nDecoration_Styles\t= Decoration Styles\nCreate_Shell\t\t= Create Shell\nClose_All_Shells\t= Close All Shells\nPush\t\t\t\t= Push\nRadio\t\t\t\t= Radio\nCheck\t\t\t\t= Check\nCascade\t\t\t\t= Cascade\nDrop_Down\t\t\t= Drop Down\nImages_failed\t\t= Warning: Failed to load images\nreadme_txt\t\t\t= readme.txt\nIndex\t\t\t\t= Index:\nTitle\t\t\t\t= Title:\nClose\t\t\t\t= Close\nResult\t\t\t\t= Result: {0}\nFilterName_0\t\t= Text Files\nFilterName_1\t\t= Batch Files\nFilterName_2\t\t= Doc Files\nFilterName_3\t\t= All Files\nTableTitle_0\t\t= Name\nTableTitle_1\t\t= Type\nTableTitle_2\t\t= Size\nTableTitle_3\t\t= Modified\nTableLine0_0\t\t= <empty>\nTableLine0_1\t\t= classes\nTableLine0_2\t\t= 0\nTableLine0_3\t\t= today\nTableLine1_0\t\t= <empty>\nTableLine1_1\t\t= databases\nTableLine1_2\t\t= 2556\nTableLine1_3\t\t= tomorrow\nTableLine2_0\t\t= <empty>\nTableLine2_1\t\t= images\nTableLine2_2\t\t= 91571\nTableLine2_3\t\t= yesterday\nListData0_0\t\t\t= Line 1\nListData0_1\t\t\t= Line 2\nListData0_2\t\t\t= Line 3\nListData0_3\t\t\t= Line 4\nListData0_4\t\t\t= Line 5\nListData0_5\t\t\t= Line 6\nListData0_6\t\t\t= Line 7\nListData0_7\t\t\t= Line 8\nListData0_8\t\t\t= Longest Line In List\nListData1_0\t\t\t= Apples\nListData1_1\t\t\t= Oranges\nListData1_2\t\t\t= Bananas\nListData1_3\t\t\t= Grapefruit\nListData1_4\t\t\t= Peaches\nListData1_5\t\t\t= Kiwi\nListData1_6\t\t\t= Apricots\nListData1_7\t\t\t= Strawberries\nListData1_8\t\t\t= The Longest String\nDropDownData_0\t\t= Apples\nDropDownData_1\t\t= Oranges\nDropDownData_2\t\t=\nDropDownData_3\t\t= Grapefruit\nDropDownData_4\t\t= Peaches\nDropDownData_5\t\t= Kiwi\nDropDownData_6\t\t=\nDropDownData_7\t\t= Strawberries\nDropDownData_8\t\t= The Longest String\nColors \t\t\t\t= Colors and Font\nTable_Item_Colors\t= Row 0 Colors and Font\nTree_Item_Colors\t= Node 1 Colors and Font\nItem_Font\t\t\t= Item Font ...\nBackground_Color\t= Background Color\nForeground_Color\t= Foreground Color\nFont\t\t\t\t= &Font...\nDefaults\t\t\t= &Defaults\nWrap_Text\t\t\t= Jack and Jill went up the hill to fetch a pail of water, \\\n\t\t\t\t\t Jack fell down and broke his crown and Jill came tumbling after!\nForeground_Style\t= Foreground Style\nBackground_Style \t= Background Style\nStyledText_Styles\t= Text Styles\nStyledText_Style_Instructions\t= Select text, then style.\nBold\t\t\t\t= Bold\nItalic\t\t\t\t= Italic\nUnderline\t\t= Underline\nStrikeout\t\t= Strikeout\nFill\t\t\t\t= Horizontal Fill\nTabItem1_0\t\t\t= Tab 0\nTabItem1_1\t\t\t= Tab 1\nTabItem1_2\t\t\t= Tab 2\nTabItem_content\t\t= TabItem Content\nCTabItem1_0\t\t\t= CTabItem 0\nCTabItem1_1\t\t\t= CTabItem 1\nCTabItem1_2\t\t\t= CTabItem 2 has a long name\nCItem_Colors\t\t= CTabItem Colors\nCTabItem_content\t= CTabItem Content\nSet_Simple_Tabs\t\t= Simple Tabs\nSet_Single_Tabs\t\t= Single Tab\nSet_Min_Visible = Minimize\nSet_Max_Visible = Maximize\nSet_Unselected_Close_Visible = Close on Unselected Tabs\nSet_Unselected_Image_Visible = Image on Unselected Tabs\nSelection_Foreground_Color = Selection Foreground Color\nSelection_Background_Color = Selection Background Color\nSet_Image\t\t\t= Set Image\nTableTree_column\t= Column\nMenuItem_Cut\t\t= Cu&t\tCtrl+X\nMenuItem_Copy\t\t= &Copy\tCtrl+C\nMenuItem_Paste\t\t= &Paste\tCtrl+V\nMenuItem_SelectAll\t= Select &All\tCtrl+A\nOrientation \t\t= Orientation\nDefault \t\t\t= Default (Inherit)\nImages\t\t\t\t= Images\nImage\t\t\t\t= Image\nAccelerators\t\t= Accelerators\nMnemonics\t\t\t= Mnemonics\nSubMenu\t\t\t\t= Sub-Menu\nSubSubMenu\t\t\t= Sub-Sub-Menu\n1Radio\t\t\t\t= Radio1\n2Radio\t\t\t\t= Radio2\n1RadioWithMnemonic\t= Radio&1\n2RadioWithMnemonic\t= Radio&2\nPushWithMnemonic\t= &Push\nRadioWithMnemonic\t= &Radio\nCheckWithMnemonic\t= &Check\nCascadeWithMnemonic\t= C&ascade\nPopupMenuHere\t\t= Popup Menu Here\nLinkText=Visit the <A HREF=\\\"www.eclipse.org\\\">Eclipse.org</A> project and the <A HREF=\\\"www.eclipse.org\\\\swt\">SWT</A> homepage.\n");
299+
*/ { }
300+
resourceBundle = ResourceBundle.getBundle("examples_control");
301+
}
295302
final Class clazz = ControlExample.class;
296303
if (resourceBundle != null) {
297304
try {
@@ -327,24 +334,11 @@ void initResources() {
327334
public static void main(String[] args) {
328335
//System.out.println("To begin control examples ..."); // bring the correct width and height of XHTML
329336
Display display = new Display();
330-
int styleNone = SWT.NONE;
331-
int style = styleNone;
332-
style = SWT.SHELL_TRIM;
333-
/**
334-
* @j2sNative
335-
* style = styleNone;
336-
*/ {}
337-
338-
Shell shell = new Shell(display, style);
337+
Shell shell = new Shell(display, SWT.SHELL_TRIM);
339338
shell.setLayout(new FillLayout());
340339
ControlExample instance = new ControlExample(shell);
341340
shell.setText(getResourceString("window.title"));
342341
// setShellSize(display, shell);
343-
/**
344-
* @j2sNative
345-
* shell.setMaximized(true);
346-
*/ {}
347-
348342
shell.open();
349343
while (! shell.isDisposed()) {
350344
if (! display.readAndDispatch()) display.sleep();

0 commit comments

Comments
 (0)