My window is a login form which has 2 text fields (for user name and password) and 1 button (login button).  I used NetBeans to help me designing the window and this is the actionPerformed method for the login button:  private void loginButtonActionPerformed(ActionEvent evt)  {        String password = new String(this.passwordField.getPassword());      if (this.userNameTextField.getText() == "system" &amp;&amp; password == "admin")     {         JOptionPane.showMessageDialog(null, "good");     }  }     I debugged the application because the login button did nothing and I found out that the if sentence was not even read. But if I remove the if sentence and press the login button, the message will appear.  What am I doing wrong ?
93
I've been using the == operator in my program to compare all my strings so far. However, I ran into a bug, changed one of them into .equals() instead, and it fixed the bug.  Is == bad? When should it and should it not be used? What's the difference?
56813
I have a textbox and a link button.  When I write some text, then select some of them and then click the link button, selected text from textbox must be show with a messagebox.   How can I do it?    When I click the submit button for textbox below, message box must show Lorem ipsum. Because "Lorem ipsum" is selected in the area.    If I select any text from the page and click the submit button it is working, but if I write a text to textbox and make it, it's not. Because when i click to another space, selection of textbox is canceled.   Now problem is that, when i select a text from textbox and click any other control or space, text which is selected is must be still selected.   How it is be done?
84765
One of my pages was scanned by Checkmarx and it's returning this flag "Multiple Forms In Visualforce Page"  Indeed in my page I have several form tags like so:  &lt;apex:outputPanel rendered="{! $CurrentPage.parameters.show_custom_1 == '1'}"&gt;     &lt;apex:form &gt;         &lt;apex:commandButton value="Custom Action 1" action="{!customAction1}"/&gt;     &lt;/apex:form&gt; &lt;/apex:outputPanel&gt;    &lt;apex:form &gt;     &lt;apex:inputText value="{!customText1}"/&gt;&lt;br /&gt;     &lt;apex:commandButton value="Update customText1" action="{!updateCustomText1}"/&gt; &lt;/apex:form&gt;   One other interesting thing to note is one of these forms is conditional and may or may not appear.  But regardless, it doesn't seem like it should matter? Why is it a problem to have more than one form on a page? That's a very common thing in a modern webpage. I've seen some pages that have 10 forms or more, as long as they are contained to their own area and don't overlap, I don't see why it's a problem?
124101
Is there any way to make the login screen from a locked session (either by using Ctrl+Alt+L or from a screen timeout) look like the login screen when you're starting a new session? I hate that everything on the lock screen aside from the password input is black.
49022
How can I send keyboard input messages to either the currently selected window or the previously selected window?   I have a program which I use to type some characters which are not present on my keyboard and I would like it if I could just send the input directly rather than me having to copy and paste all the time.  EDIT:  The application of this is typing the German Umlauts. I'm an American and I work in Germany. I'm working on an American keyboard and from time to time I have to type in the umlauts / the euro symbol / the sharp S. Currently I have a simple WinForms application with a textfield and some buttons with the extra characters on it. I type into the textfield and I can press the buttons to append text to the textfield. I then copy the text and paste it where ever. What would be nice though if I could just just hit one of the buttons and it would send the text where ever I'm typing / was typing. The current program works fairly well but I could make it better.
107745
I am a complete newbie in Selenium and java in general. I am trying to use the Page object model with Page factory to create Page object class for the Login page of an application. I am reading lot of sample code on the web tutorials and there the "Webdriver"  reference is delared as "static". Is it that other classes can use the Base class driver instance?  package com.test.login;  import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy;  public class LoginPage {      **public static WebDriver driver = null;**      public LoginPage(WebDriver driver) {         this.driver = driver;            PageFactory.initelements(driver, this);     }      @FindBy(xpath = "//input[contains(@id,'username')]")     public WebElement User_ID      @FindBy(xpath = "//input[contains(@id,'password')]")     public WebElement Password;      @FindBy(xpath = "//input[contains(@id,'login')]")     public WebElement Login_Button;   LoginTestClass.java  public class LoginPageTest{     WebDriver driver;     LoginPage loginpage = PageFactory.initElements(Login.class);
49620
I am beginner in automation field, I am trying to automated one of the module, I have tried many different XPATH to fetch proper XPATH for City field o UTest site. Im trying to automate registration module as one of my assignment. I have tried my different xpath example below:  //xpath="//body/div[@class='pac-container pac-logo']/div/span[2]/span" //div[@class='pac-item']/span[3] //div[@class='pac-item']/span //div[@class='pac-container pac-logo']/div/span[2]/../span[3]   the following code written:  //xpath to send data in field @FindBy(xpath="//input[@placeholder='Enter a location']") WebElement city;  //xpath for list to appear @FindBy(xpath="div[@class='pac-item']/span") List&lt;WebElement&gt; City;  public void EnterSignupTwo(String CiTy) throws Exception {     city.clear();     city.sendKeys(CiTy);     Thread.sleep(3000);     System.out.println("the size of List " +City.size());//printing list size      for(int i=0; i&lt;City.size(); i++ ) {         String cities = City.get(i).getText(); //storing list element in String         System.out.println("Converted value of city :"+cities); //print of total list      if(cities.contains(CiTy)) //if parameterized match with Available then click     {         System.out.println("enter specific value of city :"+City.get(i).getText());         City.get(i).click();         break;     } }   kindly refer the
37382
I'm a C++ guy learning Java. I'm reading Effective Java and something confused me. It says never to write code like this:  String s = new String("silly");   Because it creates unnecessary String objects. But instead it should be written like this:  String s = "No longer silly";   Ok fine so far...However, given this class:  public final class CaseInsensitiveString {     private String s;     public CaseInsensitiveString(String s) {         if (s == null) {             throw new NullPointerException();         }         this.s = s;     }     :     : }  CaseInsensitiveString cis = new CaseInsensitiveString("Polish"); String s = "polish";    Why is the first statement ok? Shouldn't it be   CaseInsensitiveString cis = "Polish"; How do I make CaseInsensitiveString behave like String so the above statement is OK (with and without extending String)? What is it about String that makes it OK to just be able to pass it a literal like that? From my understanding there is no "copy constructor" concept in Java?
104197
When i create new User Account and login with that credentials, it gives me this problem if admin doesnt have set thier values yet !!!**  AllotmentList = [select id, Days_Remaining__c from PTO_Allotment__c where Year__c =:year and Employee__c=:EmployeeList[0].id LIMIT 100]; //access only Current user Allotment details                 //to handle Listoutof Bound Exception wrote if-else          if(AllotmentList.size()&gt;0)         {         requests.PTO_Allotment__c=AllotmentList[0].id;         requests.Days_Remaining__c=AllotmentList[0].Days_Remaining__c;         }         else         {             //write a code when AllotmentList is empty ....         }
120376
As more and more websites add  of one type or another to e-mail and password fields and more people use password managers, the two are increasingly coming into conflict.  While there are extensions such as  for Chrome or  and the dom.event.clipboardevents.enabled preference&dagger; for FireFox, all of these suffer the problem that there are legitimate reasons why websites might want to hook into onpaste (such as Google docs rich text support or Facebook's link handling) so I don't want that functionality completely disabled.  &dagger; Go to about:config and search for dom.event.clipboardevents.enabled then double click to toggle.  Another option is to hack every page you find with the offending code manually, but that is a lot of hassle and doesn't work in every case (such as with ). One suggestion of how to do this can be found on Martin Brinkmann's  page.  Ideally I just want to be able to say "Re-enable paste on all fields on this page" either as a button or a context menu option for the page, so is there any way to do this?  The closest thing I have found is Derek Prior's  but this uses the same method as the manual method, so fails to work with the specific page I was having problems with, and I have no idea how many other methods might be available.
122134
I am dynamically creating a toast as shown below. This toast is created when response is received from server. I have created a component for toast and am dynamically creating it using $A.createComponent. The toast is getting fired when I am testing it in SF1 simulator or when I  have added my component in app builder. However, it is not getting thrown on screen, thought it is generated as seen in console.log, in case when I test it using standalone app (adding parent component to .app file and then preview) OR when i render my component using ltng:out in a VF page. What may be the reason for this?     controller from where dynamically toast is created:   . . . if (component.isValid() &amp;&amp; state === "SUCCESS") {             console.log("Values updated successfully!");             //$A.get('e.force:refreshView').fire(); //this is also not working             this.createToastComponent(component, 'success', 'Success!', 'Record Saved successfully!');      createToastComponent : function(component, type, title, message){      $A.createComponent(         "c:ToastComponent",         {             "type" : type,             "title" : title,             "message": message         },         function(newToast, status, errorMessage){             if(errorMessage === null){                 //do nothing             }             else{                 console.log('Toast errorMessage: '+ errorMessage);             }         }     ); },      toastComponent UPDATED:   &lt;aura:component &gt; &lt;aura:attribute name="type" type="String" /&gt; &lt;aura:attribute name="title" type="String" /&gt; &lt;aura:attribute name="message" type="String" /&gt; &lt;!--&lt;aura:handler name="init" action="{!c.handleInit}" value="{!this}" /&gt;--&gt;  &lt;div class="slds"&gt;     &lt;div class="slds-notify_container"&gt;         &lt;div aura:id="successToast" class="slds-notify slds-notify--toast slds-theme--success" role="alert"&gt;             &lt;span class="slds-assistive-text"&gt;Success&lt;/span&gt;             &lt;button class="slds-button slds-notify__close slds-button--icon-inverse" title="Close"&gt;                 &lt;c:SVGIcon svgPath="/resource/SLDS214/assets/icons/action-sprite/svg/symbols.svg#close"                            class="slds-button__icon slds-button__icon--large" assistiveText="Close"/&gt;                 &lt;span class="slds-assistive-text"&gt;Close&lt;/span&gt;             &lt;/button&gt;             &lt;div class="slds-notify__content slds-grid"&gt;                 &lt;div class="slds-col slds-align-middle"&gt;                     &lt;h2 class="slds-text-heading--small "&gt;{!v.message}&lt;/h2&gt;                 &lt;/div&gt;             &lt;/div&gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/div&gt;        toast component controller:   ({ handleInit : function(component, event, helper) {      var toastEvent = $A.get("e.force:showToast");     console.log('toastEvent: '+ toastEvent+ 'title: '+ component.get("v.title")+ 'message: '+ component.get("v.message"));     toastEvent.setParams({         "title": component.get("v.title"),         "message":  component.get("v.message"),         "type": component.get("v.type")     });     toastEvent.fire(); }   })     Output in console.log:   toastEvent: SecureAuraEvent: [object Object]{ key: {"namespace":"c"} }title: SUCCESS!message: Record created Successfully
8617
I see an empty drop down box where the language code of the  should be.  To reproduce the bug: Lock screen or log out and log in again.    I also get the same behavior on the lock screen at the time when I try to log in with my password:    After I tried the workaround (below) the language code on the login screen disappeared as soon as I typed the first character of my password.  Workaround (not permanent): Switching with keyboard (Super+space) or mouse.  System info: Ubuntu 18.04.1 LTS, GNOME 3.28.2.    Please  if also affects you.
3463
How can I login to the this page  by using HttpWebRequest? Login button is &quot;Pošalji&quot; (upper left corner). HTML source of login page: &lt;table id=&quot;maintable&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; style=&quot;height:100%; width:100%&quot;&gt;   &lt;tr&gt;     &lt;td width=&quot;367&quot; style=&quot;vertical-align:top;padding:3px&quot;&gt;&lt;script type=&quot;text/javascript&quot;&gt; function checkUserid(){     if (document &amp;&amp; document.getElementById){         var f = document.getElementById('userid');         if (f){             if (f.value.length &lt; 8){                 alert('Korisničko ime treba biti u formatu 061/062 xxxxxx !');                 return false;             }         }     }     return true; } &lt;/script&gt; &lt;div style=&quot;margin-bottom:12px&quot;&gt;&lt;table class=&quot;leftbox&quot; style=&quot;height:184px; background-image:url(/web/2007/slike/okvir.jpg);&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;     &lt;tr&gt;         &lt;th style=&quot;vertical-align:middle&quot;&gt;&lt;form action=&quot;http://sso.bhmobile.ba/sso/login&quot; method=&quot;post&quot; onSubmit=&quot;return checkUserid();&quot;&gt;              &lt;input type=&quot;hidden&quot; name=&quot;realm&quot; value=&quot;sso&quot;&gt;             &lt;input type=&quot;hidden&quot; name=&quot;application&quot; value=&quot;portal&quot;&gt;             &lt;input type=&quot;hidden&quot; name=&quot;url&quot; value=&quot;http://www.bhmobile.ba/portal/redirect?type=ssologin&amp;amp;url=/portal/show?idc=1111&quot;&gt;             &lt;table class=&quot;formbox&quot; align=&quot;center&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;                 &lt;tr&gt;                     &lt;th style=&quot;vertical-align:middle; text-align:right;padding-right:4px;&quot;&gt;Korisnik:&lt;/th&gt;                     &lt;td&gt;&lt;input type=&quot;text&quot; size=&quot;20&quot; id=&quot;userid&quot; name=&quot;userid&quot;/&gt;&lt;/td&gt;                 &lt;/tr&gt;                  &lt;tr&gt;                     &lt;th style=&quot;text-align:right;padding-right:4px;&quot;&gt;Lozinka:&lt;/th&gt;                     &lt;td&gt;&lt;input type=&quot;password&quot; size=&quot;20&quot; name=&quot;password&quot; /&gt;&lt;/td&gt;                 &lt;/tr&gt;                 &lt;tr&gt;                     &lt;th colspan=&quot;2&quot;&gt;                          &lt;input class=&quot;dugmic&quot; type=&quot;image&quot; id=&quot;prijava1&quot; alt=&quot;Prijava&quot; src=&quot;/web/2007/dugmici/posalji_1.jpg&quot; onmouseover=&quot;ChangeImage('prijava1','/web/2007/dugmici/posalji_2.jpg')&quot; onmouseout=&quot;ChangeImage('prijava1','/web/2007/dugmici/posalji_1.jpg')&quot;&gt;                     &lt;/th&gt;                  &lt;/tr&gt;             &lt;/table&gt;             &lt;div style=&quot;padding:12px;&quot;&gt;                 &lt;a href=&quot;/portal/show?idc=1121&quot;&gt;Da li ste novi BH Mobile korisnik?&lt;/a&gt;&lt;br /&gt;                 &lt;a href=&quot;/portal/show?idc=1121&quot;&gt;Da li ste zaboravili lozinku(šifru)?&lt;/a&gt;&lt;br /&gt;             &lt;/div&gt;         &lt;/form&gt;&lt;/th&gt;     &lt;/tr&gt;  &lt;/table&gt;&lt;/div&gt;  Form action is . How can I use this with HttpWebRequest to get a cookie and use some date from this page?
121948
If I select a feature and run self.iface.actionIdentify().trigger() it will open the identify window but won't open the selected feature's data, how can I make it open the data of the selected feature?
46363
What is the proper way to terminate a Swing application from the code, and what are the pitfalls?  I'd tried to close my application automatically after a timer fires. But just calling dispose() on the JFrame didn't do the trick - the window vanished but the application did not terminate. However when closing the window with the close button, the application does terminate. What should I do?
97697
I was playing around with "User accounts" and somehow set automatic login. Now, when I start my PC, it just has one button named as "login". Clicking that button, directly logs me in to my PC.  There is no music or no asking for password while logging in. As a side effect, it asks me separately for keyring password   How to disable auto login and make login/keyring password unified again like before?  NOTE: Attempting to disable Automatic Login from System Settings > User Accounts does not work.  This is the content of my /etc/lightdm/lightdm.conf (where I have commented the autologin for my username mgandhi):  [SeatDefaults] greeter-session=unity-greeter user-session=ubuntu #autologin-user=mgandhi
46585
I have a output view page, and i want to insert a edit command button. when user click on edit button it will enable them to type on output field and save. Can anybody tell me how to do that? Thanks  &lt;apex:page standardController="Product_Brief__c" sidebar="true" showHeader="true" extensions="gibco" &gt;&lt;br/&gt; &lt;apex:form &gt;&lt;br/&gt;             &lt;apex:pageBlock mode="inlineEdit"&gt;&lt;br/&gt;             &lt;apex:pageBlockSection collapsible="false" title="Section 1: Custom Media Information (Required)"&gt;&lt;br/&gt;                 &lt;apex:outputField value="{!Product_Brief__c.Opportunity__r.Account.Name}"  Label="Company Name"/&gt;&lt;br/&gt;                 &lt;apex:outputField value="{!Product_Brief__c.Customer_Number__c}" label="Customer Number"/&gt;&lt;br/&gt;                 &lt;apex:outputField value="{!Product_Brief__c.Billing_Address__c}" /&gt;&lt;br/&gt;                 &lt;apex:outputField value="{!Product_Brief__c.CreatedBy.Name}"  Label="Contact Name"/&gt;&lt;br/&gt;                 &lt;apex:outputField value="{!Product_Brief__c.Shipping_Address__c}"/&gt;             &lt;/apex:pageBlockSection&gt;&lt;br/&gt;  &lt;apex:pageblockButtons &gt;&lt;br/&gt;                 &lt;apex:commandButton action="{!save&amp;view}" value="SAVE"/&gt;&lt;br/&gt;                 &lt;apex:commandButton value="PRINT" onclick="window.print();"/&gt;&lt;br/&gt;                 &lt;apex:commandButton value="Cancel" action="{!Cancel}"/&gt;&lt;br/&gt;             &lt;/apex:pageblockButtons&gt;&lt;br/&gt; &lt;/apex:form&gt;