Setting background from image file in NetBeans
Hello,
recently I started to use NetBeans to create my applications and I found a little problem - I don't know how to set background in JPanel from a image file (*.bmp, *.jpg, etc.) without writing my own code. I found how to use ImageIcon, but cannot deal with setting background. Anyone know a solution?
The code that you have to write is a custom JPanel (extend it) and in the paintComponent() method you draw the image you want as a background.
public void paintComponent(Graphics g)
super.paintComponent(g);
g.drawImage(img, 0, 0, null);
}Where 'img' is an object of type Image (such as a BufferedImage).
Similar Messages
-
Backgrounds from images in database
I've been working with images lately, and I'm trying to do the following:
Users can upload images that adhere to my restrictions (ie, size, filetype, etc). What I would then like to do with those images is set the users profile background to be the image itself. I need this to be dynamic, ie, no hard coding of image ids or anything like that. Is it possible to dynamically determine the page background using images in the database? My theory is I may need to create a custom template for the profile page to do this but I'm not sure. Does anyone have experience with this?fac586 wrote:
>
Welcome to the forum: please read the FAQ and forum sticky threads (if you haven't done so already), and update your profile with a real handle instead of "user12612539".
When you have a problem you'll get a faster, more effective response by including as much relevant information as possible upfront. This should include:
<li>Full APEX version
<li>Full DB/version/edition/host OS
<li>Web server architecture (EPG, OHS or APEX listener/host OS)
<li>Browser(s) and version(s) used
<li>Theme
<li>Template(s)
<li>Region/item type(s) (making particular distinction as to whether a "report" is a standard report, an interactive report, or in fact an "updateable report" (i.e. a tabular form)
With APEX we're also fortunate to have a great resource in apex.oracle.com where we can reproduce and share problems. Reproducing things there is the best way to troubleshoot most issues, especially those relating to layout and visual formatting. If you expect a detailed answer then it's appropriate for you to take on a significant part of the effort by getting as far as possible with an example of the problem on apex.oracle.com before asking for assistance with specific issues, which we can then see at first hand.Thank you for the response, but you are right, I did leave some info out. Take two:
I'm using the online Apex workspace, so the version is 4.2 Currently, I'm using the new theme throughout my application, Theme 26 (Which is actually really nice). The images are going to be displayed on the users profile page, which is composed of the following:
-An HTML Region containing several text fields, which show the users information
>
I've been working with images lately, and I'm trying to do the following:
Users can upload images that adhere to my restrictions (ie, size, filetype, etc).It would help us to help you if you explained what you'd been doing with these images, how they are uploaded, where they are stored etc.At the moment, the images are simply stored in the database in a BLOB column. They will have no other use other than being used as backgrounds. Users can only have one image uploaded at a time. They are uploaded via the built in APEX item "File Browser".
>
What I would then like to do with those images is set the users profile background to be the image itself. I need this to be dynamic, ie, no hard coding of image ids or anything like that. Is it possible to dynamically determine the page background using images in the database?Yes.
My theory is I may need to create a custom template for the profile page to do this but I'm not sure.That's possible, but probably more work than is necessary. Customized styling of individual pages can be applied using Page Attributes—precisely how is dependent on the APEX version used, hence the requirement for you to provide this information.Hopefully the above information clarifies my problem a little. In the meantime, I will look at the link you posted about page attributes. Thank you. -
Unusual Bug when creating pdf from image files
Hi I have a very mindboggling problem which I cant seem to get my head around.
basically I am trying to create a pdf using a large amount of image files, these images are scans of pages of a book. so I have been trying to create a pdf file from these images, and everytime i try, it all looks ok except for one page which comes up smaller in size than the rest which is a big problem and very unusual. If I change the view of acrobat so that it shows two pages at a time then this is clearly visable where one page is normal and the page next to it is like a third of the size. Ive checked the image file properties for that page and they are more or less the same as the rest, the dimensions of the image file too, but when I add it into a PDF it seems to shrink in size, any ideas as to why? any help would be much appreciated! (and I hope what I said made sense lol )
Thanks
NavHi Davew000
Can you please tell the steps you are doing to create the PDF ?
Thanks,
Tanvi -
Pdftotext extracting from image files mystery
hello all, just had a bit of a shock when I ran pdftotext (accidentally) on an unocr'd pdf file, and it extracted all the text. Running pdftohtml (as I'd intended) produced the expected output - i.e. png dumps. Curious, I then tried running it on a bunch of other downloaded files, and with the exception of one, pdftotext extracted the text from ALL of them. The mystery then is that it isnt using any ocr (no tesseract dependency, plus it's way too quick), so clearly it must be pulling it directly from the files. But if the text really is there in the original, then presumably the people who scanned them didn't know, else they'd have left it there. The only thing I can think is that some common piece of pdf software (probably acrobat) has ocr built in, so it's scanning them automatically and then encoding the hidden text in the pdf.
take for example (legal):
http://www.cd3wd.com/cd3wd_40/JF/JF_VE/SMALL/27-714.pdf
open up in a normal pdfreader - very clearly a (poorly) scanned document. Now run 'pdftotext -layout' on it and you get a pretty impressive text file, considering the source. Sure, some of the formatting is messed up, but I'm sure anyone with sed knowledge could quickly sort most of that out. Besides, that's one of the worst documents - on most others it was perfect, maintaining columns (even tesseract can't do that) and everything.
It makes for a fantastic command line pdf reader that works on almost all the files I've thrown at it, and since pdf's are almost the only reason I ever have to load up X, consider me tickled pink.
Just thought I'd mention it here, as a google search brings up nothing on the issue. hope someone finds it usefulYes, Adobe Acrobat has a feature that allows you OCR the text and insert the text as a separate layer behind the image. Such PDFs are called "Searchable image PDFs". There are no doubt some other commercial software options that can do this too. The copier/scanner/multifunction device in my office actually does this automatically when you scan in a text PDF.
Theoretically, it is even possible to create PDFs like this using free software on linux (a combination of ExactImage and Cuneiform; or WatchOCR).
See, e.g., this blog post:
Searchable PDFs with linux
and this slashdot story:
Open Source OCR that makes Searchable PDFs
My own experiments with trying to get something like this to work have not been very successful--at least the quality of the result is nowhere near what I'm getting with our work printer.
If you like pdftohtml, you should also know about pdfreflow, which takes the XML output of pdftohtml with the -xml flag and creates an html file that can be reflowed (I.e., is smart about paragraph breaks, removes page numbers and recombines words broken through hyphenation and so on).
pdfreflow
Last edited by frabjous (2010-10-15 13:03:00) -
Reading metadata to - from image files
I am using Creative Suite CS4. In CS3 I created two custom XMP metadata pages that I used to add information to RAW, TIF, PSD files. The resulting custom panel could be seen and used in Bridge and Extensis Portfolio. In CS4 that all changed. I can create the GUI part of the panel using Flex Builder 3.
My questions are 1) How do you get the controls to work (combo boxes with fixed lists, fields for text data and a note field), 2) how do I get the data from the image file, have it update when a field changes, read it back to the image file when closed, and 3) how do I get it to work in Bridge CS4 properly and also be readable to Extensis Portfolio.
I have attached the CS3 files that were used to create the panels in CS3.
FredI am using Creative Suite CS4. In CS3 I created two custom XMP metadata pages that I used to add information to RAW, TIF, PSD files. The resulting custom panel could be seen and used in Bridge and Extensis Portfolio. In CS4 that all changed. I can create the GUI part of the panel using Flex Builder 3.
My questions are 1) How do you get the controls to work (combo boxes with fixed lists, fields for text data and a note field), 2) how do I get the data from the image file, have it update when a field changes, read it back to the image file when closed, and 3) how do I get it to work in Bridge CS4 properly and also be readable to Extensis Portfolio.
I have attached the CS3 files that were used to create the panels in CS3.
Fred -
Unable to create cd from Image file
I downloaded the Solaris 8 for Intel, unzipped the files. I have been unsuccessful creating an image file for the file sol-8-1_01-fcs-bin-ia-v1. I have tried various CD writing applications.
I was able to create images from the other files.
ThanksYou are not supposed to create an image file from the unzipped data. These unzipped files are image
files! You just have to rename them using the proper file extension so that your CD-R burning software
recognizes them as cd image files. (common extension are .ISO or .RAW; check with your CD recording
software) -
How can I make a short video for watching in my iPod 30GB from some image files?
Thank youckaker_kid says:
1. take a screen shot of every slide.
2. either put the image files into the ipod separtely or make a short video with them
I think from .png files
Thank you -
Dear all,
I want to use Labview to process a data.
Now I have a array in a text file.
this array is very very big. which is at least row*col = 6 * 100000;
the column size always 6,
but the row size is ramdom, some times is very big, like bigger than 65535,
when I use "read from measurement file express.vi" to read this file, the array I could get always 6*5339, I don't know why. the column size is always 5339.
and then I delete the 1st row of the array and then write into a txt file via "write measurement file express. vi", it takes a very long time. almost computer has no response. after a while, no file was creat to record the data.
is there an efficient way to process such big data file and store the processed file into a new file
thank you very much
Jack
Message Edited by weichengatech on 03-09-2006 12:00 AMHello,
There’s no real efficient way to read the file if you don’t
know exactly how many rows of data you have.
Your going to just have to read a row at a time and add the results to
the end of an array (granted for the clever programmers there are some more
efficient ways to do this than just with ‘build array’). I would start by asking you how much
information you know about the file and what the exact structure of it is (i.e.
is it a binary file, a tab delimited file, or a LVM file)? Could you provide a screenshot of the code
you are running? If you provide a little more information on the file structure
we might be able to contribute some additional information.
Look forward to hearing back from you-
Travis M
LabVIEW R&D
National Instruments -
Problem in constructing URL from Image file
Hi,
i have a requirement , have to construct a URL object with an absolute image file..
like URL url = new URL("/resources/image1.gif")
url.getpath()
But url is returning null, as it couln't found rela path..
but previously i have using
String realPath = servletContext.getRealPath("/images/stateseal_green.jpg");
it was working, but now i dont have servletContext object..
any suggestions around this problem?Hi,
Is the root directory /resources relative or abs directory?
It seems you have java application and the resources is on the class path right? so it is relative to the file system.
try the below it may help
ClassLoader cl = null;
cl = Thread.currentThread().getContextClassLoader();
if (cl == null) {
* No thread context class loader -> use class loader of this class
cl = GetImageFileOnResourceDirectory.class.getClassLoader();
InputStream inputStream = (cl
.getResourceAsStream("resources/images/image1.gif"));Regards,
Alan Mehio
London,UK -
Set a file icon from image file of same name
I have a folder of files and I have another folder of images that have the same names as the files. What I would like to do is apply an icon of each image to it's corresponding file. Is this possible? Any help would be greatly appreciated.
IanIanWfsdafeqry rasrbd wrote:
I have a folder of files and I have another folder of images that have the same names as the files. What I would like to do is apply an icon of each image to it's corresponding file. Is this possible? Any help would be greatly appreciated.
That reminds me of the question asked by Fierabras in this thread.
If both of your folders contain exactly the same number of files, and if the names of the files are the same in both folders (except the name extension of course), then the following script should do what you are asking for, though admittedly not in the background.
(The script seems to work flawlessly on my MacBook Pro under Mac OS X 10.8.)
tell application "Finder"
set folder1 to folder POSIX file "/POSIX/path/to/folder/of/images"
-- for example: "/Users/me/Desktop/My images"
set folder2 to folder POSIX file "/POSIX/path/to/folder/of/files"
-- for example: "/Users/me/Desktop/My files"
set N to (count folder1)
if not (count folder2) = N then return
set theImages to files of folder1
set theFiles to files of folder2
tell application "Image Events" to launch
repeat with k from 1 to N
set thisImageFile to item k of theImages
tell application "Image Events"
set theImage to open thisImageFile as alias
save theImage with icon
close theImage
end tell
tell application "Finder"
activate
set infoWindow1 to open information window of thisImageFile
tell application "System Events"
keystroke tab
keystroke "c" using command down
keystroke "x" using command down -- optional
end tell
close infoWindow1
set infoWindow2 to open information window of item k of theFiles
tell application "System Events"
keystroke tab
keystroke "v" using command down
end tell
close infoWindow2
end tell
end repeat
tell application "Image Events" to quit
end tell
Message was edited by: Pierre L. (“count folder” instead of “count files of folder”) -
Movie from image files jerky playback
I'm making movies which have to be rendered out as an image sequence but when I play back the footage in Quicktime it is totally jerky and is skipping massively only using about 8 frames in a 250 frame sequence as far as I can see. It is totally unusable which is heartbreaking after so much work.
Quicktime movies other than image sequence ones play fine.
All the frames are there and numbered correctly.
This is a problem that started a few weeks ago and gradually got worse and worse.
It was suggested elsewhere that there wasn't enough hard drive space so I freed up a load and if anything it's now much worse.
Can anyone suggest what might be going wrong and how to fix it? Is there yet another obscure setting somewhere no one tells you about?
Thanks.
ti book 1 gig mhrz, 1 gig RAM, 60 gig HD Mac OS X (10.4.8) rendering image sequences from Artlantis and Poser. Both have same playback issue in Quicktime."Small files and big ones" is not really enough to go on. What codec are you using? A small 10 second clip in H264 at 640X480 and 10 mb/sec might choke all but the mightiest macs.
-
Create pdf form from image file
is there any way to create a pdf form from an image? perhaps using ghostscript? TIA
#pacman -S potrace
The only disadvantage of this utility is input image format is bmp only. -
How to remove background from image?
Hello folks.
I am trying to incorporate some business logos into a brochure I am creating. The problem is, most of these logos have a white background. How can I remove this and make a transparent background?
Thanks!Blend modes are your friend. always keep in mind that Multiply, screen and overlay affect the white, black and gray depending which one you choose.
Attached is a blend mode example from photoshop using a black to white gradient. The normal layer fills the document with.the blend layers on top with the gradient inverted.
This example is text naming the solid color backgrounds blended over a gradient. -
I need to extract some basic data from image files and put it into a spreadsheet.
Hi.
I'm looking for I believe is a simple task but I am not sure how to go about it. I want to get the relevant data (seen in the screen grab below) into a spread sheet. I need to get the File Name, Size, Dimensions, Resolution and Kind into the spreadsheet so I can better analyze the data for my purposes. I have tried to find EXIF and IPTC extractors but only come across products that show me the info with no way of transferring it. I figured there must be a way to do this in the Finder. Maybe it's a simple Automator task (which I am not very good at) or a Script.
Can anyone guide me thru or suggest a tool that would work?
Thanks,
StephenMost certainly it is not a feature of iPhoto for the Mac
thought that was a clear statement
and the reason that LarryHN mentioned iPhoto is that you posted your question in the iPhoto for Mac forum
There has to be a way to get that metadata into a text file and then transfer it to the spreadsheet.
not sure why you think that
I guess you can print your screen shot and do an OCR scan
LN
LN -
Remove background from Smart Build images
Hi,
I've just started creating my first project with Keynote, and so far it's terrific. The question I have is, is it possible to use the alpha tool, or something similar to remove backgrounds from images that I'm using for a smart builds effect.
Thanks,
DaveWelcome to the discussions, Decaffeinated1.
The problem you're seeing is specifically with how Keynote copies images. Neither Pages nor Numbers has this problem. The problem and the solution is described here.
http://www.keynoteuser.com/news/?p=256
Basically, your choice is to copy through Pages or Numbers (or iWeb) OR to copy another object which will force Keynote to adhere to the transparency set with Instant Alpha.
Maybe you are looking for
-
My ipod will not let me access any apps using wifi, it indicates at the top of the screen that there is a strong wifi source but it refused to work on wifi apps. I think this is because if need an update but will not let me as it says an error occurr
-
My Book won't show up on harddrive
I unplugged the My Book from my Mac OS X 10.6.2. I got a message that said to eject the disk before unplugging. I replugged in the My Book and it showed up on the hard drive. Then I ejected it because I wanted to see it I could plug it into the Airpo
-
How to diagnose rapid memory growth in Solaris 10 java server application
Hi, We have a production java based server that experienced large memory growth recently and we are looking for help in diagnosing what might be the cause. The memory footprint of this java server application is limited to 120M using the jvm -Xmx swi
-
Why can I not hear voicemail on my iphone4s?
I cannot listen to voicemial. Why? I can tell the message is running - I just can't hear it.
-
Can't establish a secure connection
keep getting this when i try to connect to variour sites, including apples own discussion groups. can't access gmail either. any ideas on how to overcome this please. (i've just started to use safari in mountain lion to see if i can get used to it. i