Wikipedia:Reference desk/Archives/Computing/2009 July 23
Computing desk | ||
---|---|---|
< July 22 | << Jun | July | Aug >> | July 24 > |
Welcome to the Wikipedia Computing Reference Desk Archives |
---|
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
July 23
editHow to create a PDF file for free?
editI placed this at the Wikipedia:Help desk and Steve was so nice to refer me to this board which I wasn't aware of:
I need to scan in and send some papers in PDF format (ASAP), but I don't want to buy the quite expensive software since I never needed it before and I'm sure I won't need it again in the near future. I wrongly thought [wishful thinking] Adope Photoshop (which I have) would work to convert my files. Is there a simple way out of this? Any help would be much appreciated. Thanks,--The Magnificent Clean-keeper (talk) 00:06, 23 July 2009 (UTC)
PS:"I already checked our articles about PDF's but couldn't find anything helpful for my case.The Magnificent Clean-keeper (talk) 00:06, 23 July 2009 (UTC)
- I believe Open Office has the option to save as PDF. There may be something more lightweight...or appropriate for scanned materialsFribbler (talk) 00:11, 23 July 2009 (UTC)
- I would like to be (at least pretty) sure before I download some major program as there are several which might or might not do what I need. But thanks for you trying to help me. Best, --The Magnificent Clean-keeper (talk) 00:37, 23 July 2009 (UTC)
- http://sourceforge.net/projects/pdfcreator/ is a good piece of software. Install it and you can print to a PDF. So you can scan to an image file, then print the image file to PDF. - Akamad (talk) 00:26, 23 July 2009 (UTC)
- My mistake. I wasn't clear in my initial question. I need to send these papers per e-mail so printing is not my problem. :( --The Magnificent Clean-keeper (talk) 00:37, 23 July 2009 (UTC)
- The software that Akamad linked is a fake printer. It shows up in the Windows printer list, but when you "print" to it, instead of producing a physical piece of paper, it produces a PDF file. APL (talk) 00:46, 23 July 2009 (UTC)
- I just tried it. It works great. I now have a PDF of today's Computing reference desk. Easy. Thank you User:Akamad, this is a handy program. APL (talk) 00:49, 23 July 2009 (UTC)
- The software that Akamad linked is a fake printer. It shows up in the Windows printer list, but when you "print" to it, instead of producing a physical piece of paper, it produces a PDF file. APL (talk) 00:46, 23 July 2009 (UTC)
- My mistake. I wasn't clear in my initial question. I need to send these papers per e-mail so printing is not my problem. :( --The Magnificent Clean-keeper (talk) 00:37, 23 July 2009 (UTC)
- Hey, that sounds like good news. I'll try this (and maybe other recommendations) tomorrow. Big thanks to all of you guys and girl from by now more relaxed The Magnificent Clean-keeper (talk) 00:57, 23 July 2009 (UTC)
- What type of computer are you using? That will help us a bit in recommending the software (there are many choices). Also, when Akamad says "print the image file to PDF," what he means is that most PDF creators (other than Adobe Acrobat) are printer drivers: you "print" to the PDF software, and it grabs the "printed" data (which would normally be sent to your printer), and turns that into a PDF.
- Incidentally, if you have a scanner, check that it doesn't already have a "document" mode for scanning. Most do, these days, and they will automatically turn documents into PDFs. --98.217.14.211 (talk) 00:42, 23 July 2009 (UTC)
- I'm running a PC with XP and since my good scanner has problems I'm stuck with like a "first generation" scanner. Can't expect much out of it.--The Magnificent Clean-keeper (talk) 00:52, 23 July 2009 (UTC)
- Maybe not, but you might check if the company has updated scanner software that is compatible with it. Making it into a PDF is a software-side thing, so that can be updated, even with an old scanner, much of the time. --98.217.14.211 (talk) 02:41, 23 July 2009 (UTC)
- I'm running a PC with XP and since my good scanner has problems I'm stuck with like a "first generation" scanner. Can't expect much out of it.--The Magnificent Clean-keeper (talk) 00:52, 23 July 2009 (UTC)
- Guess my problem is solved. I'll "bother" you tomorrow if not :) . Thanks to everyone.--The Magnificent Clean-keeper (talk) 01:02, 23 July 2009 (UTC)
- Update: Unfortunately I'm back and unfortunately I don't think there is a way out. I could scan and save my files as PDF with Adobe Photoshop (even so it didn't work before; Don't know why). Now the only probably unsolvable problem [w/o Adobe reader pro] is to make a single file out of them. This has some importance in my case. Does someone has an idea how to do this without the Adobe software? I tried several things inclusive promising free programs but nothing works. Also Openoffice doesn't do the job as someone recommended to give it a try (yet I'll keep it on my PC as it seems to be a quite good program. Anyways, if I don't find a solution I'll have to send the PDF's as single files [one file per page]which hopefully will be accepted from the receiving party.
- Appreciated for some new possitive input as far as it is possible, --The Magnificent Clean-keeper (talk) 21:49, 23 July 2009 (UTC)
- This google search seems to point to freeware which combines multiple PDFs into a single PDF. However I can vouch for none of it.—Preceding unsigned comment added by Tagishsimon (talk • contribs) 22:04, 23 July, 2009 (UTC)
- Gosh. I was so fixated on Wiki that I've not even thought about doing a google search. Shame on me! I'll check out what google has to offer and hope I won't need to bother again. Thank you Tagishsimon.--The Magnificent Clean-keeper (talk) 22:28, 23 July 2009 (UTC)
- Done. The first google entry did the trick. Thank you sooooooo much.--The Magnificent Clean-keeper (talk) 22:53, 23 July 2009 (UTC)
LaTex and “smart quotes”
editIn LaTex, it appears that the default output for the command " is ”, the closing "smart quote" - whether or not the quote is an opening quote or closing quote. Is there a command to make it output “ instead? --72.197.202.36 (talk) 03:07, 23 July 2009 (UTC)
- I use two backquotes (``) for the opening quote, and two single quotes (apostrophes) ('') for the closing quote. --Spoon! (talk) 06:31, 23 July 2009 (UTC)
- And that's in fact the LaTeX-approved way to do it. Best not to have any " characters at all in your input file. rspεεr (talk) 06:42, 23 July 2009 (UTC)
Hypercam
editHyperCam used to be able to record sound for me, but now, it can't. Why? How can I fix this? 121.220.109.214 (talk) 09:40, 23 July 2009 (UTC)
Running a server from within Virtualbox
editSo I've set up windows xp in virtualbox and got a simple webserver running on it. All works good from the VMs localhost, but how do I direct outside connections to the server running in virtualbox?
- You're looking for port forwarding. Since you're using Windows, you'll probably need to set it up through VirtualBox, since afaik Windows doesn't offer any tools for port forwarding. Here's two guides to setting up VirtualBox to forward ports. 1 2 You'll also need to make sure that your firewall has those ports open. Also keep in mind that if your windows xp computer is behind a home router, it's probably already using NAT and the virtualbox server will be double-NATed, which often causes problems. Plus you'll need to forward the port from your router to your windows xp computer, then from there to the virtual server. Indeterminate (talk) 21:47, 23 July 2009 (UTC)
Books
editOn social networking sites, why do many people claim they hate books? 121.220.109.214 (talk) 10:44, 23 July 2009 (UTC)
- Whatever reason it is, I think it has more to do with the people themselves than the fact they are on social networking sites, ie they'd say they hate books irl too —Preceding unsigned comment added by 82.43.91.128 (talk) 11:03, 23 July 2009 (UTC)
- Perhaps because they like things that only require a brief attention span - hence the success of Twitter which I think is limited to 40 characters - and do not like the much longer attention span required to read a book? 78.147.241.234 (talk) 11:23, 23 July 2009 (UTC)
- My theory is that it's because a tremendous number of people are poor readers. I would hate books too if I couldn't read them fast enough to hold my interest. (Might cause a bit of sour grapes too. )
- I'm sure there's some antiintellectualism mixed in there too.
- And, as with all things "Social", some people say it because the cool people are saying it. APL (talk) 12:47, 23 July 2009 (UTC)
- (I assume they mean novels and not cookbooks and the like.) APL (talk) 12:51, 23 July 2009 (UTC)
Auto script
editIs it possible to write a script that would automatically make a post on the internet, for example a blog or open forum? How would I write such a script? What language? Would .bat do? This is on a windows computer btw and I have zero previous programming knowledge —Preceding unsigned comment added by 82.43.91.128 (talk) 11:08, 23 July 2009 (UTC)
- Lots of blogging (and the like) systems have Application Programming Interfaces which allow entries to be made programatically - Twitter and Blogger, for example. Windows batch files are not appropriate for this; a proper programming language like Python, Perl, Java, or C# is necessary. Posting to a forum that doesn't have an API is possible, but would require a more sophisticated screen scraping system. All of this will require some modicum of programming. -- Finlay McWalter Talk 11:43, 23 July 2009 (UTC)
- Oh, and forums that want to discourage spammers using automated scripts often employ a CAPTCHA; getting around that is very difficult. Unfortunately such countermeasures also thwart legitimate uses as well as spam. -- Finlay McWalter Talk 11:45, 23 July 2009 (UTC)
- Thanks for the reply :) I've used iMacros a few times but it's very buggy, but I guess I'll have to stick with it unless I want to learn programming languages! Thanks anyway —Preceding unsigned comment added by 82.43.91.128 (talk) 11:47, 23 July 2009 (UTC)
- Learn python; it's dead easy, and you'll never again be the prisoner of a bunch of weird buggy programs that won't work together. -- Finlay McWalter Talk 12:28, 23 July 2009 (UTC)
Best quality way to edit Flashvideo .flv files, for free?
editThere seem to be two routes: 1) directly editing with a .flv editor, although the only free one I'm aware of so far is VideoThang, or 2) translate the .flv format into another format and edit that. Does anyone know what the best route would be to preserve the best picture quality, using what software? Edit: another FLV editor I've found is Avidemux (Have edited Flash Video article accordingly). Are there any more please? 78.147.241.234 (talk) 11:21, 23 July 2009 (UTC)
- Well, when you convert FLV to another format, you almost always lose picture quality by definition (see transcoding). That's not good with FLVs, where the quality is usually low to begin with (low resolution and high compression). So anything you can do that involves not transcoding (editing it with something that understands FLV natively) is a good idea. --98.217.14.211 (talk) 12:50, 23 July 2009 (UTC)
- Flash video isn't an encoding format, it's a container format. So it's perfectly simple to transfer it to another container format without any transcoding or any loss of quality (it's the same stuff in a different wrapper). I use mencoder:
mencoder -oac copy -ovc copy -o outputfile.avi inputfile.flv
. This should open up more video editing programs (ones that understand .avi or .mpg wrappers, but not .flv); you might still run into a codec incompatibility (as FLVs can be encoded with a variety of codecs), however. -- Finlay McWalter Talk 13:06, 23 July 2009 (UTC)
Thanks. Are YouTube videos encoded in this way? I'm rather surprised that FLV is simply wrapped-up AVI - really? Are there any converters with a less intimidating GUI please? 89.240.217.9 (talk) 19:39, 23 July 2009 (UTC)
- Mediacoder is free, works great, and has a GUI, although it can be a bit intimidating. Videora has a friendlier GUI, but it only converts into MPEG-4 H.264 (used by iPods, but also a common video standard). There are probably many others. Indeterminate (talk) 21:37, 23 July 2009 (UTC)
Windows 7 IE Europe How?
editAccording to Windows_7#E_editions there won't be internet explorer on some version - so how does one get any browser at all?83.100.250.79 (talk) 13:20, 23 July 2009 (UTC)
- One downloads the browser one likes the most. Internet Explorer, Mozilla Firefox, Opera, Sarari, and Google Chrome can be downloaded by anyone in just a few minutes, completely free of charge. --Andreas Rejbrand (talk) 13:28, 23 July 2009 (UTC)
- Well, one downloads those other browsers using a browser (downloading Firefox is the only thing I ever seem to use IE for). How to get IE, or any other browser, onto an IE-free machine will pose something of a delicate challenge for them. They'd probably have an "add optional components" program, which would fetch the IE interface over the internet. But if they just offer IE, then they may be in the same problematic anti-trust position as they are trying to avoid. Technically the fix is simple: an app that lets you pick from one of several browsers (IE, FF, Opera, Safari) and install the one(s) you want, but I can hear Balmer's teeth grind over that from here. -- Finlay McWalter Talk 13:39, 23 July 2009 (UTC)
- There is a simple FTP client in Windows: just run "ftp". Probably there are many FTP servers that offer web browsers. But it is not nearly as convenient as going to e.g. firefox.com and download it. --Andreas Rejbrand (talk) 21:02, 23 July 2009 (UTC)
- "going to e.g. firefox.com" with what? -- 87.114.144.52 (talk) 00:15, 24 July 2009 (UTC)
- I think that was a comment.83.100.250.79 (talk) 09:48, 24 July 2009 (UTC)
- "going to e.g. firefox.com" with what? -- 87.114.144.52 (talk) 00:15, 24 July 2009 (UTC)
- Alternatively, those E-editions may only be offered to OEMs - so Dell or whoever would be able to ship with Firefox preinstalled but not IE (clearly Trident will still be installed regardless). The technicalities of all this are simple, but what the EU and MS are willing to put up with from the other is the hard part; it's in MS's interest to offer an IE-free version (as they offer a WMP-free version), but have in practice OEMs and users pick the with-IE version. Right now this is as much as we know - I don't believe MS have formally announced the actualities about how the IE-free E-versions will actually work. -- Finlay McWalter Talk 13:57, 23 July 2009 (UTC)
- There could be a specialty FTP client included with an icon on the desktop whose only task, when launched, would be to go and fetch Internet Explorer, and place its installer icon on the desktop. Or the user could be told the arcane set of steps needed to run cmd and then go and FTP it. Unlikely, the latter, these days. Tempshill (talk) 15:49, 23 July 2009 (UTC)
- Officially you need to download whatever browser you want in advance BEFORE you do the installation and save it to USB/CD etc and then install that after Windows 7 has been installed (or use another computer to download the installer and transfer it the Windows 7 machine). Of course unofficially you'll be likely be able to get whatever browser you want via scripting or FTP etc, but there's no "menu" or installer provided with Windows 7 to do so. ZX81 talk 16:15, 23 July 2009 (UTC)
- Well done, you found it. So no special dialog box then..
- Officially you need to download whatever browser you want in advance BEFORE you do the installation and save it to USB/CD etc and then install that after Windows 7 has been installed (or use another computer to download the installer and transfer it the Windows 7 machine). Of course unofficially you'll be likely be able to get whatever browser you want via scripting or FTP etc, but there's no "menu" or installer provided with Windows 7 to do so. ZX81 talk 16:15, 23 July 2009 (UTC)
Incidentally does anyone know if the 'browser' that can be obtained via windows help is IE independent - does anyone know what I'm talking about.83.100.250.79 (talk) 16:49, 23 July 2009 (UTC)
- It's Trident (layout engine), which is the real core of IE. I rather suspect that when they say "we're not shipping IE" they mean "we're shipping Trident, just not the IE application that makes it a general purpose browser". If they didn't ship Trident, then all kinds of things (windows update, steam, windows help, and encarta) wouldn't work. 87.114.144.52 (talk) 18:08, 23 July 2009 (UTC)
- The parts that do the networking are something else as well (I guess) eg whatever ftp.exe uses. Do those components have a name? Is it part of winsock? (networking leaves me totally blank)83.100.250.79 (talk) 09:50, 24 July 2009 (UTC)
- Yes, I've seen this before, you can also uninstall IE in Windows 7 non-E. AFAIK, they basically do the same thing which is mostly remove the IE exe. There's also some info on compatibility problems in one of the MS blogs (of course they've looked at it). There aren't many except for stuff like brain dead apps which are hardcoded to use IE. And obviously if you don't have any browser and the software you use can't handle that. Nil Einne (talk) 22:39, 27 July 2009 (UTC)
Hot off the presses- Users get the choice at first boot after install 161.222.160.8 (talk) 19:58, 24 July 2009 (UTC)
DHCP problem
editHi,
i have configured the DHCP in VMware, its assiging the IP but not assiging the defualt gateway but i have setted the gateway also..what could be the reaseon or any setting problem. —Preceding unsigned comment added by Anand.khani (talk • contribs) 13:29, 23 July 2009 (UTC)
- Is DNS getting set? -- kainaw™ 14:15, 23 July 2009 (UTC)
Firefox equivalent of Safari's .webarchive?
editI've been using Safari since it was released. One feature I like is the ability to save webpages to self-contained .webarchive files. I've been using Firefox 3.6 more and more. But when I go to save a webpage I can either save it as a bare HTML file, which strips off all the graphics. Or a "complete" webpage that saves the HTML page plus a folder of graphics -- which is kind of a hassle to deal with. Is there a way for Firefox to save a complete page in one file (and not use PDF)? —Preceding unsigned comment added by 70.167.58.6 (talk) 14:23, 23 July 2009 (UTC)
- Unofficially yes, but it's not especially practical. You save the files off as normal, zip them up, rename the zip file to being a .JAR, and then use the JAR url scheme to access the files within it. I've got a note written about how to do that last bit, I'll look it out for you. -- Finlay McWalter Talk 14:45, 23 July 2009 (UTC)
- Here's the syntax - if the JAR is at /home/fin/foo.jar you'd tell Firefox to go to the following url
jar:file:///home/fin/foo.jar!/index.html
-- Finlay McWalter Talk 14:48, 23 July 2009 (UTC)- You shouldn't need to rename it to .jar, it should work fine with a .zip extension. Under Windows the syntax is jar:file:///c:/path/foo.zip!/index.html. -- BenRG (talk) 16:52, 23 July 2009 (UTC)
- Here's the syntax - if the JAR is at /home/fin/foo.jar you'd tell Firefox to go to the following url
- There are plugins that let you mirror sites with Firefox and probably ones that let you save them into single files. I've used a plugin called Scrapbook to save "whole" webpages (it downloads all the little images and etc., though it buries them into your Firefox profile directory) --98.217.14.211 (talk) 15:05, 23 July 2009 (UTC)
This is what you're looking for 8I.24.07.715 (talk) 15:15, 23 July 2009 (UTC)
I T knowledge.
editI have very less knowledge on os,recent developments in hardware, softwares,..in general stuff related to IT and computers.Which is the best website that gives me all the updates??pl help —Preceding unsigned comment added by 117.193.139.41 (talk) 16:09, 23 July 2009 (UTC)
- I recommend you start reading an IT news site every day (pick a sensible one not slashdot, or the register, or the inquirer).
- I can only think of Ars Technica which covers both PC, entertainment electronics, and business IT. Hopefully someone else can suggest others.
- As you come accross terms and concepts you don't understand, look them up (maybe on wikipedia)
- I wouldn't expect to be able to follow everything, so it might be a good idea to concentrate on building up your knowledge in a selection of areas at first, and relying on other people for other topics.83.100.250.79 (talk) 16:42, 23 July 2009 (UTC)
- You probably already know this, but I always thought the most valuable IT education was by doing it yourself; download Debian and use it to set up an e-mail server, a web server, a Mediawiki server; do the same with another couple of popular Linux distros; do the same with a version of Windows Server, etc. Tempshill (talk) 17:32, 23 July 2009 (UTC)
Wii OS
editWhat programming language would you suppose the Wii's operating system is written in? -- penubag (talk) 18:39, 23 July 2009 (UTC)
- The official devtree for Wii is Freescale's Codewarrior C++ tree (ref); there's no reason to suppose that system (wii-IOS) development would be done with a substantively different toolchain. So "C or C++" is the answer, although when C++ is used for systems programming the system programmers often dictate a lengthy list of thou-shalt-nots which preclude a bunch of standard C++ features (rtti, pure-virtual, templates, exceptions) that reduce C++ to being a C-with-classes subset some call C++-- 87.114.144.52 (talk) 19:13, 23 July 2009 (UTC)
- In addition a tiny amount of assembly is usually required, but these days that's usually limited to a few instructions on startup (setup the CPU and a stack for C to run in), wrappers around interrupt handling (push and pull registers, maybe weird stuff like branch-delay slot recalc) and a very few pieces of hand-optimised sections like filter kernels, the data pump of media codecs, and texture scalers. 87.114.144.52 (talk) 19:19, 23 July 2009 (UTC)
- Thanks very much for the thorough answer. I appreciate it. -- penubag (talk) 22:42, 23 July 2009 (UTC)
- In addition a tiny amount of assembly is usually required, but these days that's usually limited to a few instructions on startup (setup the CPU and a stack for C to run in), wrappers around interrupt handling (push and pull registers, maybe weird stuff like branch-delay slot recalc) and a very few pieces of hand-optimised sections like filter kernels, the data pump of media codecs, and texture scalers. 87.114.144.52 (talk) 19:19, 23 July 2009 (UTC)
Minus everything else, how long do you suppose it took to make the OS? -- penubag (talk) 08:12, 24 July 2009 (UTC)
What are the most active discussion forums on the web?
editWhat are the most active discussion forums on the web? --Gary123 (talk) 18:58, 23 July 2009 (UTC)
- Here's a site that tracks members and posts. [[1]] 24.6.46.177 (talk) 19:50, 23 July 2009 (UTC)
Quality control with AdSense Competitive Ad Filter
editOn my new blog, I'd like to perform some quality control on the AdSense ads. I'm particularly concerned with eliminating the following:
- Health care products and advice that is contrary to medical consensus or sold without a license.
- Malware.
- Products and services based on pseudoscience or claims of the paranormal.
- Religions and cults.
- Conspiracy theories.
- Political conservatism.
- Get-rich-quick schemes.
- Unaccredited colleges.
- Tools for speculating on commodities and foreign currencies.
Are there any sites that can provide black lists or other tools to help do this with AdSense's Competitive Ad Filter? NeonMerlin 22:18, 23 July 2009 (UTC)
Disable Firefox 3.5's top bar slide effect?
editWhenever Firefox 3.5 blocks a popup or asks you to save a password, the top bar slides down, moving the page with it.Same thing happens when you close a page. is there anyway to disable it? 24.6.46.177 (talk) 22:49, 23 July 2009 (UTC)
- You might find the option to disable it entirely in about:config but I'm not sure. Until someone who knows better can say, I might have an indirect solution. If you add Adblock Plus you will no longer get popups from advertisers (if that's what's causing the problem) and if you navigate to Tools>options>security>passwords>... you can tweak some settings so it doesn't ask you. Again, I know this doesn't answer your question but maybe someone else knows the answer. -- penubag (talk) 06:43, 24 July 2009 (UTC)
- I recommend AdBlock Plus regardless. It's great.
- There are two settings in the about:config screen. (Put about:config in the URL bar and hit enter.) Search for "alerts". There's two variables having to do with "SlideInterval". I haven't figured out how these work, but I'll bet some experimentation could stop it from sliding. APL (talk) 13:10, 24 July 2009 (UTC)
- It's not in about:config sadly. There might be a userchrome.css tweak for it but I haven't found one. The alerts configs refer to the alert boxes in the lower right of the screen, like the download alert. I already have adblock plus, and I would rather have the annoyance of the sliding than disabling it altogether. 24.6.46.177 (talk) 16:08, 24 July 2009 (UTC)
- You should probably ask your question here: http://forums.mozillazine.org/viewforum.php?f=38 I'm sure they know more than us. -- penubag (talk) 22:10, 24 July 2009 (UTC)
- Already did, but I'll just live with it since a) it doesn't come up too often b) I'd rather see it and be annoyed than not see it at all. —Preceding unsigned comment added by 24.6.46.177 (talk) 02:25, 25 July 2009 (UTC)
- You should probably ask your question here: http://forums.mozillazine.org/viewforum.php?f=38 I'm sure they know more than us. -- penubag (talk) 22:10, 24 July 2009 (UTC)
- You can totally disable the notification bar for popups with privacy.popups.showBrowserMessage, but you'll still get it for "remember this password?" dialogs.Indeterminate (talk) 00:20, 25 July 2009 (UTC)
- It's not in about:config sadly. There might be a userchrome.css tweak for it but I haven't found one. The alerts configs refer to the alert boxes in the lower right of the screen, like the download alert. I already have adblock plus, and I would rather have the annoyance of the sliding than disabling it altogether. 24.6.46.177 (talk) 16:08, 24 July 2009 (UTC)
Painting in Java
editHello! I haven't done very much with the java.awt package or anything with graphics other than Swing, and I have a question. I'm trying to paint (i.e. fill()) an Ellipse2D on a JLabel in a JLayeredPane (the JLabel is on the top Layer above everything else, so it's not covered up). These are the snippets of code that I have that I've used for this purpose:
Graphics2D g2 = (Graphics2D) myJLabel.getGraphics(); g2.setPaint(Color.WHITE); Ellipse2D.Float point = new Ellipse2D.Float(200, 200, 100, 100); g2.fill(point);
The fill() method is part of an actionListener, and when I run my program and trigger the action, I see a white ellipse for a very, very brief moment, and then it goes away (i.e. I see the layer below). I want the ellipse to remain there. What am I doing wrong? I have a felling it has something to do with the concurrency of Swing. (I'm running NetBeans, if that makes any difference.) Any help much appreciated. Thank you!--el Aprel (facta-facienda) 22:48, 23 July 2009 (UTC)
- In general it's better to paint on a canvas or jcanvas rather than a specific widget like a Label or JLabel, as you're not fighting with the control's own draw code; so if you want to change the appearance of a JLabel, the safest idea is to subclass the look and feel and do it there. But it is generally safe to do, if you implement both the paint() and update() methods of your own subclass of JLabel and do all the painting there. You're doing something else - you're getting the graphics context from another place, and painting on it - that works, but your work gets undone as soon as something makes the JLabel draw itself. So instead add your paint code to a subclass of JLabel, implement paint() and update(), and in your other code just throw a damage at the widget by calling its repaint() method. Repaint just adds a "repaint me" event to that component's queue, so this makes sure that all the repainting happens in the appropriate eventqueue thread, and so swing takes care of the threading problem for you. 87.114.144.52 (talk) 23:11, 23 July 2009 (UTC)
- Actually when I say "that works", I'm wrong. That works for java.awt (which relies on the native code for thread safety), but not for swing (which explicitly and deliberately isn't threadsafe). 87.114.144.52 (talk) 23:13, 23 July 2009 (UTC)
- Repaint() has another nice feature (in addition to not breaking everything); swing implements damage event ellision, so if multiple repaint events are adjacent in the queue (some thrown by you, some by the window manager, some by other bits of the system like the LnF) it will join them together into one big fat repaint event. If there are lots of paints going on, this makes for a significant performance enhancement. 87.114.144.52 (talk) 23:16, 23 July 2009 (UTC)
- Bah, I'm wrong again. Override paintComponent(), not paint() 87.114.144.52 (talk) 23:26, 23 July 2009 (UTC)