Quantum-dot states in graphene nanoribbons (GNR) were calculated using density-functional theory, considering the effect of the electric field of gate electrodes. The field is parallel to the GNR plane and was generated by an inhomogeneous charge sheet placed atop the ribbon. Varying the electric field allowed to observe the development of the GNR states and the formation of localized, quantum-dot-like states in the band gap. The calculation has been performed for armchair GNRs and for armchair ribbons with a zigzag section. For the armchair GNR a static dielectric constant of {epsilon} approx. 4 could be determined.