Search Results

Search found 171 results on 7 pages for 'jl'.

Page 1/7 | 1 2 3 4 5 6 7  | Next Page >

  • Java: how to register a listener that listen to a JFrame movement

    - by cocotwo
    How can you track the movement of a JFrame itself? I'd like to register a listener that would be called back every single time JFrame.getLocation() is going to return a new value. Here's a skeleton that compiles and runs, what kind of listener should I add so that I can track every JFrame movement on screen? import javax.swing.*; public class SO { public static void main( String[] args ) throws Exception { SwingUtilities.invokeAndWait( new Runnable() { public void run() { final JFrame jf = new JFrame(); final JPanel jp = new JPanel(); final JLabel jl = new JLabel(); updateText( jf, jl ); jp.add( jl ); jf.add( jp ); jf.pack(); jf.setVisible( true ); } } ); } private static void updateText( final JFrame jf, final JLabel jl ) { jl.setText( "JFrame is located at: " + jf.getLocation() ); jl.repaint(); } }

    Read the article

  • how to reuse the area in a container when any component is removed from it?

    - by vybhav
    hi! i hav a panel and i m trying to remove labels from it which were added to it during run-time. but when labels are removed succesfully i m not able to use the space,left by that label,again to add any label to it. thanks in anticipation of the solution. here is the relevant code snippet: to add label to the panel: JLabel jl = new JLabel(); jl.setOpaque(true); jl.setIcon(new ImageIcon("D:/Project/router2.jpg")); jl.setBounds(x, y,jl.getPreferredSize().width,jl.getPreferredSize().height); for(Component c :lcomponent) { flag=true; Rectangle r4=c.getBounds(); int x1=(int) r4.getX(); int y1=(int) r4.getY(); Rectangle r5 = new Rectangle(new Point(x1-60, y1-60),new Dimension(170,170)); if(r5.contains(p)){ //To ensure that two labels do not overlap or are too close flag = false; // to each other break; }} if(flag) { p2.add(jl); //p2 is a panel Component c2 = p2.getComponentAt(x,y); p2.repaint(); lcomponent.add(c2); //lcomponent is an ArrayList<Component> to store all the labels added to the panel } 2.to remove the label: p2.remove(); p2.repaint();

    Read the article

  • add Component to JPanel

    - by jouzef19
    Hi , I am using netBeans editor to create desktop application . and i want to add Component without using drag and drop way. I am trying code like this for adding JList to JPanel but nothing showed JList jl = new JList(); Vector<String> v= new Vector<String>(); v.add("one"); v.add("Two"); v.add("Three"); jl.setListData(v); JScrollPane js = new JScrollPane(jl); js.setLocation(50, 50); js.setSize(100, 100); js.setVisible(true); jPanel1.add(js);

    Read the article

  • Does anyone know how to appropriately deal with user timezones in rails 2.3?

    - by Amazing Jay
    We're building a rails app that needs to display dates (and more importantly, calculate them) in multiple timezones. Can anyone point me towards how to work with user timezones in rails 2.3(.5 or .8) The most inclusive article I've seen detailing how user time zones are supposed to work is here: http://wiki.rubyonrails.org/howtos/time-zones... although it is unclear when this was written or for what version of rails. Specifically it states that: "Time.zone - The time zone that is actually used for display purposes. This may be set manually to override config.time_zone on a per-request basis." Keys terms being "display purposes" and "per-request basis". Locally on my machine, this is true. However on production, neither are true. Setting Time.zone persists past the end of the request (to all subsequent requests) and also affects the way AR saves to the DB (basically treating any date as if it were already in UTC even when its not), thus saving completely inappropriate values. We run Ruby Enterprise Edition on production with passenger. If this is my problem, do we need to switch to JRuby or something else? To illustrate the problem I put the following actions in my ApplicationController right now: def test p_time = Time.now.utc s_time = Time.utc(p_time.year, p_time.month, p_time.day, p_time.hour) logger.error "TIME.ZONE" + Time.zone.inspect logger.error ENV['TZ'].inspect logger.error p_time.inspect logger.error s_time.inspect jl = JunkLead.create! jl.date_at = s_time logger.error s_time.inspect logger.error jl.date_at.inspect jl.save! logger.error s_time.inspect logger.error jl.date_at.inspect render :nothing => true, :status => 200 end def test2 Time.zone = 'Mountain Time (US & Canada)' logger.error "TIME.ZONE" + Time.zone.inspect logger.error ENV['TZ'].inspect render :nothing => true, :status => 200 end def test3 Time.zone = 'UTC' logger.error "TIME.ZONE" + Time.zone.inspect logger.error ENV['TZ'].inspect render :nothing => true, :status => 200 end and they yield the following: Processing ApplicationController#test (for 98.202.196.203 at 2010-12-24 22:15:50) [GET] TIME.ZONE#<ActiveSupport::TimeZone:0x2c57a68 @tzinfo=#<TZInfo::DataTimezone: Etc/UTC>, @name="UTC", @utc_offset=0> nil Fri Dec 24 22:15:50 UTC 2010 Fri Dec 24 22:00:00 UTC 2010 Fri Dec 24 22:00:00 UTC 2010 Fri, 24 Dec 2010 22:00:00 UTC +00:00 Fri Dec 24 22:00:00 UTC 2010 Fri, 24 Dec 2010 22:00:00 UTC +00:00 Completed in 21ms (View: 0, DB: 4) | 200 OK [http://www.dealsthatmatter.com/test] Processing ApplicationController#test2 (for 98.202.196.203 at 2010-12-24 22:15:53) [GET] TIME.ZONE#<ActiveSupport::TimeZone:0x2c580a8 @tzinfo=#<TZInfo::DataTimezone: America/Denver>, @name="Mountain Time (US & Canada)", @utc_offset=-25200> nil Completed in 143ms (View: 1, DB: 3) | 200 OK [http://www.dealsthatmatter.com/test2] Processing ApplicationController#test (for 98.202.196.203 at 2010-12-24 22:15:59) [GET] TIME.ZONE#<ActiveSupport::TimeZone:0x2c580a8 @tzinfo=#<TZInfo::DataTimezone: America/Denver>, @name="Mountain Time (US & Canada)", @utc_offset=-25200> nil Fri Dec 24 22:15:59 UTC 2010 Fri Dec 24 22:00:00 UTC 2010 Fri Dec 24 22:00:00 UTC 2010 Fri, 24 Dec 2010 15:00:00 MST -07:00 Fri Dec 24 22:00:00 UTC 2010 Fri, 24 Dec 2010 15:00:00 MST -07:00 Completed in 20ms (View: 0, DB: 4) | 200 OK [http://www.dealsthatmatter.com/test] Processing ApplicationController#test3 (for 98.202.196.203 at 2010-12-24 22:16:03) [GET] TIME.ZONE#<ActiveSupport::TimeZone:0x2c57a68 @tzinfo=#<TZInfo::DataTimezone: Etc/UTC>, @name="UTC", @utc_offset=0> nil Completed in 17ms (View: 0, DB: 2) | 200 OK [http://www.dealsthatmatter.com/test3] Processing ApplicationController#test (for 98.202.196.203 at 2010-12-24 22:16:04) [GET] TIME.ZONE#<ActiveSupport::TimeZone:0x2c57a68 @tzinfo=#<TZInfo::DataTimezone: Etc/UTC>, @name="UTC", @utc_offset=0> nil Fri Dec 24 22:16:05 UTC 2010 Fri Dec 24 22:00:00 UTC 2010 Fri Dec 24 22:00:00 UTC 2010 Fri, 24 Dec 2010 22:00:00 UTC +00:00 Fri Dec 24 22:00:00 UTC 2010 Fri, 24 Dec 2010 22:00:00 UTC +00:00 Completed in 151ms (View: 0, DB: 4) | 200 OK [http://www.dealsthatmatter.com/test] It should be clear above that the 2nd call to /test shows Time.zone set to Mountain, even though it shouldn't. Additionally, checking the database reveals that the test action when run after test2 saved a JunkLead record with a date of 2010-12-22 15:00:00, which is clearly wrong.

    Read the article

  • Debian Lenny to Debian Squeeze upgrade problems

    - by Roland Soós
    Hi! Yesterday I made a dist-upgrade on my Debian Lenny server. I thought it will be easy as an usual upgrade, but it's not. I got a lot of problem after the update: # apt-get upgrade Reading package lists... Done Building dependency tree Reading state information... Done You might want to run 'apt-get -f install' to correct these. The following packages have unmet dependencies: linux-image-2.6-amd64 : Depends: linux-image-2.6.32-5-amd64 but it is not installed E: Unmet dependencies. Try using -f. Then I tried the suggestion: # apt-get -f install Reading package lists... Done Building dependency tree Reading state information... Done Correcting dependencies... Done The following packages were automatically installed and are no longer required: libio-compress-base-perl libatk1.0-0 libts-0.0-0 libmime-types-perl libc-client2007b libgtk2.0-common libxfixes3 libgsf-1-common hicolor-icon-theme libfile-remove-perl libxcomposite1 libltdl3-dev libneon27 libmd5-perl libwmf0.2-7 libilmbase6 libatk1.0-data djvulibre-desktop libdirectfb-1.0-0 fam libxinerama1 libcroco3 libopenexr6 libgsf-1-114 libmail-box-perl libdjvulibre21 openssl-blacklist librsvg2-2 libio-compress-zlib-perl libsysfs2 libbeecrypt6 libxdamage1 libobject-realize-later-perl libuser-identity-perl libgtk2.0-bin libxi6 libxcursor1 portmap libxrandr2 libgtk2.0-0 Use 'apt-get autoremove' to remove them. The following extra packages will be installed: linux-image-2.6.32-5-amd64 Suggested packages: linux-doc-2.6.32 The following NEW packages will be installed: linux-image-2.6.32-5-amd64 0 upgraded, 1 newly installed, 0 to remove and 121 not upgraded. 98 not fully installed or removed. Need to get 0 B/28.6 MB of archives. After this operation, 103 MB of additional disk space will be used. Do you want to continue [Y/n]? y perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LANG = "hu_HU.UTF-8" are supported and installed on your system. perl: warning: Falling back to the standard locale ("C"). locale: Cannot set LC_CTYPE to default locale: No such file or directory locale: Cannot set LC_ALL to default locale: Nincs ilyen f?jl vagy k?nyvt?r Preconfiguring packages ... (Reading database ... 37915 files and directories currently installed.) Unpacking linux-image-2.6.32-5-amd64 (from .../linux-image-2.6.32-5-amd64_2.6.32-30_amd64.deb) ... locale: Cannot set LC_CTYPE to default locale: No such file or directory locale: Cannot set LC_ALL to default locale: Nincs ilyen f?jl vagy k?nyvt?r dpkg: error processing /var/cache/apt/archives/linux-image-2.6.32-5-amd64_2.6.32-30_amd64.deb (--unpack): failed in write on buffer copy for backend dpkg-deb during `./lib/modules/2.6.32-5-amd64/kernel/sound/pci/hda/snd-hda-codec-realtek.ko': No space left on device configured to not write apport reports dpkg-deb: subprocess paste killed by signal (Broken pipe) locale: Cannot set LC_CTYPE to default locale: No such file or directory locale: Cannot set LC_ALL to default locale: Nincs ilyen f?jl vagy k?nyvt?r Running postrm hook script /sbin/update-grub. Searching for GRUB installation directory ... found: /boot/grub Searching for default file ... found: /boot/grub/default Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst Searching for splash image ... none found, skipping ... Found kernel: /boot/vmlinuz-2.6.26-2-amd64 Updating /boot/grub/menu.lst ... done Examining /etc/kernel/postrm.d . run-parts: executing /etc/kernel/postrm.d/initramfs-tools 2.6.32-5-amd64 /boot/vmlinuz-2.6.32-5-amd64 Errors were encountered while processing: /var/cache/apt/archives/linux-image-2.6.32-5-amd64_2.6.32-30_amd64.deb E: Sub-process /usr/bin/dpkg returned an error code (1) # dpkg-reconfigure locales perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LANG = "hu_HU.UTF-8" are supported and installed on your system. perl: warning: Falling back to the standard locale ("C"). locale: Cannot set LC_CTYPE to default locale: No such file or directory locale: Cannot set LC_ALL to default locale: Nincs ilyen f?jl vagy k?nyvt?r /usr/sbin/dpkg-reconfigure: locales is broken or not fully installed Then I stucked. Do you have any idea how could I solve this?

    Read the article

  • Frame Showing Problem

    - by Nitz
    Hey Guys I have made one project which is showing the inventory of the stock of one store. In that inventory the software should store data of the products with their images. There is one problem... Bcz of the lots of stock, the screen on which is image is loading taking a lot of time. So, i thought i should give the frame in which there will be on label which will show the "Loading Software". But now when i am setting visible = true for that frame, but bcz of that images screen class loading problem my frame is not showing correctly. I have put screen shot, now my code. JFrame f; try{ f = new JFrame("This is a test"); f.setSize(300, 300); Container content = f.getContentPane(); content.setBackground(Color.white); content.setLayout(new FlowLayout()); JLabel jl = new JLabel(); jl.setText("Loading Please Wait...."); content.add(jl); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); }catch(Exception e){ e.printStackTrace(); } initComponents(); try { addInverntory = new AddInventoryScreen(); showstock = new showStock(); // this class will take big time. mf = new mainForm(); f.setVisible(false); }catch (Exception ex) { ex.printStackTrace(); } How Can show some message that, other class is loading or "Loading Software" kind of thing in this situation. Just For the know....this class is not screen on which the image will load.

    Read the article

  • Ubuntu 12.04 not Locking Encrypted Hard Drive on Log Out

    - by J.L.
    I'm running Ubuntu 12.04 with Gnome 3.4. I have two external hard drives. I encrypted both using Ubuntu's Disk Utility. When I use Nautilus to mount them, I'm asked for my decryption password. Regardless of whether I then click "Forget password immediately" or "Remember password until you logout", though, I find that Ubuntu does not lock the drives when I log out. Rather, when I log back in, they're still mounted. (To be clear, restarting the computer does unmount them so that they require the password on the next log in.) I'm concerned that these drives are remaining unprotected when I log out without restarting my computer. I would be grateful for help understanding whether this is a bug. Thank you!

    Read the article

  • Insane CPU usage in QT 5.0

    - by GravityScore
    I'm having trouble using the QT framework, particularly with the paintEvent of QWidget. I have a QWidget set up, and am overriding the paintEvent of it. I need to render a bunch of rectangles (grid system), 51 by 19, leading to 969 rectangles being drawn. This is done in a for loop. Then I also need to draw an image on each on of these grids. The QWidget is added to a QMainWindow, which is shown. This works nicely, but it's using up 47% of CPU per window open! And I want to allow the user to open multiple windows like this, likey having 3-4 open at a time, which puts the CPU close to 150%. Why does this happen? Here is the paintEvent contents. The JNI calls don't cause the CPU usage, commenting them out doesn't lower it, but commenting out the p.fillRect and Renderer::renderString (which draws the image) lowers the CPU to about 5%. // Background QPainter p(this); p.fillRect(0, 0, this->width(), this->height(), QBrush(QColor(0, 0, 0))); // Lines for (int y = 0; y < Global::terminalHeight; y++) { // Line and color method ID jmethodID lineid = Manager::jenv->GetMethodID(this->javaClass, "getLine", "(I)Ljava/lang/String;"); error(); jmethodID colorid = Manager::jenv->GetMethodID(this->javaClass, "getColorLine", "(I)Ljava/lang/String;"); error(); // Values jstring jl = (jstring) Manager::jenv->CallObjectMethod(this->javaObject, lineid, jint(y)); error(); jstring cjl = (jstring) Manager::jenv->CallObjectMethod(this->javaObject, colorid, jint(y)); error(); // Convert to C values const char *l = Manager::jenv->GetStringUTFChars(jl, 0); const char *cl = Manager::jenv->GetStringUTFChars(cjl, 0); QString line = QString(l); QString color = QString(cl); // Render line for (int x = 0; x < Global::terminalWidth; x++) { QColor bg = Renderer::colorForHex(color.mid(x + color.length() / 2, 1)); // Cell location on widget int cellx = x * Global::cellWidth + Global::xoffset; int celly = y * Global::cellHeight + Global::yoffset; // Background p.fillRect(cellx, celly, Global::cellWidth, Global::cellHeight, QBrush(bg)); // String // Renders the image to the grid Renderer::renderString(p, tc, text, cellx, celly); } // Release Manager::jenv->ReleaseStringUTFChars(jl, l); Manager::jenv->ReleaseStringUTFChars(cjl, cl); }

    Read the article

  • SMTP 552 4.3.1 Session size exceeds fixed maximum session size.

    - by JL
    I'm having a frustrating problem with one of our clients who is running an exchange SMTP server. I have an emailing component that is written in .net and I've specifically used Mono DLL's to ensure that the email component sends the ELO and QUIT command for each message it sends. Each mail I send will never exceed 10MB's including attachments, which is lower than the session size value set in the clients exchange configuration. Still the problem persists. Any ideas where to look?

    Read the article

  • Public free time server

    - by JL.
    I need to get the current datetime from a reliable source, because its likely that the local system time could be changed. Is it possible to get this from an internet time server, one that has close to 100% uptime, preferably via a webservice method, something that is free, and I have to stress absolutely reliable? I would hope an offering from Microsoft, or the organisation responsible for keeping global time.

    Read the article

  • Project Professional 2010 can't publish existing project file

    - by JL
    I have an existing project file (created in project 2007 professional), opened by me in project professional 2010, and saved. I open this newly saved file, and connect to Project Server (2010) using my credentials (I'm admin), now when I try and publish this existing project, I can't because the button is grayed out. If I start from a blank file, I can publish without any issues (so its not permissions). I suspect something is wrong with the template for this project, but I have no idea what, any idea what to check for?

    Read the article

  • Win 7 XP Mode, run hardware?

    - by JL
    I have a Web Cam thats built into my laptop, no drivers exist for a 64Bit env (Thank you Sony!). Now I am wondering if I can somehow publish the web cam from XP Mode into my Win 7 environment. Does anyone know if this is possible?

    Read the article

  • How to prevent hard drive from spinning down Windows 7?

    - by JL.
    I had a Western Digital External 1TB drive, which I was accessing via USB. I decided one day, that I would prefer to mount the HDD in my case, and access it via SATA interface. So I took it apart, and the actual mounting was a breeze. The only thing is, I think the device has some default power saving features, which means the device tends to stop spinning when idle for (x) amount of time. This creates delays when I am accessing the HDD. Is there anyway I can turn off these power saving features for this HDD?

    Read the article

  • Code won't work under mono, any ideas whats wrong?

    - by JL
    Mono won't fire the following code: I get internal server error 500, error writing request error. Code works perfectly under normal .net.... any ideas why its broken and how to fix it? [WebServiceBinding] public class testService : System.Web.Services.Protocols.SoapHttpClientProtocol { private string DummySoapRequest = @"<?xml version=""1.0"" encoding=""utf-8""?> <soap:Envelope xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema""> <soap:Body> <DummyOperation xmlns=""http://mynamespace.com""> </DummyOperation> </soap:Body> </soap:Envelope>"; public void SendDummyRequest() { System.Net.WebRequest req = GetWebRequest(new Uri(Url)); req.Headers.Add("SOAPAction", ""); req.ContentType = "text/xml;charset=\"utf-8\""; req.Method = "POST"; using (Stream stm = req.GetRequestStream()) { using (StreamWriter stmw = new StreamWriter(stm)) { stmw.Write(DummySoapRequest); } } System.Net.WebResponse response = req.GetResponse(); } }

    Read the article

  • Which internet scenario would be better?

    - by JL
    I currently have an 8mbps (down) / 512kbps (up) telephone ADSL solution. I must say the reliability is excellent, and up until now its been the fastest connection I could get because I don't live in a cable zone. The real speed of my connection is around 7mbps, but sometimes I manage to get the full 8mbps. I use my connection for work, so it needs to be at least 99% reliable. Recently I was told by a guy who lives up the road that he has a wireless connection with an external antenna and his speeds are 20mbps / 512kbps - he's also paying about 1/2 of what I pay for my wired telephone connection. My question is, is wireless internet good enough for a power user who uses his connection for work 8 hours a day, including VPNing into servers remotely. Besides this I also enjoy playing the odd network game, not a WoW freak, but sometimes I do pick up the odd MMORPG and at times do indulge in some semi heavy gaming sprees. Will this wireless latency drive me crazy and seem slow in comparison? Will it be reliable enough, I also live in an area that snows heavily in winter. I guess its a question of - should I go wireless or not. I've only had 1 wireless connection before and that was years ago using iBurst technology and I remember it was terrible for VPN, but I guess the technology might have been improved since then? What do you guys think?

    Read the article

  • Core i7 920 vs 870

    - by JL
    I am not sure which is better. Surely with processors you would think the 920 would be a higher version because 920 870. What's bothering me is that the 870 seems to have a higher clock speed, so which one is the better processor?

    Read the article

  • OpenSSL decode not working

    - by JL
    I am trying to use the following command: openssl enc -base64 -in myfile -out myfile.b64 For more info this link, has full instructions. Nothing happens and via a DOS window, it just doesn't work. Any suggestions why?

    Read the article

  • Wordpress: Upload has failed to upload due to an error Missing a temporary folder

    - by JL.
    I've installed Wordpress on IIS, Running on Windows 7 (64Bit). Rest of the site is working perfectly. Except when I try upload images into media. I then get this error message "sample.jpg" has failed to upload due to an error Missing a temporary folder I have edited the php.ini file to point to a directory : D:\work\websites\mySite Saved that and done an IIS reset. Problem still persists. Any ideas what is wrong?

    Read the article

  • Mono under Apache Question

    - by JL
    I have installed Mono under Apache and its working. My question is - Do I need to restart the mono service each time I make ANY change to any asp.net file under Apache, be this a .cs or even a configuration change in web.config?

    Read the article

  • SharePoint domain authentication

    - by JL
    I have a local domain controller setup, which is MYDOMAIN.com, and on a seperate local server I have a MOSS site running. the DNS is all working fine but when I try to connect to the MOSS site using domain credentials I can't use syntax: MYDOMAIN/MyAccount it is expecting [email protected] What can I do to fix this issue, so I have normal domain login capabilities like every other sharepoint site out there?

    Read the article

  • Windows 7 won't restart with SSD

    - by JL
    I have this annoying problem that I just can't seem to fix. Recently I upgraded my main boot drive to an OCZ Vertex Turbo (60GB) which is an SSD. I've installed Windows 7 64bit. The drive works, and is really quick... blah blah blah. My problem is when I do a restart, for example click start, then arrow next to shutdown, and restart. The computer will shut down, and do a warm reboot, but it gets stuck where it says loading Windows. Just before the animation starts. So what I have to do is physically press the reset switch on the computer, then it restarts, firing up a menu which offers to launch Windows Startup Repair, so I select "Start Windows Normally". After this I boot in normally, but its damn annoying. Any ideas why this is happening, what I can do to fix it?

    Read the article

  • What commands are being sent to an exe?

    - by JL
    I have an application that calls a console based application when I open a file. I would like to somehow "spy" on this console application so that when it gets called I would like to see what command line parameters are being passed to this console app. Is this possible?

    Read the article

1 2 3 4 5 6 7  | Next Page >