The Equilibrium of Particles Electrostatically Confined by External Forces and the Competition between the Electrostatic Interaction and Gravitational Field