embedded-resource

ImageIcons on JButton are not showing up in Runnable JAR file

空扰寡人 提交于 2019-11-29 11:07:39
I have 6 JButtons on my GUI all have images on it, when I compile and run the code, all images on JButtons show up perfectly but in runnable JAR file, images on JButtons are not showing up.. how do I fix this problem? I used this method in my code to show icons on JButtons ImageIcon SettingsIc = new ImageIcon("bin/images/settings.png"); jb1 = new JButton(SettingsIc); jb1.setFocusPainted( false ); //jb1.setBorderPainted(false); jb1.setContentAreaFilled(false); This is how my GUI looks when I compile my code in Eclipse This is how my GUI looks after executing Runnable JAR file This (as pointed

How to read a text file inside a JAR? [duplicate]

柔情痞子 提交于 2019-11-29 10:24:52
This question already has an answer here: Java resource as file 6 answers What I am attempting to do is store a text file (that won't change) inside the JAR of the program so that it can be read. The purpose of the text file is that it will be read in by one of my classes and the contents of the text file will be added to an JEditorPane . The file will basically be a tutorial and when the user clicks on the option to read the tutorial, the file contents will be read and displayed in a new window that pops up. I have the GUI portion of it down, but as far as storing the file in the JAR so it

How To Get A Stream Object From A Resource File (Console App/Windows Service Project)

拟墨画扇 提交于 2019-11-29 09:59:57
I'm creating a Windows service and am trying to access some files I added to a resource file, but I'm stuck because I don't know how to access the individual files. Just for some background info, here's what I've done so far: This is a C# Windows Service application running in debug mode as a console app, which helps me step into the code. I added a resource file to the root called "Resources.resx". In my resource file, I added a few jpg images and html files using the visual designer/editor. After I added the images and html files to the resource file, a new folder in my project appeared

MS WebBrowser + Embedded HTML Resource + res:// Protocol

╄→尐↘猪︶ㄣ 提交于 2019-11-29 06:45:40
I have an embedded HTML resource (helloworld.htm) inside my Visual Studio project. (Ie, I've added an HTML file to the project and set its properties to "Embedded Resource". Within the same application I have a WebBrowser control. I'd like to direct the WebBrowser control to display the HTML resource using the res:// protocol . But I can't figure out the exact format needed to address an embedded resource using this style of URL. Any ideas? Thanks! I know this thread is dead, but I had to do this yesterday and couldn't get any of these methods to work. So I did a little research and found the

How to use compiled global resources in ASP.NET MVC

冷暖自知 提交于 2019-11-29 06:45:26
问题 I want to compile App_GlobalResources/Strings.resx into my assembly (and eventually use satellite assemblies for Strings.es.resx, Strings.fr.resx , etc.) but the following error occurs once the app is published: "Could not load file or assembly 'App_GlobalResources' or one of its dependencies. The system cannot find the file specified." Steps to Reproduce: Create a new ASP.NET MVC project. Add an App_GlobalResources folder and a Strings.resx file. Set the file's build action to 'Embedded

How do I add a TXT file as resource to my EXE file?

徘徊边缘 提交于 2019-11-29 03:06:30
I have a TXT file containing about 10,000 lines of text. I want to display these lines in a TMemo. But I don't want to distribute that TXT file my program. How do I integrate it into my EXE file as a resource WITHIUT using stringtable {} because this requires an identifier for each line (so I will have to add 10000 identifiers). _ I have Delphi XE I usually create an RC file (which is basically an text file) for this kind of resources, then add line like MyText RCDATA ..\resources\filename.txt for each file / resource into the RC file. If the RC file is part of the project it will be compiled

Embedding a font in delphi

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-29 01:28:46
I'm working on an app that requires a particular barcode true type font that is unlikely to be on the user's PC. Can I somehow embed the font in the app, or do I need to use the installer to install the font? Yes, you can save it as a resource in the EXE file, and on user's pc, you can extract it as a file using a TResourceStream instance. Then you can call AddFontResource API function. At last, you should send a WM_FONTCHANGE message to all top-level windows in the system (Check Remark section of AddFontResource description in MSDN website). If you need an example code, let me know. In my

Including resource file in a project by .RC file rather than .RES file

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-29 01:25:59
I remember reading an article or post somewhere years ago that suggested including a resource file in a project by referencing the .rc file instead of an already compiled .res file so that the resource is built as part of the project's build process. I have a glyphs.rc file that I currently compile using the command brcc32 glyphs.rc. In my project file I then have the statement {$R Glyphs.res}. I'd like to simplify this by changing it to something like {$R Glyphs.rc} but am unsure of the syntax. When I try using {$R Glyphs.rc} I get an error ` [DCC Error] E2161 Error: RLINK32: Unsupported

How to run unmanaged executable from memory rather than disc

本秂侑毒 提交于 2019-11-28 23:55:01
I want to embed a command-line utility in my C# application, so that I can grab its bytes as an array and run the executable without ever saving it to disk as a separate file (avoids storing executable as separate file and avoids needing ability to write temporary files anywhere). I cannot find a method to run an executable from just its byte stream. Does windows require it to be on a disk, or is there a way to run it from memory? If windows requires it to be on disk, is there an easy way in the .NET framework to create a virtual drive/file of some kind and map the file to the executable's

WPF - Add Custom Font

自闭症网瘾萝莉.ら 提交于 2019-11-28 20:41:53
I'm trying to add a custom font as a resource in my application. I have a "CustomFont" directory in the application and all the fonts inside of it are set to "Resource" <Window.Resources> <Style x:Key="Gotham-XLight"> <Setter Property="TextElement.FontFamily" Value="/CustomFonts;Component/#Gotham-XLight" /> </Style> </Window.Resources> And then on my TextBlock I have this: (inside a grid) <TextBlock x:Name="TimeTextBlock" Style="{DynamicResource Gotham-XLight}" TextAlignment="Center" FontSize="25" FontWeight="Bold" Foreground="White" Text="TextBlockTimer" Margin="105,242.974,0,226.975"